Code review Part 3.

This commit is contained in:
MobiusDevelopment
2019-12-20 00:35:40 +00:00
parent 6954f58f5e
commit cd1f62cc68
2014 changed files with 9456 additions and 12142 deletions

View File

@@ -1234,7 +1234,7 @@ public class Config
DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
BACKUP_DATABASE = Boolean.valueOf(serverSettings.getProperty("BackupDatabase", "false"));
BACKUP_DATABASE = Boolean.parseBoolean(serverSettings.getProperty("BackupDatabase", "false"));
MYSQL_BIN_PATH = serverSettings.getProperty("MySqlBinLocation", "C:/xampp/mysql/bin/");
BACKUP_PATH = serverSettings.getProperty("BackupPath", "../backup/");
BACKUP_DAYS = Integer.parseInt(serverSettings.getProperty("BackupDays", "30"));
@@ -1247,8 +1247,8 @@ public class Config
MAXIMUM_ONLINE_USERS = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
SERVER_LIST_BRACKET = Boolean.valueOf(serverSettings.getProperty("ServerListBrackets", "false"));
SERVER_LIST_CLOCK = Boolean.valueOf(serverSettings.getProperty("ServerListClock", "false"));
SERVER_LIST_BRACKET = Boolean.parseBoolean(serverSettings.getProperty("ServerListBrackets", "false"));
SERVER_LIST_CLOCK = Boolean.parseBoolean(serverSettings.getProperty("ServerListClock", "false"));
MIN_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MinProtocolRevision", "660"));
MAX_PROTOCOL_REVISION = Integer.parseInt(serverSettings.getProperty("MaxProtocolRevision", "665"));
@@ -1316,7 +1316,7 @@ public class Config
is.close();
IDFACTORY_TYPE = IdFactoryType.valueOf(idSettings.getProperty("IDFactory", "BITSET"));
BAD_ID_CHECKING = Boolean.valueOf(idSettings.getProperty("BadIdChecking", "true"));
BAD_ID_CHECKING = Boolean.parseBoolean(idSettings.getProperty("BadIdChecking", "true"));
}
catch (Exception e)
{
@@ -1398,17 +1398,17 @@ public class Config
is.close();
SERVER_LIST_TESTSERVER = Boolean.parseBoolean(generalSettings.getProperty("TestServer", "false"));
SERVER_GMONLY = Boolean.valueOf(generalSettings.getProperty("ServerGMOnly", "false"));
SERVER_GMONLY = Boolean.parseBoolean(generalSettings.getProperty("ServerGMOnly", "false"));
ALT_DEV_NO_QUESTS = Boolean.parseBoolean(generalSettings.getProperty("AltDevNoQuests", "false"));
ALT_DEV_NO_SPAWNS = Boolean.parseBoolean(generalSettings.getProperty("AltDevNoSpawns", "false"));
ALT_DEV_NO_SCRIPT = Boolean.parseBoolean(generalSettings.getProperty("AltDevNoScript", "false"));
ALT_DEV_NO_RB = Boolean.parseBoolean(generalSettings.getProperty("AltDevNoRB", "false"));
GMAUDIT = Boolean.valueOf(generalSettings.getProperty("GMAudit", "false"));
LOG_CHAT = Boolean.valueOf(generalSettings.getProperty("LogChat", "false"));
LOG_ITEMS = Boolean.valueOf(generalSettings.getProperty("LogItems", "false"));
GMAUDIT = Boolean.parseBoolean(generalSettings.getProperty("GMAudit", "false"));
LOG_CHAT = Boolean.parseBoolean(generalSettings.getProperty("LogChat", "false"));
LOG_ITEMS = Boolean.parseBoolean(generalSettings.getProperty("LogItems", "false"));
LAZY_CACHE = Boolean.valueOf(generalSettings.getProperty("LazyCache", "false"));
LAZY_CACHE = Boolean.parseBoolean(generalSettings.getProperty("LazyCache", "false"));
REMOVE_CASTLE_CIRCLETS = Boolean.parseBoolean(generalSettings.getProperty("RemoveCastleCirclets", "true"));
ALT_GAME_VIEWNPC = Boolean.parseBoolean(generalSettings.getProperty("AltGameViewNpc", "false"));
@@ -1535,7 +1535,7 @@ public class Config
WYVERN_SPEED = Integer.parseInt(generalSettings.getProperty("WyvernSpeed", "100"));
STRIDER_SPEED = Integer.parseInt(generalSettings.getProperty("StriderSpeed", "80"));
ALLOW_WYVERN_UPGRADER = Boolean.valueOf(generalSettings.getProperty("AllowWyvernUpgrader", "false"));
ALLOW_WYVERN_UPGRADER = Boolean.parseBoolean(generalSettings.getProperty("AllowWyvernUpgrader", "false"));
ENABLE_AIO_SYSTEM = Boolean.parseBoolean(generalSettings.getProperty("EnableAioSystem", "true"));
ALLOW_AIO_NCOLOR = Boolean.parseBoolean(generalSettings.getProperty("AllowAioNameColor", "true"));
@@ -1587,8 +1587,8 @@ public class Config
LIST_NONDROPPABLE_ITEMS.add(Integer.parseInt(id));
}
JAIL_IS_PVP = Boolean.valueOf(generalSettings.getProperty("JailIsPvp", "true"));
JAIL_DISABLE_CHAT = Boolean.valueOf(generalSettings.getProperty("JailDisableChat", "true"));
JAIL_IS_PVP = Boolean.parseBoolean(generalSettings.getProperty("JailIsPvp", "true"));
JAIL_DISABLE_CHAT = Boolean.parseBoolean(generalSettings.getProperty("JailDisableChat", "true"));
USE_SAY_FILTER = Boolean.parseBoolean(generalSettings.getProperty("UseChatFilter", "false"));
CHAT_FILTER_CHARS = generalSettings.getProperty("ChatFilterChars", "[I love L2jMobius]");
@@ -1628,7 +1628,7 @@ public class Config
ANNOUNCE_CASTLE_LORDS = Boolean.parseBoolean(generalSettings.getProperty("AnnounceCastleLords", "false"));
ANNOUNCE_MAMMON_SPAWN = Boolean.parseBoolean(generalSettings.getProperty("AnnounceMammonSpawn", "true"));
ALLOW_GUARDS = Boolean.valueOf(generalSettings.getProperty("AllowGuards", "false"));
ALLOW_GUARDS = Boolean.parseBoolean(generalSettings.getProperty("AllowGuards", "false"));
AUTODESTROY_ITEM_AFTER = Integer.parseInt(generalSettings.getProperty("AutoDestroyDroppedItemAfter", "0"));
HERB_AUTO_DESTROY_TIME = Integer.parseInt(generalSettings.getProperty("AutoDestroyHerbTime", "15")) * 1000;
@@ -1638,44 +1638,44 @@ public class Config
{
LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
}
DESTROY_DROPPED_PLAYER_ITEM = Boolean.valueOf(generalSettings.getProperty("DestroyPlayerDroppedItem", "false"));
DESTROY_EQUIPABLE_PLAYER_ITEM = Boolean.valueOf(generalSettings.getProperty("DestroyEquipableItem", "false"));
SAVE_DROPPED_ITEM = Boolean.valueOf(generalSettings.getProperty("SaveDroppedItem", "false"));
EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD = Boolean.valueOf(generalSettings.getProperty("EmptyDroppedItemTableAfterLoad", "false"));
DESTROY_DROPPED_PLAYER_ITEM = Boolean.parseBoolean(generalSettings.getProperty("DestroyPlayerDroppedItem", "false"));
DESTROY_EQUIPABLE_PLAYER_ITEM = Boolean.parseBoolean(generalSettings.getProperty("DestroyEquipableItem", "false"));
SAVE_DROPPED_ITEM = Boolean.parseBoolean(generalSettings.getProperty("SaveDroppedItem", "false"));
EMPTY_DROPPED_ITEM_TABLE_AFTER_LOAD = Boolean.parseBoolean(generalSettings.getProperty("EmptyDroppedItemTableAfterLoad", "false"));
SAVE_DROPPED_ITEM_INTERVAL = Integer.parseInt(generalSettings.getProperty("SaveDroppedItemInterval", "0")) * 60000;
CLEAR_DROPPED_ITEM_TABLE = Boolean.valueOf(generalSettings.getProperty("ClearDroppedItemTable", "false"));
CLEAR_DROPPED_ITEM_TABLE = Boolean.parseBoolean(generalSettings.getProperty("ClearDroppedItemTable", "false"));
PRECISE_DROP_CALCULATION = Boolean.valueOf(generalSettings.getProperty("PreciseDropCalculation", "true"));
MULTIPLE_ITEM_DROP = Boolean.valueOf(generalSettings.getProperty("MultipleItemDrop", "true"));
PRECISE_DROP_CALCULATION = Boolean.parseBoolean(generalSettings.getProperty("PreciseDropCalculation", "true"));
MULTIPLE_ITEM_DROP = Boolean.parseBoolean(generalSettings.getProperty("MultipleItemDrop", "true"));
ALLOW_WAREHOUSE = Boolean.valueOf(generalSettings.getProperty("AllowWarehouse", "true"));
WAREHOUSE_CACHE = Boolean.valueOf(generalSettings.getProperty("WarehouseCache", "false"));
ALLOW_WAREHOUSE = Boolean.parseBoolean(generalSettings.getProperty("AllowWarehouse", "true"));
WAREHOUSE_CACHE = Boolean.parseBoolean(generalSettings.getProperty("WarehouseCache", "false"));
WAREHOUSE_CACHE_TIME = Integer.parseInt(generalSettings.getProperty("WarehouseCacheTime", "15"));
ALLOW_FREIGHT = Boolean.valueOf(generalSettings.getProperty("AllowFreight", "true"));
ALLOW_WEAR = Boolean.valueOf(generalSettings.getProperty("AllowWear", "false"));
ALLOW_FREIGHT = Boolean.parseBoolean(generalSettings.getProperty("AllowFreight", "true"));
ALLOW_WEAR = Boolean.parseBoolean(generalSettings.getProperty("AllowWear", "false"));
WEAR_DELAY = Integer.parseInt(generalSettings.getProperty("WearDelay", "5"));
WEAR_PRICE = Integer.parseInt(generalSettings.getProperty("WearPrice", "10"));
ALLOW_LOTTERY = Boolean.valueOf(generalSettings.getProperty("AllowLottery", "false"));
ALLOW_RACE = Boolean.valueOf(generalSettings.getProperty("AllowRace", "false"));
ALLOW_RENTPET = Boolean.valueOf(generalSettings.getProperty("AllowRentPet", "false"));
ALLOW_DISCARDITEM = Boolean.valueOf(generalSettings.getProperty("AllowDiscardItem", "true"));
ALLOWFISHING = Boolean.valueOf(generalSettings.getProperty("AllowFishing", "false"));
ALLOW_LOTTERY = Boolean.parseBoolean(generalSettings.getProperty("AllowLottery", "false"));
ALLOW_RACE = Boolean.parseBoolean(generalSettings.getProperty("AllowRace", "false"));
ALLOW_RENTPET = Boolean.parseBoolean(generalSettings.getProperty("AllowRentPet", "false"));
ALLOW_DISCARDITEM = Boolean.parseBoolean(generalSettings.getProperty("AllowDiscardItem", "true"));
ALLOWFISHING = Boolean.parseBoolean(generalSettings.getProperty("AllowFishing", "false"));
ALLOW_MANOR = Boolean.parseBoolean(generalSettings.getProperty("AllowManor", "false"));
ALLOW_BOAT = Boolean.valueOf(generalSettings.getProperty("AllowBoat", "false"));
ALLOW_NPC_WALKERS = Boolean.valueOf(generalSettings.getProperty("AllowNpcWalkers", "true"));
ALLOW_CURSED_WEAPONS = Boolean.valueOf(generalSettings.getProperty("AllowCursedWeapons", "false"));
ALLOW_BOAT = Boolean.parseBoolean(generalSettings.getProperty("AllowBoat", "false"));
ALLOW_NPC_WALKERS = Boolean.parseBoolean(generalSettings.getProperty("AllowNpcWalkers", "true"));
ALLOW_CURSED_WEAPONS = Boolean.parseBoolean(generalSettings.getProperty("AllowCursedWeapons", "false"));
DEFAULT_GLOBAL_CHAT = generalSettings.getProperty("GlobalChat", "ON");
DEFAULT_TRADE_CHAT = generalSettings.getProperty("TradeChat", "ON");
MAX_CHAT_LENGTH = Integer.parseInt(generalSettings.getProperty("MaxChatLength", "100"));
TRADE_CHAT_IS_NOOBLE = Boolean.valueOf(generalSettings.getProperty("TradeChatIsNooble", "false"));
TRADE_CHAT_WITH_PVP = Boolean.valueOf(generalSettings.getProperty("TradeChatWithPvP", "false"));
TRADE_CHAT_IS_NOOBLE = Boolean.parseBoolean(generalSettings.getProperty("TradeChatIsNooble", "false"));
TRADE_CHAT_WITH_PVP = Boolean.parseBoolean(generalSettings.getProperty("TradeChatWithPvP", "false"));
TRADE_PVP_AMOUNT = Integer.parseInt(generalSettings.getProperty("TradePvPAmount", "800"));
GLOBAL_CHAT_WITH_PVP = Boolean.valueOf(generalSettings.getProperty("GlobalChatWithPvP", "false"));
GLOBAL_CHAT_WITH_PVP = Boolean.parseBoolean(generalSettings.getProperty("GlobalChatWithPvP", "false"));
GLOBAL_PVP_AMOUNT = Integer.parseInt(generalSettings.getProperty("GlobalPvPAmount", "1500"));
ENABLE_COMMUNITY_BOARD = Boolean.valueOf(generalSettings.getProperty("EnableCommunityBoard", "true"));
ENABLE_COMMUNITY_BOARD = Boolean.parseBoolean(generalSettings.getProperty("EnableCommunityBoard", "true"));
BBS_DEFAULT = generalSettings.getProperty("BBSDefault", "_bbshome");
ZONE_TOWN = Integer.parseInt(generalSettings.getProperty("ZoneTown", "0"));
@@ -1687,14 +1687,14 @@ public class Config
MIN_MONSTER_ANIMATION = Integer.parseInt(generalSettings.getProperty("MinMonsterAnimation", "5"));
MAX_MONSTER_ANIMATION = Integer.parseInt(generalSettings.getProperty("MaxMonsterAnimation", "60"));
SHOW_NPC_LVL = Boolean.valueOf(generalSettings.getProperty("ShowNpcLevel", "false"));
SHOW_NPC_AGGRESSION = Boolean.valueOf(generalSettings.getProperty("ShowNpcAggression", "false"));
SHOW_NPC_LVL = Boolean.parseBoolean(generalSettings.getProperty("ShowNpcLevel", "false"));
SHOW_NPC_AGGRESSION = Boolean.parseBoolean(generalSettings.getProperty("ShowNpcAggression", "false"));
FORCE_INVENTORY_UPDATE = Boolean.valueOf(generalSettings.getProperty("ForceInventoryUpdate", "false"));
FORCE_INVENTORY_UPDATE = Boolean.parseBoolean(generalSettings.getProperty("ForceInventoryUpdate", "false"));
FORCE_COMPLETE_STATUS_UPDATE = Boolean.valueOf(generalSettings.getProperty("ForceCompletePlayerStatusUpdate", "true"));
FORCE_COMPLETE_STATUS_UPDATE = Boolean.parseBoolean(generalSettings.getProperty("ForceCompletePlayerStatusUpdate", "true"));
AUTODELETE_INVALID_QUEST_DATA = Boolean.valueOf(generalSettings.getProperty("AutoDeleteInvalidQuestData", "false"));
AUTODELETE_INVALID_QUEST_DATA = Boolean.parseBoolean(generalSettings.getProperty("AutoDeleteInvalidQuestData", "false"));
DELETE_DAYS = Integer.parseInt(generalSettings.getProperty("DeleteCharAfterDays", "7"));
@@ -1705,7 +1705,7 @@ public class Config
GRID_NEIGHBOR_TURNON_TIME = Integer.parseInt(generalSettings.getProperty("GridNeighborTurnOnTime", "30"));
GRID_NEIGHBOR_TURNOFF_TIME = Integer.parseInt(generalSettings.getProperty("GridNeighborTurnOffTime", "300"));
USE_3D_MAP = Boolean.valueOf(generalSettings.getProperty("Use3DMap", "false"));
USE_3D_MAP = Boolean.parseBoolean(generalSettings.getProperty("Use3DMap", "false"));
PATH_NODE_RADIUS = Integer.parseInt(generalSettings.getProperty("PathNodeRadius", "50"));
NEW_NODE_ID = Integer.parseInt(generalSettings.getProperty("NewNodeId", "7952"));
@@ -1713,15 +1713,15 @@ public class Config
LINKED_NODE_ID = Integer.parseInt(generalSettings.getProperty("NewNodeId", "7952"));
NEW_NODE_TYPE = generalSettings.getProperty("NewNodeType", "npc");
COUNT_PACKETS = Boolean.valueOf(generalSettings.getProperty("CountPacket", "false"));
DUMP_PACKET_COUNTS = Boolean.valueOf(generalSettings.getProperty("DumpPacketCounts", "false"));
COUNT_PACKETS = Boolean.parseBoolean(generalSettings.getProperty("CountPacket", "false"));
DUMP_PACKET_COUNTS = Boolean.parseBoolean(generalSettings.getProperty("DumpPacketCounts", "false"));
DUMP_INTERVAL_SECONDS = Integer.parseInt(generalSettings.getProperty("PacketDumpInterval", "60"));
MINIMUM_UPDATE_DISTANCE = Integer.parseInt(generalSettings.getProperty("MaximumUpdateDistance", "50"));
MINIMUN_UPDATE_TIME = Integer.parseInt(generalSettings.getProperty("MinimumUpdateTime", "500"));
KNOWNLIST_FORGET_DELAY = Integer.parseInt(generalSettings.getProperty("KnownListForgetDelay", "10000"));
HIGH_RATE_SERVER_DROPS = Boolean.valueOf(generalSettings.getProperty("HighRateServerDrops", "false"));
HIGH_RATE_SERVER_DROPS = Boolean.parseBoolean(generalSettings.getProperty("HighRateServerDrops", "false"));
}
catch (Exception e)
{
@@ -1768,56 +1768,56 @@ public class Config
final InputStream is = new FileInputStream(new File(CLANHALL_CONFIG_FILE));
clanhallSettings.load(is);
is.close();
CH_TELE_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeRation", "86400000"));
CH_TELE1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeLvl1", "86400000"));
CH_TELE2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeLvl2", "86400000"));
CH_SUPPORT_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallSupportFunctionFeeRation", "86400000"));
CH_SUPPORT1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl1", "86400000"));
CH_SUPPORT2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl2", "86400000"));
CH_SUPPORT3_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl3", "86400000"));
CH_SUPPORT4_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl4", "86400000"));
CH_SUPPORT5_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl5", "86400000"));
CH_SUPPORT6_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl6", "86400000"));
CH_SUPPORT7_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl7", "86400000"));
CH_SUPPORT8_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallSupportFeeLvl8", "86400000"));
CH_MPREG_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFunctionFeeRation", "86400000"));
CH_MPREG1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl1", "86400000"));
CH_MPREG2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl2", "86400000"));
CH_MPREG3_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl3", "86400000"));
CH_MPREG4_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl4", "86400000"));
CH_MPREG5_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl5", "86400000"));
CH_HPREG_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFunctionFeeRation", "86400000"));
CH_HPREG1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl1", "86400000"));
CH_HPREG2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl2", "86400000"));
CH_HPREG3_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl3", "86400000"));
CH_HPREG4_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl4", "86400000"));
CH_HPREG5_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl5", "86400000"));
CH_HPREG6_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl6", "86400000"));
CH_HPREG7_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl7", "86400000"));
CH_HPREG8_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl8", "86400000"));
CH_HPREG9_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl9", "86400000"));
CH_HPREG10_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl10", "86400000"));
CH_HPREG11_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl11", "86400000"));
CH_HPREG12_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl12", "86400000"));
CH_HPREG13_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl13", "86400000"));
CH_EXPREG_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFunctionFeeRation", "86400000"));
CH_EXPREG1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl1", "86400000"));
CH_EXPREG2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl2", "86400000"));
CH_EXPREG3_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl3", "86400000"));
CH_EXPREG4_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl4", "86400000"));
CH_EXPREG5_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl5", "86400000"));
CH_EXPREG6_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl6", "86400000"));
CH_EXPREG7_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl7", "86400000"));
CH_ITEM_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeRation", "86400000"));
CH_ITEM1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl1", "86400000"));
CH_ITEM2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl2", "86400000"));
CH_ITEM3_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl3", "86400000"));
CH_CURTAIN_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeRation", "86400000"));
CH_CURTAIN1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeLvl1", "86400000"));
CH_CURTAIN2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeLvl2", "86400000"));
CH_FRONT_FEE_RATIO = Long.valueOf(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeRation", "86400000"));
CH_FRONT1_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeLvl1", "86400000"));
CH_FRONT2_FEE = Integer.valueOf(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeLvl2", "86400000"));
CH_TELE_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeRation", "86400000"));
CH_TELE1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeLvl1", "86400000"));
CH_TELE2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallTeleportFunctionFeeLvl2", "86400000"));
CH_SUPPORT_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallSupportFunctionFeeRation", "86400000"));
CH_SUPPORT1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl1", "86400000"));
CH_SUPPORT2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl2", "86400000"));
CH_SUPPORT3_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl3", "86400000"));
CH_SUPPORT4_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl4", "86400000"));
CH_SUPPORT5_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl5", "86400000"));
CH_SUPPORT6_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl6", "86400000"));
CH_SUPPORT7_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl7", "86400000"));
CH_SUPPORT8_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallSupportFeeLvl8", "86400000"));
CH_MPREG_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallMpRegenerationFunctionFeeRation", "86400000"));
CH_MPREG1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl1", "86400000"));
CH_MPREG2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl2", "86400000"));
CH_MPREG3_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl3", "86400000"));
CH_MPREG4_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl4", "86400000"));
CH_MPREG5_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallMpRegenerationFeeLvl5", "86400000"));
CH_HPREG_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallHpRegenerationFunctionFeeRation", "86400000"));
CH_HPREG1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl1", "86400000"));
CH_HPREG2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl2", "86400000"));
CH_HPREG3_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl3", "86400000"));
CH_HPREG4_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl4", "86400000"));
CH_HPREG5_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl5", "86400000"));
CH_HPREG6_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl6", "86400000"));
CH_HPREG7_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl7", "86400000"));
CH_HPREG8_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl8", "86400000"));
CH_HPREG9_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl9", "86400000"));
CH_HPREG10_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl10", "86400000"));
CH_HPREG11_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl11", "86400000"));
CH_HPREG12_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl12", "86400000"));
CH_HPREG13_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallHpRegenerationFeeLvl13", "86400000"));
CH_EXPREG_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallExpRegenerationFunctionFeeRation", "86400000"));
CH_EXPREG1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl1", "86400000"));
CH_EXPREG2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl2", "86400000"));
CH_EXPREG3_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl3", "86400000"));
CH_EXPREG4_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl4", "86400000"));
CH_EXPREG5_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl5", "86400000"));
CH_EXPREG6_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl6", "86400000"));
CH_EXPREG7_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallExpRegenerationFeeLvl7", "86400000"));
CH_ITEM_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeRation", "86400000"));
CH_ITEM1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl1", "86400000"));
CH_ITEM2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl2", "86400000"));
CH_ITEM3_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallItemCreationFunctionFeeLvl3", "86400000"));
CH_CURTAIN_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeRation", "86400000"));
CH_CURTAIN1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeLvl1", "86400000"));
CH_CURTAIN2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallCurtainFunctionFeeLvl2", "86400000"));
CH_FRONT_FEE_RATIO = Long.parseLong(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeRation", "86400000"));
CH_FRONT1_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeLvl1", "86400000"));
CH_FRONT2_FEE = Integer.parseInt(clanhallSettings.getProperty("ClanHallFrontPlatformFunctionFeeLvl2", "86400000"));
}
catch (Exception e)
{
@@ -1835,12 +1835,12 @@ public class Config
elitchSettings.load(is);
is.close();
DEVASTATED_DAY = Integer.valueOf(elitchSettings.getProperty("DevastatedDay", "1"));
DEVASTATED_HOUR = Integer.valueOf(elitchSettings.getProperty("DevastatedHour", "18"));
DEVASTATED_MINUTES = Integer.valueOf(elitchSettings.getProperty("DevastatedMinutes", "0"));
PARTISAN_DAY = Integer.valueOf(elitchSettings.getProperty("PartisanDay", "5"));
PARTISAN_HOUR = Integer.valueOf(elitchSettings.getProperty("PartisanHour", "21"));
PARTISAN_MINUTES = Integer.valueOf(elitchSettings.getProperty("PartisanMinutes", "0"));
DEVASTATED_DAY = Integer.parseInt(elitchSettings.getProperty("DevastatedDay", "1"));
DEVASTATED_HOUR = Integer.parseInt(elitchSettings.getProperty("DevastatedHour", "18"));
DEVASTATED_MINUTES = Integer.parseInt(elitchSettings.getProperty("DevastatedMinutes", "0"));
PARTISAN_DAY = Integer.parseInt(elitchSettings.getProperty("PartisanDay", "5"));
PARTISAN_HOUR = Integer.parseInt(elitchSettings.getProperty("PartisanHour", "21"));
PARTISAN_MINUTES = Integer.parseInt(elitchSettings.getProperty("PartisanMinutes", "0"));
}
catch (Exception e)
{
@@ -1890,7 +1890,7 @@ public class Config
WeddingSettings.load(is);
is.close();
L2JMOD_ALLOW_WEDDING = Boolean.valueOf(WeddingSettings.getProperty("AllowWedding", "false"));
L2JMOD_ALLOW_WEDDING = Boolean.parseBoolean(WeddingSettings.getProperty("AllowWedding", "false"));
L2JMOD_WEDDING_PRICE = Integer.parseInt(WeddingSettings.getProperty("WeddingPrice", "250000000"));
L2JMOD_WEDDING_PUNISH_INFIDELITY = Boolean.parseBoolean(WeddingSettings.getProperty("WeddingPunishInfidelity", "true"));
L2JMOD_WEDDING_TELEPORT = Boolean.parseBoolean(WeddingSettings.getProperty("WeddingTeleport", "true"));
@@ -2251,11 +2251,11 @@ public class Config
is.close();
/** Custom Tables **/
CUSTOM_SPAWNLIST_TABLE = Boolean.valueOf(CustomServerSettings.getProperty("CustomSpawnlistTable", "true"));
SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(CustomServerSettings.getProperty("SaveGmSpawnOnCustom", "true"));
DELETE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(CustomServerSettings.getProperty("DeleteGmSpawnOnCustom", "true"));
CUSTOM_SPAWNLIST_TABLE = Boolean.parseBoolean(CustomServerSettings.getProperty("CustomSpawnlistTable", "true"));
SAVE_GMSPAWN_ON_CUSTOM = Boolean.parseBoolean(CustomServerSettings.getProperty("SaveGmSpawnOnCustom", "true"));
DELETE_GMSPAWN_ON_CUSTOM = Boolean.parseBoolean(CustomServerSettings.getProperty("DeleteGmSpawnOnCustom", "true"));
ONLINE_PLAYERS_ON_LOGIN = Boolean.valueOf(CustomServerSettings.getProperty("OnlineOnLogin", "false"));
ONLINE_PLAYERS_ON_LOGIN = Boolean.parseBoolean(CustomServerSettings.getProperty("OnlineOnLogin", "false"));
/** Protector **/
PROTECTOR_PLAYER_PK = Boolean.parseBoolean(CustomServerSettings.getProperty("ProtectorPlayerPK", "false"));
@@ -2286,9 +2286,9 @@ public class Config
DIFFERENT_Z_CHANGE_OBJECT = Integer.parseInt(CustomServerSettings.getProperty("DifferentZchangeObject", "650"));
DIFFERENT_Z_NEW_MOVIE = Integer.parseInt(CustomServerSettings.getProperty("DifferentZnewmovie", "1000"));
ALLOW_SIMPLE_STATS_VIEW = Boolean.valueOf(CustomServerSettings.getProperty("AllowSimpleStatsView", "true"));
ALLOW_DETAILED_STATS_VIEW = Boolean.valueOf(CustomServerSettings.getProperty("AllowDetailedStatsView", "false"));
ALLOW_ONLINE_VIEW = Boolean.valueOf(CustomServerSettings.getProperty("AllowOnlineView", "false"));
ALLOW_SIMPLE_STATS_VIEW = Boolean.parseBoolean(CustomServerSettings.getProperty("AllowSimpleStatsView", "true"));
ALLOW_DETAILED_STATS_VIEW = Boolean.parseBoolean(CustomServerSettings.getProperty("AllowDetailedStatsView", "false"));
ALLOW_ONLINE_VIEW = Boolean.parseBoolean(CustomServerSettings.getProperty("AllowOnlineView", "false"));
KEEP_SUBCLASS_SKILLS = Boolean.parseBoolean(CustomServerSettings.getProperty("KeepSubClassSkills", "false"));
@@ -2323,7 +2323,7 @@ public class Config
ALLOW_HERO_SUBSKILL = Boolean.parseBoolean(CustomServerSettings.getProperty("CustomHeroSubSkill", "false"));
HERO_COUNT = Integer.parseInt(CustomServerSettings.getProperty("HeroCount", "1"));
CRUMA_TOWER_LEVEL_RESTRICT = Integer.parseInt(CustomServerSettings.getProperty("CrumaTowerLevelRestrict", "56"));
ALLOW_RAID_BOSS_PETRIFIED = Boolean.valueOf(CustomServerSettings.getProperty("AllowRaidBossPetrified", "true"));
ALLOW_RAID_BOSS_PETRIFIED = Boolean.parseBoolean(CustomServerSettings.getProperty("AllowRaidBossPetrified", "true"));
ALT_PLAYER_PROTECTION_LEVEL = Integer.parseInt(CustomServerSettings.getProperty("AltPlayerProtectionLevel", "0"));
MONSTER_RETURN_DELAY = Integer.parseInt(CustomServerSettings.getProperty("MonsterReturnDelay", "1200"));
SCROLL_STACKABLE = Boolean.parseBoolean(CustomServerSettings.getProperty("ScrollStackable", "false"));
@@ -2408,19 +2408,19 @@ public class Config
PVP_NORMAL_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsNormalTime", "15000"));
PVP_PVP_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsPvPTime", "30000"));
ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanBeKilledInPeaceZone", "false"));
ALT_GAME_KARMA_PLAYER_CAN_SHOP = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanShop", "true"));
ALT_GAME_KARMA_PLAYER_CAN_USE_GK = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanUseGK", "false"));
ALT_GAME_KARMA_PLAYER_CAN_TELEPORT = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanTeleport", "true"));
ALT_GAME_KARMA_PLAYER_CAN_TRADE = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanTrade", "true"));
ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE = Boolean.valueOf(pvpSettings.getProperty("AltKarmaPlayerCanUseWareHouse", "true"));
ALT_KARMA_TELEPORT_TO_FLORAN = Boolean.valueOf(pvpSettings.getProperty("AltKarmaTeleportToFloran", "true"));
ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanBeKilledInPeaceZone", "false"));
ALT_GAME_KARMA_PLAYER_CAN_SHOP = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanShop", "true"));
ALT_GAME_KARMA_PLAYER_CAN_USE_GK = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanUseGK", "false"));
ALT_GAME_KARMA_PLAYER_CAN_TELEPORT = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanTeleport", "true"));
ALT_GAME_KARMA_PLAYER_CAN_TRADE = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanTrade", "true"));
ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaPlayerCanUseWareHouse", "true"));
ALT_KARMA_TELEPORT_TO_FLORAN = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaTeleportToFloran", "true"));
/** Custom Reword **/
PVP_REWARD_ENABLED = Boolean.valueOf(pvpSettings.getProperty("PvpRewardEnabled", "false"));
PVP_REWARD_ENABLED = Boolean.parseBoolean(pvpSettings.getProperty("PvpRewardEnabled", "false"));
PVP_REWARD_ID = Integer.parseInt(pvpSettings.getProperty("PvpRewardItemId", "6392"));
PVP_REWARD_AMOUNT = Integer.parseInt(pvpSettings.getProperty("PvpRewardAmmount", "1"));
PK_REWARD_ENABLED = Boolean.valueOf(pvpSettings.getProperty("PKRewardEnabled", "false"));
PK_REWARD_ENABLED = Boolean.parseBoolean(pvpSettings.getProperty("PKRewardEnabled", "false"));
PK_REWARD_ID = Integer.parseInt(pvpSettings.getProperty("PKRewardItemId", "6392"));
PK_REWARD_AMOUNT = Integer.parseInt(pvpSettings.getProperty("PKRewardAmmount", "1"));
@@ -2452,7 +2452,7 @@ public class Config
TITLE_COLOR_FOR_PK_AMOUNT4 = Integer.decode("0x" + pvpSettings.getProperty("TitleForAmount4", "00FF00"));
TITLE_COLOR_FOR_PK_AMOUNT5 = Integer.decode("0x" + pvpSettings.getProperty("TitleForAmount5", "00FF00"));
FLAGED_PLAYER_USE_BUFFER = Boolean.valueOf(pvpSettings.getProperty("AltKarmaFlagPlayerCanUseBuffer", "false"));
FLAGED_PLAYER_USE_BUFFER = Boolean.parseBoolean(pvpSettings.getProperty("AltKarmaFlagPlayerCanUseBuffer", "false"));
FLAGED_PLAYER_CAN_USE_GK = Boolean.parseBoolean(pvpSettings.getProperty("FlaggedPlayerCanUseGK", "false"));
PVPEXPSP_SYSTEM = Boolean.parseBoolean(pvpSettings.getProperty("AllowAddExpSpAtPvP", "false"));
@@ -2461,7 +2461,7 @@ public class Config
ALLOW_SOE_IN_PVP = Boolean.parseBoolean(pvpSettings.getProperty("AllowSoEInPvP", "true"));
ALLOW_POTS_IN_PVP = Boolean.parseBoolean(pvpSettings.getProperty("AllowPotsInPvP", "true"));
/** Enable Pk Info mod. Displays number of times player has killed other */
ENABLE_PK_INFO = Boolean.valueOf(pvpSettings.getProperty("EnablePkInfo", "false"));
ENABLE_PK_INFO = Boolean.parseBoolean(pvpSettings.getProperty("EnablePkInfo", "false"));
// Get the AnnounceAllKill, AnnouncePvpKill and AnnouncePkKill values
ANNOUNCE_ALL_KILL = Boolean.parseBoolean(pvpSettings.getProperty("AnnounceAllKill", "false"));
ANNOUNCE_PVP_KILL = Boolean.parseBoolean(pvpSettings.getProperty("AnnouncePvPKill", "false"));
@@ -2833,7 +2833,7 @@ public class Config
/** count enchant **/
CUSTOM_ENCHANT_VALUE = Integer.parseInt(ENCHANTSetting.getProperty("CustomEnchantValue", "1"));
ALT_OLY_ENCHANT_LIMIT = Integer.parseInt(ENCHANTSetting.getProperty("AltOlyMaxEnchant", "-1"));
BREAK_ENCHANT = Integer.valueOf(ENCHANTSetting.getProperty("BreakEnchant", "0"));
BREAK_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("BreakEnchant", "0"));
MAX_ITEM_ENCHANT_KICK = Integer.parseInt(ENCHANTSetting.getProperty("EnchantKick", "0"));
GM_OVER_ENCHANT = Integer.parseInt(ENCHANTSetting.getProperty("GMOverEnchant", "0"));
@@ -3077,7 +3077,7 @@ public class Config
MAX_ITERATIONS = Integer.parseInt(geodataSetting.getProperty("MaxIterations", "3500"));
FALL_DAMAGE = Boolean.parseBoolean(geodataSetting.getProperty("FallDamage", "false"));
ALLOW_WATER = Boolean.valueOf(geodataSetting.getProperty("AllowWater", "false"));
ALLOW_WATER = Boolean.parseBoolean(geodataSetting.getProperty("AllowWater", "false"));
}
catch (Exception e)
{
@@ -3136,9 +3136,9 @@ public class Config
PLAYERS_CAN_HEAL_RB = Boolean.parseBoolean(bossSettings.getProperty("PlayersCanHealRb", "true"));
// ============================================================
ALLOW_DIRECT_TP_TO_BOSS_ROOM = Boolean.valueOf(bossSettings.getProperty("AllowDirectTeleportToBossRoom", "false"));
ALLOW_DIRECT_TP_TO_BOSS_ROOM = Boolean.parseBoolean(bossSettings.getProperty("AllowDirectTeleportToBossRoom", "false"));
// Antharas
ANTHARAS_OLD = Boolean.valueOf(bossSettings.getProperty("AntharasOldScript", "true"));
ANTHARAS_OLD = Boolean.parseBoolean(bossSettings.getProperty("AntharasOldScript", "true"));
ANTHARAS_CLOSE = Integer.parseInt(bossSettings.getProperty("AntharasClose", "1200"));
ANTHARAS_DESPAWN_TIME = Integer.parseInt(bossSettings.getProperty("AntharasDespawnTime", "240"));
ANTHARAS_RESP_FIRST = Integer.parseInt(bossSettings.getProperty("AntharasRespFirst", "192"));
@@ -3195,7 +3195,7 @@ public class Config
FRINTEZZA_RESP_SECOND = Integer.parseInt(bossSettings.getProperty("FrintezzaRespSecond", "8"));
FRINTEZZA_POWER_MULTIPLIER = Float.parseFloat(bossSettings.getProperty("FrintezzaPowerMultiplier", "1.0"));
BYPASS_FRINTEZZA_PARTIES_CHECK = Boolean.valueOf(bossSettings.getProperty("BypassPartiesCheck", "false"));
BYPASS_FRINTEZZA_PARTIES_CHECK = Boolean.parseBoolean(bossSettings.getProperty("BypassPartiesCheck", "false"));
FRINTEZZA_MIN_PARTIES = Integer.parseInt(bossSettings.getProperty("FrintezzaMinParties", "4"));
FRINTEZZA_MAX_PARTIES = Integer.parseInt(bossSettings.getProperty("FrintezzaMaxParties", "5"));
// ============================================================
@@ -3417,7 +3417,7 @@ public class Config
MAX_PETITIONS_PER_PLAYER = Integer.parseInt(characterSettings.getProperty("MaxPetitionsPerPlayer", "5"));
MAX_PETITIONS_PENDING = Integer.parseInt(characterSettings.getProperty("MaxPetitionsPending", "25"));
DEATH_PENALTY_CHANCE = Integer.parseInt(characterSettings.getProperty("DeathPenaltyChance", "20"));
EFFECT_CANCELING = Boolean.valueOf(characterSettings.getProperty("CancelLesserEffect", "true"));
EFFECT_CANCELING = Boolean.parseBoolean(characterSettings.getProperty("CancelLesserEffect", "true"));
STORE_SKILL_COOLTIME = Boolean.parseBoolean(characterSettings.getProperty("StoreSkillCooltime", "true"));
BUFFS_MAX_AMOUNT = Byte.parseByte(characterSettings.getProperty("MaxBuffAmount", "24"));
DEBUFFS_MAX_AMOUNT = Byte.parseByte(characterSettings.getProperty("MaxDebuffAmount", "6"));
@@ -3452,13 +3452,13 @@ public class Config
}
}
}
ALLOW_CLASS_MASTERS = Boolean.valueOf(characterSettings.getProperty("AllowClassMasters", "false"));
CLASS_MASTER_STRIDER_UPDATE = Boolean.valueOf(characterSettings.getProperty("AllowClassMastersStriderUpdate", "false"));
ALLOW_CLASS_MASTERS_FIRST_CLASS = Boolean.valueOf(characterSettings.getProperty("AllowClassMastersFirstClass", "true"));
ALLOW_CLASS_MASTERS_SECOND_CLASS = Boolean.valueOf(characterSettings.getProperty("AllowClassMastersSecondClass", "true"));
ALLOW_CLASS_MASTERS_THIRD_CLASS = Boolean.valueOf(characterSettings.getProperty("AllowClassMastersThirdClass", "true"));
ALLOW_CLASS_MASTERS = Boolean.parseBoolean(characterSettings.getProperty("AllowClassMasters", "false"));
CLASS_MASTER_STRIDER_UPDATE = Boolean.parseBoolean(characterSettings.getProperty("AllowClassMastersStriderUpdate", "false"));
ALLOW_CLASS_MASTERS_FIRST_CLASS = Boolean.parseBoolean(characterSettings.getProperty("AllowClassMastersFirstClass", "true"));
ALLOW_CLASS_MASTERS_SECOND_CLASS = Boolean.parseBoolean(characterSettings.getProperty("AllowClassMastersSecondClass", "true"));
ALLOW_CLASS_MASTERS_THIRD_CLASS = Boolean.parseBoolean(characterSettings.getProperty("AllowClassMastersThirdClass", "true"));
CLASS_MASTER_SETTINGS = new ClassMasterSettings(characterSettings.getProperty("ConfigClassMaster"));
ALLOW_REMOTE_CLASS_MASTERS = Boolean.valueOf(characterSettings.getProperty("AllowRemoteClassMasters", "false"));
ALLOW_REMOTE_CLASS_MASTERS = Boolean.parseBoolean(characterSettings.getProperty("AllowRemoteClassMasters", "false"));
}
catch (Exception e)
{
@@ -3582,7 +3582,7 @@ public class Config
DATABASE_PASSWORD = serverSettings.getProperty("Password", "");
DATABASE_MAX_CONNECTIONS = Integer.parseInt(serverSettings.getProperty("MaximumDbConnections", "10"));
BACKUP_DATABASE = Boolean.valueOf(serverSettings.getProperty("BackupDatabase", "false"));
BACKUP_DATABASE = Boolean.parseBoolean(serverSettings.getProperty("BackupDatabase", "false"));
MYSQL_BIN_PATH = serverSettings.getProperty("MySqlBinLocation", "C:/xampp/mysql/bin/");
BACKUP_PATH = serverSettings.getProperty("BackupPath", "../backup/");
BACKUP_DAYS = Integer.parseInt(serverSettings.getProperty("BackupDays", "30"));

View File

@@ -51,10 +51,7 @@ public class ThreadPool
INSTANT_POOL.prestartAllCoreThreads();
// Launch purge task.
scheduleAtFixedRate(() ->
{
purge();
}, 60000, 60000);
scheduleAtFixedRate(ThreadPool::purge, 60000, 60000);
LOGGER.info("ThreadPool: Initialized");
LOGGER.info("...scheduled pool executor with " + Config.SCHEDULED_THREAD_POOL_COUNT + " total threads.");
@@ -165,7 +162,7 @@ public class ThreadPool
}
catch (Throwable t)
{
t.printStackTrace();
LOGGER.info("ThreadPool: Problem at Shutting down. " + t.getMessage());
}
}
}

