Disallow character creation by race.

This commit is contained in:
mobius 2015-01-02 09:06:53 +00:00
parent bb13c3a3c5
commit 9a133a19b0
3 changed files with 86 additions and 0 deletions

View File

@ -509,6 +509,21 @@ AllowChangePassword = False
OldDropBehavior = False
# ---------------------------------------------------------------------------
# Allowed Player Races
# ---------------------------------------------------------------------------
# Allowing specific races to be created.
# Default: True
AllowHuman = True
AllowElf = True
AllowDarkElf = True
AllowOrc = True
AllowDwarf = True
AllowKamael = True
AllowErtheia = True
# ---------------------------------------------------------------------------
# Custom Starting Location
# ---------------------------------------------------------------------------

View File

@ -790,6 +790,13 @@ public final class Config
public static Map<Integer, Integer> L2JMOD_DUALBOX_CHECK_WHITELIST;
public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
public static boolean L2JMOD_OLD_DROP_BEHAVIOR;
public static boolean ALLOW_HUMAN;
public static boolean ALLOW_ELF;
public static boolean ALLOW_DARKELF;
public static boolean ALLOW_ORC;
public static boolean ALLOW_DWARF;
public static boolean ALLOW_KAMAEL;
public static boolean ALLOW_ERTHEIA;
public static boolean CUSTOM_STARTING_LOC;
public static int CUSTOM_STARTING_LOC_X;
public static int CUSTOM_STARTING_LOC_Y;
@ -2543,6 +2550,14 @@ public final class Config
}
L2JMOD_ALLOW_CHANGE_PASSWORD = CustomSettings.getBoolean("AllowChangePassword", false);
ALLOW_HUMAN = CustomSettings.getBoolean("AllowHuman", true);
ALLOW_ELF = CustomSettings.getBoolean("AllowElf", true);
ALLOW_DARKELF = CustomSettings.getBoolean("AllowDarkElf", true);
ALLOW_ORC = CustomSettings.getBoolean("AllowOrc", true);
ALLOW_DWARF = CustomSettings.getBoolean("AllowDwarf", true);
ALLOW_KAMAEL = CustomSettings.getBoolean("AllowKamael", true);
ALLOW_ERTHEIA = CustomSettings.getBoolean("AllowErtheia", true);
CUSTOM_STARTING_LOC = CustomSettings.getBoolean("CustomStartingLocation", false);
CUSTOM_STARTING_LOC_X = CustomSettings.getInt("CustomStartingLocX", 50821);
CUSTOM_STARTING_LOC_Y = CustomSettings.getInt("CustomStartingLocY", 186527);

View File

@ -191,6 +191,62 @@ public final class CharacterCreate extends L2GameClientPacket
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
// Custom Feature: Disallow a race to be created.
// Example: Humans can not be created if AllowHuman = False in Custom.properties
switch (template.getRace())
{
case HUMAN:
if (!Config.ALLOW_HUMAN)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case ELF:
if (!Config.ALLOW_ELF)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case DARK_ELF:
if (!Config.ALLOW_DARKELF)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case ORC:
if (!Config.ALLOW_ORC)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case DWARF:
if (!Config.ALLOW_DWARF)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case KAMAEL:
if (!Config.ALLOW_KAMAEL)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
case ERTHEIA:
if (!Config.ALLOW_ERTHEIA)
{
sendPacket(new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED));
return;
}
break;
}
final PcAppearance app = new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0);
newChar = L2PcInstance.create(template, getClient().getAccountName(), _name, app);
}