View File

@@ -1119,7 +1119,6 @@ public class BlowfishEngine
encrypting = pEncrypting;
workingKey = key;
setKey(workingKey);
return;
}
public String getAlgorithmName()

View File

@@ -24,7 +24,7 @@ import java.util.logging.Logger;
*/
public class NewCrypt
{
protected static Logger LOGGER = Logger.getLogger(NewCrypt.class.getName());
protected static final Logger LOGGER = Logger.getLogger(NewCrypt.class.getName());
BlowfishEngine _crypt;
BlowfishEngine _decrypt;

View File

@@ -19,6 +19,7 @@ package org.l2jmobius.commons.crypt;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.network.GameClient;
@@ -30,6 +31,8 @@ import org.l2jmobius.gameserver.network.serverpackets.GameGuardQuery;
*/
public class nProtect
{
private static final Logger LOGGER = Logger.getLogger(nProtect.class.getName());
public enum RestrictionType
{
RESTRICT_ENTER,
@@ -40,10 +43,6 @@ public class nProtect
public class nProtectAccessor
{
public nProtectAccessor()
{
}
public void setCheckGameGuardQuery(Method m)
{
_checkGameGuardQuery = m;
@@ -107,7 +106,7 @@ public class nProtect
}
catch (SecurityException | InvocationTargetException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
}
@@ -122,7 +121,7 @@ public class nProtect
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
}
@@ -137,7 +136,7 @@ public class nProtect
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
return true;
}
@@ -153,7 +152,7 @@ public class nProtect
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
return null;
}
@@ -168,7 +167,7 @@ public class nProtect
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
}
}
@@ -183,6 +182,7 @@ public class nProtect
}
catch (Exception e)
{
// Ignore.
}
}
}
@@ -198,7 +198,7 @@ public class nProtect
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Ptoblem with nProtect: " + e.getMessage());
}
return true;
}

View File

@@ -60,11 +60,13 @@ public class DatabaseBackup
}
catch (Exception ex)
{
// Ignore.
}
});
}
catch (Exception e)
{
// Ignore.
}
}
@@ -77,6 +79,7 @@ public class DatabaseBackup
}
catch (Exception e)
{
// Ignore.
}
}
}

View File

@@ -50,7 +50,7 @@ public class DatabaseFactory
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.info("Database: Problem on initialize. " + e);
}
}

View File

@@ -25,9 +25,9 @@ public class IPSubnet
private final byte[] _mask;
private final boolean _isIPv4;
public IPSubnet(String input) throws UnknownHostException, NumberFormatException, ArrayIndexOutOfBoundsException
public IPSubnet(String input) throws UnknownHostException
{
final int idx = input.indexOf("/");
final int idx = input.indexOf('/');
if (idx > 0)
{
_addr = InetAddress.getByName(input.substring(0, idx)).getAddress();

View File

@@ -95,12 +95,10 @@ public interface IXmlReader
catch (SAXParseException e)
{
LOGGER.log(Level.WARNING, "Could not parse file: " + f.getName() + " at line: " + e.getLineNumber() + ", column: " + e.getColumnNumber() + " :", e);
return;
}
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Could not parse file: " + f.getName(), e);
return;
}
}

View File

@@ -91,11 +91,13 @@ public class LimitLinesDocumentListener implements DocumentListener
@Override
public void removeUpdate(DocumentEvent e)
{
// Ignore.
}
@Override
public void changedUpdate(DocumentEvent e)
{
// Ignore.
}
/*

View File

@@ -140,7 +140,7 @@ import org.l2jmobius.telnet.TelnetStatusThread;
public class GameServer
{
private static Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static SelectorThread<GameClient> _selectorThread;
private static LoginServerThread _loginThread;

View File

@@ -203,7 +203,7 @@ public class GameTimeController
{
sleep(sleepTime); // hope other threads will have much more cpu time available now
}
catch (InterruptedException ie)
catch (InterruptedException e)
{
// nothing
}

View File

@@ -444,9 +444,7 @@ public class LoginServerThread extends Thread
}
catch (IOException e)
{
LOGGER.warning("Error while sending logout packet to login");
e.printStackTrace();
LOGGER.warning("Error while sending logout packet to login: " + e.getMessage());
}
}

View File

@@ -78,7 +78,6 @@ public class RecipeController
SystemMessage sm = new SystemMessage(SystemMessageId.CANT_ALTER_RECIPEBOOK_WHILE_CRAFTING);
player.sendPacket(sm);
return;
}
public synchronized void requestMakeItemAbort(PlayerInstance player)
@@ -396,8 +395,9 @@ public class RecipeController
{
Thread.sleep(_delay);
}
catch (InterruptedException e)
catch (Exception e)
{
// Ignore.
}
finally
{

View File

@@ -48,25 +48,25 @@ public class ServerStatus
@Override
public void run()
{
int ActivePlayers = 0;
int OfflinePlayers = 0;
int activePlayers = 0;
int offlinePlayers = 0;
for (PlayerInstance player : World.getInstance().getAllPlayers())
{
if (player.isInOfflineMode())
{
OfflinePlayers++;
offlinePlayers++;
}
else
{
ActivePlayers++;
activePlayers++;
}
}
Util.printSection("Server Status");
LOGGER.info("Server Time: " + fmt.format(new Date(System.currentTimeMillis())));
LOGGER.info("Active Players Online: " + ActivePlayers);
LOGGER.info("Offline Players Online: " + OfflinePlayers);
LOGGER.info("Active Players Online: " + activePlayers);
LOGGER.info("Offline Players Online: " + offlinePlayers);
LOGGER.info("Threads: " + Thread.activeCount());
LOGGER.info("Free Memory: " + (((Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory()) + Runtime.getRuntime().freeMemory()) / 1048576) + " MB");
LOGGER.info("Used memory: " + ((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1048576) + " MB");

View File

@@ -22,8 +22,8 @@ import org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
import org.l2jmobius.commons.database.DatabaseBackup;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.datatables.SchemeBufferTable;
import org.l2jmobius.gameserver.datatables.OfflineTradeTable;
import org.l2jmobius.gameserver.datatables.SchemeBufferTable;
import org.l2jmobius.gameserver.instancemanager.AutoSaveManager;
import org.l2jmobius.gameserver.instancemanager.CastleManorManager;
import org.l2jmobius.gameserver.instancemanager.CursedWeaponsManager;
@@ -174,7 +174,7 @@ public class Shutdown extends Thread
*/
public void startShutdown(PlayerInstance player, int seconds, boolean restart)
{
Announcements _an = Announcements.getInstance();
Announcements announcements = Announcements.getInstance();
LOGGER.warning((player != null ? "GM: " + player.getName() + "(" + player.getObjectId() + ")" : "Server") + " issued shutdown command. " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
@@ -189,8 +189,8 @@ public class Shutdown extends Thread
if (_shutdownMode > 0)
{
_an.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
_an.announceToAll("Please exit game now!!");
announcements.announceToAll("Server is " + MODE_TEXT[_shutdownMode] + " in " + seconds + " seconds!");
announcements.announceToAll("Please exit game now!!");
}
if (_counterInstance != null)
@@ -214,11 +214,11 @@ public class Shutdown extends Thread
*/
public void abort(PlayerInstance player)
{
Announcements _an = Announcements.getInstance();
Announcements announcements = Announcements.getInstance();
LOGGER.warning((player != null ? "GM: " + player.getName() + "(" + player.getObjectId() + ")" : "Server") + " issued shutdown ABORT. " + MODE_TEXT[_shutdownMode] + " has been stopped!");
_an.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
announcements.announceToAll("Server aborts " + MODE_TEXT[_shutdownMode] + " and continues normal operation!");
if (_counterInstance != null)
{
@@ -246,25 +246,25 @@ public class Shutdown extends Thread
{
while (_secondsShut > 0)
{
int _seconds;
int _minutes;
int _hours;
int seconds;
int minutes;
int hours;
_seconds = _secondsShut;
_minutes = _seconds / 60;
_hours = _seconds / 3600;
seconds = _secondsShut;
minutes = seconds / 60;
hours = seconds / 3600;
// announce only every minute after 10 minutes left and every second after 20 seconds
if (((_seconds <= 20) || (_seconds == (_minutes * 10))) && (_seconds <= 600) && (_hours <= 1))
if (((seconds <= 20) || (seconds == (minutes * 10))) && (seconds <= 600) && (hours <= 1))
{
SystemMessage sm = new SystemMessage(SystemMessageId.THE_SERVER_WILL_BE_COMING_DOWN_IN_S1_SECONDS);
sm.addString(Integer.toString(_seconds));
sm.addString(Integer.toString(seconds));
Announcements.getInstance().announceToAll(sm);
}
try
{
if (_seconds <= 60)
if (seconds <= 60)
{
LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN);
}
@@ -444,7 +444,7 @@ public class Shutdown extends Thread
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.warning("Problem while saving Olympiad: " + e.getMessage());
}
LOGGER.info("Olympiad System: Data saved!!");

View File

@@ -41,7 +41,7 @@ import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
*/
public class TradeController
{
private static Logger LOGGER = Logger.getLogger(TradeController.class.getName());
private static final Logger LOGGER = Logger.getLogger(TradeController.class.getName());
private int _nextListId;
private final Map<Integer, StoreTradeList> _lists;
@@ -98,13 +98,15 @@ public class TradeController
{
continue;
}
// FIXME: Nothing?
}
LOGGER.info("TradeController: Loaded " + _lists.size() + " Buylists.");
}
catch (Exception e)
{
LOGGER.warning("error while creating trade controller in line: " + (lnr == null ? 0 : lnr.getLineNumber()) + " " + e);
LOGGER.warning("Error while creating trade controller in line: " + (lnr == null ? 0 : lnr.getLineNumber()) + " " + e);
}
finally
{
@@ -116,7 +118,7 @@ public class TradeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
@@ -128,7 +130,7 @@ public class TradeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
@@ -140,7 +142,7 @@ public class TradeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with TradeController: " + e1.getMessage());
}
}
}
@@ -152,7 +154,7 @@ public class TradeController
/**
* Initialize Shop buylist
*/
boolean LimitedItem = false;
boolean limitedItem = false;
try (Connection con = DatabaseFactory.getConnection())
{
@@ -168,7 +170,7 @@ public class TradeController
ResultSet rset = statement.executeQuery();
if (rset.next())
{
LimitedItem = false;
limitedItem = false;
StoreTradeList buy1 = new StoreTradeList(rset1.getInt("shop_id"));
int itemId = rset.getInt("item_id");
@@ -189,7 +191,7 @@ public class TradeController
if (count > -1)
{
item.setCountDecrease(true);
LimitedItem = true;
limitedItem = true;
}
if (!rset1.getString("npc_id").equals("gm") && (price < (item.getReferencePrice() / 2)))
@@ -216,7 +218,7 @@ public class TradeController
try
{
while (rset.next()) // TODO aici
while (rset.next())
{
itemId = rset.getInt("item_id");
price = rset.getInt("price");
@@ -233,7 +235,7 @@ public class TradeController
if (count > -1)
{
item2.setCountDecrease(true);
LimitedItem = true;
limitedItem = true;
}
if (!rset1.getString("npc_id").equals("gm") && (price < (item2.getReferencePrice() / 2)))
@@ -261,7 +263,7 @@ public class TradeController
{
LOGGER.warning("TradeController: Problem with buylist " + buy1.getListId() + " item " + itemId);
}
if (LimitedItem)
if (limitedItem)
{
_listsTaskItem.put(buy1.getListId(), buy1);
}
@@ -312,15 +314,13 @@ public class TradeController
}
catch (Exception e)
{
LOGGER.warning("TradeController: Could not restore Timer for Item count.");
e.printStackTrace();
LOGGER.warning("TradeController: Could not restore Timer for Item count. " + e.getMessage());
}
}
catch (Exception e)
{
// problem with initializing spawn, go to next one
LOGGER.warning("TradeController: Buylists could not be initialized.");
e.printStackTrace();
LOGGER.warning("TradeController: Buylists could not be initialized." + e.getMessage());
}
/*
@@ -345,7 +345,7 @@ public class TradeController
if (rset.next())
{
LimitedItem = false;
limitedItem = false;
StoreTradeList buy1 = new StoreTradeList(rset1.getInt("shop_id"));
int itemId = rset.getInt("item_id");
int price = rset.getInt("price");
@@ -363,7 +363,7 @@ public class TradeController
if (count > -1)
{
item.setCountDecrease(true);
LimitedItem = true;
limitedItem = true;
}
if (!rset1.getString("npc_id").equals("gm") && (price < (item.getReferencePrice() / 2)))
@@ -405,7 +405,7 @@ public class TradeController
if (count > -1)
{
item2.setCountDecrease(true);
LimitedItem = true;
limitedItem = true;
}
if (!rset1.getString("npc_id").equals("gm") && (price < (item2.getReferencePrice() / 2)))
@@ -432,7 +432,7 @@ public class TradeController
{
LOGGER.warning("TradeController: Problem with buylist " + buy1.getListId() + " item " + itemId);
}
if (LimitedItem)
if (limitedItem)
{
_listsTaskItem.put(buy1.getListId(), buy1);
}
@@ -481,15 +481,13 @@ public class TradeController
}
catch (Exception e)
{
LOGGER.warning("TradeController: Could not restore Timer for Item count.");
e.printStackTrace();
LOGGER.warning("TradeController: Could not restore Timer for Item count. " + e.getMessage());
}
}
catch (Exception e)
{
// problem with initializing spawn, go to next one
LOGGER.warning("TradeController: Buylists could not be initialized.");
e.printStackTrace();
LOGGER.warning("TradeController: Buylists could not be initialized. " + e.getMessage());
}
}
}

View File

@@ -475,7 +475,7 @@ abstract class AbstractAI implements Ctrl
protected abstract void onEvtArrivedRevalidate();
protected abstract void onEvtArrivedBlocked(Location blocked_at_pos);
protected abstract void onEvtArrivedBlocked(Location location);
protected abstract void onEvtForgetObject(WorldObject object);
@@ -618,7 +618,6 @@ abstract class AbstractAI implements Ctrl
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
CharMoveToLocation msg = new CharMoveToLocation(_actor);
_actor.broadcastPacket(msg);
msg = null;
}
else
{
@@ -637,7 +636,6 @@ abstract class AbstractAI implements Ctrl
{
MoveToLocationInVehicle msg = new MoveToLocationInVehicle(_actor, destination, origin);
_actor.broadcastPacket(msg);
msg = null;
}
}
else
@@ -670,7 +668,6 @@ abstract class AbstractAI implements Ctrl
// Send a Server->Client packet StopMove to the actor and all PlayerInstance in its _knownPlayers
StopMove msg = new StopMove(_actor);
_actor.broadcastPacket(msg);
msg = null;
if (pos != null)
{
@@ -678,7 +675,6 @@ abstract class AbstractAI implements Ctrl
StopRotation sr = new StopRotation(_actor, pos.getHeading(), 0);
_actor.sendPacket(sr);
_actor.broadcastPacket(sr);
sr = null;
}
}
}
@@ -691,7 +687,6 @@ abstract class AbstractAI implements Ctrl
_clientMovingToPawnOffset = 0;
StopMove msg = new StopMove(_actor);
_actor.broadcastPacket(msg);
msg = null;
}
_clientMoving = false;
}
@@ -776,7 +771,6 @@ abstract class AbstractAI implements Ctrl
// Send a Server->Client packet Die to the actor and all PlayerInstance in its _knownPlayers
Die msg = new Die(_actor);
_actor.broadcastPacket(msg);
msg = null;
// Init AI
setIntention(AI_INTENTION_IDLE);
@@ -806,14 +800,12 @@ abstract class AbstractAI implements Ctrl
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers
MoveToPawn msg = new MoveToPawn(_actor, follow, _clientMovingToPawnOffset);
player.sendPacket(msg);
msg = null;
}
else
{
// Send a Server->Client packet CharMoveToLocation to the actor and all PlayerInstance in its _knownPlayers
CharMoveToLocation msg = new CharMoveToLocation(_actor);
player.sendPacket(msg);
msg = null;
}
}
}
@@ -925,33 +917,33 @@ abstract class AbstractAI implements Ctrl
/**
* @return the _intentionArg0
*/
public synchronized Object get_intentionArg0()
public synchronized Object getIntentionArg0()
{
return _intentionArg0;
}
/**
* @param _intentionArg0 the _intentionArg0 to set
* @param intentionArg0 the _intentionArg0 to set
*/
public synchronized void set_intentionArg0(Object _intentionArg0)
public synchronized void setIntentionArg0(Object intentionArg0)
{
this._intentionArg0 = _intentionArg0;
_intentionArg0 = intentionArg0;
}
/**
* @return the _intentionArg1
*/
public synchronized Object get_intentionArg1()
public synchronized Object getIntentionArg1()
{
return _intentionArg1;
}
/**
* @param _intentionArg1 the _intentionArg1 to set
* @param intentionArg1 the _intentionArg1 to set
*/
public synchronized void set_intentionArg1(Object _intentionArg1)
public synchronized void setIntentionArg1(Object intentionArg1)
{
this._intentionArg1 = _intentionArg1;
_intentionArg1 = intentionArg1;
}
/**

View File

@@ -183,8 +183,8 @@ public class AttackableAI extends CreatureAI
return false;
}
// Check if player is an ally //TODO! [Nemesiss] it should be rather boolean or smth like that
// Comparing String isnt good idea!
// Check if player is an ally
// TODO! [Nemesiss] it should be rather boolean or something like that. Comparing String isnt good idea!
if ((me.getFactionId() != null) && me.getFactionId().equals("varka") && ((PlayerInstance) target).isAlliedWithVarka())
{
return false;
@@ -231,11 +231,11 @@ public class AttackableAI extends CreatureAI
return false;
}
// Check if player is an ally (comparing mem addr)
if ((me.getFactionId() != null) && (me.getFactionId() == "varka") && owner.isAlliedWithVarka())
if ((me.getFactionId() != null) && (me.getFactionId().equals("varka")) && owner.isAlliedWithVarka())
{
return false;
}
if ((me.getFactionId() != null) && (me.getFactionId() == "ketra") && owner.isAlliedWithKetra())
if ((me.getFactionId() != null) && (me.getFactionId().equals("ketra")) && owner.isAlliedWithKetra())
{
return false;
}
@@ -427,7 +427,7 @@ public class AttackableAI extends CreatureAI
// Go through visible objects
for (WorldObject obj : npc.getKnownList().getKnownObjects().values())
{
if ((obj == null) || !(obj instanceof Creature))
if (!(obj instanceof Creature))
{
continue;
}
@@ -562,7 +562,6 @@ public class AttackableAI extends CreatureAI
z1 = ((MinionInstance) _actor).getLeader().getZ();
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, z1);
return;
}
}
// Order to the MonsterInstance to random walk (1/100)
@@ -619,8 +618,6 @@ public class AttackableAI extends CreatureAI
// Move the actor to Location (x,y,z) server side AND client side by sending Server->Client packet CharMoveToLocation (broadcast)
moveTo(x1, y1, z1);
}
return;
}
/**
@@ -694,9 +691,9 @@ public class AttackableAI extends CreatureAI
if (obj instanceof NpcInstance)
{
NpcInstance npc = (NpcInstance) obj;
String faction_id = ((NpcInstance) _actor).getFactionId();
String factionId = ((NpcInstance) _actor).getFactionId();
if (!faction_id.equalsIgnoreCase(npc.getFactionId()) || (npc.getFactionRange() == 0))
if (!factionId.equalsIgnoreCase(npc.getFactionId()) || (npc.getFactionRange() == 0))
{
continue;
}
@@ -753,7 +750,7 @@ public class AttackableAI extends CreatureAI
{
_actor.setTarget(originalAttackTarget);
skills = _actor.getAllSkills();
dist2 = _actor.getPlanDistanceSq(originalAttackTarget.getX(), originalAttackTarget.getY());
// dist2 = _actor.getPlanDistanceSq(originalAttackTarget.getX(), originalAttackTarget.getY());
range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + originalAttackTarget.getTemplate().collisionRadius;
}
catch (NullPointerException e)
@@ -882,13 +879,13 @@ public class AttackableAI extends CreatureAI
{
final int castRange = sk.getCastRange();
boolean _inRange = false;
boolean inRange = false;
if ((dist2 >= ((castRange * castRange) / 9.0)) && (dist2 <= (castRange * castRange)) && (castRange > 70))
{
_inRange = true;
inRange = true;
}
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || _inRange) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive() && (Rnd.get(100) <= 5))
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || inRange) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive() && (Rnd.get(100) <= 5))
{
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
@@ -921,12 +918,12 @@ public class AttackableAI extends CreatureAI
}
}
WorldObject OldTarget = _actor.getTarget();
WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -994,11 +991,11 @@ public class AttackableAI extends CreatureAI
return;
}
WorldObject OldTarget = _actor.getTarget();
WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}

View File

@@ -152,7 +152,7 @@ public class ControllableMobAI extends AttackableAI
if (!_actor.isMuted())
{
// check distant skills
int max_range = 0;
int maxRange = 0;
for (Skill sk : _actor.getAllSkills())
{
if (Util.checkIfInRange(sk.getCastRange(), _actor, getAttackTarget(), true) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
@@ -160,14 +160,13 @@ public class ControllableMobAI extends AttackableAI
_accessor.doCast(sk);
return;
}
max_range = Math.max(max_range, sk.getCastRange());
maxRange = Math.max(maxRange, sk.getCastRange());
}
if (!_isNotMoving)
{
moveToPawn(getAttackTarget(), max_range);
moveToPawn(getAttackTarget(), maxRange);
}
return;
}
}
@@ -195,7 +194,7 @@ public class ControllableMobAI extends AttackableAI
final Skill[] skills = _actor.getAllSkills();
final double dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + target.getTemplate().collisionRadius;
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@@ -208,7 +207,7 @@ public class ControllableMobAI extends AttackableAI
_accessor.doCast(sk);
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
if (!_isNotMoving)
@@ -233,7 +232,7 @@ public class ControllableMobAI extends AttackableAI
final Skill[] skills = _actor.getAllSkills();
final double dist2 = _actor.getPlanDistanceSq(getForcedTarget().getX(), getForcedTarget().getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + getForcedTarget().getTemplate().collisionRadius;
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@@ -247,7 +246,7 @@ public class ControllableMobAI extends AttackableAI
_accessor.doCast(sk);
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
if (!_isNotMoving)
@@ -285,9 +284,9 @@ public class ControllableMobAI extends AttackableAI
}
NpcInstance npc = (NpcInstance) obj;
String faction_id = ((NpcInstance) _actor).getFactionId();
String factionId = ((NpcInstance) _actor).getFactionId();
if (!faction_id.equalsIgnoreCase(npc.getFactionId()))
if (!factionId.equalsIgnoreCase(npc.getFactionId()))
{
continue;
}
@@ -303,7 +302,7 @@ public class ControllableMobAI extends AttackableAI
final Skill[] skills = _actor.getAllSkills();
final double dist2 = _actor.getPlanDistanceSq(getAttackTarget().getX(), getAttackTarget().getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + getAttackTarget().getTemplate().collisionRadius;
int max_range = range;
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
@@ -316,7 +315,7 @@ public class ControllableMobAI extends AttackableAI
_accessor.doCast(sk);
return;
}
max_range = Math.max(max_range, castRange);
maxRange = Math.max(maxRange, castRange);
}
moveToPawn(getAttackTarget(), range);
return;
@@ -380,7 +379,6 @@ public class ControllableMobAI extends AttackableAI
_actor.setRunning();
setIntention(AI_INTENTION_ATTACK, hated);
}
return;
}
private boolean autoAttackCondition(Creature target)
@@ -408,14 +406,10 @@ public class ControllableMobAI extends AttackableAI
return false;
}
// Check if the target is a PlayerInstance
if (target instanceof PlayerInstance)
// Check if the target is a PlayerInstance and if the target isn't in silent move mode
if ((target instanceof PlayerInstance) && ((PlayerInstance) target).isSilentMoving())
{
// Check if the target isn't in silent move mode
if (((PlayerInstance) target).isSilentMoving())
{
return false;
}
return false;
}
if (target instanceof NpcInstance)
@@ -470,7 +464,7 @@ public class ControllableMobAI extends AttackableAI
}
}
if (potentialTarget.size() == 0)
if (potentialTarget.isEmpty())
{
return null;
}
@@ -478,9 +472,7 @@ public class ControllableMobAI extends AttackableAI
// we choose a random target
final int choice = Rnd.get(potentialTarget.size());
final Creature target = potentialTarget.get(choice);
return target;
return potentialTarget.get(choice);
}
private ControllableMobInstance findNextGroupTarget()
@@ -499,9 +491,9 @@ public class ControllableMobAI extends AttackableAI
return _alternateAI;
}
public void setAlternateAI(int _alternateai)
public void setAlternateAI(int alternateAI)
{
_alternateAI = _alternateai;
_alternateAI = alternateAI;
}
public void forceAttack(Creature target)

View File

@@ -119,14 +119,11 @@ public class CreatureAI extends AbstractAI
*/
protected void onIntentionActive(Creature target)
{
if ((target instanceof PlayerInstance) && (_actor instanceof PlayerInstance))
// If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff.
if ((target instanceof PlayerInstance) && (_actor instanceof PlayerInstance) && (((PlayerInstance) _actor).getKarma() > 0) && ((_actor.getLevel() - target.getLevel()) >= 10) && ((Playable) target).getProtectionBlessing() && !target.isInsideZone(ZoneId.PVP))
{
if ((((PlayerInstance) _actor).getKarma() > 0) && ((_actor.getLevel() - target.getLevel()) >= 10) && ((Playable) target).getProtectionBlessing() && !target.isInsideZone(ZoneId.PVP))
{
// If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff,
clientActionFailed();
return;
}
clientActionFailed();
return;
}
// Check if the Intention is not already Active
@@ -274,14 +271,11 @@ public class CreatureAI extends AbstractAI
clientActionFailed();
return;
}
if ((target instanceof PlayerInstance) && (_actor instanceof PlayerInstance))
// If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff.
if ((target instanceof PlayerInstance) && (_actor instanceof PlayerInstance) && (((PlayerInstance) _actor).getKarma() > 0) && ((_actor.getLevel() - ((PlayerInstance) target).getLevel()) >= 10) && ((Playable) target).getProtectionBlessing() && !((Creature) target).isInsideZone(ZoneId.PVP))
{
if ((((PlayerInstance) _actor).getKarma() > 0) && ((_actor.getLevel() - ((PlayerInstance) target).getLevel()) >= 10) && ((Playable) target).getProtectionBlessing() && !((Creature) target).isInsideZone(ZoneId.PVP))
{
// If attacker have karma and have level >= 10 than his target and target have Newbie Protection Buff,
clientActionFailed();
return;
}
clientActionFailed();
return;
}
// Set the AI cast target
@@ -299,7 +293,7 @@ public class CreatureAI extends AbstractAI
}
// Set the AI skill used by INTENTION_CAST
set_skill(skill);
setSkill(skill);
// Change the Intention of this AbstractAI to AI_INTENTION_CAST
changeIntention(AI_INTENTION_CAST, skill, target);
@@ -502,7 +496,7 @@ public class CreatureAI extends AbstractAI
// Set the AI pick up target
setTarget(object);
if ((object.getX() == 0) && (object.getY() == 0)) // TODO: Find the drop&spawn bug
if ((object.getX() == 0) && (object.getY() == 0))
{
final Creature creature = getActor();
if (creature instanceof PlayerInstance)
@@ -796,7 +790,7 @@ public class CreatureAI extends AbstractAI
* <BR>
*/
@Override
protected void onEvtArrivedBlocked(Location blocked_at_pos)
protected void onEvtArrivedBlocked(Location location)
{
// If the Intention was AI_INTENTION_MOVE_TO, set the Intention to AI_INTENTION_ACTIVE
if ((getIntention() == AI_INTENTION_MOVE_TO) || (getIntention() == AI_INTENTION_CAST))
@@ -805,7 +799,7 @@ public class CreatureAI extends AbstractAI
}
// Stop the actor movement server side AND client side by sending Server->Client packet StopMove/StopRotation (broadcast)
clientStopMoving(blocked_at_pos);
clientStopMoving(location);
// Launch actions corresponding to the Event Think
onEvtThink();
@@ -1020,18 +1014,15 @@ public class CreatureAI extends AbstractAI
if (follow != null)
{
// prevent attack-follow into peace zones
if ((getAttackTarget() != null) && (_actor instanceof Playable) && (target instanceof Playable))
if ((getAttackTarget() != null) && (_actor instanceof Playable) && (target instanceof Playable) && (getAttackTarget() == follow))
{
if (getAttackTarget() == follow)
// allow GMs to keep following
final boolean isGM = (_actor instanceof PlayerInstance) && ((PlayerInstance) _actor).isGM();
if (Creature.isInsidePeaceZone(_actor, target) && !isGM)
{
// allow GMs to keep following
final boolean isGM = _actor instanceof PlayerInstance ? ((PlayerInstance) _actor).isGM() : false;
if (Creature.isInsidePeaceZone(_actor, target) && !isGM)
{
stopFollow();
setIntention(AI_INTENTION_IDLE);
return true;
}
stopFollow();
setIntention(AI_INTENTION_IDLE);
return true;
}
}
// if the target is too far (maybe also teleported)
@@ -1198,25 +1189,18 @@ public class CreatureAI extends AbstractAI
}
}
/**
* @return the _skill
*/
public synchronized Skill get_skill()
public synchronized Skill getSkill()
{
return _skill;
}
/**
* @param _skill the _skill to set
*/
public synchronized void set_skill(Skill _skill)
public synchronized void setSkill(Skill skill)
{
this._skill = _skill;
this._skill = skill;
}
public IntentionCommand getNextIntention()
{
return null;
}
}

View File

@@ -26,7 +26,7 @@ import org.l2jmobius.gameserver.model.actor.instance.FortSiegeGuardInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeGuardInstance;
/**
* @author mkizub TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates
* @author mkizub
*/
public class DoorAI extends CreatureAI
{
@@ -186,10 +186,6 @@ public class DoorAI extends CreatureAI
_attacker = attacker;
}
/*
* (non-Javadoc)
* @see java.lang.Runnable#run()
*/
@Override
public void run()
{

View File

@@ -365,7 +365,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
((CommanderInstance) _actor).returnHome();
}
}
return;
}
/**
@@ -382,17 +381,14 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
*/
private void thinkAttack()
{
if (_attackTimeout < GameTimeController.getGameTicks())
// Check if the actor is running
if ((_attackTimeout < GameTimeController.getGameTicks()) && _actor.isRunning())
{
// Check if the actor is running
if (_actor.isRunning())
{
// Set the actor movement type to walk and send Server->Client packet ChangeMoveType to all others PlayerInstance
_actor.setWalking();
// Calculate a new attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
}
// Set the actor movement type to walk and send Server->Client packet ChangeMoveType to all others PlayerInstance
_actor.setWalking();
// Calculate a new attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
}
final Creature attackTarget = getAttackTarget();
@@ -525,11 +521,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
break;
}
final WorldObject OldTarget = _actor.getTarget();
final WorldObject oldTarget = _actor.getTarget();
_actor.setTarget(creature);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -560,9 +556,9 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
}
}
// heal friends
if (/* _selfAnalysis.hasHealOrResurrect && */!_actor.isAttackingDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
if (/* _selfAnalysis.hasHealOrResurrect && */ !_actor.isAttackingDisabled() && (npc.getCurrentHp() < (npc.getMaxHp() * 0.6)) && (_actor.getCurrentHp() > (_actor.getMaxHp() / 2)) && (_actor.getCurrentMp() > (_actor.getMaxMp() / 2)) && npc.isInCombat())
{
for (Skill sk : /* _selfAnalysis.healSkills */healSkills)
for (Skill sk : /* _selfAnalysis.healSkills */ healSkills)
{
if (_actor.getCurrentMp() < sk.getMpConsume())
{
@@ -587,11 +583,11 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
break;
}
final WorldObject OldTarget = _actor.getTarget();
final WorldObject oldTarget = _actor.getTarget();
_actor.setTarget(npc);
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -603,7 +599,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
{
// Get all information needed to choose between physical or magical attack
Skill[] skills = null;
double dist_2 = 0;
double dist2 = 0;
int range = 0;
FortSiegeGuardInstance sGuard;
sGuard = (FortSiegeGuardInstance) _actor;
@@ -613,7 +609,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
{
_actor.setTarget(attackTarget);
skills = _actor.getAllSkills();
dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
dist2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + attackTarget.getTemplate().collisionRadius;
if (attackTarget.isMoving())
{
@@ -648,16 +644,16 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
}
// Check if the actor isn't muted and if it is far from target
if (!_actor.isMuted() && (dist_2 > (range * range)))
if (!_actor.isMuted() && (dist2 > (range * range)))
{
// check for long ranged skills and heal/buff skills
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if ((dist_2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
if ((dist2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
final WorldObject OldTarget = _actor.getTarget();
final WorldObject oldTarget = _actor.getTarget();
if ((sk.getSkillType() == SkillType.BUFF) || (sk.getSkillType() == SkillType.HEAL))
{
boolean useSkillSelf = true;
@@ -687,7 +683,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -736,11 +732,9 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
}
}
}
return;
}
// Else, if the actor is muted and far from target, just "move to pawn"
else if (_actor.isMuted() && (dist_2 > (range * range)))
else if (_actor.isMuted() && (dist2 > (range * range)))
{
// Temporary hack for preventing guards jumping off towers,
// before replacing this with effective GeoClient checks and AI modification
@@ -762,10 +756,9 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
moveToPawn(attackTarget, range);
}
}
return;
}
// Else, if this is close enough to attack
else if (dist_2 <= (range * range))
else if (dist2 <= (range * range))
{
// Force mobs to attack anybody if confused
Creature hated = null;
@@ -797,9 +790,9 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist_2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
if (((castRange * castRange) >= dist2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
final WorldObject OldTarget = _actor.getTarget();
final WorldObject oldTarget = _actor.getTarget();
if ((sk.getSkillType() == SkillType.BUFF) || (sk.getSkillType() == SkillType.HEAL))
{
boolean useSkillSelf = true;
@@ -829,7 +822,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}

View File

@@ -100,12 +100,12 @@ public class NpcWalkerAI extends CreatureAI implements Runnable
/**
* If npc can't walk to it's target then just teleport to next point
* @param blocked_at_pos ignoring it
* @param location ignoring it
*/
@Override
protected void onEvtArrivedBlocked(Location blocked_at_pos)
protected void onEvtArrivedBlocked(Location location)
{
LOGGER.warning("NpcWalker ID: " + getActor().getNpcId() + ": Blocked at rote position [" + _currentPos + "], coords: " + blocked_at_pos.getX() + ", " + blocked_at_pos.getY() + ", " + blocked_at_pos.getZ() + ". Teleporting to next point");
LOGGER.warning("NpcWalker ID: " + getActor().getNpcId() + ": Blocked at rote position [" + _currentPos + "], coords: " + location.getX() + ", " + location.getY() + ", " + location.getZ() + ". Teleporting to next point");
if (_route.size() <= _currentPos)
{
@@ -117,7 +117,7 @@ public class NpcWalkerAI extends CreatureAI implements Runnable
final int destinationZ = _route.get(_currentPos).getMoveZ();
getActor().teleToLocation(destinationX, destinationY, destinationZ, false);
super.onEvtArrivedBlocked(blocked_at_pos);
super.onEvtArrivedBlocked(location);
}
private void checkArrived()

View File

@@ -75,10 +75,6 @@ public class PlayerAI extends CreatureAI
@Override
public void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
{
/*
* if (Config.DEBUG) LOGGER.warning("PlayerAI: changeIntention -> " + intention + " " + arg0 + " " + arg1);
*/
// nothing to do if it does not CAST intention
if (intention != AI_INTENTION_CAST)
{
@@ -86,23 +82,19 @@ public class PlayerAI extends CreatureAI
return;
}
final CtrlIntention _intention = getIntention();
final Object _intentionArg0 = get_intentionArg0();
final Object _intentionArg1 = get_intentionArg1();
final CtrlIntention oldIntention = getIntention();
final Object oldArg0 = getIntentionArg0();
final Object oldArg1 = getIntentionArg1();
// do nothing if next intention is same as current one.
if ((intention == _intention) && (arg0 == _intentionArg0) && (arg1 == _intentionArg1))
if ((intention == oldIntention) && (arg0 == oldArg0) && (arg1 == oldArg1))
{
super.changeIntention(intention, arg0, arg1);
return;
}
/*
* if (Config.DEBUG) LOGGER.warning("PlayerAI: changeIntention -> Saving current intention: " + _intention + " " + _intention_arg0 + " " + _intention_arg1);
*/
// push current intention to stack
getInterruptedIntentions().push(new IntentionCommand(_intention, _intentionArg0, _intentionArg1));
getInterruptedIntentions().push(new IntentionCommand(oldIntention, oldArg0, oldArg1));
super.changeIntention(intention, arg0, arg1);
}
@@ -115,7 +107,7 @@ public class PlayerAI extends CreatureAI
protected void onEvtFinishCasting()
{
// forget interupted actions after offensive skill
final Skill skill = get_skill();
final Skill skill = getSkill();
if ((skill != null) && skill.isOffensive())
{
@@ -136,10 +128,6 @@ public class PlayerAI extends CreatureAI
{
}
/*
* if (Config.DEBUG) LOGGER.warning("PlayerAI: onEvtFinishCasting -> " + cmd._intention + " " + cmd._arg0 + " " + cmd._arg1);
*/
if ((cmd != null) && (cmd._crtlIntention != AI_INTENTION_CAST)) // previous state shouldn't be casting
{
setIntention(cmd._crtlIntention, cmd._arg0, cmd._arg1);
@@ -151,9 +139,6 @@ public class PlayerAI extends CreatureAI
}
else
{
/*
* if (Config.DEBUG) LOGGER.warning("PlayerAI: no previous intention set... Setting it to IDLE");
*/
// set intention to idle if skill doesn't change intention.
setIntention(AI_INTENTION_IDLE);
}
@@ -213,13 +198,12 @@ public class PlayerAI extends CreatureAI
}
_accessor.doAttack(target);
return;
}
private void thinkCast()
{
final Creature target = getCastTarget();
final Skill skill = get_skill();
final Skill skill = getSkill();
// if (Config.DEBUG) LOGGER.warning("PlayerAI: thinkCast -> Start");
if (checkTargetLost(target))
@@ -232,12 +216,9 @@ public class PlayerAI extends CreatureAI
return;
}
if (target != null)
if ((target != null) && maybeMoveToPawn(target, _actor.getMagicalAttackRange(skill)))
{
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(skill)))
{
return;
}
return;
}
if (skill.getHitTime() > 50)
@@ -256,7 +237,7 @@ public class PlayerAI extends CreatureAI
}
// Launch the Cast of the skill
_accessor.doCast(get_skill());
_accessor.doCast(getSkill());
// Restore the initial target
if ((target != null) && (oldTarget != target))
@@ -268,8 +249,6 @@ public class PlayerAI extends CreatureAI
{
_accessor.doCast(skill);
}
return;
}
private void thinkPickUp()
@@ -292,8 +271,6 @@ public class PlayerAI extends CreatureAI
setIntention(AI_INTENTION_IDLE);
((PlayerInstance.AIAccessor) _accessor).doPickupItem(target);
return;
}
private void thinkInteract()
@@ -320,7 +297,6 @@ public class PlayerAI extends CreatureAI
}
setIntention(AI_INTENTION_IDLE);
return;
}
@Override
@@ -363,5 +339,4 @@ public class PlayerAI extends CreatureAI
ThreadPool.execute(new KnownListAsynchronousUpdateTask(_actor));
super.onEvtArrivedRevalidate();
}
}

View File

@@ -140,15 +140,12 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
}
// Check if the target is a PlayerInstance
if (target instanceof PlayerInstance)
// Check if the target is a PlayerInstance and if the target isn't in silent move mode AND too far (>100)
if ((target instanceof PlayerInstance) && ((PlayerInstance) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
{
// Check if the target isn't in silent move mode AND too far (>100)
if (((PlayerInstance) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
{
return false;
}
return false;
}
// Los Check Here
return _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
}
@@ -317,15 +314,13 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
// Order to the SiegeGuardInstance to return to its home location because there's no target to attack
((SiegeGuardInstance) _actor).returnHome();
return;
}
private void attackPrepare()
{
// Get all information needed to chose between physical or magical attack
Skill[] skills = null;
double dist_2 = 0;
double dist2 = 0;
int range = 0;
SiegeGuardInstance sGuard = (SiegeGuardInstance) _actor;
@@ -335,7 +330,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
_actor.setTarget(attackTarget);
skills = _actor.getAllSkills();
dist_2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
dist2 = _actor.getPlanDistanceSq(attackTarget.getX(), attackTarget.getY());
range = _actor.getPhysicalAttackRange() + _actor.getTemplate().collisionRadius + attackTarget.getTemplate().collisionRadius;
}
catch (NullPointerException e)
@@ -366,7 +361,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
// Check if the actor isn't muted and if it is far from target
if (!_actor.isMuted() && (dist_2 > ((range + 20) * (range + 20))))
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
// check for long ranged skills and heal/buff skills
if (!Config.ALT_GAME_MOB_ATTACK_AI || ((_actor instanceof MonsterInstance) && (Rnd.get(100) <= 5)))
@@ -375,13 +370,13 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
final int castRange = sk.getCastRange();
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist_2 >= ((castRange * castRange) / 9)) && (dist_2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist2 >= ((castRange * castRange) / 9)) && (dist2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
boolean useSkillSelf = true;
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist_2 >= ((castRange * castRange) / 9)) && (dist_2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist2 >= ((castRange * castRange) / 9)) && (dist2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
useSkillSelf = false;
break;
@@ -407,11 +402,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
}
WorldObject OldTarget = _actor.getTarget();
WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -448,11 +443,9 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
moveToPawn(attackTarget, range);
}
}
return;
}
// Else, if the actor is muted and far from target, just "move to pawn"
else if (_actor.isMuted() && (dist_2 > ((range + 20) * (range + 20))))
else if (_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
// Temporary hack for preventing guards jumping off towers,
// before replacing this with effective geodata checks and AI modification
@@ -463,11 +456,9 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
moveToPawn(attackTarget, range);
}
return;
}
// Else, if this is close enough to attack
else if (dist_2 <= ((range + 20) * (range + 20)))
else if (dist2 <= ((range + 20) * (range + 20)))
{
// Force mobs to attak anybody if confused
Creature hated = null;
@@ -501,7 +492,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist_2) && (castRange <= 70) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
if (((castRange * castRange) >= dist2) && (castRange <= 70) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
@@ -534,11 +525,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
}
WorldObject OldTarget = _actor.getTarget();
WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(OldTarget);
_actor.setTarget(oldTarget);
return;
}
}
@@ -562,17 +553,14 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
*/
private void thinkAttack()
{
if (_attackTimeout < GameTimeController.getGameTicks())
// Check if the actor is running
if ((_attackTimeout < GameTimeController.getGameTicks()) && _actor.isRunning())
{
// Check if the actor is running
if (_actor.isRunning())
{
// Set the actor movement type to walk and send Server->Client packet ChangeMoveType to all others PlayerInstance
_actor.setWalking();
// Calculate a new attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
}
// Set the actor movement type to walk and send Server->Client packet ChangeMoveType to all others PlayerInstance
_actor.setWalking();
// Calculate a new attack timeout
_attackTimeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks();
}
final Creature attackTarget = getAttackTarget();
@@ -634,9 +622,9 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
NpcInstance npc = (NpcInstance) creature;
String faction_id = ((NpcInstance) actor).getFactionId();
String factionId = ((NpcInstance) actor).getFactionId();
if (!faction_id.equalsIgnoreCase(npc.getFactionId()))
if (!factionId.equalsIgnoreCase(npc.getFactionId()))
{
continue;
}

View File

@@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.model.actor.Summon;
public class SummonAI extends CreatureAI
{
private boolean _thinking; // to prevent recursive thinking
private Summon summon;
public SummonAI(AIAccessor accessor)
{
@@ -63,12 +62,13 @@ public class SummonAI extends CreatureAI
private void thinkAttack()
{
summon = (Summon) _actor;
Summon summon = (Summon) _actor;
WorldObject target = null;
target = summon.getTarget();
// Like L2OFF if the target is dead the summon must go back to his owner
if ((target != null) && (summon != null) && ((Creature) target).isDead())
if ((target != null) && ((Creature) target).isDead())
{
summon.setFollowStatus(true);
}
@@ -86,7 +86,6 @@ public class SummonAI extends CreatureAI
clientStopMoving(null);
_accessor.doAttack(getAttackTarget());
return;
}
private void thinkCast()
@@ -99,7 +98,7 @@ public class SummonAI extends CreatureAI
setCastTarget(null);
}
final Skill skill = get_skill();
final Skill skill = getSkill();
if (maybeMoveToPawn(target, _actor.getMagicalAttackRange(skill)))
{
return;
@@ -109,7 +108,6 @@ public class SummonAI extends CreatureAI
summon.setFollowStatus(false);
setIntention(AI_INTENTION_IDLE);
_accessor.doCast(skill);
return;
}
private void thinkPickUp()
@@ -133,8 +131,6 @@ public class SummonAI extends CreatureAI
setIntention(AI_INTENTION_IDLE);
((Summon.AIAccessor) _accessor).doPickupItem(target);
return;
}
private void thinkInteract()
@@ -157,8 +153,6 @@ public class SummonAI extends CreatureAI
}
setIntention(AI_INTENTION_IDLE);
return;
}
@Override

View File

@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.model.clan.Clan;
*/
public class CrestCache
{
private static Logger LOGGER = Logger.getLogger(CrestCache.class.getName());
private static final Logger LOGGER = Logger.getLogger(CrestCache.class.getName());
private final Map<Integer, byte[]> _cachePledge = new HashMap<>();
private final Map<Integer, byte[]> _cachePledgeLarge = new HashMap<>();
@@ -84,15 +84,15 @@ public class CrestCache
if (file.getName().startsWith("Crest_Large_"))
{
_cachePledgeLarge.put(Integer.valueOf(file.getName().substring(12, file.getName().length() - 4)), content);
_cachePledgeLarge.put(Integer.parseInt(file.getName().substring(12, file.getName().length() - 4)), content);
}
else if (file.getName().startsWith("Crest_"))
{
_cachePledge.put(Integer.valueOf(file.getName().substring(6, file.getName().length() - 4)), content);
_cachePledge.put(Integer.parseInt(file.getName().substring(6, file.getName().length() - 4)), content);
}
else if (file.getName().startsWith("AllyCrest_"))
{
_cacheAlly.put(Integer.valueOf(file.getName().substring(10, file.getName().length() - 4)), content);
_cacheAlly.put(Integer.parseInt(file.getName().substring(10, file.getName().length() - 4)), content);
}
_loadedFiles++;
@@ -112,7 +112,7 @@ public class CrestCache
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with CrestCache: " + e1.getMessage());
}
}
}
@@ -283,7 +283,7 @@ public class CrestCache
}
catch (IOException e)
{
e.printStackTrace();
LOGGER.warning("Problem with CrestCache: " + e.getMessage());
}
}
}
@@ -318,7 +318,7 @@ public class CrestCache
}
catch (IOException e)
{
e.printStackTrace();
LOGGER.warning("Problem with CrestCache: " + e.getMessage());
}
}
}
@@ -353,7 +353,7 @@ public class CrestCache
}
catch (IOException e)
{
e.printStackTrace();
LOGGER.warning("Problem with CrestCache: " + e.getMessage());
}
}
}

View File

@@ -20,6 +20,7 @@ import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileFilter;
import java.io.FileInputStream;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
@@ -32,7 +33,7 @@ import org.l2jmobius.gameserver.util.Util;
*/
public class HtmCache
{
private static Logger LOGGER = Logger.getLogger(HtmCache.class.getName());
private static final Logger LOGGER = Logger.getLogger(HtmCache.class.getName());
private final Map<Integer, String> _cache;
private int _loadedFiles;
@@ -132,7 +133,7 @@ public class HtmCache
bis.read(raw);
content = new String(raw, "UTF-8");
content = new String(raw, StandardCharsets.UTF_8);
content = content.replaceAll("\r\n", "\n");
content = content.replaceAll("(?s)<!--.*?-->", ""); // Remove html comments
@@ -155,8 +156,7 @@ public class HtmCache
}
catch (Exception e)
{
LOGGER.warning("problem with htm file " + e);
e.printStackTrace();
LOGGER.warning("Problem with htm file " + e);
}
finally
{
@@ -168,7 +168,7 @@ public class HtmCache
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with HtmCache: " + e1.getMessage());
}
}
@@ -180,7 +180,7 @@ public class HtmCache
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with HtmCache: " + e1.getMessage());
}
}
}
@@ -228,13 +228,7 @@ public class HtmCache
{
File file = new File(path);
HtmFilter filter = new HtmFilter();
if (file.exists() && filter.accept(file) && !file.isDirectory())
{
return true;
}
return false;
return file.exists() && filter.accept(file) && !file.isDirectory();
}
public static HtmCache getInstance()

View File

@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.cache;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
@@ -54,12 +55,13 @@ public class WarehouseCacheManager
public void run()
{
final long cTime = System.currentTimeMillis();
for (PlayerInstance pc : _cachedWh.keySet())
for (Entry<PlayerInstance, Long> entry : _cachedWh.entrySet())
{
if ((cTime - _cachedWh.get(pc)) > _cacheTime)
if ((cTime - entry.getValue()) > _cacheTime)
{
pc.clearWarehouse();
_cachedWh.remove(pc);
PlayerInstance player = entry.getKey();
player.clearWarehouse();
_cachedWh.remove(player);
}
}
}

View File

@@ -44,7 +44,7 @@ public class Forum
public static final int CLANMEMBERONLY = 2;
public static final int OWNERONLY = 3;
private static Logger LOGGER = Logger.getLogger(Forum.class.getName());
private static final Logger LOGGER = Logger.getLogger(Forum.class.getName());
private final List<Forum> _children;
private final Map<Integer, Topic> _topic;
private final int _forumId;
@@ -58,13 +58,13 @@ public class Forum
private boolean _loaded = false;
/**
* @param Forumid
* @param FParent
* @param forumId
* @param fParent
*/
public Forum(int Forumid, Forum FParent)
public Forum(int forumId, Forum fParent)
{
_forumId = Forumid;
_fParent = FParent;
_forumId = forumId;
_fParent = fParent;
_children = new ArrayList<>();
_topic = new HashMap<>();
}
@@ -74,9 +74,9 @@ public class Forum
* @param parent
* @param type
* @param perm
* @param OwnerID
* @param ownerID
*/
public Forum(String name, Forum parent, int type, int perm, int OwnerID)
public Forum(String name, Forum parent, int type, int perm, int ownerID)
{
_forumName = name;
_forumId = ForumsBBSManager.getInstance().getANewID();
@@ -85,7 +85,7 @@ public class Forum
_forumPost = 0;
_forumPerm = perm;
_fParent = parent;
_ownerID = OwnerID;
_ownerID = ownerID;
_children = new ArrayList<>();
_topic = new HashMap<>();
parent._children.add(this);

View File

@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.communitybbs.Manager.PostBBSManager;
*/
public class Post
{
private static Logger LOGGER = Logger.getLogger(Post.class.getName());
private static final Logger LOGGER = Logger.getLogger(Post.class.getName());
public class CPost
{
@@ -47,23 +47,23 @@ public class Post
private final List<CPost> _post;
/**
* @param _PostOwner
* @param _PostOwnerID
* @param postOwner
* @param postOwnerId
* @param date
* @param tid
* @param _PostForumID
* @param postForumId
* @param txt
*/
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
public Post(String postOwner, int postOwnerId, long date, int tid, int postForumId, String txt)
{
_post = new ArrayList<>();
CPost cp = new CPost();
cp.postId = 0;
cp.postOwner = _PostOwner;
cp.postOwnerId = _PostOwnerID;
cp.postOwner = postOwner;
cp.postOwnerId = postOwnerId;
cp.postDate = date;
cp.postTopicId = tid;
cp.postForumId = _PostForumID;
cp.postForumId = postForumId;
cp.postTxt = txt;
_post.add(cp);
insertindb(cp);

View File

@@ -25,7 +25,7 @@ import org.l2jmobius.gameserver.communitybbs.Manager.TopicBBSManager;
public class Topic
{
private static Logger LOGGER = Logger.getLogger(Topic.class.getName());
private static final Logger LOGGER = Logger.getLogger(Topic.class.getName());
public static final int MORMAL = 0;
public static final int MEMO = 1;
@@ -47,9 +47,9 @@ public class Topic
* @param oname
* @param oid
* @param type
* @param Creply
* @param cReply
*/
public Topic(ConstructorType ct, int id, int fid, String name, long date, String oname, int oid, int type, int Creply)
public Topic(ConstructorType ct, int id, int fid, String name, long date, String oname, int oid, int type, int cReply)
{
_id = id;
_forumId = fid;
@@ -58,7 +58,7 @@ public class Topic
_ownerName = oname;
_ownerId = oid;
_type = type;
_cReply = Creply;
_cReply = cReply;
TopicBBSManager.getInstance().addTopic(this);
if (ct == ConstructorType.CREATE)

View File

@@ -82,25 +82,25 @@ public abstract class BaseBBSManager
protected static void send1002(PlayerInstance player, String string, String string2, String string3)
{
List<String> _arg = new ArrayList<>();
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add("0");
_arg.add(player.getName());
_arg.add(Integer.toString(player.getObjectId()));
_arg.add(player.getAccountName());
_arg.add("9");
_arg.add(string2);
_arg.add(string2);
_arg.add(string);
_arg.add(string3);
_arg.add(string3);
_arg.add("0");
_arg.add("0");
player.sendPacket(new ShowBoard(_arg));
List<String> arg = new ArrayList<>();
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add(player.getName());
arg.add(Integer.toString(player.getObjectId()));
arg.add(player.getAccountName());
arg.add("9");
arg.add(string2);
arg.add(string2);
arg.add(string);
arg.add(string3);
arg.add(string3);
arg.add("0");
arg.add("0");
player.sendPacket(new ShowBoard(arg));
}
/**

View File

@@ -103,7 +103,7 @@ public class ClanBBSManager extends BaseBBSManager
{
if (ar1.equalsIgnoreCase("intro"))
{
if (Integer.valueOf(ar2) != activeChar.getClanId())
if (Integer.parseInt(ar2) != activeChar.getClanId())
{
return;
}
@@ -115,7 +115,7 @@ public class ClanBBSManager extends BaseBBSManager
}
clan.setIntroduction(ar3, true);
sendClanManagement(activeChar, Integer.valueOf(ar2));
sendClanManagement(activeChar, Integer.parseInt(ar2));
}
else if (ar1.equals("notice"))
{
@@ -124,7 +124,7 @@ public class ClanBBSManager extends BaseBBSManager
}
else if (ar1.equalsIgnoreCase("mail"))
{
if (Integer.valueOf(ar2) != activeChar.getClanId())
if (Integer.parseInt(ar2) != activeChar.getClanId())
{
return;
}
@@ -136,7 +136,7 @@ public class ClanBBSManager extends BaseBBSManager
}
// Retrieve clans members, and store them under a String.
final StringBuffer membersList = new StringBuffer();
final StringBuilder membersList = new StringBuilder();
for (ClanMember player : clan.getMembers())
{
@@ -181,8 +181,8 @@ public class ClanBBSManager extends BaseBBSManager
}
String content = HtmCache.getInstance().getHtm(CB_PATH + "clan/clanhome-mail.htm");
content = content.replaceAll("%clanid%", Integer.toString(clanId));
content = content.replaceAll("%clanName%", clan.getName());
content = content.replace("%clanid%", Integer.toString(clanId));
content = content.replace("%clanName%", clan.getName());
separateAndSend(content, activeChar);
}
@@ -202,7 +202,7 @@ public class ClanBBSManager extends BaseBBSManager
}
String content = HtmCache.getInstance().getHtm(CB_PATH + "clan/clanhome-management.htm");
content = content.replaceAll("%clanid%", Integer.toString(clan.getClanId()));
content = content.replace("%clanid%", Integer.toString(clan.getClanId()));
send1001(content, activeChar);
send1002(activeChar, clan.getIntroduction(), "", "");
}
@@ -223,7 +223,7 @@ public class ClanBBSManager extends BaseBBSManager
}
String content = HtmCache.getInstance().getHtm(CB_PATH + "clan/clanhome-notice.htm");
content = content.replaceAll("%clanid%", Integer.toString(clan.getClanId()));
content = content.replace("%clanid%", Integer.toString(clan.getClanId()));
content = content.replace("%enabled%", "[" + String.valueOf(clan.isNoticeEnabled()) + "]");
content = content.replace("%flag%", String.valueOf(!clan.isNoticeEnabled()));
send1001(content, activeChar);
@@ -278,7 +278,6 @@ public class ClanBBSManager extends BaseBBSManager
StringUtil.append(sb, "<td><button action=\"_bbsclan;clan;", index - 1, "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
}
i = 0;
int nbp = ClanTable.getInstance().getClans().length / 8;
if ((nbp * 8) != ClanTable.getInstance().getClans().length)
{
@@ -327,7 +326,7 @@ public class ClanBBSManager extends BaseBBSManager
return;
}
// Load different HTM following player case, 3 possibilites : randomer, member, clan leader.
// Load different HTM following player case, 3 possibilities : randomer, member, clan leader.
String content;
if (activeChar.getClanId() != clanId)
{
@@ -342,12 +341,12 @@ public class ClanBBSManager extends BaseBBSManager
content = HtmCache.getInstance().getHtm(CB_PATH + "clan/clanhome-member.htm");
}
content = content.replaceAll("%clanid%", Integer.toString(clan.getClanId()));
content = content.replace("%clanid%", Integer.toString(clan.getClanId()));
content = content.replace("%clanIntro%", clan.getIntroduction());
content = content.replace("%clanName%", clan.getName());
content = content.replace("%clanLvL%", Integer.toString(clan.getLevel()));
content = content.replace("%clanMembers%", Integer.toString(clan.getMembersCount()));
content = content.replaceAll("%clanLeader%", clan.getLeaderName());
content = content.replace("%clanLeader%", clan.getLeaderName());
content = content.replace("%allyName%", (clan.getAllyId() > 0) ? clan.getAllyName() : "");
separateAndSend(content, activeChar);
}

View File

@@ -64,16 +64,16 @@ public class FavoriteBBSManager extends BaseBBSManager
{
while (rs.next())
{
String link = list.replaceAll("%fav_bypass%", rs.getString("favBypass"));
link = link.replaceAll("%fav_title%", rs.getString("favTitle"));
String link = list.replace("%fav_bypass%", rs.getString("favBypass"));
link = link.replace("%fav_title%", rs.getString("favTitle"));
final SimpleDateFormat date = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
link = link.replaceAll("%fav_add_date%", date.format(rs.getTimestamp("favAddDate")));
link = link.replaceAll("%fav_id%", String.valueOf(rs.getInt("favId")));
link = link.replace("%fav_add_date%", date.format(rs.getTimestamp("favAddDate")));
link = link.replace("%fav_id%", String.valueOf(rs.getInt("favId")));
sb.append(link);
}
}
String html = HtmCache.getInstance().getHtm(CB_PATH + "favorite.html");
html = html.replaceAll("%fav_list%", sb.toString());
html = html.replace("%fav_list%", sb.toString());
separateAndSend(html, player);
}
catch (Exception e)
@@ -111,7 +111,7 @@ public class FavoriteBBSManager extends BaseBBSManager
}
else if (command.startsWith("_bbsdelfav_"))
{
final String favId = command.replaceAll("_bbsdelfav_", "");
final String favId = command.replace("_bbsdelfav_", "");
if (!Util.isDigit(favId))
{
LOGGER.warning(FavoriteBBSManager.class.getSimpleName() + ": Couldn't delete favorite link, " + favId + " it's not a valid ID!");

View File

@@ -83,11 +83,11 @@ public class ForumsBBSManager extends BaseBBSManager
}
}
public Forum getForumByName(String Name)
public Forum getForumByName(String name)
{
for (Forum f : _table)
{
if (f.getName().equals(Name))
if (f.getName().equals(name))
{
return f;
}

View File

@@ -69,12 +69,12 @@ public class FriendsBBSManager extends BaseBBSManager
if (action.equals("select"))
{
activeChar.selectFriend((st.hasMoreTokens()) ? Integer.valueOf(st.nextToken()) : 0);
activeChar.selectFriend((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
showFriendsList(activeChar, false);
}
else if (action.equals("deselect"))
{
activeChar.deselectFriend((st.hasMoreTokens()) ? Integer.valueOf(st.nextToken()) : 0);
activeChar.deselectFriend((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
showFriendsList(activeChar, false);
}
else if (action.equals("delall"))
@@ -170,12 +170,12 @@ public class FriendsBBSManager extends BaseBBSManager
if (action.equals("select"))
{
activeChar.selectBlock((st.hasMoreTokens()) ? Integer.valueOf(st.nextToken()) : 0);
activeChar.selectBlock((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
showBlockList(activeChar, false);
}
else if (action.equals("deselect"))
{
activeChar.deselectBlock((st.hasMoreTokens()) ? Integer.valueOf(st.nextToken()) : 0);
activeChar.deselectBlock((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
showBlockList(activeChar, false);
}
else if (action.equals("delall"))
@@ -257,7 +257,7 @@ public class FriendsBBSManager extends BaseBBSManager
final PlayerInstance friend = World.getInstance().getPlayer(id);
StringUtil.append(sb, "<a action=\"bypass _friend;select;", id, "\">[Select]</a>&nbsp;", friendName, " ", (((friend != null) && (friend.isOnline() == 1)) ? "(on)" : "(off)"), "<br1>");
}
content = content.replaceAll("%friendslist%", sb.toString());
content = content.replace("%friendslist%", sb.toString());
// Cleanup sb.
sb.setLength(0);
@@ -274,10 +274,10 @@ public class FriendsBBSManager extends BaseBBSManager
final PlayerInstance friend = World.getInstance().getPlayer(id);
StringUtil.append(sb, "<a action=\"bypass _friend;deselect;", id, "\">[Deselect]</a>&nbsp;", friendName, " ", (((friend != null) && (friend.isOnline() == 1)) ? "(on)" : "(off)"), "<br1>");
}
content = content.replaceAll("%selectedFriendsList%", sb.toString());
content = content.replace("%selectedFriendsList%", sb.toString());
// Delete button.
content = content.replaceAll("%deleteMSG%", (delMsg) ? FRIENDLIST_DELETE_BUTTON : "");
content = content.replace("%deleteMSG%", (delMsg) ? FRIENDLIST_DELETE_BUTTON : "");
separateAndSend(content, activeChar);
}
@@ -313,7 +313,7 @@ public class FriendsBBSManager extends BaseBBSManager
final PlayerInstance block = World.getInstance().getPlayer(id);
StringUtil.append(sb, "<a action=\"bypass _block;select;", id, "\">[Select]</a>&nbsp;", blockName, " ", (((block != null) && (block.isOnline() == 1)) ? "(on)" : "(off)"), "<br1>");
}
content = content.replaceAll("%blocklist%", sb.toString());
content = content.replace("%blocklist%", sb.toString());
// Cleanup sb.
sb.setLength(0);
@@ -330,10 +330,10 @@ public class FriendsBBSManager extends BaseBBSManager
final PlayerInstance block = World.getInstance().getPlayer(id);
StringUtil.append(sb, "<a action=\"bypass _block;deselect;", id, "\">[Deselect]</a>&nbsp;", blockName, " ", (((block != null) && (block.isOnline() == 1)) ? "(on)" : "(off)"), "<br1>");
}
content = content.replaceAll("%selectedBlocksList%", sb.toString());
content = content.replace("%selectedBlocksList%", sb.toString());
// Delete button.
content = content.replaceAll("%deleteMSG%", (delMsg) ? BLOCKLIST_DELETE_BUTTON : "");
content = content.replace("%deleteMSG%", (delMsg) ? BLOCKLIST_DELETE_BUTTON : "");
separateAndSend(content, activeChar);
}
@@ -363,7 +363,7 @@ public class FriendsBBSManager extends BaseBBSManager
sb.append(friendName);
}
content = content.replaceAll("%list%", sb.toString());
content = content.replace("%list%", sb.toString());
separateAndSend(content, activeChar);
}

View File

@@ -251,10 +251,10 @@ public class MailBBSManager extends BaseBBSManager
private List<Mail> getPlayerMails(int objId)
{
List<Mail> _letters = _mails.get(objId);
if (_letters == null)
List<Mail> letters = _mails.get(objId);
if (letters == null)
{
_letters = new ArrayList<>();
letters = new ArrayList<>();
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SELECT_CHAR_MAILS);
@@ -273,7 +273,7 @@ public class MailBBSManager extends BaseBBSManager
letter.sentDate = result.getTimestamp("sentDate");
letter.sentDateString = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(letter.sentDate);
letter.unread = result.getInt("unread") != 0;
_letters.add(0, letter);
letters.add(0, letter);
}
result.close();
statement.close();
@@ -282,9 +282,9 @@ public class MailBBSManager extends BaseBBSManager
{
LOGGER.warning("couldnt load mail for ID:" + objId + " " + e.getMessage());
}
_mails.put(objId, _letters);
_mails.put(objId, letters);
}
return _letters;
return letters;
}
private Mail getLetter(PlayerInstance activeChar, int letterId)
@@ -515,8 +515,8 @@ public class MailBBSManager extends BaseBBSManager
content = content.replace("%sentDate%", letter.sentDateString);
content = content.replace("%receiver%", letter.recipientNames);
content = content.replace("%delDate%", "Unknown");
content = content.replace("%title%", letter.subject.replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;"));
content = content.replace("%mes%", letter.message.replaceAll("\r\n", "<br>").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll("\"", "&quot;"));
content = content.replace("%title%", letter.subject.replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;"));
content = content.replace("%mes%", letter.message.replace("\r\n", "<br>").replace("<", "&lt;").replace(">", "&gt;").replace("\"", "&quot;"));
content = content.replace("%letterId%", letter.letterId + "");
separateAndSend(content, activeChar);
}
@@ -570,7 +570,7 @@ public class MailBBSManager extends BaseBBSManager
}
// Edit message.
message = message.replaceAll("\n", "<br1>");
message = message.replace("\n", "<br1>");
try (Connection con = DatabaseFactory.getConnection())
{
@@ -738,12 +738,7 @@ public class MailBBSManager extends BaseBBSManager
{
if (player.getObjectId() == recipId)
{
if (BlockList.isInBlockList(player, activeChar))
{
return true;
}
return false;
return BlockList.isInBlockList(player, activeChar);
}
}
return false;

View File

@@ -282,12 +282,9 @@ public class TopicBBSManager extends BaseBBSManager
}
Topic t = forum.getTopic(j);
if (t != null)
if ((t != null) && (i++ >= (12 * (index - 1))))
{
if (i++ >= (12 * (index - 1)))
{
StringUtil.append(sb, "<table border=0 cellspacing=0 cellpadding=5 WIDTH=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=415><a action=\"bypass _bbsposts;read;", forum.getID(), ";", t.getID(), "\">", t.getName(), "</a></td><td FIXWIDTH=120 align=center></td><td FIXWIDTH=70 align=center>", dateFormat.format(new Date(t.getDate())), "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
}
StringUtil.append(sb, "<table border=0 cellspacing=0 cellpadding=5 WIDTH=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=415><a action=\"bypass _bbsposts;read;", forum.getID(), ";", t.getID(), "\">", t.getName(), "</a></td><td FIXWIDTH=120 align=center></td><td FIXWIDTH=70 align=center>", dateFormat.format(new Date(t.getDate())), "</td></tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
}
}

View File

@@ -46,71 +46,71 @@ public class CrownTable
return _crownList;
}
public static int getCrownId(int CastleId)
public static int getCrownId(int castleId)
{
int CrownId = 0;
switch (CastleId)
int crownId = 0;
switch (castleId)
{
// Gludio
case 1:
{
CrownId = 6838;
crownId = 6838;
break;
}
// Dion
case 2:
{
CrownId = 6835;
crownId = 6835;
break;
}
// Giran
case 3:
{
CrownId = 6839;
crownId = 6839;
break;
}
// Oren
case 4:
{
CrownId = 6837;
crownId = 6837;
break;
}
// Aden
case 5:
{
CrownId = 6840;
crownId = 6840;
break;
}
// Innadril
case 6:
{
CrownId = 6834;
crownId = 6834;
break;
}
// Goddard
case 7:
{
CrownId = 6836;
crownId = 6836;
break;
}
// Rune
case 8:
{
CrownId = 8182;
crownId = 8182;
break;
}
// Schuttgart
case 9:
{
CrownId = 8183;
crownId = 8183;
break;
}
default:
{
CrownId = 0;
crownId = 0;
break;
}
}
return CrownId;
return crownId;
}
}

View File

@@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.datatables;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.Map;
@@ -74,7 +75,7 @@ public class DesireTable
public Desires(DesireType... desireList)
{
_desireTable = new HashMap<>();
_desireTable = new EnumMap<>(DesireType.class);
for (DesireType desire : desireList)
{

View File

@@ -23,42 +23,40 @@ import org.l2jmobius.gameserver.model.Skill;
*/
public class HeroSkillTable
{
private static Skill[] _heroSkills;
private static final Integer[] HERO_SKILL_IDS = new Integer[]
{
395,
396,
1374,
1375,
1376
};
private static Skill[] HERO_SKILLS;
private HeroSkillTable()
{
_heroSkills = new Skill[5];
_heroSkills[0] = SkillTable.getInstance().getInfo(395, 1);
_heroSkills[1] = SkillTable.getInstance().getInfo(396, 1);
_heroSkills[2] = SkillTable.getInstance().getInfo(1374, 1);
_heroSkills[3] = SkillTable.getInstance().getInfo(1375, 1);
_heroSkills[4] = SkillTable.getInstance().getInfo(1376, 1);
HERO_SKILLS = new Skill[5];
HERO_SKILLS[0] = SkillTable.getInstance().getInfo(395, 1);
HERO_SKILLS[1] = SkillTable.getInstance().getInfo(396, 1);
HERO_SKILLS[2] = SkillTable.getInstance().getInfo(1374, 1);
HERO_SKILLS[3] = SkillTable.getInstance().getInfo(1375, 1);
HERO_SKILLS[4] = SkillTable.getInstance().getInfo(1376, 1);
}
public static Skill[] getHeroSkills()
{
return _heroSkills;
return HERO_SKILLS;
}
public static boolean isHeroSkill(int skillid)
{
Integer[] _HeroSkillsId = new Integer[]
{
395,
396,
1374,
1375,
1376
};
for (int id : _HeroSkillsId)
for (int id : HERO_SKILL_IDS)
{
if (id == skillid)
{
return true;
}
}
return false;
}

View File

@@ -40,7 +40,7 @@ import org.l2jmobius.gameserver.network.GameClient.GameClientState;
*/
public class OfflineTradeTable
{
private static Logger LOGGER = Logger.getLogger(OfflineTradeTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(OfflineTradeTable.class.getName());
// SQL DEFINITIONS
private static final String SAVE_OFFLINE_STATUS = "INSERT INTO character_offline_trade (`charId`,`time`,`type`,`title`) VALUES (?,?,?,?)";
@@ -67,7 +67,7 @@ public class OfflineTradeTable
con.setAutoCommit(false); // avoid halfway done
stm = con.prepareStatement(SAVE_OFFLINE_STATUS);
final PreparedStatement stm_items = con.prepareStatement(SAVE_ITEMS);
final PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS);
for (PlayerInstance pc : World.getInstance().getAllPlayers())
{
@@ -92,13 +92,13 @@ public class OfflineTradeTable
title = pc.getBuyList().getTitle();
for (TradeItem i : pc.getBuyList().getItems())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getItem().getItemId());
stm_items.setLong(3, i.getCount());
stm_items.setLong(4, i.getPrice());
stm_items.setLong(5, i.getEnchant());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getItem().getItemId());
stmItems.setLong(3, i.getCount());
stmItems.setLong(4, i.getPrice());
stmItems.setLong(5, i.getEnchant());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -113,13 +113,13 @@ public class OfflineTradeTable
pc.getSellList().updateItems();
for (TradeItem i : pc.getSellList().getItems())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getObjectId());
stm_items.setLong(3, i.getCount());
stm_items.setLong(4, i.getPrice());
stm_items.setLong(5, i.getEnchant());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getObjectId());
stmItems.setLong(3, i.getCount());
stmItems.setLong(4, i.getPrice());
stmItems.setLong(5, i.getEnchant());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -132,13 +132,13 @@ public class OfflineTradeTable
title = pc.getCreateList().getStoreName();
for (ManufactureItem i : pc.getCreateList().getList())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getRecipeId());
stm_items.setLong(3, 0);
stm_items.setLong(4, i.getCost());
stm_items.setLong(5, 0);
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getRecipeId());
stmItems.setLong(3, 0);
stmItems.setLong(4, i.getCost());
stmItems.setLong(5, 0);
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -161,7 +161,7 @@ public class OfflineTradeTable
}
}
stm.close();
stm_items.close();
stmItems.close();
LOGGER.info("Offline traders stored.");
}
catch (Exception e)
@@ -217,9 +217,9 @@ public class OfflineTradeTable
}
player.spawnMe(player.getX(), player.getY(), player.getZ());
LoginServerThread.getInstance().addGameServerLogin(player.getAccountName(), client);
final PreparedStatement stm_items = con.prepareStatement(LOAD_OFFLINE_ITEMS);
stm_items.setInt(1, player.getObjectId());
final ResultSet items = stm_items.executeQuery();
final PreparedStatement stmItems = con.prepareStatement(LOAD_OFFLINE_ITEMS);
stmItems.setInt(1, player.getObjectId());
final ResultSet items = stmItems.executeQuery();
switch (type)
{
@@ -260,7 +260,7 @@ public class OfflineTradeTable
}
}
items.close();
stm_items.close();
stmItems.close();
player.sitDown();
if (Config.OFFLINE_MODE_SET_INVULNERABLE)
@@ -320,7 +320,7 @@ public class OfflineTradeTable
con.setAutoCommit(false); // avoid halfway done
stm = con.prepareStatement(SAVE_OFFLINE_STATUS);
final PreparedStatement stm_items = con.prepareStatement(SAVE_ITEMS);
final PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS);
boolean save = true;
@@ -342,13 +342,13 @@ public class OfflineTradeTable
title = pc.getBuyList().getTitle();
for (TradeItem i : pc.getBuyList().getItems())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getItem().getItemId());
stm_items.setLong(3, i.getCount());
stm_items.setLong(4, i.getPrice());
stm_items.setLong(5, i.getEnchant());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getItem().getItemId());
stmItems.setLong(3, i.getCount());
stmItems.setLong(4, i.getPrice());
stmItems.setLong(5, i.getEnchant());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -363,13 +363,13 @@ public class OfflineTradeTable
pc.getSellList().updateItems();
for (TradeItem i : pc.getSellList().getItems())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getObjectId());
stm_items.setLong(3, i.getCount());
stm_items.setLong(4, i.getPrice());
stm_items.setLong(5, i.getEnchant());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getObjectId());
stmItems.setLong(3, i.getCount());
stmItems.setLong(4, i.getPrice());
stmItems.setLong(5, i.getEnchant());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -382,13 +382,13 @@ public class OfflineTradeTable
title = pc.getCreateList().getStoreName();
for (ManufactureItem i : pc.getCreateList().getList())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getRecipeId());
stm_items.setLong(3, 0);
stm_items.setLong(4, i.getCost());
stm_items.setLong(5, 0);
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getRecipeId());
stmItems.setLong(3, 0);
stmItems.setLong(4, i.getCost());
stmItems.setLong(5, 0);
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -414,7 +414,7 @@ public class OfflineTradeTable
}
stm.close();
stm_items.close();
stmItems.close();
}
catch (Exception e)
{

View File

@@ -51,7 +51,7 @@ public class SchemeBufferTable
private static final String DELETE_SCHEMES = "TRUNCATE TABLE buffer_schemes";
private static final String INSERT_SCHEME = "INSERT INTO buffer_schemes (object_id, scheme_name, skills) VALUES (?,?,?)";
private final Map<Integer, Map<String, ArrayList<Integer>>> _schemesTable = new ConcurrentHashMap<>();
private final Map<Integer, Map<String, List<Integer>>> _schemesTable = new ConcurrentHashMap<>();
private final Map<Integer, BuffSkillHolder> _availableBuffs = new LinkedHashMap<>();
public SchemeBufferTable()
@@ -80,7 +80,7 @@ public class SchemeBufferTable
break;
}
schemeList.add(Integer.valueOf(skill));
schemeList.add(Integer.parseInt(skill));
}
setScheme(objectId, schemeName, schemeList);
@@ -146,9 +146,9 @@ public class SchemeBufferTable
// Save _schemesTable content.
try (PreparedStatement st = con.prepareStatement(INSERT_SCHEME))
{
for (Map.Entry<Integer, Map<String, ArrayList<Integer>>> player : _schemesTable.entrySet())
for (Map.Entry<Integer, Map<String, List<Integer>>> player : _schemesTable.entrySet())
{
for (Map.Entry<String, ArrayList<Integer>> scheme : player.getValue().entrySet())
for (Map.Entry<String, List<Integer>> scheme : player.getValue().entrySet())
{
// Build a String composed of skill ids seperated by a ",".
final StringBuilder sb = new StringBuilder();
@@ -178,7 +178,7 @@ public class SchemeBufferTable
}
}
public void setScheme(int playerId, String schemeName, ArrayList<Integer> list)
public void setScheme(int playerId, String schemeName, List<Integer> list)
{
if (!_schemesTable.containsKey(playerId))
{
@@ -196,7 +196,7 @@ public class SchemeBufferTable
* @param playerId : The player objectId to check.
* @return the list of schemes for a given player.
*/
public Map<String, ArrayList<Integer>> getPlayerSchemes(int playerId)
public Map<String, List<Integer>> getPlayerSchemes(int playerId)
{
return _schemesTable.get(playerId);
}

View File

@@ -39,7 +39,7 @@ import org.l2jmobius.gameserver.model.entity.ClanHall;
public class DoorTable
{
private static Logger LOGGER = Logger.getLogger(DoorTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(DoorTable.class.getName());
private final Map<Integer, DoorInstance> _doors = new HashMap<>();
@@ -106,7 +106,7 @@ public class DoorTable
catch (IOException e)
{
_initialized = false;
LOGGER.warning("error while creating door table " + e);
LOGGER.warning("Error while creating door table " + e);
}
finally
{
@@ -118,7 +118,7 @@ public class DoorTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with DoorTable: " + e1.getMessage());
}
}
@@ -130,7 +130,7 @@ public class DoorTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with DoorTable: " + e1.getMessage());
}
}
@@ -142,7 +142,7 @@ public class DoorTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with DoorTable: " + e1.getMessage());
}
}
}

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.model.ExtractableProductItem;
*/
public class ExtractableItemsData
{
private static Logger LOGGER = Logger.getLogger(ExtractableItemsData.class.getName());
private static final Logger LOGGER = Logger.getLogger(ExtractableItemsData.class.getName());
// Map<itemid, ExtractableItem>
private Map<Integer, ExtractableItem> _items;
@@ -76,7 +76,7 @@ public class ExtractableItemsData
return;
}
final List<ExtractableProductItem> product_temp = new ArrayList<>(lineSplit.length);
final List<ExtractableProductItem> productTemp = new ArrayList<>(lineSplit.length);
for (int i = 0; i < (lineSplit.length - 1); i++)
{
String[] lineSplit2 = lineSplit[i + 1].split(",");
@@ -104,11 +104,11 @@ public class ExtractableItemsData
continue;
}
product_temp.add(new ExtractableProductItem(production, amount, chance));
productTemp.add(new ExtractableProductItem(production, amount, chance));
}
int fullChances = 0;
for (ExtractableProductItem Pi : product_temp)
for (ExtractableProductItem Pi : productTemp)
{
fullChances += Pi.getChance();
}
@@ -120,15 +120,13 @@ public class ExtractableItemsData
continue;
}
_items.put(itemID, new ExtractableItem(itemID, product_temp));
_items.put(itemID, new ExtractableItem(itemID, productTemp));
}
LOGGER.info("Extractable items data: Loaded " + _items.size() + " extractable items!");
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.info("Extractable items data: Can not find './data/csv/extractable_items.csv'");
}
finally
@@ -141,7 +139,7 @@ public class ExtractableItemsData
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with ExtractableItemsData: " + e1.getMessage());
}
}
}

View File

@@ -28,7 +28,6 @@ import java.util.StringTokenizer;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.datatables.sql.SkillTreeTable;
import org.l2jmobius.gameserver.model.FishData;
/**
@@ -36,7 +35,7 @@ import org.l2jmobius.gameserver.model.FishData;
*/
public class FishTable
{
private static Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(FishTable.class.getName());
private static List<FishData> _fishsNormal;
private static List<FishData> _fishsEasy;
@@ -64,7 +63,6 @@ public class FishTable
_fishsEasy = new ArrayList<>();
_fishsNormal = new ArrayList<>();
_fishsHard = new ArrayList<>();
FishData fish;
// format:
// id;level;name;hp;hpregen;fish_type;fish_group;fish_guts;guts_check_time;wait_time;combat_time
@@ -130,7 +128,7 @@ public class FishTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
@@ -142,7 +140,7 @@ public class FishTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
@@ -154,7 +152,7 @@ public class FishTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with FishTable: " + e1.getMessage());
}
}
}
@@ -170,31 +168,31 @@ public class FishTable
public List<FishData> getfish(int lvl, int type, int group)
{
final List<FishData> result = new ArrayList<>();
List<FishData> _Fishs = null;
List<FishData> fishes = null;
switch (group)
{
case 0:
{
_Fishs = _fishsEasy;
fishes = _fishsEasy;
break;
}
case 1:
{
_Fishs = _fishsNormal;
fishes = _fishsNormal;
break;
}
case 2:
{
_Fishs = _fishsHard;
fishes = _fishsHard;
}
}
if (_Fishs == null)
if (fishes == null)
{
LOGGER.warning("Fish are not defined!");
return null;
}
for (FishData f : _Fishs)
for (FishData f : fishes)
{
if (f.getLevel() != lvl)
{
@@ -208,7 +206,7 @@ public class FishTable
result.add(f);
}
if (result.size() == 0)
if (result.isEmpty())
{
LOGGER.warning("Cant Find Any Fish!? - Lvl: " + lvl + " Type: " + type);
}

View File

@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.model.items.Henna;
public class HennaTable
{
private static Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
private final Map<Integer, Henna> _henna;
private final boolean _initialized = true;
@@ -108,7 +108,7 @@ public class HennaTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with HennaTable: " + e1.getMessage());
}
}
@@ -120,7 +120,7 @@ public class HennaTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with HennaTable: " + e1.getMessage());
}
}
@@ -132,7 +132,7 @@ public class HennaTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with HennaTable: " + e1.getMessage());
}
}
}

View File

@@ -47,7 +47,7 @@ import org.l2jmobius.gameserver.model.zone.type.TownZone;
public class MapRegionTable
{
private static Logger LOGGER = Logger.getLogger(MapRegionTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(MapRegionTable.class.getName());
private final int[][] _regions = new int[19][21];
private final int[][] _pointsWithKarmas;
@@ -104,12 +104,10 @@ public class MapRegionTable
catch (NoSuchElementException e1)
{
LOGGER.warning("Error for structure CSV file: ");
e1.printStackTrace();
}
catch (IOException e0)
{
LOGGER.warning("Error while creating table: " + e0);
e0.printStackTrace();
}
finally
{
@@ -121,7 +119,7 @@ public class MapRegionTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with MapRegionTable: " + e1.getMessage());
}
}
@@ -133,7 +131,7 @@ public class MapRegionTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with MapRegionTable: " + e1.getMessage());
}
}
@@ -145,7 +143,7 @@ public class MapRegionTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with MapRegionTable: " + e1.getMessage());
}
}
}
@@ -446,7 +444,7 @@ public class MapRegionTable
case 16:
{
nearestTown = "Town of Shuttgart";
break; // TODO: (Check mapregion table)[Luno]
break;
}
case 18:
{
@@ -596,15 +594,15 @@ public class MapRegionTable
}
// Get the nearest town
TownZone local_zone = null;
if ((creature != null) && ((local_zone = TownManager.getInstance().getClosestTown(creature)) != null))
TownZone localZone = null;
if ((creature != null) && ((localZone = TownManager.getInstance().getClosestTown(creature)) != null))
{
coord = local_zone.getSpawnLoc();
coord = localZone.getSpawnLoc();
return new Location(coord[0], coord[1], coord[2]);
}
local_zone = TownManager.getInstance().getTown(9); // giran
coord = local_zone.getSpawnLoc();
localZone = TownManager.getInstance().getTown(9); // giran
coord = localZone.getSpawnLoc();
return new Location(coord[0], coord[1], coord[2]);
}

View File

@@ -119,7 +119,7 @@ public class NpcWalkerRoutesTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with NpcWalkerRoutesTable: " + e1.getMessage());
}
}
@@ -131,7 +131,7 @@ public class NpcWalkerRoutesTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with NpcWalkerRoutesTable: " + e1.getMessage());
}
}
@@ -143,7 +143,7 @@ public class NpcWalkerRoutesTable
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with NpcWalkerRoutesTable: " + e1.getMessage());
}
}
}
@@ -151,15 +151,15 @@ public class NpcWalkerRoutesTable
public List<NpcWalkerNode> getRouteForNpc(int id)
{
final List<NpcWalkerNode> _return = new ArrayList<>();
final List<NpcWalkerNode> result = new ArrayList<>();
for (NpcWalkerNode node : _routes)
{
if (node.getNpcId() == id)
{
_return.add(node);
result.add(node);
}
}
return _return;
return result;
}
public static NpcWalkerRoutesTable getInstance()

View File

@@ -90,7 +90,7 @@ public class RecipeTable extends RecipeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with RecipeTable: " + e1.getMessage());
}
}
@@ -102,7 +102,7 @@ public class RecipeTable extends RecipeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with RecipeTable: " + e1.getMessage());
}
}
@@ -114,7 +114,7 @@ public class RecipeTable extends RecipeController
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with RecipeTable: " + e1.getMessage());
}
}
}

View File

@@ -32,7 +32,7 @@ import org.l2jmobius.gameserver.model.actor.instance.StaticObjectInstance;
public class StaticObjects
{
private static Logger LOGGER = Logger.getLogger(StaticObjects.class.getName());
private static final Logger LOGGER = Logger.getLogger(StaticObjects.class.getName());
private final Map<Integer, StaticObjectInstance> _staticObjects;
@@ -75,7 +75,7 @@ public class StaticObjects
}
catch (Exception e)
{
LOGGER.warning("error while creating StaticObjects table " + e);
LOGGER.warning("Error while creating StaticObjects table " + e);
}
finally
{
@@ -87,7 +87,7 @@ public class StaticObjects
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
@@ -99,7 +99,7 @@ public class StaticObjects
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
@@ -111,7 +111,7 @@ public class StaticObjects
}
catch (Exception e1)
{
e1.printStackTrace();
LOGGER.warning("Problem with StaticObjects: " + e1.getMessage());
}
}
}

View File

@@ -27,7 +27,7 @@ import org.l2jmobius.gameserver.model.SummonItem;
public class SummonItemsData
{
private static Logger LOGGER = Logger.getLogger(SummonItemsData.class.getName());
private static final Logger LOGGER = Logger.getLogger(SummonItemsData.class.getName());
private final Map<Integer, SummonItem> _summonitems;

View File

@@ -105,14 +105,14 @@ public class ArmorSetsTable
private final int _skill_id;
private final int _shield;
public ArmorDummy(int chest, int legs, int head, int gloves, int feet, int skill_id, int shield)
public ArmorDummy(int chest, int legs, int head, int gloves, int feet, int skillId, int shield)
{
_chest = chest;
_legs = legs;
_head = head;
_gloves = gloves;
_feet = feet;
_skill_id = skill_id;
_skill_id = skillId;
_shield = shield;
}

View File

@@ -69,7 +69,6 @@ public class CharNameTable
catch (SQLException e)
{
LOGGER.warning("Could not check existing player name " + e);
e.printStackTrace();
}
return name;
@@ -96,7 +95,6 @@ public class CharNameTable
catch (SQLException e)
{
LOGGER.warning("Could not check existing player id " + e);
e.printStackTrace();
}
return id;
@@ -123,7 +121,6 @@ public class CharNameTable
catch (SQLException e)
{
LOGGER.warning("Could not check existing player id " + e);
e.printStackTrace();
}
return accessLevel;
@@ -150,7 +147,6 @@ public class CharNameTable
catch (SQLException e)
{
LOGGER.warning("Could not check existing char number " + e);
e.printStackTrace();
}
return number;

View File

@@ -34,7 +34,7 @@ import org.l2jmobius.gameserver.model.base.ClassId;
*/
public class CharTemplateTable
{
private static Logger LOGGER = Logger.getLogger(CharTemplateTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(CharTemplateTable.class.getName());
private static final String[] CHAR_CLASSES =
{

View File

@@ -52,7 +52,7 @@ import org.l2jmobius.gameserver.util.Util;
*/
public class ClanTable
{
private static Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(ClanTable.class.getName());
private final Map<Integer, Clan> _clans = new HashMap<>();
@@ -113,29 +113,19 @@ public class ClanTable
return _clans.values().toArray(new Clan[_clans.size()]);
}
public int getTopRate(int clan_id)
public int getTopRate(int clanId)
{
Clan clan = getClan(clan_id);
Clan clan = getClan(clanId);
if (clan.getLevel() < 3)
{
return 0;
}
int i = 1;
for (Clan clans : getClans())
for (Clan c : getClans())
{
if (clan != clans)
if ((clan != c) && ((clan.getLevel() < c.getLevel()) || ((clan.getLevel() == c.getLevel()) && (clan.getReputationScore() <= c.getReputationScore()))))
{
if (clan.getLevel() < clans.getLevel())
{
i++;
}
else if (clan.getLevel() == clans.getLevel())
{
if (clan.getReputationScore() <= clans.getReputationScore())
{
i++;
}
}
i++;
}
}
return i;
@@ -541,8 +531,7 @@ public class ClanTable
}
catch (Exception e)
{
LOGGER.warning("Could not restore clan wars data:");
e.printStackTrace();
LOGGER.warning("Could not restore clan wars data: " + e.getMessage());
}
}

View File

@@ -24,7 +24,6 @@ import java.util.List;
import java.util.logging.Logger;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.datatables.csv.HennaTable;
import org.l2jmobius.gameserver.model.StatsSet;
import org.l2jmobius.gameserver.model.holders.HelperBuffHolder;
@@ -33,7 +32,7 @@ import org.l2jmobius.gameserver.model.holders.HelperBuffHolder;
*/
public class HelperBuffTable
{
private static final Logger LOGGER = Logger.getLogger(HennaTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(HelperBuffTable.class.getName());
public List<HelperBuffHolder> helperBuff = new ArrayList<>();
private final boolean _initialized = true;
@@ -78,46 +77,46 @@ public class HelperBuffTable
/**
* Load the Newbie Helper Buff list from SQL Table helper_buff_list
* @param HelperBuffData
* @param helperBuffData
* @throws Exception
*/
private void fillHelperBuffTable(ResultSet HelperBuffData) throws Exception
private void fillHelperBuffTable(ResultSet helperBuffData) throws Exception
{
while (HelperBuffData.next())
while (helperBuffData.next())
{
final StatsSet helperBuffDat = new StatsSet();
final int id = HelperBuffData.getInt("id");
final int id = helperBuffData.getInt("id");
helperBuffDat.set("id", id);
helperBuffDat.set("skillID", HelperBuffData.getInt("skill_id"));
helperBuffDat.set("skillLevel", HelperBuffData.getInt("skill_level"));
helperBuffDat.set("lowerLevel", HelperBuffData.getInt("lower_level"));
helperBuffDat.set("upperLevel", HelperBuffData.getInt("upper_level"));
helperBuffDat.set("isMagicClass", HelperBuffData.getString("is_magic_class"));
helperBuffDat.set("skillID", helperBuffData.getInt("skill_id"));
helperBuffDat.set("skillLevel", helperBuffData.getInt("skill_level"));
helperBuffDat.set("lowerLevel", helperBuffData.getInt("lower_level"));
helperBuffDat.set("upperLevel", helperBuffData.getInt("upper_level"));
helperBuffDat.set("isMagicClass", helperBuffData.getString("is_magic_class"));
// Calulate the range level in wich player must be to obtain buff from Newbie Helper
if ("false".equals(HelperBuffData.getString("is_magic_class")))
if ("false".equals(helperBuffData.getString("is_magic_class")))
{
if (HelperBuffData.getInt("lower_level") < _physicClassLowestLevel)
if (helperBuffData.getInt("lower_level") < _physicClassLowestLevel)
{
_physicClassLowestLevel = HelperBuffData.getInt("lower_level");
_physicClassLowestLevel = helperBuffData.getInt("lower_level");
}
if (HelperBuffData.getInt("upper_level") > _physicClassHighestLevel)
if (helperBuffData.getInt("upper_level") > _physicClassHighestLevel)
{
_physicClassHighestLevel = HelperBuffData.getInt("upper_level");
_physicClassHighestLevel = helperBuffData.getInt("upper_level");
}
}
else
{
if (HelperBuffData.getInt("lower_level") < _magicClassLowestLevel)
if (helperBuffData.getInt("lower_level") < _magicClassLowestLevel)
{
_magicClassLowestLevel = HelperBuffData.getInt("lower_level");
_magicClassLowestLevel = helperBuffData.getInt("lower_level");
}
if (HelperBuffData.getInt("upper_level") > _magicClassHighestLevel)
if (helperBuffData.getInt("upper_level") > _magicClassHighestLevel)
{
_magicClassHighestLevel = HelperBuffData.getInt("upper_level");
_magicClassHighestLevel = helperBuffData.getInt("upper_level");
}
}

View File

@@ -20,7 +20,7 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -33,14 +33,14 @@ import org.l2jmobius.gameserver.model.items.Henna;
public class HennaTreeTable
{
private static Logger LOGGER = Logger.getLogger(HennaTreeTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(HennaTreeTable.class.getName());
private final Map<ClassId, List<HennaInstance>> _hennaTrees;
private final boolean _initialized = true;
private HennaTreeTable()
{
_hennaTrees = new HashMap<>();
_hennaTrees = new EnumMap<>(ClassId.class);
int classId = 0;
int count = 0;
@@ -50,7 +50,7 @@ public class HennaTreeTable
final ResultSet classlist = statement.executeQuery();
List<HennaInstance> list;
classlist: while (classlist.next())
CLASSLIST: while (classlist.next())
{
list = new ArrayList<>();
classId = classlist.getInt("id");
@@ -70,7 +70,7 @@ public class HennaTreeTable
statement2.close();
classlist.close();
statement.close();
continue classlist;
continue CLASSLIST;
}
final HennaInstance temp = new HennaInstance(template);

View File

@@ -274,23 +274,22 @@ public class NpcTable
}
catch (Exception e)
{
LOGGER.info("Error loading minion data");
e.printStackTrace();
LOGGER.info("Error loading minion data: " + e.getMessage());
}
_initialized = true;
}
private void fillNpcTable(ResultSet NpcData, boolean custom) throws Exception
private void fillNpcTable(ResultSet npcData, boolean custom) throws Exception
{
while (NpcData.next())
while (npcData.next())
{
final StatsSet npcDat = new StatsSet();
final int id = NpcData.getInt("id");
final int id = npcData.getInt("id");
npcDat.set("npcId", id);
npcDat.set("idTemplate", NpcData.getInt("idTemplate"));
npcDat.set("idTemplate", npcData.getInt("idTemplate"));
// Level: for special bosses could be different
int level = 0;
@@ -305,17 +304,18 @@ public class NpcTable
case 29005:
{
minion = true;
// fallthrough
}
case 29001: // queenAnt
{
if (Config.QA_LEVEL > 0)
{
diff = Config.QA_LEVEL - NpcData.getInt("level");
diff = Config.QA_LEVEL - npcData.getInt("level");
level = Config.QA_LEVEL;
}
else
{
level = NpcData.getInt("level");
level = npcData.getInt("level");
}
break;
}
@@ -323,12 +323,12 @@ public class NpcTable
{
if (Config.ZAKEN_LEVEL > 0)
{
diff = Config.ZAKEN_LEVEL - NpcData.getInt("level");
diff = Config.ZAKEN_LEVEL - npcData.getInt("level");
level = Config.ZAKEN_LEVEL;
}
else
{
level = NpcData.getInt("level");
level = npcData.getInt("level");
}
break;
}
@@ -338,17 +338,18 @@ public class NpcTable
case 29018:
{
minion = true;
// fallthrough
}
case 29014: // orfen
{
if (Config.ORFEN_LEVEL > 0)
{
diff = Config.ORFEN_LEVEL - NpcData.getInt("level");
diff = Config.ORFEN_LEVEL - npcData.getInt("level");
level = Config.ORFEN_LEVEL;
}
else
{
level = NpcData.getInt("level");
level = npcData.getInt("level");
}
break;
}
@@ -357,58 +358,59 @@ public class NpcTable
case 290011:
{
minion = true;
// fallthrough
}
case 29006: // core
{
if (Config.CORE_LEVEL > 0)
{
diff = Config.CORE_LEVEL - NpcData.getInt("level");
diff = Config.CORE_LEVEL - npcData.getInt("level");
level = Config.CORE_LEVEL;
}
else
{
level = NpcData.getInt("level");
level = npcData.getInt("level");
}
break;
}
default:
{
level = NpcData.getInt("level");
level = npcData.getInt("level");
}
}
npcDat.set("level", level);
npcDat.set("jClass", NpcData.getString("class"));
npcDat.set("jClass", npcData.getString("class"));
npcDat.set("baseShldDef", 0);
npcDat.set("baseShldRate", 0);
npcDat.set("baseCritRate", 4);
npcDat.set("name", NpcData.getString("name"));
npcDat.set("serverSideName", NpcData.getBoolean("serverSideName"));
npcDat.set("title", NpcData.getString("title"));
npcDat.set("serverSideTitle", NpcData.getBoolean("serverSideTitle"));
npcDat.set("collision_radius", NpcData.getDouble("collision_radius"));
npcDat.set("collision_height", NpcData.getDouble("collision_height"));
npcDat.set("sex", NpcData.getString("sex"));
npcDat.set("type", NpcData.getString("type"));
npcDat.set("baseAtkRange", NpcData.getInt("attackrange"));
npcDat.set("name", npcData.getString("name"));
npcDat.set("serverSideName", npcData.getBoolean("serverSideName"));
npcDat.set("title", npcData.getString("title"));
npcDat.set("serverSideTitle", npcData.getBoolean("serverSideTitle"));
npcDat.set("collision_radius", npcData.getDouble("collision_radius"));
npcDat.set("collision_height", npcData.getDouble("collision_height"));
npcDat.set("sex", npcData.getString("sex"));
npcDat.set("type", npcData.getString("type"));
npcDat.set("baseAtkRange", npcData.getInt("attackrange"));
// BOSS POWER CHANGES
double multi_value = 1;
double multiValue = 1;
if (diff >= 15) // means that there is level customization
{
multi_value = multi_value * (diff / 10);
multiValue = multiValue * (diff / 10);
}
else if ((diff > 0) && (diff < 15))
{
multi_value = multi_value + (diff / 10);
multiValue = multiValue + (diff / 10);
}
if (minion)
{
multi_value = multi_value * Config.LEVEL_DIFF_MULTIPLIER_MINION;
multiValue = multiValue * Config.LEVEL_DIFF_MULTIPLIER_MINION;
}
else
{
@@ -418,7 +420,7 @@ public class NpcTable
{
if (Config.QA_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.QA_POWER_MULTIPLIER;
multiValue = multiValue * Config.QA_POWER_MULTIPLIER;
}
break;
}
@@ -426,7 +428,7 @@ public class NpcTable
{
if (Config.ZAKEN_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ZAKEN_POWER_MULTIPLIER;
multiValue = multiValue * Config.ZAKEN_POWER_MULTIPLIER;
}
break;
}
@@ -434,7 +436,7 @@ public class NpcTable
{
if (Config.ORFEN_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ORFEN_POWER_MULTIPLIER;
multiValue = multiValue * Config.ORFEN_POWER_MULTIPLIER;
}
break;
}
@@ -442,7 +444,7 @@ public class NpcTable
{
if (Config.CORE_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.CORE_POWER_MULTIPLIER;
multiValue = multiValue * Config.CORE_POWER_MULTIPLIER;
}
break;
}
@@ -450,7 +452,7 @@ public class NpcTable
{
if (Config.ANTHARAS_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.ANTHARAS_POWER_MULTIPLIER;
multiValue = multiValue * Config.ANTHARAS_POWER_MULTIPLIER;
}
break;
}
@@ -458,7 +460,7 @@ public class NpcTable
{
if (Config.VALAKAS_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.VALAKAS_POWER_MULTIPLIER;
multiValue = multiValue * Config.VALAKAS_POWER_MULTIPLIER;
}
break;
}
@@ -466,7 +468,7 @@ public class NpcTable
{
if (Config.BAIUM_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.BAIUM_POWER_MULTIPLIER;
multiValue = multiValue * Config.BAIUM_POWER_MULTIPLIER;
}
break;
}
@@ -474,50 +476,50 @@ public class NpcTable
{
if (Config.FRINTEZZA_POWER_MULTIPLIER > 0)
{
multi_value = multi_value * Config.FRINTEZZA_POWER_MULTIPLIER;
multiValue = multiValue * Config.FRINTEZZA_POWER_MULTIPLIER;
}
break;
}
}
}
npcDat.set("rewardExp", NpcData.getInt("exp") * multi_value);
npcDat.set("rewardSp", NpcData.getInt("sp") * multi_value);
npcDat.set("basePAtkSpd", NpcData.getInt("atkspd") * multi_value);
npcDat.set("baseMAtkSpd", NpcData.getInt("matkspd") * multi_value);
npcDat.set("baseHpMax", NpcData.getInt("hp") * multi_value);
npcDat.set("baseMpMax", NpcData.getInt("mp") * multi_value);
npcDat.set("baseHpReg", ((int) NpcData.getFloat("hpreg") * multi_value) > 0 ? NpcData.getFloat("hpreg") : 1.5 + ((level - 1) / 10.0));
npcDat.set("baseMpReg", ((int) NpcData.getFloat("mpreg") * multi_value) > 0 ? NpcData.getFloat("mpreg") : 0.9 + ((0.3 * (level - 1)) / 10.0));
npcDat.set("basePAtk", NpcData.getInt("patk") * multi_value);
npcDat.set("basePDef", NpcData.getInt("pdef") * multi_value);
npcDat.set("baseMAtk", NpcData.getInt("matk") * multi_value);
npcDat.set("baseMDef", NpcData.getInt("mdef") * multi_value);
npcDat.set("rewardExp", npcData.getInt("exp") * multiValue);
npcDat.set("rewardSp", npcData.getInt("sp") * multiValue);
npcDat.set("basePAtkSpd", npcData.getInt("atkspd") * multiValue);
npcDat.set("baseMAtkSpd", npcData.getInt("matkspd") * multiValue);
npcDat.set("baseHpMax", npcData.getInt("hp") * multiValue);
npcDat.set("baseMpMax", npcData.getInt("mp") * multiValue);
npcDat.set("baseHpReg", ((int) npcData.getFloat("hpreg") * multiValue) > 0 ? npcData.getFloat("hpreg") : 1.5 + ((level - 1) / 10.0));
npcDat.set("baseMpReg", ((int) npcData.getFloat("mpreg") * multiValue) > 0 ? npcData.getFloat("mpreg") : 0.9 + ((0.3 * (level - 1)) / 10.0));
npcDat.set("basePAtk", npcData.getInt("patk") * multiValue);
npcDat.set("basePDef", npcData.getInt("pdef") * multiValue);
npcDat.set("baseMAtk", npcData.getInt("matk") * multiValue);
npcDat.set("baseMDef", npcData.getInt("mdef") * multiValue);
npcDat.set("aggroRange", NpcData.getInt("aggro"));
npcDat.set("rhand", NpcData.getInt("rhand"));
npcDat.set("lhand", NpcData.getInt("lhand"));
npcDat.set("armor", NpcData.getInt("armor"));
npcDat.set("baseWalkSpd", NpcData.getInt("walkspd"));
npcDat.set("baseRunSpd", NpcData.getInt("runspd"));
npcDat.set("aggroRange", npcData.getInt("aggro"));
npcDat.set("rhand", npcData.getInt("rhand"));
npcDat.set("lhand", npcData.getInt("lhand"));
npcDat.set("armor", npcData.getInt("armor"));
npcDat.set("baseWalkSpd", npcData.getInt("walkspd"));
npcDat.set("baseRunSpd", npcData.getInt("runspd"));
// constants, until we have stats in DB
npcDat.safeSet("baseSTR", NpcData.getInt("str"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseCON", NpcData.getInt("con"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseDEX", NpcData.getInt("dex"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseINT", NpcData.getInt("int"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseWIT", NpcData.getInt("wit"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseMEN", NpcData.getInt("men"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + NpcData.getInt("idTemplate"));
npcDat.safeSet("baseSTR", npcData.getInt("str"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseCON", npcData.getInt("con"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseDEX", npcData.getInt("dex"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseINT", npcData.getInt("int"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseWIT", npcData.getInt("wit"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseMEN", npcData.getInt("men"), 0, BaseStats.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.set("baseCpMax", 0);
npcDat.set("factionId", NpcData.getString("faction_id"));
npcDat.set("factionRange", NpcData.getInt("faction_range"));
npcDat.set("factionId", npcData.getString("faction_id"));
npcDat.set("factionRange", npcData.getInt("faction_range"));
npcDat.set("isUndead", NpcData.getString("isUndead"));
npcDat.set("isUndead", npcData.getString("isUndead"));
npcDat.set("absorb_level", NpcData.getString("absorb_level"));
npcDat.set("absorb_type", NpcData.getString("absorb_type"));
npcDat.set("absorb_level", npcData.getString("absorb_level"));
npcDat.set("absorb_type", npcData.getString("absorb_type"));
final NpcTemplate template = new NpcTemplate(npcDat, custom);
template.addVulnerability(Stats.BOW_WPN_VULN, 1);

View File

@@ -25,11 +25,10 @@ import java.util.logging.Logger;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.model.PetData;
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
public class PetDataTable
{
private static final Logger LOGGER = Logger.getLogger(PetInstance.class.getName());
private static final Logger LOGGER = Logger.getLogger(PetDataTable.class.getName());
private static Map<Integer, Map<Integer, PetData>> _petTable = new HashMap<>();

View File

@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.Skill;
*/
public class SkillSpellbookTable
{
private static final Logger LOGGER = Logger.getLogger(SkillTreeTable.class.getName());
private static final Logger LOGGER = Logger.getLogger(SkillSpellbookTable.class.getName());
private static Map<Integer, Integer> skillSpellbooks;

View File

@@ -21,6 +21,7 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -324,9 +325,8 @@ public class SkillTreeTable
{
if (_skillTrees == null)
{
_skillTrees = new HashMap<>();
_skillTrees = new EnumMap<>(ClassId.class);
}
return _skillTrees;
}
@@ -519,12 +519,9 @@ public class SkillTreeTable
for (SkillLearn temp : skills)
{
if ((temp.getMinLevel() > player.getLevel()) && (temp.getSpCost() != 0))
if ((temp.getMinLevel() > player.getLevel()) && (temp.getSpCost() != 0) && ((minLevel == 0) || (temp.getMinLevel() < minLevel)))
{
if ((minLevel == 0) || (temp.getMinLevel() < minLevel))
{
minLevel = temp.getMinLevel();
}
minLevel = temp.getMinLevel();
}
}
@@ -545,12 +542,9 @@ public class SkillTreeTable
for (SkillLearn s : skills)
{
if (s.getMinLevel() > player.getLevel())
if ((s.getMinLevel() > player.getLevel()) && ((minLevel == 0) || (s.getMinLevel() < minLevel)))
{
if ((minLevel == 0) || (s.getMinLevel() < minLevel))
{
minLevel = s.getMinLevel();
}
minLevel = s.getMinLevel();
}
}

View File

@@ -379,11 +379,6 @@ public class SpawnTable
}
}
public Map<Integer, Spawn> getAllTemplates()
{
return _spawntable;
}
public static SpawnTable getInstance()
{
return SingletonHolder.INSTANCE;

View File

@@ -83,7 +83,7 @@ public class TeleportLocationTable
final ResultSet rset = statement.executeQuery();
TeleportLocation teleport;
int _cTeleCount = _teleports.size();
int cTeleCount = _teleports.size();
while (rset.next())
{
@@ -100,11 +100,11 @@ public class TeleportLocationTable
statement.close();
rset.close();
_cTeleCount = _teleports.size() - _cTeleCount;
cTeleCount = _teleports.size() - cTeleCount;
if (_cTeleCount > 0)
if (cTeleCount > 0)
{
LOGGER.info("TeleportLocationTable: Loaded " + _cTeleCount + " Custom Teleport Location Templates.");
LOGGER.info("TeleportLocationTable: Loaded " + cTeleCount + " Custom Teleport Location Templates.");
}
}
catch (Exception e)

View File

@@ -24,12 +24,11 @@ import java.util.Map;
import java.util.logging.Logger;
import org.l2jmobius.commons.database.DatabaseFactory;
import org.l2jmobius.gameserver.TradeController;
import org.l2jmobius.gameserver.model.Territory;
public class TerritoryTable
{
private static final Logger LOGGER = Logger.getLogger(TradeController.class.getName());
private static final Logger LOGGER = Logger.getLogger(TerritoryTable.class.getName());
private static Map<Integer, Territory> _territory = new HashMap<>();
public TerritoryTable()

View File

@@ -19,9 +19,7 @@ package org.l2jmobius.gameserver.datatables.sql;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Logger;
@@ -84,9 +82,9 @@ public class TradeListTable
final StoreTradeList buylist = new StoreTradeList(rset1.getInt("shop_id"));
buylist.setNpcId(rset1.getString("npc_id"));
int _itemId = 0;
int _itemCount = 0;
int _price = 0;
int itemId = 0;
int itemCount = 0;
int price = 0;
if (!buylist.isGm() && (NpcTable.getInstance().getTemplate(rset1.getInt("npc_id")) == null))
{
@@ -97,26 +95,26 @@ public class TradeListTable
{
while (rset.next())
{
_itemId = rset.getInt("item_id");
_price = rset.getInt("price");
itemId = rset.getInt("item_id");
price = rset.getInt("price");
final int count = rset.getInt("count");
final int currentCount = rset.getInt("currentCount");
final int time = rset.getInt("time");
final ItemInstance buyItem = ItemTable.getInstance().createDummyItem(_itemId);
final ItemInstance buyItem = ItemTable.getInstance().createDummyItem(itemId);
if (buyItem == null)
{
continue;
}
_itemCount++;
itemCount++;
if (count > -1)
{
buyItem.setCountDecrease(true);
}
buyItem.setPriceToSell(_price);
buyItem.setPriceToSell(price);
buyItem.setTime(time);
buyItem.setInitCount(count);
@@ -131,9 +129,9 @@ public class TradeListTable
buylist.addItem(buyItem);
if (!buylist.isGm() && (buyItem.getReferencePrice() > _price))
if (!buylist.isGm() && (buyItem.getReferencePrice() > price))
{
LOGGER.warning("TradeListTable: Reference price of item " + _itemId + " in buylist " + buylist.getListId() + " higher then sell price.");
LOGGER.warning("TradeListTable: Reference price of item " + itemId + " in buylist " + buylist.getListId() + " higher then sell price.");
}
}
}
@@ -142,7 +140,7 @@ public class TradeListTable
LOGGER.warning("TradeListTable: Problem with buylist " + buylist.getListId() + ". " + e);
}
if (_itemCount > 0)
if (itemCount > 0)
{
_lists.put(buylist.getListId(), buylist);
_nextListId = Math.max(_nextListId, buylist.getListId() + 1);
@@ -165,7 +163,7 @@ public class TradeListTable
int time = 0;
long savetimer = 0;
final long currentMillis = System.currentTimeMillis();
final PreparedStatement statement2 = con.prepareStatement("SELECT DISTINCT time, savetimer FROM " + (custom ? "merchant_buylists" : "merchant_buylists") + " WHERE time <> 0 ORDER BY time");
final PreparedStatement statement2 = con.prepareStatement("SELECT DISTINCT time, savetimer FROM " + (custom ? "custom_merchant_buylists" : "merchant_buylists") + " WHERE time <> 0 ORDER BY time");
final ResultSet rset2 = statement2.executeQuery();
while (rset2.next())
@@ -220,30 +218,8 @@ public class TradeListTable
return null;
}
public List<StoreTradeList> getBuyListByNpcId(int npcId)
{
final List<StoreTradeList> lists = new ArrayList<>();
for (StoreTradeList list : _lists.values())
{
if (list.isGm())
{
continue;
}
/** if (npcId == list.getNpcId()) **/
lists.add(list);
}
return lists;
}
protected void restoreCount(int time)
{
if (_lists == null)
{
return;
}
for (StoreTradeList list : _lists.values())
{
list.restoreCount(time);
@@ -270,11 +246,6 @@ public class TradeListTable
public void dataCountStore()
{
if (_lists == null)
{
return;
}
int listId;
try (Connection con = DatabaseFactory.getConnection())
{

View File

@@ -245,9 +245,9 @@ public class AdminData implements IXmlReader
}
String command = adminCommand;
if (adminCommand.indexOf(" ") != -1)
if (adminCommand.indexOf(' ') != -1)
{
command = adminCommand.substring(0, adminCommand.indexOf(" "));
command = adminCommand.substring(0, adminCommand.indexOf(' '));
}
int acar = 0;

View File

@@ -62,7 +62,7 @@ public class AugmentationData
private static final int BASESTAT_INT = 16343;
private static final int BASESTAT_MEN = 16344;
private static List<augmentationStat> _augmentationStats[] = null;
private static List<augmentationStat>[] _augmentationStats = null;
private static Map<Integer, ArrayList<augmentationSkill>> _blueSkills = null;
private static Map<Integer, ArrayList<augmentationSkill>> _purpleSkills = null;
private static Map<Integer, ArrayList<augmentationSkill>> _redSkills = null;
@@ -218,8 +218,8 @@ public class AugmentationData
NamedNodeMap attrs = d.getAttributes();
String statName = attrs.getNamedItem("name").getNodeValue();
float soloValues[] = null;
float combinedValues[] = null;
float[] soloValues = null;
float[] combinedValues = null;
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
@@ -289,7 +289,7 @@ public class AugmentationData
// Note: stat12 stands for stat 1 AND 2 (same for stat34 ;p ) this is because a value can contain up to 2 stat modifications (there are two short values packed in one integer value, meaning 4 stat modifications at max) for more info take a look at getAugStatsById(...)
// Note: lifeStoneGrade: (0 means low grade, 3 top grade)
// First: determine whether we will add a skill/baseStatModifier or not because this determine which color could be the result
int skill_Chance = 0;
int skillChance = 0;
int stat34 = 0;
boolean generateSkill = false;
int resultColor = 0;
@@ -299,7 +299,7 @@ public class AugmentationData
{
case 0:
{
skill_Chance = Config.AUGMENTATION_NG_SKILL_CHANCE;
skillChance = Config.AUGMENTATION_NG_SKILL_CHANCE;
if (Rnd.get(1, 100) <= Config.AUGMENTATION_NG_GLOW_CHANCE)
{
generateGlow = true;
@@ -308,7 +308,7 @@ public class AugmentationData
}
case 1:
{
skill_Chance = Config.AUGMENTATION_MID_SKILL_CHANCE;
skillChance = Config.AUGMENTATION_MID_SKILL_CHANCE;
if (Rnd.get(1, 100) <= Config.AUGMENTATION_MID_GLOW_CHANCE)
{
generateGlow = true;
@@ -317,7 +317,7 @@ public class AugmentationData
}
case 2:
{
skill_Chance = Config.AUGMENTATION_HIGH_SKILL_CHANCE;
skillChance = Config.AUGMENTATION_HIGH_SKILL_CHANCE;
if (Rnd.get(1, 100) <= Config.AUGMENTATION_HIGH_GLOW_CHANCE)
{
generateGlow = true;
@@ -326,7 +326,7 @@ public class AugmentationData
}
case 3:
{
skill_Chance = Config.AUGMENTATION_TOP_SKILL_CHANCE;
skillChance = Config.AUGMENTATION_TOP_SKILL_CHANCE;
if (Rnd.get(1, 100) <= Config.AUGMENTATION_TOP_GLOW_CHANCE)
{
generateGlow = true;
@@ -334,7 +334,7 @@ public class AugmentationData
}
}
if (Rnd.get(1, 100) <= skill_Chance)
if (Rnd.get(1, 100) <= skillChance)
{
generateSkill = true;
}
@@ -489,7 +489,7 @@ public class AugmentationData
// the first 12 combined stats (14-26) is the stat 1 combined with stat 2-13
// the next 11 combined stats then are stat 2 combined with stat 3-13 and so on...
// to get the idea have a look @ optiondata_client-e.dat - thats where the data came from :)
final int stats[] = new int[2];
final int[] stats = new int[2];
stats[0] = 0x0000FFFF & augmentationId;
stats[1] = augmentationId >> 16;
@@ -622,10 +622,10 @@ public class AugmentationData
private final Stats _stat;
private final int _singleSize;
private final int _combinedSize;
private final float _singleValues[];
private final float _combinedValues[];
private final float[] _singleValues;
private final float[] _combinedValues;
public augmentationStat(Stats stat, float sValues[], float cValues[])
public augmentationStat(Stats stat, float[] sValues, float[] cValues)
{
_stat = stat;
_singleSize = sValues.length;

View File

@@ -35,7 +35,7 @@ import org.l2jmobius.Config;
*/
public class ExperienceData
{
private static Logger LOGGER = Logger.getLogger(ExperienceData.class.getName());
private static final Logger LOGGER = Logger.getLogger(ExperienceData.class.getName());
private byte MAX_LEVEL;
private byte MAX_PET_LEVEL;
@@ -86,8 +86,8 @@ public class ExperienceData
if (experience.getNodeName().equals("experience"))
{
attrs = experience.getAttributes();
level = Integer.valueOf(attrs.getNamedItem("level").getNodeValue());
exp = Long.valueOf(attrs.getNamedItem("tolevel").getNodeValue());
level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
exp = Long.parseLong(attrs.getNamedItem("tolevel").getNodeValue());
_expTable.put(level, exp);
}
}

View File

@@ -101,7 +101,7 @@ public class ZoneData
{
Document doc = factory.newDocumentBuilder().parse(file);
int effect_zone_id = 150000; // FIXME Temporally workaround to avoid zone.xml modification
int effectZoneId = 150000; // FIXME: Temporally workaround to avoid zone.xml modification
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -216,22 +216,22 @@ public class ZoneData
}
case "BossZone":
{
int boss_id = -1;
int bossId = -1;
try
{
boss_id = Integer.parseInt(attrs.getNamedItem("bossId").getNodeValue());
bossId = Integer.parseInt(attrs.getNamedItem("bossId").getNodeValue());
}
catch (IllegalArgumentException e)
{
e.printStackTrace();
}
temp = new BossZone(zoneId, boss_id);
temp = new BossZone(zoneId, bossId);
break;
}
case "EffectZone":
{
zoneId = effect_zone_id;
effect_zone_id++;
zoneId = effectZoneId;
effectZoneId++;
temp = new EffectZone(zoneId);
break;
}
@@ -341,25 +341,25 @@ public class ZoneData
}
case "NPoly":
{
List<Integer> fl_x = new ArrayList<>();
final List<Integer> fl_y = new ArrayList<>();
List<Integer> flX = new ArrayList<>();
final List<Integer> flY = new ArrayList<>();
// Load the rest
while (rset.next())
{
fl_x.add(rset.getInt("x"));
fl_y.add(rset.getInt("y"));
flX.add(rset.getInt("x"));
flY.add(rset.getInt("y"));
}
// An nPoly needs to have at least 3 vertices
if ((fl_x.size() == fl_y.size()) && (fl_x.size() > 2))
if ((flX.size() == flY.size()) && (flX.size() > 2))
{
// Create arrays
final int[] aX = new int[fl_x.size()];
final int[] aY = new int[fl_y.size()];
final int[] aX = new int[flX.size()];
final int[] aY = new int[flY.size()];
// This runs only at server startup so dont complain :>
for (int i = 0; i < fl_x.size(); i++)
for (int i = 0; i < flX.size(); i++)
{
aX[i] = fl_x.get(i);
aY[i] = fl_y.get(i);
aX[i] = flX.get(i);
aY[i] = flY.get(i);
}
// Create the zone
temp.setZone(new ZoneNPoly(aX, aY, minZ, maxZ));

View File

@@ -258,22 +258,19 @@ public abstract class DocumentBase
{
time = Integer.decode(getValue(attrs.getNamedItem("time").getNodeValue(), template));
if (Config.ENABLE_MODIFY_SKILL_DURATION)
if (Config.ENABLE_MODIFY_SKILL_DURATION && Config.SKILL_DURATION_LIST.containsKey(((Skill) template).getId()))
{
if (Config.SKILL_DURATION_LIST.containsKey(((Skill) template).getId()))
if (((Skill) template).getLevel() < 100)
{
if (((Skill) template).getLevel() < 100)
{
time = Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
else if ((((Skill) template).getLevel() >= 100) && (((Skill) template).getLevel() < 140))
{
time += Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
else if (((Skill) template).getLevel() > 140)
{
time = Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
time = Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
else if ((((Skill) template).getLevel() >= 100) && (((Skill) template).getLevel() < 140))
{
time += Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
else if (((Skill) template).getLevel() > 140)
{
time = Config.SKILL_DURATION_LIST.get(((Skill) template).getId());
}
}
}
@@ -284,12 +281,9 @@ public abstract class DocumentBase
boolean self = false;
if (attrs.getNamedItem("self") != null)
if ((attrs.getNamedItem("self") != null) && (Integer.decode(getValue(attrs.getNamedItem("self").getNodeValue(), template)) == 1))
{
if (Integer.decode(getValue(attrs.getNamedItem("self").getNodeValue(), template)) == 1)
{
self = true;
}
self = true;
}
final Lambda lambda = getLambda(n, template);
@@ -541,7 +535,7 @@ public abstract class DocumentBase
protected Condition parsePlayerCondition(Node n)
{
Condition cond = null;
final int[] ElementSeeds = new int[5];
final int[] elementSeeds = new int[5];
final int[] forces = new int[2];
final NamedNodeMap attrs = n.getAttributes();
for (int i = 0; i < attrs.getLength(); i++)
@@ -559,37 +553,37 @@ public abstract class DocumentBase
}
else if ("resting".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.RESTING, val));
}
else if ("flying".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.FLYING, val));
}
else if ("moving".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.MOVING, val));
}
else if ("running".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.RUNNING, val));
}
else if ("behind".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.BEHIND, val));
}
else if ("front".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.FRONT, val));
}
else if ("side".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionPlayerState(CheckPlayerState.SIDE, val));
}
else if ("hp".equalsIgnoreCase(a.getNodeName()))
@@ -609,23 +603,23 @@ public abstract class DocumentBase
}
else if ("seed_fire".equalsIgnoreCase(a.getNodeName()))
{
ElementSeeds[0] = Integer.decode(getValue(a.getNodeValue(), null));
elementSeeds[0] = Integer.decode(getValue(a.getNodeValue(), null));
}
else if ("seed_water".equalsIgnoreCase(a.getNodeName()))
{
ElementSeeds[1] = Integer.decode(getValue(a.getNodeValue(), null));
elementSeeds[1] = Integer.decode(getValue(a.getNodeValue(), null));
}
else if ("seed_wind".equalsIgnoreCase(a.getNodeName()))
{
ElementSeeds[2] = Integer.decode(getValue(a.getNodeValue(), null));
elementSeeds[2] = Integer.decode(getValue(a.getNodeValue(), null));
}
else if ("seed_various".equalsIgnoreCase(a.getNodeName()))
{
ElementSeeds[3] = Integer.decode(getValue(a.getNodeValue(), null));
elementSeeds[3] = Integer.decode(getValue(a.getNodeValue(), null));
}
else if ("seed_any".equalsIgnoreCase(a.getNodeName()))
{
ElementSeeds[4] = Integer.decode(getValue(a.getNodeValue(), null));
elementSeeds[4] = Integer.decode(getValue(a.getNodeValue(), null));
}
else if ("battle_force".equalsIgnoreCase(a.getNodeName()))
{
@@ -649,11 +643,11 @@ public abstract class DocumentBase
}
// Elemental seed condition processing
for (int elementSeed : ElementSeeds)
for (int elementSeed : elementSeeds)
{
if (elementSeed > 0)
{
cond = joinAnd(cond, new ConditionElementSeed(ElementSeeds));
cond = joinAnd(cond, new ConditionElementSeed(elementSeeds));
break;
}
}
@@ -679,7 +673,7 @@ public abstract class DocumentBase
final Node a = attrs.item(i);
if ("aggro".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionTargetAggro(val));
}
else if ("level".equalsIgnoreCase(a.getNodeName()))
@@ -831,13 +825,13 @@ public abstract class DocumentBase
final Node a = attrs.item(i);
if ("skill".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionWithSkill(val));
}
if ("night".equalsIgnoreCase(a.getNodeName()))
{
final boolean val = Boolean.valueOf(a.getNodeValue());
final boolean val = Boolean.parseBoolean(a.getNodeValue());
cond = joinAnd(cond, new ConditionGameTime(CheckGameTime.NIGHT, val));
}

View File

@@ -59,12 +59,9 @@ public class DocumentEngine
final File[] files = dir.listFiles();
for (File f : files)
{
if (f.getName().endsWith(".xml"))
if (f.getName().endsWith(".xml") && !f.getName().startsWith("custom"))
{
if (!f.getName().startsWith("custom"))
{
hash.add(f);
}
hash.add(f);
}
}
final File customfile = new File(Config.DATAPACK_ROOT, dirname + "/custom.xml");

View File

@@ -373,12 +373,12 @@ final class DocumentSkill extends DocumentBase
}
}
int _count = count;
int count2 = count;
for (int i = 0; i < _currentSkill.enchsets1.length; i++)
{
try
{
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets1[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets1[i]));
_currentSkill.currentSkills.add(count2 + i, _currentSkill.enchsets1[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets1[i]));
count++;
}
catch (Exception e)
@@ -387,12 +387,12 @@ final class DocumentSkill extends DocumentBase
}
}
_count = count;
count2 = count;
for (int i = 0; i < _currentSkill.enchsets2.length; i++)
{
try
{
_currentSkill.currentSkills.add(_count + i, _currentSkill.enchsets2[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets2[i]));
_currentSkill.currentSkills.add(count2 + i, _currentSkill.enchsets2[i].getEnum("skillType", SkillType.class).makeSkill(_currentSkill.enchsets2[i]));
count++;
}
catch (Exception e)

View File

@@ -187,7 +187,6 @@ public class GeoEngine
// an error occured while loading, load null blocks
LOGGER.warning("GeoEngine: Error while loading " + filename + " region file.");
LOGGER.warning(e.getMessage());
e.printStackTrace();
// replace whole region file with null blocks
loadNullBlocks(regionX, regionY);

View File

@@ -85,7 +85,6 @@ import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTeleport;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTest;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTownWar;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminTvTEngine;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminUnblockIp;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminVIPEngine;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminWho;
import org.l2jmobius.gameserver.handler.admincommandhandlers.AdminZone;
@@ -153,7 +152,6 @@ public class AdminCommandHandler
registerAdminCommandHandler(new AdminMobGroup());
registerAdminCommandHandler(new AdminRes());
registerAdminCommandHandler(new AdminMammon());
registerAdminCommandHandler(new AdminUnblockIp());
registerAdminCommandHandler(new AdminPledge());
registerAdminCommandHandler(new AdminRideWyvern());
registerAdminCommandHandler(new AdminLogin());
@@ -180,7 +178,7 @@ public class AdminCommandHandler
String[] ids = handler.getAdminCommandList();
for (String element : ids)
{
if (_datatable.keySet().contains(new String(element)))
if (_datatable.keySet().contains(element))
{
LOGGER.warning("Duplicated command \"" + element + "\" definition in " + handler.getClass().getName() + ".");
}
@@ -195,9 +193,9 @@ public class AdminCommandHandler
{
String command = adminCommand;
if (adminCommand.indexOf(" ") != -1)
if (adminCommand.indexOf(' ') != -1)
{
command = adminCommand.substring(0, adminCommand.indexOf(" "));
command = adminCommand.substring(0, adminCommand.indexOf(' '));
}
return _datatable.get(command);

View File

@@ -73,7 +73,7 @@ public class AutoAnnouncementHandler
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.info("Problem with AutoAnnouncementHandler: " + e.getMessage());
}
}
@@ -201,6 +201,7 @@ public class AutoAnnouncementHandler
}
catch (Exception e)
{
LOGGER.info("Problem with AutoAnnouncementHandler: " + e.getMessage());
}
return nextId;
}

View File

@@ -754,7 +754,7 @@ public class AutoChatHandler implements SpawnListener
if (text.indexOf("%player_random%") > -1)
{
text = text.replaceAll("%player_random%", randomPlayer.getName());
text = text.replace("%player_random%", randomPlayer.getName());
}
if (text.indexOf("%player_cabal_winner%") > -1)
@@ -763,7 +763,7 @@ public class AutoChatHandler implements SpawnListener
{
if (SevenSigns.getInstance().getPlayerCabal(nearbyPlayer) == winningCabal)
{
text = text.replaceAll("%player_cabal_winner%", nearbyPlayer.getName());
text = text.replace("%player_cabal_winner%", nearbyPlayer.getName());
break;
}
}
@@ -775,7 +775,7 @@ public class AutoChatHandler implements SpawnListener
{
if (SevenSigns.getInstance().getPlayerCabal(nearbyPlayer) == losingCabal)
{
text = text.replaceAll("%player_cabal_loser%", nearbyPlayer.getName());
text = text.replace("%player_cabal_loser%", nearbyPlayer.getName());
break;
}
}
@@ -806,7 +806,7 @@ public class AutoChatHandler implements SpawnListener
}
catch (Exception e)
{
e.printStackTrace();
LOGGER.info("Problem with AutoChatHandler: " + e.getMessage());
return;
}
}

View File

@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.GameServer;
import org.l2jmobius.gameserver.handler.itemhandlers.BeastSoulShot;
import org.l2jmobius.gameserver.handler.itemhandlers.BeastSpice;
import org.l2jmobius.gameserver.handler.itemhandlers.BeastSpiritShot;
@@ -66,7 +65,7 @@ import org.l2jmobius.gameserver.handler.itemhandlers.SummonItems;
public class ItemHandler
{
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static final Logger LOGGER = Logger.getLogger(ItemHandler.class.getName());
private final Map<Integer, IItemHandler> _datatable;

View File

@@ -20,7 +20,6 @@ import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Logger;
import org.l2jmobius.gameserver.GameServer;
import org.l2jmobius.gameserver.handler.skillhandlers.BalanceLife;
import org.l2jmobius.gameserver.handler.skillhandlers.BeastFeed;
import org.l2jmobius.gameserver.handler.skillhandlers.Blow;
@@ -59,7 +58,7 @@ import org.l2jmobius.gameserver.model.Skill.SkillType;
public class SkillHandler
{
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static final Logger LOGGER = Logger.getLogger(SkillHandler.class.getName());
private final Map<SkillType, ISkillHandler> _datatable;

View File

@@ -21,7 +21,6 @@ import java.util.Map;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.GameServer;
import org.l2jmobius.gameserver.handler.usercommandhandlers.ChannelDelete;
import org.l2jmobius.gameserver.handler.usercommandhandlers.ChannelLeave;
import org.l2jmobius.gameserver.handler.usercommandhandlers.ChannelListUpdate;
@@ -39,7 +38,7 @@ import org.l2jmobius.gameserver.handler.usercommandhandlers.Time;
public class UserCommandHandler
{
private static final Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static final Logger LOGGER = Logger.getLogger(UserCommandHandler.class.getName());
private final Map<Integer, IUserCommandHandler> _datatable;

View File

@@ -21,7 +21,6 @@ import java.util.Map;
import java.util.logging.Logger;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.GameServer;
import org.l2jmobius.gameserver.handler.voicedcommandhandlers.AwayCmd;
import org.l2jmobius.gameserver.handler.voicedcommandhandlers.BankingCmd;
import org.l2jmobius.gameserver.handler.voicedcommandhandlers.CTFCmd;
@@ -36,7 +35,7 @@ import org.l2jmobius.gameserver.handler.voicedcommandhandlers.Wedding;
public class VoicedCommandHandler
{
private static Logger LOGGER = Logger.getLogger(GameServer.class.getName());
private static final Logger LOGGER = Logger.getLogger(VoicedCommandHandler.class.getName());
private final Map<String, IVoicedCommandHandler> _datatable;
@@ -108,9 +107,9 @@ public class VoicedCommandHandler
public IVoicedCommandHandler getVoicedCommandHandler(String voicedCommand)
{
String command = voicedCommand;
if (voicedCommand.indexOf(" ") != -1)
if (voicedCommand.indexOf(' ') != -1)
{
command = voicedCommand.substring(0, voicedCommand.indexOf(" "));
command = voicedCommand.substring(0, voicedCommand.indexOf(' '));
}
return _datatable.get(command);
}

View File

@@ -34,7 +34,7 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminAdmin implements IAdminCommandHandler
{
private static Logger LOGGER = Logger.getLogger(AdminAdmin.class.getName());
private static final Logger LOGGER = Logger.getLogger(AdminAdmin.class.getName());
private static final String[] ADMIN_COMMANDS =
{
@@ -145,7 +145,7 @@ public class AdminAdmin implements IAdminCommandHandler
}
case admin_diet:
{
boolean no_token = false;
boolean noToken = false;
if (st.hasMoreTokens())
{
if (st.nextToken().equalsIgnoreCase("on"))
@@ -161,9 +161,9 @@ public class AdminAdmin implements IAdminCommandHandler
}
else
{
no_token = true;
noToken = true;
}
if (no_token)
if (noToken)
{
if (activeChar.getDietMode())
{
@@ -181,7 +181,7 @@ public class AdminAdmin implements IAdminCommandHandler
}
case admin_set:
{
boolean no_token = false;
boolean noToken = false;
String[] cmd = st.nextToken().split("_");
if ((cmd != null) && (cmd.length > 1))
{
@@ -201,17 +201,17 @@ public class AdminAdmin implements IAdminCommandHandler
{
case "RateXp":
{
Config.RATE_XP = Float.valueOf(pValue);
Config.RATE_XP = Float.parseFloat(pValue);
break;
}
case "RateSp":
{
Config.RATE_SP = Float.valueOf(pValue);
Config.RATE_SP = Float.parseFloat(pValue);
break;
}
case "RateDropSpoil":
{
Config.RATE_DROP_SPOIL = Float.valueOf(pValue);
Config.RATE_DROP_SPOIL = Float.parseFloat(pValue);
break;
}
}
@@ -219,7 +219,7 @@ public class AdminAdmin implements IAdminCommandHandler
}
else
{
no_token = true;
noToken = true;
}
}
@@ -237,10 +237,10 @@ public class AdminAdmin implements IAdminCommandHandler
}
else
{
no_token = true;
noToken = true;
}
if (no_token)
if (noToken)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //set parameter=vaue");
return false;

View File

@@ -66,7 +66,7 @@ public class AdminAio implements IAdminCommandHandler
{
case admin_setaio:
{
boolean no_token = false;
boolean noToken = false;
if (st.hasMoreTokens())
{ // char_name not specified
final String char_name = st.nextToken();
@@ -101,28 +101,29 @@ public class AdminAio implements IAdminCommandHandler
}
else
{
no_token = true;
noToken = true;
}
}
else
{
BuilderUtil.sendSysMessage(activeChar, "Player must be online to set AIO status");
no_token = true;
noToken = true;
}
}
else
{
no_token = true;
noToken = true;
}
if (no_token)
if (noToken)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //setaio <char_name> [time](in days)");
return false;
}
break;
}
case admin_removeaio:
{
boolean no_token = false;
boolean noToken = false;
if (st.hasMoreTokens())
{ // char_name
final String char_name = st.nextToken();
@@ -138,14 +139,14 @@ public class AdminAio implements IAdminCommandHandler
else
{
BuilderUtil.sendSysMessage(activeChar, "Player must be online to remove AIO status");
no_token = true;
noToken = true;
}
}
else
{
no_token = true;
noToken = true;
}
if (no_token)
if (noToken)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //removeaio <char_name>");
return false;
@@ -156,46 +157,46 @@ public class AdminAio implements IAdminCommandHandler
return true;
}
public void doAio(PlayerInstance activeChar, PlayerInstance _player, String _playername, String _time)
public void doAio(PlayerInstance activeChar, PlayerInstance player, String playerName, String time)
{
final int days = Integer.parseInt(_time);
if (_player == null)
final int days = Integer.parseInt(time);
if (player == null)
{
BuilderUtil.sendSysMessage(activeChar, "not found char" + _playername);
BuilderUtil.sendSysMessage(activeChar, "not found char" + playerName);
return;
}
if (days > 0)
{
_player.setAio(true);
_player.setEndTime("aio", days);
_player.getStat().addExp(_player.getStat().getExpForLevel(81));
player.setAio(true);
player.setEndTime("aio", days);
player.getStat().addExp(player.getStat().getExpForLevel(81));
try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET aio=1, aio_end=? WHERE obj_id=?");
statement.setLong(1, _player.getAioEndTime());
statement.setInt(2, _player.getObjectId());
statement.setLong(1, player.getAioEndTime());
statement.setInt(2, player.getObjectId());
statement.execute();
statement.close();
if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
{
_player.getAppearance().setNameColor(Config.AIO_NCOLOR);
player.getAppearance().setNameColor(Config.AIO_NCOLOR);
}
if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
{
_player.getAppearance().setTitleColor(Config.AIO_TCOLOR);
player.getAppearance().setTitleColor(Config.AIO_TCOLOR);
}
_player.rewardAioSkills();
_player.broadcastUserInfo();
_player.sendPacket(new EtcStatusUpdate(_player));
_player.sendSkillList();
AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " set Aio stat for player " + _playername + " for " + _time + " day(s)");
_player.sendMessage("You are now an Aio, Congratulations!");
_player.broadcastUserInfo();
player.rewardAioSkills();
player.broadcastUserInfo();
player.sendPacket(new EtcStatusUpdate(player));
player.sendSkillList();
AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " set Aio stat for player " + playerName + " for " + time + " day(s)");
player.sendMessage("You are now an Aio, Congratulations!");
player.broadcastUserInfo();
}
catch (Exception e)
{
@@ -204,31 +205,31 @@ public class AdminAio implements IAdminCommandHandler
}
else
{
removeAio(activeChar, _player, _playername);
removeAio(activeChar, player, playerName);
}
}
public void removeAio(PlayerInstance activeChar, PlayerInstance _player, String _playername)
public void removeAio(PlayerInstance activeChar, PlayerInstance player, String playerName)
{
_player.setAio(false);
_player.setAioEndTime(0);
player.setAio(false);
player.setAioEndTime(0);
try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET Aio=0, Aio_end=0 WHERE obj_id=?");
statement.setInt(1, _player.getObjectId());
statement.setInt(1, player.getObjectId());
statement.execute();
statement.close();
_player.lostAioSkills();
_player.getAppearance().setNameColor(0xFFFFFF);
_player.getAppearance().setTitleColor(0xFFFFFF);
_player.broadcastUserInfo();
_player.sendPacket(new EtcStatusUpdate(_player));
_player.sendSkillList();
AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " remove Aio stat of player " + _playername);
_player.sendMessage("Now You are not an Aio..");
_player.broadcastUserInfo();
player.lostAioSkills();
player.getAppearance().setNameColor(0xFFFFFF);
player.getAppearance().setTitleColor(0xFFFFFF);
player.broadcastUserInfo();
player.sendPacket(new EtcStatusUpdate(player));
player.sendSkillList();
AdminData.broadcastMessageToGMs("GM " + activeChar.getName() + " remove Aio stat of player " + playerName);
player.sendMessage("Now You are not an Aio..");
player.broadcastUserInfo();
}
catch (Exception e)
{

View File

@@ -249,6 +249,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //del_autoannouncement <index> (number >= 0)");
return false;
}
return false;
}
case admin_autoannounce:
{

View File

@@ -94,19 +94,19 @@ public class AdminBuffs implements IAdminCommandHandler
String playername = st.nextToken();
if (st.hasMoreTokens())
{
int SkillId = 0;
int skillId = 0;
try
{
SkillId = Integer.parseInt(st.nextToken());
skillId = Integer.parseInt(st.nextToken());
}
catch (NumberFormatException e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //stopbuff <playername> [skillId] (skillId must be a number)");
return false;
}
if (SkillId > 0)
if (skillId > 0)
{
removeBuff(activeChar, playername, SkillId);
removeBuff(activeChar, playername, skillId);
}
else
{

View File

@@ -132,7 +132,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
if (st.hasMoreTokens())
{
if (CTF.set_eventName(st.nextToken()))
if (CTF.setEventName(st.nextToken()))
{
showMainPage(activeChar);
return true;
@@ -147,7 +147,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
if (st.hasMoreTokens())
{
if (CTF.set_eventDesc(st.nextToken()))
if (CTF.setEventDesc(st.nextToken()))
{
showMainPage(activeChar);
return true;
@@ -162,7 +162,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
if (st.hasMoreTokens())
{
if (CTF.set_joiningLocationName(st.nextToken()))
if (CTF.setJoiningLocationName(st.nextToken()))
{
showMainPage(activeChar);
return true;
@@ -234,7 +234,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Cannot perform requested operation, Max lvl must be higher then Min");
return false;
}
if (CTF.set_maxlvl(lvl))
if (CTF.setMaxlvl(lvl))
{
showMainPage(activeChar);
return true;
@@ -247,8 +247,9 @@ public class AdminCTFEngine implements IAdminCommandHandler
}
case admin_ctf_tele_npc:
{
activeChar.teleToLocation(CTF.get_npcLocation(), false);
activeChar.teleToLocation(CTF.getNpcLocation(), false);
showMainPage(activeChar);
return false;
}
case admin_ctf_tele_team:
{
@@ -297,14 +298,14 @@ public class AdminCTFEngine implements IAdminCommandHandler
int id = 0;
try
{
id = Integer.valueOf(st.nextToken());
id = Integer.parseInt(st.nextToken());
}
catch (NumberFormatException e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_npc <npc_id>");
return false;
}
if (CTF.set_npcId(id))
if (CTF.setNpcId(id))
{
showMainPage(activeChar);
return true;
@@ -328,7 +329,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
int id = 0;
try
{
id = Integer.valueOf(st.nextToken());
id = Integer.parseInt(st.nextToken());
}
catch (NumberFormatException e)
{
@@ -353,7 +354,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
int amount = 0;
try
{
amount = Integer.valueOf(st.nextToken());
amount = Integer.parseInt(st.nextToken());
}
catch (NumberFormatException e)
{
@@ -521,7 +522,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_jointime <minutes>");
return false;
}
if (CTF.set_joinTime(time))
if (CTF.setJoinTime(time))
{
showMainPage(activeChar);
return true;
@@ -547,7 +548,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_eventtime <minutes>");
return false;
}
if (CTF.set_eventTime(time))
if (CTF.setEventTime(time))
{
showMainPage(activeChar);
return true;
@@ -560,7 +561,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
}
case admin_ctf_autoevent:
{
if ((CTF.get_joinTime() > 0) && (CTF.get_eventTime() > 0))
if ((CTF.getJoinTime() > 0) && (CTF.getEventTime() > 0))
{
CTF.autoEvent();
showMainPage(activeChar);
@@ -584,7 +585,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_interval <minutes>");
return false;
}
if (CTF.set_intervalBetweenMatches(time))
if (CTF.setIntervalBetweenMatches(time))
{
showMainPage(activeChar);
return true;
@@ -610,7 +611,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_minplayers <number>");
return false;
}
if (CTF.set_minPlayers(min))
if (CTF.setMinPlayers(min))
{
showMainPage(activeChar);
return true;
@@ -636,7 +637,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
BuilderUtil.sendSysMessage(activeChar, "Usage: //ctf_maxplayers <number>");
return false;
}
if (CTF.set_maxPlayers(max))
if (CTF.setMaxPlayers(max))
{
showMainPage(activeChar);
return true;
@@ -652,7 +653,6 @@ public class AdminCTFEngine implements IAdminCommandHandler
return false;
}
}
}
@Override
@@ -738,7 +738,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine]</font></center><br><br><br>");
replyMSG.append("<table><tr>");
if (!CTF.is_inProgress())
if (!CTF.isInProgress())
{
replyMSG.append("<td width=\"100\"><button value=\"Edit\" action=\"bypass -h admin_ctf_edit\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
}
@@ -746,13 +746,13 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("</tr></table><br>");
replyMSG.append("<br><font color=\"LEVEL\">Current event...</font><br1>");
replyMSG.append("Name:&nbsp;<font color=\"00FF00\">" + CTF.get_eventName() + "</font><br1>");
replyMSG.append("Description:&nbsp;<font color=\"00FF00\">" + CTF.get_eventDesc() + "</font><br1>");
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + CTF.get_joiningLocationName() + "</font><br1>");
replyMSG.append("Name:&nbsp;<font color=\"00FF00\">" + CTF.getEventName() + "</font><br1>");
replyMSG.append("Description:&nbsp;<font color=\"00FF00\">" + CTF.getEventDesc() + "</font><br1>");
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + CTF.getJoiningLocationName() + "</font><br1>");
final Location npc_loc = CTF.get_npcLocation();
final Location npcLoc = CTF.getNpcLocation();
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + CTF.get_npcId() + " on pos " + npc_loc.getX() + "," + npc_loc.getY() + "," + npc_loc.getZ() + "</font><br1>");
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + CTF.getNpcId() + " on pos " + npcLoc.getX() + "," + npcLoc.getY() + "," + npcLoc.getZ() + "</font><br1>");
replyMSG.append("<button value=\"Tele->NPC\" action=\"bypass -h admin_ctf_tele_npc\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>");
replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + CTF.get_rewardId() + "</font><br1>");
if (ItemTable.getInstance().getTemplate(CTF.get_rewardId()) != null)
@@ -765,11 +765,11 @@ public class AdminCTFEngine implements IAdminCommandHandler
}
replyMSG.append("Reward Amount:&nbsp;<font color=\"00FF00\">" + CTF.get_rewardAmount() + "</font><br>");
replyMSG.append("Min lvl:&nbsp;<font color=\"00FF00\">" + CTF.get_minlvl() + "</font><br1>");
replyMSG.append("Max lvl:&nbsp;<font color=\"00FF00\">" + CTF.get_maxlvl() + "</font><br><br>");
replyMSG.append("Min Players:&nbsp;<font color=\"00FF00\">" + CTF.get_minPlayers() + "</font><br1>");
replyMSG.append("Max Players:&nbsp;<font color=\"00FF00\">" + CTF.get_maxPlayers() + "</font><br>");
replyMSG.append("Joining Time:&nbsp;<font color=\"00FF00\">" + CTF.get_joinTime() + "</font><br1>");
replyMSG.append("Event Time:&nbsp;<font color=\"00FF00\">" + CTF.get_eventTime() + "</font><br>");
replyMSG.append("Max lvl:&nbsp;<font color=\"00FF00\">" + CTF.getMaxlvl() + "</font><br><br>");
replyMSG.append("Min Players:&nbsp;<font color=\"00FF00\">" + CTF.getMinPlayers() + "</font><br1>");
replyMSG.append("Max Players:&nbsp;<font color=\"00FF00\">" + CTF.getMaxPlayers() + "</font><br>");
replyMSG.append("Joining Time:&nbsp;<font color=\"00FF00\">" + CTF.getJoinTime() + "</font><br1>");
replyMSG.append("Event Time:&nbsp;<font color=\"00FF00\">" + CTF.getEventTime() + "</font><br>");
if ((CTF._teams != null) && !CTF._teams.isEmpty())
{
replyMSG.append("<font color=\"LEVEL\">Current teams:</font><br1>");
@@ -786,7 +786,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
}
else if (Config.CTF_EVEN_TEAMS.equals("SHUFFLE"))
{
if (CTF.is_teleport() || CTF.is_started())
if (CTF.isTeleport() || CTF.isStarted())
{
replyMSG.append("&nbsp;(" + CTF.teamPlayersCount(team) + " in)");
}
@@ -810,7 +810,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("<button value=\"Tele->Flag\" action=\"bypass -h admin_ctf_tele_flag " + team + "\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("</td></tr><tr><td>");
replyMSG.append(CTF._flagsX.get(CTF._teams.indexOf(team)) + ", " + CTF._flagsY.get(CTF._teams.indexOf(team)) + ", " + CTF._flagsZ.get(CTF._teams.indexOf(team)) + "</td></tr>");
if (!CTF.is_inProgress())
if (!CTF.isInProgress())
{
replyMSG.append("<tr><td width=\"60\"><button value=\"Remove\" action=\"bypass -h admin_ctf_team_remove " + team + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><tr></tr>");
}
@@ -818,7 +818,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("</table></center>");
if (!CTF.is_inProgress())
if (!CTF.isInProgress())
{
if (CTF.checkStartJoinOk())
{
@@ -834,7 +834,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("<br>");
}
}
else if (Config.CTF_EVEN_TEAMS.equals("SHUFFLE") && !CTF.is_started())
else if (Config.CTF_EVEN_TEAMS.equals("SHUFFLE") && !CTF.isStarted())
{
replyMSG.append("<br1>");
replyMSG.append(CTF._playersShuffle.size() + " players participating. Waiting to shuffle in teams(done on teleport)!");

View File

@@ -37,7 +37,7 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminCreateItem implements IAdminCommandHandler
{
private static Logger LOGGER = Logger.getLogger(AdminCreateItem.class.getName());
private static final Logger LOGGER = Logger.getLogger(AdminCreateItem.class.getName());
private static final String[] ADMIN_COMMANDS =
{
"admin_l2jmobius",
@@ -214,7 +214,7 @@ public class AdminCreateItem implements IAdminCommandHandler
}
}
PlayerInstance Player = null;
PlayerInstance player = null;
if (activeChar.getTarget() != null)
{
@@ -222,7 +222,7 @@ public class AdminCreateItem implements IAdminCommandHandler
{
if (activeChar.getAccessLevel().getLevel() > 70)
{
Player = (PlayerInstance) activeChar.getTarget();
player = (PlayerInstance) activeChar.getTarget();
}
else
{
@@ -237,23 +237,23 @@ public class AdminCreateItem implements IAdminCommandHandler
}
}
if (Player == null)
if (player == null)
{
activeChar.setTarget(activeChar);
Player = activeChar;
player = activeChar;
}
Player.getInventory().addItem("Admin", id, num, Player, null);
ItemList il = new ItemList(Player, true);
Player.sendPacket(il);
if (activeChar.getName().equalsIgnoreCase(Player.getName()))
player.getInventory().addItem("Admin", id, num, player, null);
ItemList il = new ItemList(player, true);
player.sendPacket(il);
if (activeChar.getName().equalsIgnoreCase(player.getName()))
{
BuilderUtil.sendSysMessage(activeChar, "You have spawned " + num + " item(s) number " + id + " in your inventory.");
}
else
{
BuilderUtil.sendSysMessage(activeChar, "You have spawned " + num + " item(s) number " + id + " in " + Player.getName() + "'s inventory.");
Player.sendMessage("Admin has spawned " + num + " item(s) number " + id + " in your inventory.");
BuilderUtil.sendSysMessage(activeChar, "You have spawned " + num + " item(s) number " + id + " in " + player.getName() + "'s inventory.");
player.sendMessage("Admin has spawned " + num + " item(s) number " + id + " in your inventory.");
}
}

View File

@@ -60,7 +60,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_name "))
{
if (DM.set_eventName(command.substring(19)))
if (DM.setEventName(command.substring(19)))
{
showMainPage(activeChar);
}
@@ -71,7 +71,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_desc "))
{
if (DM.set_eventDesc(command.substring(19)))
if (DM.setEventDesc(command.substring(19)))
{
showMainPage(activeChar);
}
@@ -83,12 +83,12 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_minlvl "))
{
if (!DM.checkMinLevel(Integer.valueOf(command.substring(21))))
if (!DM.checkMinLevel(Integer.parseInt(command.substring(21))))
{
return false;
}
if (DM.set_minlvl(Integer.valueOf(command.substring(21))))
if (DM.setMinlvl(Integer.parseInt(command.substring(21))))
{
showMainPage(activeChar);
}
@@ -99,12 +99,12 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_maxlvl "))
{
if (!DM.checkMaxLevel(Integer.valueOf(command.substring(21))))
if (!DM.checkMaxLevel(Integer.parseInt(command.substring(21))))
{
return false;
}
if (DM.set_maxlvl(Integer.valueOf(command.substring(21))))
if (DM.setMaxlvl(Integer.parseInt(command.substring(21))))
{
showMainPage(activeChar);
}
@@ -115,7 +115,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_join_loc "))
{
if (DM.set_joiningLocationName(command.substring(23)))
if (DM.setJoiningLocationName(command.substring(23)))
{
showMainPage(activeChar);
}
@@ -126,7 +126,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_npc "))
{
if (DM.set_npcId(Integer.valueOf(command.substring(18))))
if (DM.setNpcId(Integer.parseInt(command.substring(18))))
{
showMainPage(activeChar);
}
@@ -142,7 +142,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_reward "))
{
if (DM.set_rewardId(Integer.valueOf(command.substring(21))))
if (DM.setRewardId(Integer.parseInt(command.substring(21))))
{
showMainPage(activeChar);
}
@@ -153,7 +153,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_reward_amount "))
{
if (DM.set_rewardAmount(Integer.valueOf(command.substring(28))))
if (DM.setRewardAmount(Integer.parseInt(command.substring(28))))
{
showMainPage(activeChar);
}
@@ -169,7 +169,7 @@ public class AdminDMEngine implements IAdminCommandHandler
}
else if (command.startsWith("admin_dmevent_color "))
{
if (DM.set_playerColors(Integer.decode("0x" + command.substring(20))))
if (DM.setPlayerColors(Integer.decode("0x" + command.substring(20))))
{
showMainPage(activeChar);
}
@@ -293,22 +293,22 @@ public class AdminDMEngine implements IAdminCommandHandler
replyMSG.append("<td width=\"100\"><button value=\"Load\" action=\"bypass -h admin_dmevent_load\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
replyMSG.append("</tr></table><br><br>");
replyMSG.append("Current event...<br1>");
replyMSG.append("Name:&nbsp;<font color=\"00FF00\">" + DM.get_eventName() + "</font><br1>");
replyMSG.append("Description:&nbsp;<font color=\"00FF00\">" + DM.get_eventDesc() + "</font><br1>");
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + DM.get_joiningLocationName() + "</font><br1>");
replyMSG.append("Name:&nbsp;<font color=\"00FF00\">" + DM.getEventName() + "</font><br1>");
replyMSG.append("Description:&nbsp;<font color=\"00FF00\">" + DM.getEventDesc() + "</font><br1>");
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + DM.getJoiningLocationName() + "</font><br1>");
final Location npc_loc = DM.get_npcLocation();
final Location npcLoc = DM.getNpcLocation();
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + DM.get_npcId() + " on pos " + npc_loc.getX() + "," + npc_loc.getY() + "," + npc_loc.getZ() + "</font><br1>");
replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + DM.get_rewardId() + "</font><br1>");
replyMSG.append("Reward Amount:&nbsp;<font color=\"00FF00\">" + DM.get_rewardAmount() + "</font><br><br>");
replyMSG.append("Min lvl:&nbsp;<font color=\"00FF00\">" + DM.get_minlvl() + "</font><br>");
replyMSG.append("Max lvl:&nbsp;<font color=\"00FF00\">" + DM.get_maxlvl() + "</font><br><br>");
replyMSG.append("Death Match Color:&nbsp;<font color=\"00FF00\">" + DM.get_playerColors() + "</font><br>");
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + DM.getNpcId() + " on pos " + npcLoc.getX() + "," + npcLoc.getY() + "," + npcLoc.getZ() + "</font><br1>");
replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + DM.getRewardId() + "</font><br1>");
replyMSG.append("Reward Amount:&nbsp;<font color=\"00FF00\">" + DM.getRewardAmount() + "</font><br><br>");
replyMSG.append("Min lvl:&nbsp;<font color=\"00FF00\">" + DM.getMinlvl() + "</font><br>");
replyMSG.append("Max lvl:&nbsp;<font color=\"00FF00\">" + DM.getMaxlvl() + "</font><br><br>");
replyMSG.append("Death Match Color:&nbsp;<font color=\"00FF00\">" + DM.getPlayerColors() + "</font><br>");
final Location player_loc = DM.get_playersSpawnLocation();
final Location playerLoc = DM.get_playersSpawnLocation();
replyMSG.append("Death Match Spawn Pos:&nbsp;<font color=\"00FF00\">" + player_loc.getX() + "," + player_loc.getY() + "," + player_loc.getZ() + "</font><br><br>");
replyMSG.append("Death Match Spawn Pos:&nbsp;<font color=\"00FF00\">" + playerLoc.getX() + "," + playerLoc.getY() + "," + playerLoc.getZ() + "</font><br><br>");
replyMSG.append("Current players:<br1>");
if (!DM.is_started())

View File

@@ -60,7 +60,7 @@ public class AdminDelete implements IAdminCommandHandler
{
WorldObject obj = activeChar.getTarget();
if ((obj != null) && (obj instanceof NpcInstance))
if (obj instanceof NpcInstance)
{
final NpcInstance target = (NpcInstance) obj;
target.deleteMe();
@@ -76,13 +76,13 @@ public class AdminDelete implements IAdminCommandHandler
}
else
{
boolean update_db = true;
boolean update = true;
if (GrandBossManager.getInstance().isDefined(spawn.getNpcId()) && spawn.is_customBossInstance())
{
update_db = false;
update = false;
}
SpawnTable.getInstance().deleteSpawn(spawn, update_db);
SpawnTable.getInstance().deleteSpawn(spawn, update);
}
}

View File

@@ -44,7 +44,6 @@ import org.l2jmobius.gameserver.util.BuilderUtil;
*/
public class AdminDoorControl implements IAdminCommandHandler
{
private static DoorTable _doorTable;
private static final String[] ADMIN_COMMANDS =
{
"admin_open",
@@ -56,7 +55,7 @@ public class AdminDoorControl implements IAdminCommandHandler
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
_doorTable = DoorTable.getInstance();
final DoorTable doorTable = DoorTable.getInstance();
WorldObject target2 = null;
@@ -66,9 +65,9 @@ public class AdminDoorControl implements IAdminCommandHandler
{
final int doorId = Integer.parseInt(command.substring(12));
if (_doorTable.getDoor(doorId) != null)
if (doorTable.getDoor(doorId) != null)
{
_doorTable.getDoor(doorId).closeMe();
doorTable.getDoor(doorId).closeMe();
}
else
{
@@ -84,7 +83,6 @@ public class AdminDoorControl implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Wrong ID door.");
e.printStackTrace();
return false;
}
}
@@ -107,9 +105,9 @@ public class AdminDoorControl implements IAdminCommandHandler
{
final int doorId = Integer.parseInt(command.substring(11));
if (_doorTable.getDoor(doorId) != null)
if (doorTable.getDoor(doorId) != null)
{
_doorTable.getDoor(doorId).openMe();
doorTable.getDoor(doorId).openMe();
}
else
{
@@ -125,7 +123,6 @@ public class AdminDoorControl implements IAdminCommandHandler
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Wrong ID door.");
e.printStackTrace();
return false;
}
}
@@ -148,7 +145,7 @@ public class AdminDoorControl implements IAdminCommandHandler
{
try
{
for (DoorInstance door : _doorTable.getDoors())
for (DoorInstance door : doorTable.getDoors())
{
door.closeMe();
}
@@ -163,7 +160,6 @@ public class AdminDoorControl implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}
@@ -173,7 +169,7 @@ public class AdminDoorControl implements IAdminCommandHandler
// set limits on the PH door to do a cycle of opening doors.
try
{
for (DoorInstance door : _doorTable.getDoors())
for (DoorInstance door : doorTable.getDoors())
{
door.openMe();
}
@@ -188,7 +184,6 @@ public class AdminDoorControl implements IAdminCommandHandler
}
catch (Exception e)
{
e.printStackTrace();
return false;
}
}

View File

@@ -401,7 +401,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
else
{
val = val + " " + st.nextToken();
val += " " + st.nextToken();
}
}
}
@@ -474,7 +474,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
else
{
AdminHelpPage.showSubMenuPage(activeChar, "charclasses.htm");
AdminHelpPage.showHelpPage(activeChar, "charclasses.htm");
return false;
}
final WorldObject target = activeChar.getTarget();
@@ -939,15 +939,13 @@ public class AdminEditChar implements IAdminCommandHandler
private void listCharacters(PlayerInstance activeChar, int page)
{
final Collection<PlayerInstance> allPlayers_with_offlines = World.getInstance().getAllPlayers();
List<PlayerInstance> onlinePlayersList = new ArrayList<>();
List<PlayerInstance> online_players_list = new ArrayList<>();
for (PlayerInstance actual_player : allPlayers_with_offlines)
for (PlayerInstance actual_player : World.getInstance().getAllPlayers())
{
if ((actual_player != null) && (actual_player.isOnline() == 1) && !actual_player.isInOfflineMode())
{
online_players_list.add(actual_player);
onlinePlayersList.add(actual_player);
}
else if (actual_player == null)
{
@@ -955,35 +953,35 @@ public class AdminEditChar implements IAdminCommandHandler
}
}
PlayerInstance[] players = online_players_list.toArray(new PlayerInstance[online_players_list.size()]);
PlayerInstance[] players = onlinePlayersList.toArray(new PlayerInstance[onlinePlayersList.size()]);
final int MaxCharactersPerPage = 20;
int MaxPages = players.length / MaxCharactersPerPage;
int maxPages = players.length / MaxCharactersPerPage;
if (players.length > (MaxCharactersPerPage * MaxPages))
if (players.length > (MaxCharactersPerPage * maxPages))
{
MaxPages++;
maxPages++;
}
// Check if number of users changed
if (page > MaxPages)
if (page > maxPages)
{
page = MaxPages;
page = maxPages;
}
final int CharactersStart = MaxCharactersPerPage * page;
int CharactersEnd = players.length;
int charactersEnd = players.length;
if ((CharactersEnd - CharactersStart) > MaxCharactersPerPage)
if ((charactersEnd - CharactersStart) > MaxCharactersPerPage)
{
CharactersEnd = CharactersStart + MaxCharactersPerPage;
charactersEnd = CharactersStart + MaxCharactersPerPage;
}
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setFile("data/html/admin/charlist.htm");
StringBuilder replyMSG = new StringBuilder();
for (int x = 0; x < MaxPages; x++)
for (int x = 0; x < maxPages; x++)
{
final int pagenr = x + 1;
replyMSG.append("<center><a action=\"bypass -h admin_show_characters " + x + "\">Page " + pagenr + "</a></center>");
@@ -992,7 +990,7 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%pages%", replyMSG.toString());
replyMSG = new StringBuilder();
for (int i = CharactersStart; i < CharactersEnd; i++)
for (int i = CharactersStart; i < charactersEnd; i++)
{
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info " + players[i].getName() + "\">" + players[i].getName() + "</a></td><td width=110>" + players[i].getTemplate().className + "</td><td width=40>" + players[i].getLevel() + "</td></tr>");
}
@@ -1198,9 +1196,9 @@ public class AdminEditChar implements IAdminCommandHandler
gatherCharacterInfo(activeChar, player, "charedit.htm");
}
private void findCharacter(PlayerInstance activeChar, String CharacterToFind)
private void findCharacter(PlayerInstance activeChar, String characterToFind)
{
int CharactersFound = 0;
int charactersFound = 0;
String name;
Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
@@ -1214,13 +1212,13 @@ public class AdminEditChar implements IAdminCommandHandler
{
name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
CharactersFound = CharactersFound + 1;
charactersFound = charactersFound + 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_list " + name + "\">" + name + "</a></td><td width=110>" + player.getTemplate().className + "</td><td width=40>" + player.getLevel() + "</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1229,16 +1227,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
replyMSG = new StringBuilder();
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG.append("s. Please try again.");
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than 20");
replyMSG.append("s.<br>Please refine your search to see all of the results.");
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG.append('.');
}
@@ -1247,12 +1245,12 @@ public class AdminEditChar implements IAdminCommandHandler
replyMSG.append("s.");
}
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG.toString());
activeChar.sendPacket(adminReply);
}
private void findMultibox(PlayerInstance activeChar, int multibox) throws IllegalArgumentException
private void findMultibox(PlayerInstance activeChar, int multibox)
{
final Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
final PlayerInstance[] players = allPlayers.toArray(new PlayerInstance[allPlayers.size()]);
@@ -1310,12 +1308,11 @@ public class AdminEditChar implements IAdminCommandHandler
/**
* @param activeChar
* @param IpAdress
* @throws IllegalArgumentException
* @param ipAdress
*/
private void findCharactersPerIp(PlayerInstance activeChar, String IpAdress) throws IllegalArgumentException
private void findCharactersPerIp(PlayerInstance activeChar, String ipAdress)
{
if (!IpAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
if (!ipAdress.matches("^(?:(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))\\.){3}(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2(?:[0-4][0-9]|5[0-5]))$"))
{
throw new IllegalArgumentException("Malformed IPv4 number");
}
@@ -1323,7 +1320,7 @@ public class AdminEditChar implements IAdminCommandHandler
Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
PlayerInstance[] players = allPlayers.toArray(new PlayerInstance[allPlayers.size()]);
int CharactersFound = 0;
int charactersFound = 0;
String name;
String ip = "0.0.0.0";
@@ -1340,14 +1337,14 @@ public class AdminEditChar implements IAdminCommandHandler
ip = player.getClient().getConnection().getInetAddress().getHostAddress();
if (ip.equals(IpAdress))
if (ip.equals(ipAdress))
{
name = player.getName();
CharactersFound = CharactersFound + 1;
charactersFound = charactersFound + 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_list " + name + "\">" + name + "</a></td><td width=110>" + player.getTemplate().className + "</td><td width=40>" + player.getLevel() + "</td></tr>");
}
if (CharactersFound > 20)
if (charactersFound > 20)
{
break;
}
@@ -1356,16 +1353,16 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
replyMSG = new StringBuilder();
if (CharactersFound == 0)
if (charactersFound == 0)
{
replyMSG.append("s. Maybe they got d/c? :)");
}
else if (CharactersFound > 20)
else if (charactersFound > 20)
{
adminReply.replace("%number%", " more than " + CharactersFound);
adminReply.replace("%number%", " more than " + charactersFound);
replyMSG.append("s.<br>In order to avoid you a client crash I won't <br1>display results beyond the 20th character.");
}
else if (CharactersFound == 1)
else if (charactersFound == 1)
{
replyMSG.append('.');
}
@@ -1375,7 +1372,7 @@ public class AdminEditChar implements IAdminCommandHandler
}
adminReply.replace("%ip%", ip);
adminReply.replace("%number%", String.valueOf(CharactersFound));
adminReply.replace("%number%", String.valueOf(charactersFound));
adminReply.replace("%end%", replyMSG.toString());
activeChar.sendPacket(adminReply);
}
@@ -1383,9 +1380,8 @@ public class AdminEditChar implements IAdminCommandHandler
/**
* @param activeChar
* @param characterName
* @throws IllegalArgumentException
*/
private void findCharactersPerAccount(PlayerInstance activeChar, String characterName) throws IllegalArgumentException
private void findCharactersPerAccount(PlayerInstance activeChar, String characterName)
{
if (characterName.matches(Config.CNAME_TEMPLATE))
{

View File

@@ -51,11 +51,11 @@ import org.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
* @author terry Window - Preferences - Java - Code Style - Code Templates
* @author terry
*/
public class AdminEditNpc implements IAdminCommandHandler
{
private static Logger LOGGER = Logger.getLogger(AdminEditChar.class.getName());
private static final Logger LOGGER = Logger.getLogger(AdminEditNpc.class.getName());
private static final int PAGE_LIMIT = 7;
private static final String[] ADMIN_COMMANDS =
@@ -108,7 +108,7 @@ public class AdminEditNpc implements IAdminCommandHandler
{
String[] commandSplit = command.split(" ");
final int npcId = Integer.valueOf(commandSplit[1]);
final int npcId = Integer.parseInt(commandSplit[1]);
NpcTemplate npc = NpcTable.getInstance().getTemplate(npcId);
Show_Npc_Property(activeChar, npc);
@@ -120,7 +120,7 @@ public class AdminEditNpc implements IAdminCommandHandler
}
else if (activeChar.getTarget() instanceof NpcInstance)
{
final int npcId = Integer.valueOf(((NpcInstance) activeChar.getTarget()).getNpcId());
final int npcId = ((NpcInstance) activeChar.getTarget()).getNpcId();
NpcTemplate npc = NpcTable.getInstance().getTemplate(npcId);
Show_Npc_Property(activeChar, npc);
@@ -544,12 +544,12 @@ public class AdminEditNpc implements IAdminCommandHandler
private void editShopItem(PlayerInstance activeChar, String[] args)
{
final int tradeListID = Integer.parseInt(args[1]);
final int itemID = Integer.parseInt(args[2]);
final int itemId = Integer.parseInt(args[2]);
StoreTradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);
Item item = ItemTable.getInstance().getTemplate(itemID);
Item item = ItemTable.getInstance().getTemplate(itemId);
if (tradeList.getPriceForItemId(itemID) < 0)
if (tradeList.getPriceForItemId(itemId) < 0)
{
return;
}
@@ -557,10 +557,10 @@ public class AdminEditNpc implements IAdminCommandHandler
if (args.length > 3)
{
final int price = Integer.parseInt(args[3]);
final int order = findOrderTradeList(itemID, tradeList.getPriceForItemId(itemID), tradeListID);
final int order = findOrderTradeList(itemId, tradeList.getPriceForItemId(itemId), tradeListID);
tradeList.replaceItem(itemID, Integer.parseInt(args[3]));
updateTradeList(itemID, price, tradeListID, order);
tradeList.replaceItem(itemId, Integer.parseInt(args[3]));
updateTradeList(itemId, price, tradeListID, order);
BuilderUtil.sendSysMessage(activeChar, "Updated price for " + item.getName() + " in Trade List " + tradeListID);
showShopList(activeChar, tradeListID, 1);
@@ -577,10 +577,10 @@ public class AdminEditNpc implements IAdminCommandHandler
replyMSG.append("<table>");
replyMSG.append("<tr><td width=100>Property</td><td width=100>Edit Field</td><td width=100>Old Value</td></tr>");
replyMSG.append("<tr><td><br></td><td></td></tr>");
replyMSG.append("<tr><td>Price</td><td><edit var=\"price\" width=80></td><td>" + tradeList.getPriceForItemId(itemID) + "</td></tr>");
replyMSG.append("<tr><td>Price</td><td><edit var=\"price\" width=80></td><td>" + tradeList.getPriceForItemId(itemId) + "</td></tr>");
replyMSG.append("</table>");
replyMSG.append("<center><br><br><br>");
replyMSG.append("<button value=\"Save\" action=\"bypass -h admin_editShopItem " + tradeListID + " " + itemID + " $price\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<button value=\"Save\" action=\"bypass -h admin_editShopItem " + tradeListID + " " + itemId + " $price\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<br><button value=\"Back\" action=\"bypass -h admin_showShopList " + tradeListID + " 1\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("</center>");
replyMSG.append("</body></html>");
@@ -795,11 +795,11 @@ public class AdminEditNpc implements IAdminCommandHandler
activeChar.sendPacket(adminReply);
}
private void storeTradeList(int itemID, int price, int tradeListID, int order)
private void storeTradeList(int itemId, int price, int tradeListID, int order)
{
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("INSERT INTO merchant_buylists (`item_id`,`price`,`shop_id`,`order`) values (" + itemID + "," + price + "," + tradeListID + "," + order + ")");
PreparedStatement stmt = con.prepareStatement("INSERT INTO merchant_buylists (`item_id`,`price`,`shop_id`,`order`) values (" + itemId + "," + price + "," + tradeListID + "," + order + ")");
stmt.execute();
stmt.close();
}
@@ -809,7 +809,7 @@ public class AdminEditNpc implements IAdminCommandHandler
}
}
private void updateTradeList(int itemID, int price, int tradeListID, int order)
private void updateTradeList(int itemId, int price, int tradeListID, int order)
{
try (Connection con = DatabaseFactory.getConnection())
{
@@ -823,11 +823,11 @@ public class AdminEditNpc implements IAdminCommandHandler
}
}
private void deleteTradeList(int tradeListID, int order)
private void deleteTradeList(int tradeListId, int order)
{
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("DELETE FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `order`='" + order + "'");
PreparedStatement stmt = con.prepareStatement("DELETE FROM merchant_buylists WHERE `shop_id`='" + tradeListId + "' AND `order`='" + order + "'");
stmt.execute();
stmt.close();
}
@@ -837,12 +837,12 @@ public class AdminEditNpc implements IAdminCommandHandler
}
}
private int findOrderTradeList(int itemID, int price, int tradeListID)
private int findOrderTradeList(int itemId, int price, int tradeListId)
{
int order = 0;
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("SELECT * FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `item_id` ='" + itemID + "' AND `price` = '" + price + "'");
PreparedStatement stmt = con.prepareStatement("SELECT * FROM merchant_buylists WHERE `shop_id`='" + tradeListId + "' AND `item_id` ='" + itemId + "' AND `price` = '" + price + "'");
ResultSet rs = stmt.executeQuery();
rs.first();
@@ -858,11 +858,11 @@ public class AdminEditNpc implements IAdminCommandHandler
return order;
}
private List<StoreTradeList> getTradeLists(int merchantID)
private List<StoreTradeList> getTradeLists(int merchantId)
{
String target = "npc_%objectId%_Buy";
String content = HtmCache.getInstance().getHtm("data/html/merchant/" + merchantID + ".htm");
String content = HtmCache.getInstance().getHtm("data/html/merchant/" + merchantId + ".htm");
if (content == null)
{
@@ -988,7 +988,7 @@ public class AdminEditNpc implements IAdminCommandHandler
{
case "templateId":
{
newNpcData.set("idTemplate", Integer.valueOf(value));
newNpcData.set("idTemplate", Integer.parseInt(value));
break;
}
case "name":
@@ -998,7 +998,7 @@ public class AdminEditNpc implements IAdminCommandHandler
}
case "serverSideName":
{
newNpcData.set("serverSideName", Integer.valueOf(value));
newNpcData.set("serverSideName", Integer.parseInt(value));
break;
}
case "title":
@@ -1008,27 +1008,27 @@ public class AdminEditNpc implements IAdminCommandHandler
}
case "serverSideTitle":
{
newNpcData.set("serverSideTitle", Integer.valueOf(value) == 1 ? 1 : 0);
newNpcData.set("serverSideTitle", Integer.parseInt(value) == 1 ? 1 : 0);
break;
}
case "collisionRadius":
{
newNpcData.set("collision_radius", Integer.valueOf(value));
newNpcData.set("collision_radius", Integer.parseInt(value));
break;
}
case "collisionHeight":
{
newNpcData.set("collision_height", Integer.valueOf(value));
newNpcData.set("collision_height", Integer.parseInt(value));
break;
}
case "level":
{
newNpcData.set("level", Integer.valueOf(value));
newNpcData.set("level", Integer.parseInt(value));
break;
}
case "sex":
{
final int intValue = Integer.valueOf(value);
final int intValue = Integer.parseInt(value);
newNpcData.set("sex", intValue == 0 ? "male" : intValue == 1 ? "female" : "etc");
break;
}
@@ -1040,122 +1040,122 @@ public class AdminEditNpc implements IAdminCommandHandler
}
case "attackRange":
{
newNpcData.set("attackrange", Integer.valueOf(value));
newNpcData.set("attackrange", Integer.parseInt(value));
break;
}
case "hp":
{
newNpcData.set("hp", Integer.valueOf(value));
newNpcData.set("hp", Integer.parseInt(value));
break;
}
case "mp":
{
newNpcData.set("mp", Integer.valueOf(value));
newNpcData.set("mp", Integer.parseInt(value));
break;
}
case "hpRegen":
{
newNpcData.set("hpreg", Integer.valueOf(value));
newNpcData.set("hpreg", Integer.parseInt(value));
break;
}
case "mpRegen":
{
newNpcData.set("mpreg", Integer.valueOf(value));
newNpcData.set("mpreg", Integer.parseInt(value));
break;
}
case "str":
{
newNpcData.set("str", Integer.valueOf(value));
newNpcData.set("str", Integer.parseInt(value));
break;
}
case "con":
{
newNpcData.set("con", Integer.valueOf(value));
newNpcData.set("con", Integer.parseInt(value));
break;
}
case "dex":
{
newNpcData.set("dex", Integer.valueOf(value));
newNpcData.set("dex", Integer.parseInt(value));
break;
}
case "int":
{
newNpcData.set("int", Integer.valueOf(value));
newNpcData.set("int", Integer.parseInt(value));
break;
}
case "wit":
{
newNpcData.set("wit", Integer.valueOf(value));
newNpcData.set("wit", Integer.parseInt(value));
break;
}
case "men":
{
newNpcData.set("men", Integer.valueOf(value));
newNpcData.set("men", Integer.parseInt(value));
break;
}
case "exp":
{
newNpcData.set("exp", Integer.valueOf(value));
newNpcData.set("exp", Integer.parseInt(value));
break;
}
case "sp":
{
newNpcData.set("sp", Integer.valueOf(value));
newNpcData.set("sp", Integer.parseInt(value));
break;
}
case "pAtk":
{
newNpcData.set("patk", Integer.valueOf(value));
newNpcData.set("patk", Integer.parseInt(value));
break;
}
case "pDef":
{
newNpcData.set("pdef", Integer.valueOf(value));
newNpcData.set("pdef", Integer.parseInt(value));
break;
}
case "mAtk":
{
newNpcData.set("matk", Integer.valueOf(value));
newNpcData.set("matk", Integer.parseInt(value));
break;
}
case "mDef":
{
newNpcData.set("mdef", Integer.valueOf(value));
newNpcData.set("mdef", Integer.parseInt(value));
break;
}
case "pAtkSpd":
{
newNpcData.set("atkspd", Integer.valueOf(value));
newNpcData.set("atkspd", Integer.parseInt(value));
break;
}
case "aggro":
{
newNpcData.set("aggro", Integer.valueOf(value));
newNpcData.set("aggro", Integer.parseInt(value));
break;
}
case "mAtkSpd":
{
newNpcData.set("matkspd", Integer.valueOf(value));
newNpcData.set("matkspd", Integer.parseInt(value));
break;
}
case "rHand":
{
newNpcData.set("rhand", Integer.valueOf(value));
newNpcData.set("rhand", Integer.parseInt(value));
break;
}
case "lHand":
{
newNpcData.set("lhand", Integer.valueOf(value));
newNpcData.set("lhand", Integer.parseInt(value));
break;
}
case "armor":
{
newNpcData.set("armor", Integer.valueOf(value));
newNpcData.set("armor", Integer.parseInt(value));
break;
}
case "runSpd":
{
newNpcData.set("runspd", Integer.valueOf(value));
newNpcData.set("runspd", Integer.parseInt(value));
break;
}
case "factionId":
@@ -1165,17 +1165,17 @@ public class AdminEditNpc implements IAdminCommandHandler
}
case "factionRange":
{
newNpcData.set("faction_range", Integer.valueOf(value));
newNpcData.set("faction_range", Integer.parseInt(value));
break;
}
case "isUndead":
{
newNpcData.set("isUndead", Integer.valueOf(value) == 1 ? 1 : 0);
newNpcData.set("isUndead", Integer.parseInt(value) == 1 ? 1 : 0);
break;
}
case "absorbLevel":
{
final int intVal = Integer.valueOf(value);
final int intVal = Integer.parseInt(value);
newNpcData.set("absorb_level", intVal < 0 ? 0 : intVal > 12 ? 0 : intVal);
break;
}
@@ -1477,35 +1477,35 @@ public class AdminEditNpc implements IAdminCommandHandler
final Map<Integer, Skill> skills = npcData.getSkills();
final int _skillsize = Integer.valueOf(skills.size());
final int skillSize = skills.size();
final int MaxSkillsPerPage = 10;
int MaxPages = _skillsize / MaxSkillsPerPage;
if (_skillsize > (MaxSkillsPerPage * MaxPages))
final int maxSkillsPerPage = 10;
int maxPages = skillSize / maxSkillsPerPage;
if (skillSize > (maxSkillsPerPage * maxPages))
{
MaxPages++;
maxPages++;
}
if (page > MaxPages)
if (page > maxPages)
{
page = MaxPages;
page = maxPages;
}
final int SkillsStart = MaxSkillsPerPage * page;
int SkillsEnd = _skillsize;
if ((SkillsEnd - SkillsStart) > MaxSkillsPerPage)
final int SkillsStart = maxSkillsPerPage * page;
int skillsEnd = skillSize;
if ((skillsEnd - SkillsStart) > maxSkillsPerPage)
{
SkillsEnd = SkillsStart + MaxSkillsPerPage;
skillsEnd = SkillsStart + maxSkillsPerPage;
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("");
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>" + npcData.getName() + " Skillist");
replyMSG.append(" (ID:" + npcData.getNpcId() + "Skills " + Integer.valueOf(_skillsize) + ")</title>");
replyMSG.append(" (ID:" + npcData.getNpcId() + "Skills " + skillSize + ")</title>");
replyMSG.append("<body>");
String pages = "<center><table width=270><tr>";
for (int x = 0; x < MaxPages; x++)
for (int x = 0; x < maxPages; x++)
{
final int pagenr = x + 1;
if (page == x)
@@ -1538,7 +1538,7 @@ public class AdminEditNpc implements IAdminCommandHandler
while (skillite.hasNext())
{
cnt++;
if (cnt > SkillsEnd)
if (cnt > skillsEnd)
{
break;
}
@@ -1565,7 +1565,7 @@ public class AdminEditNpc implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>(NPC:" + npcId + " SKILL:" + skillId + ")</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>(NPC:" + npcId + " SKILL:" + skillId + ")</title>");
replyMSG.append("<body>");
if (skillData.next())
@@ -1603,7 +1603,7 @@ public class AdminEditNpc implements IAdminCommandHandler
if (skillData == null)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Update Npc Skill Data</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Update Npc Skill Data</title>");
replyMSG.append("<body>");
replyMSG.append("<center><button value=\"Back to Skillist\" action=\"bypass -h admin_show_skilllist_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
replyMSG.append("</body></html>");
@@ -1628,7 +1628,7 @@ public class AdminEditNpc implements IAdminCommandHandler
reLoadNpcSkillList(npcId);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Update Npc Skill Data</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Update Npc Skill Data</title>");
replyMSG.append("<body>");
replyMSG.append("<center><button value=\"Back to Skillist\" action=\"bypass -h admin_show_skilllist_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
replyMSG.append("</body></html>");
@@ -1650,7 +1650,7 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Add Skill to " + npcData.getName() + "(ID:" + npcData.getNpcId() + ")</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Add Skill to " + npcData.getName() + "(ID:" + npcData.getNpcId() + ")</title>");
replyMSG.append("<body>");
replyMSG.append("<table>");
replyMSG.append("<tr><td>SkillId</td><td><edit var=\"skillId\" width=80></td></tr>");
@@ -1674,7 +1674,7 @@ public class AdminEditNpc implements IAdminCommandHandler
if (skillData == null)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Add Skill to Npc</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Add Skill to Npc</title>");
replyMSG.append("<body>");
replyMSG.append("<center><button value=\"Back to Skillist\" action=\"bypass -h admin_show_skilllist_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
replyMSG.append("</body></html>");
@@ -1696,7 +1696,7 @@ public class AdminEditNpc implements IAdminCommandHandler
reLoadNpcSkillList(npcId);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Add Skill to Npc (" + npcId + ", " + skillId + ", " + level + ")</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Add Skill to Npc (" + npcId + ", " + skillId + ", " + level + ")</title>");
replyMSG.append("<body>");
replyMSG.append("<center><button value=\"Add Skill\" action=\"bypass -h admin_add_skill_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<br><br><button value=\"Back to Skillist\" action=\"bypass -h admin_show_skilllist_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
@@ -1725,7 +1725,7 @@ public class AdminEditNpc implements IAdminCommandHandler
reLoadNpcSkillList(npcId);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuffer replyMSG = new StringBuffer("<html><title>Delete Skill (" + npcId + ", " + skillId + ")</title>");
final StringBuilder replyMSG = new StringBuilder("<html><title>Delete Skill (" + npcId + ", " + skillId + ")</title>");
replyMSG.append("<body>");
replyMSG.append("<center><button value=\"Back to Skillist\" action=\"bypass -h admin_show_skilllist_npc " + npcId + "\" width=100 height=20 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
replyMSG.append("</body></html>");

View File

@@ -792,9 +792,9 @@ public class AdminEffects implements IAdminCommandHandler
private void playAdminSound(PlayerInstance activeChar, String sound)
{
PlaySound _snd = new PlaySound(1, sound, 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.broadcastPacket(_snd);
PlaySound snd = new PlaySound(1, sound, 0, 0, 0, 0, 0);
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);
BuilderUtil.sendSysMessage(activeChar, "Playing " + sound + ".");
}

View File

@@ -279,7 +279,7 @@ public class AdminEventEngine implements IAdminCommandHandler
int i = 0;
while (GameEvent.participatingPlayers.size() > 0)
while (!GameEvent.participatingPlayers.isEmpty())
{
String target = getMaxLeveledPlayer();
@@ -443,9 +443,9 @@ public class AdminEventEngine implements IAdminCommandHandler
muestraNpcConInfoAPlayers(activeChar, GameEvent.id);
PlaySound _snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
activeChar.sendPacket(_snd);
activeChar.broadcastPacket(_snd);
PlaySound snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
activeChar.sendPacket(snd);
activeChar.broadcastPacket(snd);
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
@@ -682,11 +682,11 @@ public class AdminEventEngine implements IAdminCommandHandler
void destroyEventNpcs()
{
NpcInstance npc;
while (GameEvent.npcs.size() > 0)
while (!GameEvent.npcs.isEmpty())
{
try
{
npc = (NpcInstance) World.getInstance().findObject(Integer.parseInt(GameEvent.npcs.getFirst()));
npc = (NpcInstance) World.getInstance().findObject(Integer.parseInt(GameEvent.npcs.get(0)));
Spawn spawn = npc.getSpawn();
if (spawn != null)
@@ -696,11 +696,11 @@ public class AdminEventEngine implements IAdminCommandHandler
}
npc.deleteMe();
GameEvent.npcs.removeFirst();
GameEvent.npcs.remove(0);
}
catch (Exception e)
{
GameEvent.npcs.removeFirst();
GameEvent.npcs.remove(0);
}
}
}

View File

@@ -115,7 +115,7 @@ public class AdminExpSp implements IAdminCommandHandler
activeChar.sendPacket(adminReply);
}
private boolean adminAddExpSp(PlayerInstance activeChar, String ExpSp)
private boolean adminAddExpSp(PlayerInstance activeChar, String expSp)
{
WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@@ -130,7 +130,7 @@ public class AdminExpSp implements IAdminCommandHandler
return false;
}
StringTokenizer st = new StringTokenizer(ExpSp);
StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{
@@ -165,7 +165,7 @@ public class AdminExpSp implements IAdminCommandHandler
return true;
}
private boolean adminRemoveExpSP(PlayerInstance activeChar, String ExpSp)
private boolean adminRemoveExpSP(PlayerInstance activeChar, String expSp)
{
WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
@@ -180,7 +180,7 @@ public class AdminExpSp implements IAdminCommandHandler
return false;
}
StringTokenizer st = new StringTokenizer(ExpSp);
StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{

View File

@@ -246,86 +246,86 @@ public class AdminFightCalculator implements IAdminCommandHandler
for (int i = 0; i < 10000; i++)
{
final boolean _miss1 = Formulas.calcHitMiss(npc1, npc2);
if (_miss1)
final boolean calcMiss1 = Formulas.calcHitMiss(npc1, npc2);
if (calcMiss1)
{
miss1++;
}
final boolean _shld1 = Formulas.calcShldUse(npc1, npc2);
if (_shld1)
final boolean calcShld1 = Formulas.calcShldUse(npc1, npc2);
if (calcShld1)
{
shld1++;
}
final boolean _crit1 = Formulas.calcCrit(npc1.getCriticalHit(npc2, null));
if (_crit1)
final boolean calcCrit1 = Formulas.calcCrit(npc1.getCriticalHit(npc2, null));
if (calcCrit1)
{
crit1++;
}
final boolean _crit4 = Formulas.calcCrit(npc1.getMCriticalHit(npc2, null));
if (_crit4)
final boolean calcCrit4 = Formulas.calcCrit(npc1.getMCriticalHit(npc2, null));
if (calcCrit4)
{
crit4++;
}
double _patk1 = npc1.getPAtk(npc2);
_patk1 += Rnd.nextDouble() * npc1.getRandomDamage(npc2);
patk1 += _patk1;
double npcPatk1 = npc1.getPAtk(npc2);
npcPatk1 += Rnd.nextDouble() * npc1.getRandomDamage(npc2);
patk1 += npcPatk1;
final double _pdef1 = npc1.getPDef(npc2);
pdef1 += _pdef1;
final double npcPdef1 = npc1.getPDef(npc2);
pdef1 += npcPdef1;
if (!_miss1)
if (!calcMiss1)
{
npc1.setAttackingBodypart();
final double _dmg1 = Formulas.calcPhysDam(npc1, npc2, null, _shld1, _crit1, false, false);
dmg1 += _dmg1;
final double calcDmg1 = Formulas.calcPhysDam(npc1, npc2, null, calcShld1, calcCrit1, false, false);
dmg1 += calcDmg1;
npc1.abortAttack();
}
}
for (int i = 0; i < 10000; i++)
{
final boolean _miss2 = Formulas.calcHitMiss(npc2, npc1);
if (_miss2)
final boolean calcMiss2 = Formulas.calcHitMiss(npc2, npc1);
if (calcMiss2)
{
miss2++;
}
final boolean _shld2 = Formulas.calcShldUse(npc2, npc1);
if (_shld2)
final boolean calcShld2 = Formulas.calcShldUse(npc2, npc1);
if (calcShld2)
{
shld2++;
}
final boolean _crit2 = Formulas.calcCrit(npc2.getCriticalHit(npc1, null));
if (_crit2)
final boolean calcCrit2 = Formulas.calcCrit(npc2.getCriticalHit(npc1, null));
if (calcCrit2)
{
crit2++;
}
final boolean _crit3 = Formulas.calcCrit(npc2.getMCriticalHit(npc1, null));
if (_crit3)
final boolean calcCrit3 = Formulas.calcCrit(npc2.getMCriticalHit(npc1, null));
if (calcCrit3)
{
crit3++;
}
double _patk2 = npc2.getPAtk(npc1);
_patk2 += Rnd.nextDouble() * npc2.getRandomDamage(npc1);
patk2 += _patk2;
double npcPatk2 = npc2.getPAtk(npc1);
npcPatk2 += Rnd.nextDouble() * npc2.getRandomDamage(npc1);
patk2 += npcPatk2;
final double _pdef2 = npc2.getPDef(npc1);
pdef2 += _pdef2;
final double npcPdef2 = npc2.getPDef(npc1);
pdef2 += npcPdef2;
if (!_miss2)
if (!calcMiss2)
{
npc2.setAttackingBodypart();
final double _dmg2 = Formulas.calcPhysDam(npc2, npc1, null, _shld2, _crit2, false, false);
dmg2 += _dmg2;
final double calcDmg2 = Formulas.calcPhysDam(npc2, npc1, null, calcShld2, calcCrit2, false, false);
dmg2 += calcDmg2;
npc2.abortAttack();
}
}

View File

@@ -66,12 +66,4 @@ public class AdminHelpPage implements IAdminCommandHandler
adminReply.setHtml(content);
targetChar.sendPacket(adminReply);
}
public static void showSubMenuPage(PlayerInstance targetChar, String filename)
{
String content = HtmCache.getInstance().getHtmForce("data/html/admin/" + filename);
NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setHtml(content);
targetChar.sendPacket(adminReply);
}
}

View File

@@ -75,14 +75,14 @@ public class AdminLevel implements IAdminCommandHandler
final Playable targetPlayer = (Playable) targetChar;
final byte lvl = Byte.parseByte(val);
int max_level = ExperienceData.getInstance().getMaxLevel();
int maxLevel = ExperienceData.getInstance().getMaxLevel();
if ((targetChar instanceof PlayerInstance) && ((PlayerInstance) targetPlayer).isSubClassActive())
{
max_level = Config.MAX_SUBCLASS_LEVEL;
maxLevel = Config.MAX_SUBCLASS_LEVEL;
}
if ((lvl >= 1) && (lvl <= max_level))
if ((lvl >= 1) && (lvl <= maxLevel))
{
final long pXp = targetPlayer.getStat().getExp();
final long tXp = ExperienceData.getInstance().getExpForLevel(lvl);

Some files were not shown because too many files have changed in this diff Show More