Code review Part 5.

This commit is contained in:
MobiusDevelopment
2019-12-22 15:33:46 +00:00
parent 4a563b8832
commit 7f3befa63c
4071 changed files with 23938 additions and 28938 deletions
@@ -71,14 +71,12 @@ public class SummonPc extends AbstractNpcAI
final Attackable monster = (Attackable) npc;
if (monster.getMostHated() != null)
{
if (((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10))
if ((((monster.getMostHated() == attacker) && (chance < 50)) || (chance < 10)) //
&& ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill())))
{
if ((SUMMON_PC.getSkill().getMpConsume() < npc.getCurrentMp()) && (SUMMON_PC.getSkill().getHpConsume() < npc.getCurrentHp()) && !npc.isSkillDisabled(SUMMON_PC.getSkill()))
{
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
npc.setTarget(attacker);
npc.doCast(SUMMON_PC.getSkill());
npc.getVariables().set("attacked", true);
}
}
}
@@ -63,7 +63,7 @@ public class Ingrit extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_INRGIT)
{
QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":
@@ -63,7 +63,7 @@ public class Iris extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_IRIS)
{
QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":
@@ -63,7 +63,7 @@ public class Magrit extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_MARGIT)
{
QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00933_ExploringTheWestWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":
@@ -63,7 +63,7 @@ public class Rosammy extends AbstractNpcAI
{
if (npc.getId() == SOUL_TRACKER_ROSAMMY)
{
QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
final QuestState qs = player.getQuestState("Q00935_ExploringTheEastWingOfTheDungeonOfAbyss");
switch (event)
{
case "1":
@@ -70,7 +70,7 @@ public class AttributeMaster extends AbstractNpcAI
spirit.upgrade();
}
}
UserInfo userInfo = new UserInfo(player);
final UserInfo userInfo = new UserInfo(player);
userInfo.addComponentType(UserInfoType.ATT_SPIRITS);
player.sendPacket(userInfo);
player.sendPacket(new ElementalSpiritInfo(player, player.getActiveElementalSpiritType(), (byte) 0x01));
@@ -54,7 +54,7 @@ public class DimensionalMerchant extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = null;
final String htmltext = null;
switch (event)
{
case "package_deposit":
@@ -46,6 +46,8 @@ import ai.AbstractNpcAI;
*/
public class OlyManager extends AbstractNpcAI implements IBypassHandler
{
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
// NPC
private static final int MANAGER = 31688;
// Misc
@@ -56,7 +58,6 @@ public class OlyManager extends AbstractNpcAI implements IBypassHandler
"watchmatch",
"arenachange"
};
private static final Logger LOGGER = Logger.getLogger(OlyManager.class.getName());
private OlyManager()
{
@@ -39,6 +39,7 @@ import ai.AbstractNpcAI;
public class EilhalderVonHellmann extends AbstractNpcAI
{
private static final Logger LOGGER = Logger.getLogger(EilhalderVonHellmann.class.getName());
private static final int EILHALDER_VON_HELLMANN = 25328;
private NpcSpawnTemplate _template;
@@ -33,7 +33,7 @@ import ai.AbstractNpcAI;
*/
public class NpcLocationInfo extends AbstractNpcAI
{
private static final List<Integer> NPC = new ArrayList<>();
private static final List<Integer> NPC = new ArrayList<>();
static
{
NPC.add(30598);
@@ -42,7 +42,7 @@ public class NpcLocationInfo extends AbstractNpcAI
NPC.add(30601);
NPC.add(30602);
}
private static final List<Integer> NPCRADAR = new ArrayList<>();
private static final List<Integer> NPCRADAR = new ArrayList<>();
static
{
// Talking Island
@@ -224,7 +224,9 @@ public class NpcLocationInfo extends AbstractNpcAI
final int npcId = Integer.parseInt(event);
if (NPCRADAR.contains(npcId))
{
int x = 0, y = 0, z = 0;
int x = 0;
int y = 0;
int z = 0;
final Spawn spawn = SpawnTable.getInstance().getAnySpawn(npcId);
if (spawn != null)
{
@@ -243,7 +245,7 @@ public class NpcLocationInfo extends AbstractNpcAI
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext = getNoQuestMsg(player);
int npcId = npc.getId();
final int npcId = npc.getId();
if (NPC.contains(npcId))
{
htmltext = npcId + ".htm";
@@ -257,7 +259,7 @@ public class NpcLocationInfo extends AbstractNpcAI
addTalkId(NPC);
}
public static void main(String args[])
public static void main(String[] args)
{
new NpcLocationInfo();
}
@@ -73,7 +73,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
public boolean useBypass(String command, PlayerInstance player, Creature target)
{
String cmd = "";
StringBuilder params = new StringBuilder();
final StringBuilder params = new StringBuilder();
final StringTokenizer st = new StringTokenizer(command, " ");
if (st.hasMoreTokens())
@@ -130,7 +130,7 @@ public class SellBuff implements IVoicedCommandHandler, IBypassHandler
}
else
{
StringBuilder title = new StringBuilder();
final StringBuilder title = new StringBuilder();
title.append("BUFF SELL: ");
final StringTokenizer st = new StringTokenizer(params, " ");
while (st.hasMoreTokens())
@@ -543,12 +543,12 @@ public class MerrySquashmas extends LongTimeEvent
{
case 13399: // Snowy Squash Seed
{
randomSpawn(13402, 13401, 13400, npc, true);
randomSpawn(13402, 13401, 13400, npc);
break;
}
case 13403: // Large Snowy Squash Seed
{
randomSpawn(13406, 13405, 13404, npc, true);
randomSpawn(13406, 13405, 13404, npc);
break;
}
}
@@ -600,7 +600,7 @@ public class MerrySquashmas extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)
@@ -542,12 +542,12 @@ public class SquashEvent extends LongTimeEvent
{
case 12774: // Young Squash
{
randomSpawn(13016, 12775, 12776, npc, true);
randomSpawn(13016, 12775, 12776, npc);
break;
}
case 12777: // Large Young Squash
{
randomSpawn(13017, 12778, 12779, npc, true);
randomSpawn(13017, 12778, 12779, npc);
break;
}
}
@@ -599,7 +599,7 @@ public class SquashEvent extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)
@@ -540,12 +540,12 @@ public class WatermelonNinja extends LongTimeEvent
{
case 13271: // Watermelon Seed
{
randomSpawn(13274, 13273, 13272, npc, true);
randomSpawn(13274, 13273, 13272, npc);
break;
}
case 13275: // Honey Watermelon Seed
{
randomSpawn(13278, 13277, 13276, npc, true);
randomSpawn(13278, 13277, 13276, npc);
break;
}
}
@@ -575,20 +575,10 @@ public class WatermelonNinja extends LongTimeEvent
final int chance = Rnd.get(100);
for (int[] drop : DROPLIST)
{
if (npcId == drop[0])
if ((npcId == drop[0]) && (chance < drop[2]))
{
if (chance < drop[2])
{
if (drop[1] > 6000)
{
((MonsterInstance) mob).dropItem(player, drop[1], 1);
}
else
{
((MonsterInstance) mob).dropItem(player, drop[1], 1);
}
continue;
}
((MonsterInstance) mob).dropItem(player, drop[1], 1);
continue;
}
if (npcId < drop[0])
{
@@ -597,18 +587,18 @@ public class WatermelonNinja extends LongTimeEvent
}
}
private void randomSpawn(int low, int medium, int high, Npc npc, boolean delete)
private void randomSpawn(int low, int medium, int high, Npc npc)
{
final int _random = Rnd.get(100);
if (_random < 5)
final int random = Rnd.get(100);
if (random < 5)
{
spawnNext(low, npc);
}
if (_random < 10)
if (random < 10)
{
spawnNext(medium, npc);
}
else if (_random < 30)
else if (random < 30)
{
spawnNext(high, npc);
}
@@ -734,7 +734,6 @@ public class MasterHandler
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Failed loading handler: " + c.getSimpleName(), e);
continue;
}
}
}
@@ -72,7 +72,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken();
st.nextToken();
if (!st.hasMoreTokens())
{
BuilderUtil.sendSysMessage(activeChar, "Skill Id and level are not specified.");
@@ -176,9 +176,9 @@ public class AdminBuffs implements IAdminCommandHandler
{
try
{
StringTokenizer st = new StringTokenizer(command, " ");
final StringTokenizer st = new StringTokenizer(command, " ");
st.nextToken();
int objectId = Integer.parseInt(st.nextToken());
final int objectId = Integer.parseInt(st.nextToken());
viewBlockedEffects(activeChar, objectId);
return true;
}
@@ -362,6 +362,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if ((target != null) && (skillId > 0))
@@ -389,6 +390,7 @@ public class AdminBuffs implements IAdminCommandHandler
}
catch (Exception e)
{
// Checked bellow.
}
if (target != null)
@@ -120,7 +120,7 @@ public class AdminInstanceZone implements IAdminCommandHandler
{
int hours = 0;
int minutes = 0;
int id = entry.getKey();
final int id = entry.getKey();
final long remainingTime = (entry.getValue() - System.currentTimeMillis()) / 1000;
if (remainingTime > 0)
{
@@ -30,8 +30,8 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in
* that radius will be killed.
* This class handles following admin commands: - kill = kills target Creature - kill_monster = kills target non-player - kill <radius> = If radius is specified, then ALL players only in that radius will be killed. - kill_monster <radius> = If radius is specified, then ALL non-players only in that
* radius will be killed.
* @version $Revision: 1.2.4.5 $ $Date: 2007/07/31 10:06:06 $
*/
public class AdminKill implements IAdminCommandHandler
@@ -316,7 +316,7 @@ public class AdminQuest implements IAdminCommandHandler
{
continue;
}
else if (n.isDirectory())
if (n.isDirectory())
{
sb.append("<a action=\"bypass -h admin_script_dir " + c + "\">" + c + "</a><br1>");
}
@@ -348,7 +348,7 @@ public class AdminQuest implements IAdminCommandHandler
{
continue;
}
else if (n.isDirectory())
if (n.isDirectory())
{
sb.append("<a action=\"bypass -h admin_script_dir " + currentPath + "/" + c + "\">" + (questReducedNames ? getQuestName(c) : c) + "</a><br1>");
}
@@ -69,7 +69,7 @@ public class AdminShop implements IAdminCommandHandler
{
try
{
int listId = Integer.parseInt(command.substring(16).trim());
final int listId = Integer.parseInt(command.substring(16).trim());
MultisellData.getInstance().separateAndSend(listId, activeChar, null, false);
}
catch (NumberFormatException | IndexOutOfBoundsException e)
@@ -81,7 +81,7 @@ public class AdminShop implements IAdminCommandHandler
{
try
{
int listId = Integer.parseInt(command.substring(20).trim());
final int listId = Integer.parseInt(command.substring(20).trim());
MultisellData.getInstance().separateAndSend(listId, activeChar, null, true);
}
catch (NumberFormatException | IndexOutOfBoundsException e)
@@ -101,6 +101,7 @@ public class AdminSkill implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.startsWith("admin_skill_list"))
@@ -116,6 +117,7 @@ public class AdminSkill implements IAdminCommandHandler
}
catch (StringIndexOutOfBoundsException e)
{
// Not important.
}
}
else if (command.startsWith("admin_add_skill"))
@@ -84,7 +84,7 @@ public class FindPvP implements IBypassHandler
// Check if the player's clan is already outnumbering the PvP
if (player.getClan() != null)
{
Map<Integer, Integer> clanNumbers = new HashMap<>();
final Map<Integer, Integer> clanNumbers = new HashMap<>();
int allyId = player.getAllyId();
if (allyId == 0)
{
@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExItemAuctionInfoPacket;
public class ItemAuctionLink implements IBypassHandler
{
private static final SimpleDateFormat fmt = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
private static final SimpleDateFormat SDF = new SimpleDateFormat("HH:mm:ss dd.MM.yyyy");
private static final String[] COMMANDS =
{
@@ -91,7 +91,7 @@ public class ItemAuctionLink implements IBypassHandler
if (nextAuction != null)
{
player.sendMessage("The next auction will begin on the " + fmt.format(new Date(nextAuction.getStartingTime())) + ".");
player.sendMessage("The next auction will begin on the " + SDF.format(new Date(nextAuction.getStartingTime())) + ".");
}
return true;
}
@@ -408,7 +408,7 @@ public class NpcViewMod implements IBypassHandler
{
final StringBuilder sb = new StringBuilder();
int height = 64;
final int height = 64;
final DropHolder dropItem = dropList.get(i);
final Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());
@@ -38,22 +38,19 @@ public class ChatPartyRoomAll implements IChatHandler
@Override
public void handleChat(ChatType type, PlayerInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().isLeader(activeChar))
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
}
}
@@ -38,22 +38,19 @@ public class ChatPartyRoomCommander implements IChatHandler
@Override
public void handleChat(ChatType type, PlayerInstance activeChar, String target, String text)
{
if (activeChar.isInParty())
if (activeChar.isInParty() && activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
{
if (activeChar.getParty().isInCommandChannel() && activeChar.getParty().getCommandChannel().getLeader().equals(activeChar))
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
if (activeChar.isChatBanned() && Config.BAN_CHAT_CHANNELS.contains(type))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
return;
}
if (Config.JAIL_DISABLE_CHAT && activeChar.isJailed() && !activeChar.canOverrideCond(PlayerCondOverride.CHAT_CONDITIONS))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED);
return;
}
activeChar.getParty().getCommandChannel().broadcastCreatureSay(new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text), activeChar);
}
}
@@ -143,38 +143,38 @@ public class DropSearchBoard implements IParseBoardHandler
public boolean parseCommunityBoardCommand(String command, PlayerInstance player)
{
final String navigation = HtmCache.getInstance().getHtm(player, NAVIGATION_PATH);
String[] params = command.split(" ");
final String[] params = command.split(" ");
String html = HtmCache.getInstance().getHtm(player, "data/html/CommunityBoard/Custom/dropsearch/main.html");
switch (params[0])
{
case "_bbs_search_item":
{
String itemName = buildItemName(params);
String result = buildItemSearchResult(itemName);
final String itemName = buildItemName(params);
final String result = buildItemSearchResult(itemName);
html = html.replace("%searchResult%", result);
break;
}
case "_bbs_search_drop":
{
final DecimalFormat chanceFormat = new DecimalFormat("0.00##");
int itemId = Integer.parseInt(params[1]);
final int itemId = Integer.parseInt(params[1]);
int page = Integer.parseInt(params[2]);
List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
final List<CBDropHolder> list = DROP_INDEX_CACHE.get(itemId);
int pages = list.size() / 14;
if (pages == 0)
{
pages++;
}
int start = (page - 1) * 14;
int end = Math.min(list.size() - 1, start + 14);
StringBuilder builder = new StringBuilder();
final int start = (page - 1) * 14;
final int end = Math.min(list.size() - 1, start + 14);
final StringBuilder builder = new StringBuilder();
final double dropAmountEffectBonus = player.getStat().getValue(Stats.BONUS_DROP_AMOUNT, 1);
final double dropRateEffectBonus = player.getStat().getValue(Stats.BONUS_DROP_RATE, 1);
final double spoilRateEffectBonus = player.getStat().getValue(Stats.BONUS_SPOIL_RATE, 1);
for (int index = start; index <= end; index++)
{
CBDropHolder cbDropHolder = list.get(index);
final CBDropHolder cbDropHolder = list.get(index);
// real time server rate calculations
double rateChance = 1;
@@ -299,15 +299,15 @@ public class DropSearchBoard implements IParseBoardHandler
}
case "_bbs_npc_trace":
{
int npcId = Integer.parseInt(params[1]);
List<NpcSpawnTemplate> spawnList = SpawnsData.getInstance().getNpcSpawns(npc -> npc.getId() == npcId);
final int npcId = Integer.parseInt(params[1]);
final List<NpcSpawnTemplate> spawnList = SpawnsData.getInstance().getNpcSpawns(npc -> npc.getId() == npcId);
if (spawnList.isEmpty())
{
player.sendMessage("Cannot find any spawn. Maybe dropped by a boss or instance monster.");
}
else
{
NpcSpawnTemplate spawn = spawnList.get(Rnd.get(spawnList.size()));
final NpcSpawnTemplate spawn = spawnList.get(Rnd.get(spawnList.size()));
player.getRadar().addMarker(spawn.getSpawnLocation().getX(), spawn.getSpawnLocation().getY(), spawn.getSpawnLocation().getZ());
}
break;
@@ -330,8 +330,8 @@ public class DropSearchBoard implements IParseBoardHandler
private String buildItemSearchResult(String itemName)
{
int limit = 0;
Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
List<Item> items = new ArrayList<>();
final Set<Integer> existInDropData = DROP_INDEX_CACHE.keySet();
final List<Item> items = new ArrayList<>();
for (Item item : ItemTable.getInstance().getAllItems())
{
if (item == null)
@@ -363,7 +363,7 @@ public class DropSearchBoard implements IParseBoardHandler
int line = 0;
StringBuilder builder = new StringBuilder(items.size() * 28);
final StringBuilder builder = new StringBuilder(items.size() * 28);
int i = 0;
for (Item item : items)
{
@@ -416,7 +416,7 @@ public class DropSearchBoard implements IParseBoardHandler
*/
private String buildItemName(String[] params)
{
StringJoiner joiner = new StringJoiner(" ");
final StringJoiner joiner = new StringJoiner(" ");
for (int i = 1; i < params.length; i++)
{
joiner.add(params[i]);
@@ -99,7 +99,7 @@ public class HomeBoard implements IParseBoardHandler
@Override
public String[] getCommunityBoardCommands()
{
List<String> commands = new ArrayList<>();
final List<String> commands = new ArrayList<>();
commands.addAll(Arrays.asList(COMMANDS));
commands.addAll(Arrays.asList(CUSTOM_COMMANDS));
return commands.stream().filter(Objects::nonNull).toArray(String[]::new);
@@ -201,7 +201,7 @@ public class HomeBoard implements IParseBoardHandler
{
player.destroyItemByItemId("CB_Buff", Config.COMMUNITYBOARD_CURRENCY, Config.COMMUNITYBOARD_BUFF_PRICE * buffCount, player, true);
final PetInstance pet = player.getPet();
List<Creature> targets = new ArrayList<>(4);
final List<Creature> targets = new ArrayList<>(4);
targets.add(player);
if (pet != null)
{
@@ -38,7 +38,7 @@ public class DispelBySlotMyself extends AbstractEffect
public DispelBySlotMyself(StatsSet params)
{
String dispel = params.getString("dispel");
final String dispel = params.getString("dispel");
if ((dispel != null) && !dispel.isEmpty())
{
_dispelAbnormals = new HashSet<>();
@@ -51,7 +51,7 @@ public class FatalBlow extends AbstractEffect
_criticalChance = params.getDouble("criticalChance", 0);
_overHit = params.getBoolean("overHit", false);
String abnormals = params.getString("abnormalType", null);
final String abnormals = params.getString("abnormalType", null);
if ((abnormals != null) && !abnormals.isEmpty())
{
_abnormals = new HashSet<>();
@@ -87,7 +87,7 @@ public class RebalanceHP extends AbstractEffect
}
}
double percentHP = currentHPs / fullHP;
final double percentHP = currentHPs / fullHP;
for (PlayerInstance member : party.getMembers())
{
if (!member.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, member, true))
@@ -70,7 +70,7 @@ public class RebalanceHPSummon extends AbstractEffect
fullHP += effector.getMaxHp();
currentHPs += effector.getCurrentHp();
double percentHP = currentHPs / fullHP;
final double percentHP = currentHPs / fullHP;
for (Summon summon : effector.getServitors().values())
{
if (!summon.isDead() && Util.checkIfInRange(skill.getAffectRange(), effector, summon, true))
@@ -109,7 +109,7 @@ public class RestorationRandom extends AbstractEffect
continue;
}
long itemCount = (long) (createdItem.getCount() * Config.RATE_EXTRACTABLE);
final long itemCount = (long) (createdItem.getCount() * Config.RATE_EXTRACTABLE);
final ItemInstance newItem = player.addItem("Extract", createdItem.getId(), itemCount, effector, false);
if (createdItem.getMaxEnchant() > 0)
@@ -88,17 +88,14 @@ public class Enemy implements ITargetTypeHandler
if (target.isAutoAttackable(creature) || forceUse)
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -124,17 +121,14 @@ public class Enemy implements ITargetTypeHandler
}
// Is this check still actual?
if (forceUse && (target.getActingPlayer() != null) && (creature.getActingPlayer() != null))
if (forceUse && (target.getActingPlayer() != null) && (creature.getActingPlayer() != null) && creature.getActingPlayer().isSiegeFriend(target))
{
if (creature.getActingPlayer().isSiegeFriend(target))
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
}
return target;
@@ -60,17 +60,14 @@ public class EnemyNot implements ITargetTypeHandler
if (!target.isAutoAttackable(creature))
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
if ((skill.isFlyType()) && !GeoEngine.getInstance().canMoveToTarget(creature.getX(), creature.getY(), creature.getZ(), target.getX(), target.getY(), target.getZ(), creature.getInstanceWorld()))
@@ -88,17 +88,14 @@ public class EnemyOnly implements ITargetTypeHandler
if (target.isAutoAttackable(creature))
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -124,17 +121,14 @@ public class EnemyOnly implements ITargetTypeHandler
}
// Is this check still actual?
if ((target.getActingPlayer() != null) && (creature.getActingPlayer() != null))
if ((target.getActingPlayer() != null) && (creature.getActingPlayer() != null) && creature.getActingPlayer().isSiegeFriend(target))
{
if (creature.getActingPlayer().isSiegeFriend(target))
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
creature.sendPacket(SystemMessageId.FORCE_ATTACK_IS_IMPOSSIBLE_AGAINST_A_TEMPORARY_ALLIED_MEMBER_DURING_A_SIEGE);
}
return null;
}
return target;
@@ -63,16 +63,13 @@ public class NpcBody implements ITargetTypeHandler
if (target.isDead())
{
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -93,17 +93,14 @@ public class PcBody implements ITargetTypeHandler
}
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
// Geodata check when character is within range.
@@ -62,17 +62,14 @@ public class Target implements ITargetTypeHandler
}
// Check for cast range if character cannot move. TODO: char will start follow until within castrange, but if his moving is blocked by geodata, this msg will be sent.
if (dontMove)
if (dontMove && (creature.calculateDistance2D(target) > skill.getCastRange()))
{
if (creature.calculateDistance2D(target) > skill.getCastRange())
if (sendMessage)
{
if (sendMessage)
{
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
creature.sendPacket(SystemMessageId.THE_DISTANCE_IS_TOO_FAR_AND_SO_THE_CASTING_HAS_BEEN_CANCELLED);
}
return null;
}
if (skill.isFlyType() && !GeoEngine.getInstance().canMoveToTarget(creature.getX(), creature.getY(), creature.getZ(), target.getX(), target.getY(), target.getZ(), creature.getInstanceWorld()))
@@ -24,10 +24,8 @@ import java.util.ArrayList;
import org.l2jmobius.gameserver.data.xml.impl.SkillData;
import org.l2jmobius.gameserver.geoengine.GeoEngine;
import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.DecoyInstance;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.skills.Skill;
import org.l2jmobius.gameserver.util.Util;
@@ -52,7 +50,7 @@ public class ScarletVanHalisha extends AbstractNpcAI
private Creature _target;
private Skill _skill;
private long _lastRangedSkillTime;
private final int _rangedSkillMinCoolTime = 60000; // 1 minute
private static final int RANGED_SKILL_MIN_COOLTIME = 60000; // 1 minute
public ScarletVanHalisha()
{
@@ -144,11 +142,11 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_CHARGE, 2);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_FIELD, 1);
}
else if (((_lastRangedSkillTime + _rangedSkillMinCoolTime) < System.currentTimeMillis()) && (getRandom(100) < 10))
else if (((_lastRangedSkillTime + RANGED_SKILL_MIN_COOLTIME) < System.currentTimeMillis()) && (getRandom(100) < 10))
{
return SkillData.getInstance().getSkill(FRINTEZZA_DAEMON_MORPH, 1);
}
@@ -215,55 +213,50 @@ public class ScarletVanHalisha extends AbstractNpcAI
{
final ArrayList<Creature> result = new ArrayList<>();
{
for (WorldObject obj : npc.getInstanceWorld().getPlayers())
for (PlayerInstance obj : npc.getInstanceWorld().getPlayers())
{
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
if (obj.isPlayer() && obj.getActingPlayer().isInvisible())
{
continue;
}
if (((((Creature) obj).getZ() < (npc.getZ() - 100)) && (((Creature) obj).getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
continue;
}
continue;
}
if (obj.isPlayable() || (obj instanceof DecoyInstance))
if (((obj.getZ() < (npc.getZ() - 100)) && (obj.getZ() > (npc.getZ() + 100))) || !GeoEngine.getInstance().canSeeTarget(obj, npc))
{
int skillRange = 150;
if (skill != null)
continue;
}
int skillRange = 150;
if (skill != null)
{
switch (skill.getId())
{
switch (skill.getId())
case FRINTEZZA_DAEMON_ATTACK:
{
case FRINTEZZA_DAEMON_ATTACK:
{
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
skillRange = 150;
break;
}
case FRINTEZZA_DAEMON_CHARGE:
{
skillRange = 400;
break;
}
case YOKE_OF_SCARLET:
{
skillRange = 200;
break;
}
case FRINTEZZA_DAEMON_MORPH:
case FRINTEZZA_DAEMON_FIELD:
{
_lastRangedSkillTime = System.currentTimeMillis();
skillRange = 550;
break;
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((Creature) obj).isDead())
{
result.add((Creature) obj);
}
}
if (Util.checkIfInRange(skillRange, npc, obj, true) && !((Creature) obj).isDead())
{
result.add(obj);
}
}
}
@@ -198,51 +198,48 @@ public class MonsterArena extends AbstractInstance
case "supply_reward":
{
final Instance world = npc.getInstanceWorld();
if ((world != null) && (npc.getId() == SUPPLIES) && (player.getLevel() > 39))
if ((world != null) && (npc.getId() == SUPPLIES) && (player.getLevel() > 39) && !REWARDED_PLAYERS.contains(player) && npc.isScriptValue(0))
{
if (!REWARDED_PLAYERS.contains(player) && npc.isScriptValue(0))
npc.setScriptValue(1);
npc.doDie(npc);
REWARDED_PLAYERS.add(player);
ThreadPool.schedule(() ->
{
npc.setScriptValue(1);
npc.doDie(npc);
REWARDED_PLAYERS.add(player);
ThreadPool.schedule(() ->
{
REWARDED_PLAYERS.remove(player);
}, 60000);
// Mandatory reward.
final Npc machine = world.getNpc(MACHINE);
final int progress = GlobalVariablesManager.getInstance().getInt(MONSTER_ARENA_VARIABLE + machine.getScriptValue());
if (progress > 16)
{
giveItems(player, BATTLE_BOX_4, 1);
}
else if (progress > 11)
{
giveItems(player, BATTLE_BOX_3, 1);
}
else if (progress > 6)
{
giveItems(player, BATTLE_BOX_2, 1);
}
else
{
giveItems(player, BATTLE_BOX_1, 1);
}
// Rare reward.
if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_L, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_M, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_H, 1);
}
REWARDED_PLAYERS.remove(player);
}, 60000);
// Mandatory reward.
final Npc machine = world.getNpc(MACHINE);
final int progress = GlobalVariablesManager.getInstance().getInt(MONSTER_ARENA_VARIABLE + machine.getScriptValue());
if (progress > 16)
{
giveItems(player, BATTLE_BOX_4, 1);
}
else if (progress > 11)
{
giveItems(player, BATTLE_BOX_3, 1);
}
else if (progress > 6)
{
giveItems(player, BATTLE_BOX_2, 1);
}
else
{
giveItems(player, BATTLE_BOX_1, 1);
}
// Rare reward.
if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_L, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_M, 1);
}
else if (getRandom(100) < 1) // 1% chance.
{
giveItems(player, TICKET_H, 1);
}
}
break;
@@ -180,6 +180,7 @@ public class ResidenceOfQueenNebula extends AbstractInstance
{
world.finishInstance();
}
break;
}
case WATER_SLIME:
{
@@ -217,6 +218,7 @@ public class ResidenceOfQueenNebula extends AbstractInstance
skill.applyEffects(player, player);
}
}
break;
}
}
@@ -163,12 +163,9 @@ public class SevenSignsRBs extends AbstractInstance
{
for (Creature charInside : _anakim_zone.getCharactersInside())
{
if (charInside != null)
if ((charInside != null) && charInside.isPlayer())
{
if (charInside.isPlayer())
{
charInside.teleToLocation(-20185 + getRandom(50), 13476 + getRandom(50), -4901);
}
charInside.teleToLocation(-20185 + getRandom(50), 13476 + getRandom(50), -4901);
}
}
break;
@@ -177,12 +174,9 @@ public class SevenSignsRBs extends AbstractInstance
{
for (Creature charInside : _lilith_zone.getCharactersInside())
{
if (charInside != null)
if ((charInside != null) && charInside.isPlayer())
{
if (charInside.isPlayer())
{
charInside.teleToLocation(171346 + getRandom(50), -17599 + getRandom(50), -4901);
}
charInside.teleToLocation(171346 + getRandom(50), -17599 + getRandom(50), -4901);
}
}
break;
@@ -154,7 +154,7 @@ public class Q00255_Tutorial extends Quest
return null;
}
String htmltext = null;
final String htmltext = null;
switch (event)
{
case "start_newbie_tutorial":
@@ -89,7 +89,7 @@ public class Q00300_HuntingLetoLizardman extends Quest
if (getQuestItemsCount(player, BRACELET_OF_LIZARDMAN) >= REQUIRED_BRACELET_COUNT)
{
takeItems(player, BRACELET_OF_LIZARDMAN, -1);
int rand = getRandom(1000);
final int rand = getRandom(1000);
if (rand < 500)
{
giveItems(player, REWARD_ADENA);
@@ -72,7 +72,7 @@ public class Q00326_VanquishRemnants extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{
@@ -345,7 +345,7 @@ public class Q00327_RecoverTheFarmland extends Quest
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getQuestState(killer, false);
if(qs != null)
if (qs != null)
{
if ((npc.getId() == TUREK_ORK_SHAMAN) || (npc.getId() == TUREK_ORK_WARLORD))
{
@@ -74,7 +74,7 @@ public class Q00328_SenseForBusiness extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{
@@ -68,7 +68,7 @@ public class Q00331_ArrowOfVengeance extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{
@@ -132,30 +132,27 @@ public class Q00331_ArrowOfVengeance extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isPet)
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if ((qs != null) && (getRandom(100) < MONSTERS.get(npc.getId())))
{
if (getRandom(100) < MONSTERS.get(npc.getId()))
switch (npc.getId())
{
switch (npc.getId())
case 20145:
{
case 20145:
{
giveItems(player, HARPY_FEATHER, 1);
break;
}
case 20158:
{
giveItems(player, MEDUSA_VENOM, 1);
break;
}
case 20176:
{
giveItems(player, WYRMS_TOOTH, 1);
break;
}
giveItems(player, HARPY_FEATHER, 1);
break;
}
case 20158:
{
giveItems(player, MEDUSA_VENOM, 1);
break;
}
case 20176:
{
giveItems(player, WYRMS_TOOTH, 1);
break;
}
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
return super.onKill(npc, player, isPet);
}
@@ -1050,7 +1050,7 @@ public class Q00333_HuntOfTheBlackLion extends Quest
final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON);
if (itemcount < 20)
{
// Do nothing?
}
else if (itemcount < 50)
{
@@ -1081,7 +1081,7 @@ public class Q00333_HuntOfTheBlackLion extends Quest
final long itemcount = getQuestItemsCount(player, UNDEAD_ASH) + getQuestItemsCount(player, BLOODY_AXE_INSIGNIA) + getQuestItemsCount(player, DELU_LIZARDMAN_FANG) + getQuestItemsCount(player, STAKATO_TALON);
if (itemcount < 20)
{
// Do nothing?
}
else if (itemcount < 50)
{
@@ -44,7 +44,7 @@ public class Q00344_1000YearsTheEndOfLamentation extends Quest
private static final ItemHolder TOTEM_NECKLACE = new ItemHolder(4272, 1);
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
// Monsters
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant
@@ -112,9 +112,9 @@ public class Q00354_ConquestOfAlligatorIsland extends Quest
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (MOB1.containsKey(npcId))
{
giveItemRandomly(qs.getPlayer(), npc, ALLIGATOR_TOOTH, 1, 0, MOB1.get(npcId), true);
@@ -217,7 +217,7 @@ public class Q00355_FamilyHonor extends Quest
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
QuestState qs = getQuestState(player, true);
final QuestState qs = getQuestState(player, true);
String htmltext = getNoQuestMsg(player);
if (qs.isCreated())
{
@@ -116,7 +116,7 @@ public class Q00369_CollectorOfJewels extends Quest
final QuestItemHolder item = MOBS_DROP_CHANCES.get(npc.getId());
if (getRandom(100) < item.getChance())
{
PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
final PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
final QuestState qs = getQuestState(luckyPlayer, false);
@@ -127,12 +127,12 @@ public class Q00370_AnElderSowsSeeds extends Quest
@Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (MOBS1.containsKey(npcId))
{
if (getRandom(100) < MOBS1.get(npcId))
{
PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
final PlayerInstance luckyPlayer = getRandomPartyMember(player, npc);
if (luckyPlayer != null)
{
giveItemRandomly(luckyPlayer, npc, SPELLBOOK_PAGE, 1, 0, 1.0, true);
@@ -142,7 +142,7 @@ public class Q00370_AnElderSowsSeeds extends Quest
else
{
final QuestState qs = getRandomPartyMemberState(player, -1, 3, npc);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, SPELLBOOK_PAGE, 1, 0, MOBS2.get(npcId), true);
}
@@ -238,12 +238,12 @@ public class Q00662_AGameOfCards extends Quest
{
final int cond = qs.getInt("v1");
int i1 = qs.getInt("ExMemoState");
int i5 = i1 % 100;
final int i5 = i1 % 100;
int i9 = i1 / 100;
i1 = cond % 100;
int i2 = (cond % 10000) / 100;
int i3 = (cond % 1000000) / 10000;
int i4 = (cond % 100000000) / 1000000;
final int i2 = (cond % 10000) / 100;
final int i3 = (cond % 1000000) / 10000;
final int i4 = (cond % 100000000) / 1000000;
switch (event)
{
case "turncard1":
@@ -531,52 +531,52 @@ public class Q00662_AGameOfCards extends Quest
{
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
htmltext = htmltext.replace("FontColor1", "FFFF00");
htmltext = htmltext.replace("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = htmltext.replace("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
htmltext = htmltext.replace("FontColor2", "FFFF00");
htmltext = htmltext.replace("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = htmltext.replace("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
htmltext = htmltext.replace("FontColor3", "FFFF00");
htmltext = htmltext.replace("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = htmltext.replace("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
htmltext = htmltext.replace("FontColor4", "FFFF00");
htmltext = htmltext.replace("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = htmltext.replace("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
htmltext = htmltext.replace("FontColor5", "FFFF00");
htmltext = htmltext.replace("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = htmltext.replace("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
@@ -612,66 +612,66 @@ public class Q00662_AGameOfCards extends Quest
}
else if (qs.getInt("ExMemoState") != 0)
{
int i0 = qs.getInt("v1");
final int i0 = qs.getInt("v1");
int i1 = qs.getInt("ExMemoState");
int i5 = i1 % 100;
int i9 = i1 / 100;
final int i5 = i1 % 100;
final int i9 = i1 / 100;
i1 = i0 % 100;
int i2 = (i0 % 10000) / 100;
int i3 = (i0 % 1000000) / 10000;
int i4 = (i0 % 100000000) / 1000000;
final int i2 = (i0 % 10000) / 100;
final int i3 = (i0 % 1000000) / 10000;
final int i4 = (i0 % 100000000) / 1000000;
htmltext = getHtm(player, "30845-11a.html");
if ((i9 % 2) < 1)
{
htmltext = htmltext.replaceAll("FontColor1", "FFFF00");
htmltext = htmltext.replaceAll("Cell1", "?");
htmltext = htmltext.replace("FontColor1", "FFFF00");
htmltext = htmltext.replace("Cell1", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor1", "FF6F6F");
htmltext = htmltext.replace("FontColor1", "FF6F6F");
htmltext = setHtml(htmltext, i1, "Cell1");
}
if ((i9 % 4) < 2)
{
htmltext = htmltext.replaceAll("FontColor2", "FFFF00");
htmltext = htmltext.replaceAll("Cell2", "?");
htmltext = htmltext.replace("FontColor2", "FFFF00");
htmltext = htmltext.replace("Cell2", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor2", "FF6F6F");
htmltext = htmltext.replace("FontColor2", "FF6F6F");
htmltext = setHtml(htmltext, i2, "Cell2");
}
if ((i9 % 8) < 4)
{
htmltext = htmltext.replaceAll("FontColor3", "FFFF00");
htmltext = htmltext.replaceAll("Cell3", "?");
htmltext = htmltext.replace("FontColor3", "FFFF00");
htmltext = htmltext.replace("Cell3", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor3", "FF6F6F");
htmltext = htmltext.replace("FontColor3", "FF6F6F");
htmltext = setHtml(htmltext, i3, "Cell3");
}
if ((i9 % 16) < 8)
{
htmltext = htmltext.replaceAll("FontColor4", "FFFF00");
htmltext = htmltext.replaceAll("Cell4", "?");
htmltext = htmltext.replace("FontColor4", "FFFF00");
htmltext = htmltext.replace("Cell4", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor4", "FF6F6F");
htmltext = htmltext.replace("FontColor4", "FF6F6F");
htmltext = setHtml(htmltext, i4, "Cell4");
}
if ((i9 % 32) < 16)
{
htmltext = htmltext.replaceAll("FontColor5", "FFFF00");
htmltext = htmltext.replaceAll("Cell5", "?");
htmltext = htmltext.replace("FontColor5", "FFFF00");
htmltext = htmltext.replace("Cell5", "?");
}
else
{
htmltext = htmltext.replaceAll("FontColor5", "FF6F6F");
htmltext = htmltext.replace("FontColor5", "FF6F6F");
htmltext = setHtml(htmltext, i5, "Cell5");
}
}
@@ -710,7 +710,7 @@ public class Q00662_AGameOfCards extends Quest
if (MONSTERS.get(npc.getId()) < getRandom(1000))
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if (qs != null)
{
giveItemRandomly(qs.getPlayer(), npc, RED_GEM, 1, 0, MONSTERS.get(npc.getId()), true);
}
@@ -163,8 +163,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -186,8 +186,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -209,8 +209,8 @@ public class Q10962_NewHorizons extends Quest
player.sendPacket(ExRequestClassChangeUi.STATIC_PACKET);
}
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -43,9 +43,9 @@ public class Q10966_ATripBegins extends Quest
private static final int BELLA = 30256;
// Items
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 10);// TODO: Replace with Advanced Scroll of Escape Event(s)
private static final ItemHolder TALISMAN_OF_ADEN = new ItemHolder(91745, 1);// TODO: Fix item
private static final ItemHolder SCROLL_OF_ENCHANT_TALISMAN_OF_ADEN = new ItemHolder(91756, 1);// TODO: Fix item
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 10); // TODO: Replace with Advanced Scroll of Escape Event(s)
private static final ItemHolder TALISMAN_OF_ADEN = new ItemHolder(91745, 1); // TODO: Fix item
private static final ItemHolder SCROLL_OF_ENCHANT_TALISMAN_OF_ADEN = new ItemHolder(91756, 1); // TODO: Fix item
private static final ItemHolder ADVENTURERS_BRACELET = new ItemHolder(91934, 1);
// Monsters
private static final int ARACHNID_PREDATOR = 20926;
@@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ExShowScreenMessage;
* Cultured Adventurer (10967)
* @author RobikBobik
* @Note: Based on NA server September 2019
* @TODO: Maybe wrong NpcStringId when you killing monsters in Abandoned Camp
* @TODO: Maybe wrong NpcStringId when you killing monsters in Abandoned Camp
*/
public class Q10967_CulturedAdventurer extends Quest
{
@@ -47,7 +47,7 @@ public class Q10982_SpiderHunt extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -149,8 +149,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -168,8 +168,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -187,8 +187,8 @@ public class Q10982_SpiderHunt extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -47,7 +47,7 @@ public class Q10984_CollectSpiderweb extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -149,8 +149,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -168,8 +168,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -187,8 +187,8 @@ public class Q10984_CollectSpiderweb extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -48,7 +48,7 @@ public class Q10986_SwampMonster extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -150,8 +150,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -169,8 +169,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -188,8 +188,8 @@ public class Q10986_SwampMonster extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -48,7 +48,7 @@ public class Q10988_Conspiracy extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -150,8 +150,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -169,8 +169,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -188,8 +188,8 @@ public class Q10988_Conspiracy extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -46,7 +46,7 @@ public class Q10990_PoisonExtraction extends Quest
private static final ItemHolder SOE_TO_CAPTAIN_BATHIS = new ItemHolder(91651, 1);
private static final ItemHolder SOE_NOVICE = new ItemHolder(10650, 20);
private static final ItemHolder SPIRIT_ORE = new ItemHolder(3031, 50);
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50);// TODO: Finish Item
private static final ItemHolder HP_POTS = new ItemHolder(91912, 50); // TODO: Finish Item
private static final ItemHolder RICE_CAKE_OF_FLAMING_FIGHTING_SPIRIT_EVENT = new ItemHolder(91840, 1);
// HELMET FOR ALL ARMORS
private static final ItemHolder MOON_HELMET = new ItemHolder(7850, 1);
@@ -148,8 +148,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "LightArmor.html":
{
@@ -167,8 +167,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
case "Robe.html":
{
@@ -186,8 +186,8 @@ public class Q10990_PoisonExtraction extends Quest
player.sendPacket(new ExShowScreenMessage("Completed the tutorial.#Now try the first class transfer and as instructed by Bathis carry out the Adventurers Journey misions to grow your character.", 5000));
qs.exitQuest(false, true);
htmltext = event;
break;
}
break;
}
}
return htmltext;
@@ -1691,7 +1691,7 @@ public class Config
MAX_ARMOR_ENCHANT_ANNOUNCE = Character.getInt("MaximumArmorEnchantAnnounce", 30);
MAX_WEAPON_ENCHANT_ANNOUNCE = Character.getInt("MaximumWeaponEnchantAnnounce", 30);
String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
final String[] array = Character.getString("AugmentationBlackList", "6656,6657,6658,6659,6660,6661,6662,8191,10170,10314,13740,13741,13742,13743,13744,13745,13746,13747,13748,14592,14593,14594,14595,14596,14597,14598,14599,14600,14664,14665,14666,14667,14668,14669,14670,14671,14672,14801,14802,14803,14804,14805,14806,14807,14808,14809,15282,15283,15284,15285,15286,15287,15288,15289,15290,15291,15292,15293,15294,15295,15296,15297,15298,15299,16025,16026,21712,22173,22174,22175").split(",");
AUGMENTATION_BLACKLIST = new int[array.length];
for (int i = 0; i < array.length; i++)
{
@@ -3292,11 +3292,11 @@ public class Config
NETWORK_SERVER_LINK = VoteReward.getString("NetworkServerLink", "");
NETWORK_VOTES_DIFFERENCE = VoteReward.getInt("NetworkVotesDifference", 5);
NETWORK_REWARD_CHECK_TIME = VoteReward.getInt("NetworkRewardCheckTime", 5);
String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
final String NETWORK_SMALL_REWARD_VALUE = VoteReward.getString("NetworkReward", "57,100000000;");
final String[] NETWORK_small_reward_splitted_1 = NETWORK_SMALL_REWARD_VALUE.split(";");
for (String i : NETWORK_small_reward_splitted_1)
{
String[] NETWORK_small_reward_splitted_2 = i.split(",");
final String[] NETWORK_small_reward_splitted_2 = i.split(",");
NETWORK_REWARD.put(Integer.parseInt(NETWORK_small_reward_splitted_2[0]), Integer.parseInt(NETWORK_small_reward_splitted_2[1]));
}
NETWORK_DUALBOXES_ALLOWED = VoteReward.getInt("NetworkDualboxesAllowed", 1);
@@ -3305,11 +3305,11 @@ public class Config
TOPZONE_SERVER_LINK = VoteReward.getString("TopzoneServerLink", "");
TOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("TopzoneVotesDifference", 5);
TOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("TopzoneRewardCheckTime", 5);
String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
final String TOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("TopzoneReward", "57,100000000;");
final String[] topzone_small_reward_splitted_1 = TOPZONE_SMALL_REWARD_VALUE.split(";");
for (String i : topzone_small_reward_splitted_1)
{
String[] topzone_small_reward_splitted_2 = i.split(",");
final String[] topzone_small_reward_splitted_2 = i.split(",");
TOPZONE_REWARD.put(Integer.parseInt(topzone_small_reward_splitted_2[0]), Integer.parseInt(topzone_small_reward_splitted_2[1]));
}
TOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("TopzoneDualboxesAllowed", 1);
@@ -3318,11 +3318,11 @@ public class Config
HOPZONE_SERVER_LINK = VoteReward.getString("HopzoneServerLink", "");
HOPZONE_VOTES_DIFFERENCE = VoteReward.getInt("HopzoneVotesDifference", 5);
HOPZONE_REWARD_CHECK_TIME = VoteReward.getInt("HopzoneRewardCheckTime", 5);
String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
final String HOPZONE_SMALL_REWARD_VALUE = VoteReward.getString("HopzoneReward", "57,100000000;");
final String[] hopzone_small_reward_splitted_1 = HOPZONE_SMALL_REWARD_VALUE.split(";");
for (String i : hopzone_small_reward_splitted_1)
{
String[] hopzone_small_reward_splitted_2 = i.split(",");
final String[] hopzone_small_reward_splitted_2 = i.split(",");
HOPZONE_REWARD.put(Integer.parseInt(hopzone_small_reward_splitted_2[0]), Integer.parseInt(hopzone_small_reward_splitted_2[1]));
}
HOPZONE_DUALBOXES_ALLOWED = VoteReward.getInt("HopzoneDualboxesAllowed", 1);
@@ -71,7 +71,7 @@ public class LimitLinesDocumentListener implements DocumentListener
{
if (maximumLines < 1)
{
String message = "Maximum lines must be greater than 0";
final String message = "Maximum lines must be greater than 0";
throw new IllegalArgumentException(message);
}
@@ -106,8 +106,8 @@ public class LimitLinesDocumentListener implements DocumentListener
private void removeLines(DocumentEvent e)
{
// The root Element of the Document will tell us the total number of line in the Document.
Document document = e.getDocument();
Element root = document.getDefaultRootElement();
final Document document = e.getDocument();
final Element root = document.getDefaultRootElement();
while (root.getElementCount() > _maximumLines)
{
@@ -127,8 +127,8 @@ public class LimitLinesDocumentListener implements DocumentListener
*/
private void removeFromStart(Document document, Element root)
{
Element line = root.getElement(0);
int end = line.getEndOffset();
final Element line = root.getElement(0);
final int end = line.getEndOffset();
try
{
@@ -147,9 +147,9 @@ public class LimitLinesDocumentListener implements DocumentListener
{
// We use start minus 1 to make sure we remove the newline character of the previous line.
Element line = root.getElement(root.getElementCount() - 1);
int start = line.getStartOffset();
int end = line.getEndOffset();
final Element line = root.getElement(root.getElementCount() - 1);
final int start = line.getStartOffset();
final int end = line.getEndOffset();
try
{
@@ -44,7 +44,7 @@ public class SplashScreen extends JWindow
{
setBackground(new Color(0, 255, 0, 0)); // Transparency.
image = Toolkit.getDefaultToolkit().getImage(path);
ImageIcon imageIcon = new ImageIcon(image);
final ImageIcon imageIcon = new ImageIcon(image);
setSize(imageIcon.getIconWidth(), imageIcon.getIconHeight());
setLocationRelativeTo(null);
setAlwaysOnTop(true);
@@ -366,8 +366,9 @@ public class RecipeController
{
Thread.sleep(_delay);
}
catch (InterruptedException e)
catch (Exception e)
{
// Ignore.
}
finally
{
@@ -120,7 +120,7 @@ public class HtmCache
BufferedInputStream bis = new BufferedInputStream(fis))
{
final int bytes = bis.available();
byte[] raw = new byte[bytes];
final byte[] raw = new byte[bytes];
bis.read(raw);
content = new String(raw, StandardCharsets.UTF_8);
@@ -60,7 +60,7 @@ public class OfflineTradersTable
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
PreparedStatement stm_items = con.prepareStatement(SAVE_ITEMS))
PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS))
{
stm1.execute();
stm2.execute();
@@ -88,12 +88,12 @@ public class OfflineTradersTable
title = pc.getBuyList().getTitle();
for (TradeItem i : pc.getBuyList().getItems())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, i.getItem().getId());
stm_items.setLong(3, i.getCount());
stm_items.setLong(4, i.getPrice());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getItem().getId());
stmItems.setLong(3, i.getCount());
stmItems.setLong(4, i.getPrice());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -109,24 +109,24 @@ public class OfflineTradersTable
{
for (SellBuffHolder holder : pc.getSellingBuffs())
{
stm_items.setInt(1, pc.getObjectId());
stm_items.setInt(2, holder.getSkillId());
stm_items.setLong(3, 0);
stm_items.setLong(4, holder.getPrice());
stm_items.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, holder.getSkillId());
stmItems.setLong(3, 0);
stmItems.setLong(4, holder.getPrice());
stmItems.executeUpdate();
stmItems.clearParameters();
}
}
else
{
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.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.executeUpdate();
stmItems.clearParameters();
}
}
break;
@@ -140,12 +140,12 @@ public class OfflineTradersTable
title = pc.getStoreName();
for (ManufactureItem i : pc.getManufactureItems().values())
{
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.executeUpdate();
stm_items.clearParameters();
stmItems.setInt(1, pc.getObjectId());
stmItems.setInt(2, i.getRecipeId());
stmItems.setLong(3, 0);
stmItems.setLong(4, i.getCost());
stmItems.executeUpdate();
stmItems.clearParameters();
}
break;
}
@@ -231,10 +231,10 @@ public class OfflineTradersTable
}
player.spawnMe(player.getX(), player.getY(), player.getZ());
try (PreparedStatement stm_items = con.prepareStatement(LOAD_OFFLINE_ITEMS))
try (PreparedStatement stmItems = con.prepareStatement(LOAD_OFFLINE_ITEMS))
{
stm_items.setInt(1, player.getObjectId());
try (ResultSet items = stm_items.executeQuery())
stmItems.setInt(1, player.getObjectId());
try (ResultSet items = stmItems.executeQuery())
{
switch (type)
{
@@ -67,7 +67,7 @@ public class ElementalSpiritData implements IXmlReader
final int npcId = parseInteger(attributes, "npcId");
final int extractItem = parseInteger(attributes, "extractItem");
final int maxCharacteristics = parseInteger(attributes, "maxCharacteristics");
ElementalSpiritTemplateHolder template = new ElementalSpiritTemplateHolder(type, stage, npcId, extractItem, maxCharacteristics);
final ElementalSpiritTemplateHolder template = new ElementalSpiritTemplateHolder(type, stage, npcId, extractItem, maxCharacteristics);
SPIRIT_DATA.computeIfAbsent(type, HashMap::new).put(stage, template);
forEach(spiritNode, "level", levelNode ->
@@ -93,7 +93,7 @@ public class ItemCrystallizationData implements IXmlReader
{
if ("item".equalsIgnoreCase(c.getNodeName()))
{
NamedNodeMap attrs = c.getAttributes();
final NamedNodeMap attrs = c.getAttributes();
final int itemId = parseInteger(attrs, "id");
final long itemCount = parseLong(attrs, "count");
final double itemChance = parseDouble(attrs, "chance");
@@ -117,7 +117,7 @@ public class ItemCrystallizationData implements IXmlReader
{
if ("item".equalsIgnoreCase(c.getNodeName()))
{
NamedNodeMap attrs = c.getAttributes();
final NamedNodeMap attrs = c.getAttributes();
final int itemId = parseInteger(attrs, "id");
final long itemCount = parseLong(attrs, "count");
final double itemChance = parseDouble(attrs, "chance");
@@ -154,7 +154,7 @@ public class ItemCrystallizationData implements IXmlReader
if (chance > 100.)
{
double countMul = Math.ceil(chance / 100.);
final double countMul = Math.ceil(chance / 100.);
chance /= countMul;
count *= countMul;
}
@@ -175,7 +175,7 @@ public class VariationData implements IXmlReader
for (int item : itemGroup)
{
Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
final Map<Integer, VariationFee> fees = _fees.computeIfAbsent(item, k -> new HashMap<>());
fees.putAll(feeByMinerals);
}
}));
@@ -206,8 +206,8 @@ public class VariationData implements IXmlReader
private VariationInstance generateRandomVariation(Variation variation, VariationWeaponType weaponType)
{
Options option1 = variation.getRandomEffect(weaponType, 0);
Options option2 = variation.getRandomEffect(weaponType, 1);
final Options option1 = variation.getRandomEffect(weaponType, 0);
final Options option2 = variation.getRandomEffect(weaponType, 1);
return ((option1 != null) && (option2 != null)) ? new VariationInstance(variation.getMineralId(), option1, option2) : null;
}
@@ -246,7 +246,7 @@ public class VariationData implements IXmlReader
public boolean hasFeeData(int itemId)
{
Map<Integer, VariationFee> itemFees = _fees.get(itemId);
final Map<Integer, VariationFee> itemFees = _fees.get(itemId);
return (itemFees != null) && !itemFees.isEmpty();
}
@@ -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()
@@ -60,8 +60,8 @@ public class SchemeBufferTable
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
final PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
final ResultSet rs = st.executeQuery();
while (rs.next())
{
@@ -70,7 +70,7 @@ public class SchemeBufferTable
final String schemeName = rs.getString("scheme_name");
final String[] skills = rs.getString("skills").split(",");
ArrayList<Integer> schemeList = new ArrayList<>();
final ArrayList<Integer> schemeList = new ArrayList<>();
for (String skill : skills)
{
@@ -97,9 +97,9 @@ public class SchemeBufferTable
try
{
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
Document doc = db.parse(new File("./data/SchemeBufferSkills.xml"));
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
final DocumentBuilder db = dbf.newDocumentBuilder();
final Document doc = db.parse(new File("./data/SchemeBufferSkills.xml"));
final Node n = doc.getFirstChild();
@@ -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);
}
@@ -246,7 +246,7 @@ public class SchemeBufferTable
*/
public List<Integer> getSkillsIdsByType(String groupType)
{
List<Integer> skills = new ArrayList<>();
final List<Integer> skills = new ArrayList<>();
for (BuffSkillHolder skill : _availableBuffs.values())
{
if (skill.getType().equalsIgnoreCase(groupType))
@@ -262,7 +262,7 @@ public class SchemeBufferTable
*/
public List<String> getSkillTypes()
{
List<String> skillTypes = new ArrayList<>();
final List<String> skillTypes = new ArrayList<>();
for (BuffSkillHolder skill : _availableBuffs.values())
{
if (!skillTypes.contains(skill.getType()))
@@ -134,7 +134,7 @@ public class GeoEngine
FileChannel fc = raf.getChannel())
{
// initialize file buffer
MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
final MappedByteBuffer buffer = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size()).load();
buffer.order(ByteOrder.LITTLE_ENDIAN);
// get block indexes
@@ -563,7 +563,7 @@ public class GeoEngine
dirt = 0;
// calculate next point coordinates
int e2 = 2 * d;
final int e2 = 2 * d;
if ((e2 > -dy) && (e2 < dx))
{
// calculate next point XY coordinates
@@ -713,7 +713,7 @@ public class GeoEngine
}
// perform geodata check
GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instance);
final GeoLocation loc = checkMove(gox, goy, goz, gtx, gty, gtz, instance);
return (loc.getGeoX() == gtx) && (loc.getGeoY() == gty);
}
@@ -843,7 +843,7 @@ public class GeoEngine
direction = 0;
// calculate next point coordinates
int e2 = 2 * d;
final int e2 = 2 * d;
if ((e2 > -dy) && (e2 < dx))
{
d -= dy;
@@ -40,18 +40,18 @@ final class GeoEnginePathfinding extends GeoEngine
{
super();
String[] array = Config.PATHFIND_BUFFERS.split(";");
final String[] array = Config.PATHFIND_BUFFERS.split(";");
_buffers = new BufferHolder[array.length];
int count = 0;
for (int i = 0; i < array.length; i++)
{
String buf = array[i];
String[] args = buf.split("x");
final String buf = array[i];
final String[] args = buf.split("x");
try
{
int size = Integer.parseInt(args[1]);
final int size = Integer.parseInt(args[1]);
count += size;
_buffers[i] = new BufferHolder(Integer.parseInt(args[0]), size);
}
@@ -68,24 +68,24 @@ final class GeoEnginePathfinding extends GeoEngine
public List<Location> findPath(int ox, int oy, int oz, int tx, int ty, int tz, Instance instance)
{
// get origin and check existing geo coords
int gox = getGeoX(ox);
int goy = getGeoY(oy);
final int gox = getGeoX(ox);
final int goy = getGeoY(oy);
if (!hasGeoPos(gox, goy))
{
return null;
}
short goz = getHeightNearest(gox, goy, oz);
final short goz = getHeightNearest(gox, goy, oz);
// get target and check existing geo coords
int gtx = getGeoX(tx);
int gty = getGeoY(ty);
final int gtx = getGeoX(tx);
final int gty = getGeoY(ty);
if (!hasGeoPos(gtx, gty))
{
return null;
}
short gtz = getHeightNearest(gtx, gty, tz);
final short gtz = getHeightNearest(gtx, gty, tz);
// Prepare buffer for pathfinding calculations
final NodeBuffer buffer = getBuffer(64 + (2 * Math.max(Math.abs(gox - gtx), Math.abs(goy - gty))));
@@ -98,7 +98,7 @@ final class GeoEnginePathfinding extends GeoEngine
List<Location> path = null;
try
{
Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
final Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
if (result == null)
{
@@ -124,7 +124,7 @@ final class GeoEnginePathfinding extends GeoEngine
}
// get path list iterator
ListIterator<Location> point = path.listIterator();
final ListIterator<Location> point = path.listIterator();
// get node A (origin)
int nodeAx = gox;
@@ -139,10 +139,10 @@ final class GeoEnginePathfinding extends GeoEngine
while (point.hasNext() && (count++ < Config.MAX_ITERATIONS))
{
// get node C
GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
final GeoLocation nodeC = (GeoLocation) path.get(point.nextIndex());
// check movement from node A to node C
GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
final GeoLocation loc = checkMove(nodeAx, nodeAy, nodeAz, nodeC.getGeoX(), nodeC.getGeoY(), nodeC.getZ(), instance);
if ((loc.getGeoX() == nodeC.getGeoX()) && (loc.getGeoY() == nodeC.getGeoY()))
{
// can move from node A to node C
@@ -175,7 +175,7 @@ final class GeoEnginePathfinding extends GeoEngine
private static List<Location> constructPath(Node target)
{
// create empty list
LinkedList<Location> list = new LinkedList<>();
final LinkedList<Location> list = new LinkedList<>();
// set direction X/Y
int dx = 0;
@@ -86,7 +86,7 @@ public class BlockMultilayer extends ABlock
if (format != GeoFormat.L2D)
{
// get data
short data = bb.getShort();
final short data = bb.getShort();
// add nswe and height
_temp.put((byte) (data & 0x000F));
@@ -453,7 +453,7 @@ public class BlockMultilayer extends ABlock
for (int i = 0; i < GeoStructure.BLOCK_CELLS; i++)
{
// write layers count
byte layers = _buffer[index++];
final byte layers = _buffer[index++];
stream.write(layers);
// write cell data
@@ -133,7 +133,7 @@ public class NodeBuffer
private final void expand()
{
// can't move anywhere, don't expand
byte nswe = _current.getLoc().getNSWE();
final byte nswe = _current.getLoc().getNSWE();
if (nswe == 0)
{
return;
@@ -217,7 +217,7 @@ public class NodeBuffer
}
// get node
Node result = _buffer[ix][iy];
final Node result = _buffer[ix][iy];
// check and update
if (result.getLoc() == null)
@@ -239,7 +239,7 @@ public class NodeBuffer
private final void addNode(int x, int y, short z, int weight)
{
// get node to be expanded
Node node = getNode(x, y, z);
final Node node = getNode(x, y, z);
if (node == null)
{
return;
@@ -403,7 +403,7 @@ public class DBSpawnManager
{
for (Entry<Integer, StatsSet> entry : _storedInfo.entrySet())
{
Integer npcId = entry.getKey();
final Integer npcId = entry.getKey();
if (npcId == null)
{
continue;
@@ -95,7 +95,7 @@ public class PremiumManager
private final Consumer<OnPlayerLogout> playerLogoutEvent = event ->
{
PlayerInstance player = event.getPlayer();
final PlayerInstance player = event.getPlayer();
stopExpireTask(player);
};
@@ -111,7 +111,7 @@ public class PremiumManager
*/
private void startExpireTask(PlayerInstance player, long delay)
{
ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
final ScheduledFuture<?> task = ThreadPool.schedule(new PremiumExpireTask(player), delay);
expiretasks.put(player.getAccountName(), task);
}
@@ -155,11 +155,11 @@ public class PremiumManager
public void addPremiumTime(String accountName, int timeValue, TimeUnit timeUnit)
{
long addTime = timeUnit.toMillis(timeValue);
long now = System.currentTimeMillis();
final long addTime = timeUnit.toMillis(timeValue);
final long now = System.currentTimeMillis();
// new premium task at least from now
long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
long newPremiumExpiration = oldPremiumExpiration + addTime;
final long oldPremiumExpiration = Math.max(now, getPremiumExpiration(accountName));
final long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
try (Connection con = DatabaseFactory.getConnection();
@@ -178,7 +178,7 @@ public class PremiumManager
premiumData.put(accountName, newPremiumExpiration);
// UPDATE PlAYER PREMIUMSTATUS
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
if (playerOnline != null)
{
stopExpireTask(playerOnline);
@@ -195,7 +195,7 @@ public class PremiumManager
{
if (checkOnline)
{
PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
final PlayerInstance playerOnline = World.getInstance().getPlayers().stream().filter(p -> accountName.equals(p.getAccountName())).findFirst().orElse(null);
if ((playerOnline != null) && playerOnline.hasPremiumStatus())
{
playerOnline.setPremiumStatus(false);
@@ -875,7 +875,7 @@ public class Party extends AbstractPlayerGroup
// Add the XP/SP points to the requested party member
double exp = member.getStat().getValue(Stats.EXPSP_RATE, xpReward * preCalculation);
double sp = member.getStat().getValue(Stats.EXPSP_RATE, spReward * preCalculation);
final double sp = member.getStat().getValue(Stats.EXPSP_RATE, spReward * preCalculation);
exp = calculateExpSpPartyCutoff(member.getActingPlayer(), topLvl, exp, sp, target.useVitalityRate());
if (exp > 0)
@@ -170,7 +170,7 @@ public class Territory
int zmin = _zMin;
for (Point p1 : _points)
{
double distance = Math.hypot(p1._x - x, p1._y - y);
final double distance = Math.hypot(p1._x - x, p1._y - y);
if ((curdistance == 0) || (distance < curdistance))
{
curdistance = distance;
@@ -90,7 +90,7 @@ public class Attackable extends Npc
private boolean _isRaidMinion = false;
//
private boolean _champion = false;
private volatile Map<Creature, AggroInfo> _aggroList = new ConcurrentHashMap<>();
private final Map<Creature, AggroInfo> _aggroList = new ConcurrentHashMap<>();
private boolean _isReturningToSpawnPoint = false;
private boolean _canReturnToSpawnPoint = true;
private boolean _seeThroughSilentMove = false;
@@ -108,7 +108,7 @@ public class Attackable extends Npc
private double _overhitDamage;
private Creature _overhitAttacker;
// Command channel
private volatile CommandChannel _firstCommandChannelAttacked = null;
private CommandChannel _firstCommandChannelAttacked = null;
private CommandChannelTimer _commandChannelTimer = null;
private long _commandChannelLastAttack = 0;
// Misc
@@ -241,15 +241,12 @@ public class Attackable extends Npc
addDamage(attacker, (int) value, skill);
// Check Raidboss attack. Character will be petrified if attacking a raid that's more than 8 levels lower. In retail you deal damage to raid before curse.
if (_isRaid && giveRaidCurse() && !Config.RAID_DISABLE_CURSE)
if (_isRaid && giveRaidCurse() && !Config.RAID_DISABLE_CURSE && (attacker.getLevel() > (getLevel() + 8)))
{
if (attacker.getLevel() > (getLevel() + 8))
final Skill raidCurse = CommonSkill.RAID_CURSE2.getSkill();
if (raidCurse != null)
{
final Skill raidCurse = CommonSkill.RAID_CURSE2.getSkill();
if (raidCurse != null)
{
raidCurse.applyEffects(this, attacker);
}
raidCurse.applyEffects(this, attacker);
}
}
}
@@ -1458,19 +1455,16 @@ public class Attackable extends Npc
// Reset champion state
_champion = false;
if (Config.CHAMPION_ENABLE)
// Set champion on next spawn
if (Config.CHAMPION_ENABLE && isMonster() && !isQuestMonster() && !getTemplate().isUndying() && !_isRaid && !_isRaidMinion && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LVL) && (getLevel() <= Config.CHAMP_MAX_LVL) && (Config.CHAMPION_ENABLE_IN_INSTANCES || (getInstanceId() == 0)))
{
// Set champion on next spawn
if (isMonster() && !isQuestMonster() && !getTemplate().isUndying() && !_isRaid && !_isRaidMinion && (Config.CHAMPION_FREQUENCY > 0) && (getLevel() >= Config.CHAMP_MIN_LVL) && (getLevel() <= Config.CHAMP_MAX_LVL) && (Config.CHAMPION_ENABLE_IN_INSTANCES || (getInstanceId() == 0)))
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{
if (Rnd.get(100) < Config.CHAMPION_FREQUENCY)
{
_champion = true;
}
if (Config.SHOW_CHAMPION_AURA)
{
setTeam(_champion ? Team.RED : Team.NONE, false);
}
_champion = true;
}
if (Config.SHOW_CHAMPION_AURA)
{
setTeam(_champion ? Team.RED : Team.NONE, false);
}
}
@@ -1770,12 +1764,9 @@ public class Attackable extends Npc
{
final WorldObject target = getTarget();
final Map<Creature, AggroInfo> aggroList = _aggroList;
if (target != null)
if ((target != null) && (aggroList != null))
{
if (aggroList != null)
{
aggroList.remove(target);
}
aggroList.remove(target);
}
if ((aggroList != null) && aggroList.isEmpty())
{
@@ -180,7 +180,7 @@ import org.l2jmobius.gameserver.util.Util;
public abstract class Creature extends WorldObject implements ISkillsHolder, IDeletable
{
public static final Logger LOGGER = Logger.getLogger(Creature.class.getName());
private volatile Set<WeakReference<Creature>> _attackByList;
private Set<WeakReference<Creature>> _attackByList;
private boolean _isDead = false;
private boolean _isImmobilized = false;
@@ -194,7 +194,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _isFlying = false;
private boolean _blockActions = false;
private volatile Map<Integer, AtomicInteger> _blockActionsAllowedSkills = new ConcurrentHashMap<>();
private final Map<Integer, AtomicInteger> _blockActionsAllowedSkills = new ConcurrentHashMap<>();
private CreatureStat _stat;
private CreatureStatus _status;
@@ -230,16 +230,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private boolean _lethalable = true;
private volatile Map<Integer, OptionsSkillHolder> _triggerSkills;
private Map<Integer, OptionsSkillHolder> _triggerSkills;
private volatile Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */
private final EffectList _effectList = new EffectList(this);
/** The creature that summons this character. */
private Creature _summoner = null;
/** Map of summoned NPCs by this creature. */
private volatile Map<Integer, Npc> _summonedNpcs = null;
private Map<Integer, Npc> _summonedNpcs = null;
private SkillChannelizer _channelizer = null;
@@ -261,7 +261,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private volatile long _attackEndTime;
private volatile long _disableRangedAttackEndTime;
private volatile CreatureAI _ai = null;
private CreatureAI _ai = null;
/** Future Skill Cast */
protected Map<SkillCastingType, SkillCaster> _skillCasters = new ConcurrentHashMap<>();
@@ -270,12 +270,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
private final Map<Integer, Integer> _knownRelations = new ConcurrentHashMap<>();
private volatile CreatureContainer _seenCreatures;
private CreatureContainer _seenCreatures;
private final Map<StatusUpdateType, Integer> _statusUpdates = new ConcurrentHashMap<>();
/** A map holding info about basic property mesmerizing system. */
private volatile Map<BasicProperty, BasicPropertyResist> _basicPropertyResists;
private Map<BasicProperty, BasicPropertyResist> _basicPropertyResists;
private ScheduledFuture<?> _hitTask = null;
/** A set containing the shot types currently charged. */
@@ -921,14 +921,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
else if (isPlayer())
else if (isPlayer() && target.isDead())
{
if (target.isDead())
{
getAI().setIntention(AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
getAI().setIntention(AI_INTENTION_ACTIVE);
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
if (checkTransformed(transform -> !transform.canAttack()))
@@ -1092,6 +1089,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
case TWOHANDCROSSBOW:
{
crossbow = true;
// fallthrough
}
case BOW:
{
@@ -1130,6 +1128,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
_hitTask = ThreadPool.schedule(() -> onHitTimeNotDual(weaponItem, attack, timeToHit, timeAtk), timeToHit);
break;
}
// fallthrough
}
case DUAL:
case DUALFIST:
@@ -1250,13 +1249,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
int damage = 0;
byte shld = 0;
boolean crit = false;
boolean miss = Formulas.calcHitMiss(this, target);
final boolean miss = Formulas.calcHitMiss(this, target);
if (!shotConsumed)
{
shotConsumed = !miss && unchargeShot(ShotType.SOULSHOTS);
}
int ssGrade = (shotConsumed && (weapon != null)) ? weapon.getItemGrade().ordinal() : 0;
final int ssGrade = (shotConsumed && (weapon != null)) ? weapon.getItemGrade().ordinal() : 0;
// Check if hit isn't missed
if (!miss)
@@ -2968,7 +2967,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
final int xPrev = getX();
final int yPrev = getY();
int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
final int zPrev = getZ(); // the z coordinate may be modified by coordinate synchronizations
double dx;
double dy;
@@ -3790,12 +3789,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
for (OptionsSkillHolder holder : _triggerSkills.values())
{
if ((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical()))
if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance()))
{
if (Rnd.get(100) < holder.getChance())
{
SkillCaster.triggerCast(this, target, holder.getSkill(), null, false);
}
SkillCaster.triggerCast(this, target, holder.getSkill(), null, false);
}
}
}
@@ -4420,7 +4416,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
int reflectedDamage = 0;
// Reduce HP of the target and calculate reflection damage to reduce HP of attacker if necessary
double reflectPercent = target.getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT, 0) - getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT_DEFENSE, 0);
final double reflectPercent = target.getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT, 0) - getStat().getValue(Stats.REFLECT_DAMAGE_PERCENT_DEFENSE, 0);
if (reflectPercent > 0)
{
reflectedDamage = (int) ((reflectPercent / 100.) * damage);
@@ -699,7 +699,7 @@ public class Npc extends Creature
String html = HtmCache.getInstance().getHtm(player, "data/html/" + type + "/" + getId() + "-pk.htm");
if (html != null)
{
html = html.replaceAll("%objectId%", String.valueOf(getObjectId()));
html = html.replace("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(new NpcHtmlMessage(getObjectId(), html));
player.sendPacket(ActionFailed.STATIC_PACKET);
return true;
@@ -1563,12 +1563,9 @@ public class Npc extends Creature
item.dropMe(this, newX, newY, newZ);
// Add drop to auto destroy item task.
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId))
if (!Config.LIST_PROTECTED_ITEMS.contains(itemId) && (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect())))
{
if (((Config.AUTODESTROY_ITEM_AFTER > 0) && !item.getItem().hasExImmediateEffect()) || ((Config.HERB_AUTO_DESTROY_TIME > 0) && item.getItem().hasExImmediateEffect()))
{
ItemsAutoDestroy.getInstance().addItem(item);
}
ItemsAutoDestroy.getInstance().addItem(item);
}
item.setProtected(false);
@@ -59,7 +59,7 @@ public class GuardInstance extends Attackable
}
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && attacker.isPlayable())
{
PlayerInstance player = attacker.getActingPlayer();
final PlayerInstance player = attacker.getActingPlayer();
if ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME)))
{
return true;
@@ -466,7 +466,7 @@ public class PlayerInstance extends Playable
/** The Raidboss points of this PlayerInstance */
private int _raidbossPoints;
private volatile ScheduledFuture<?> _teleportWatchdog;
private ScheduledFuture<?> _teleportWatchdog;
/** The Siege state of the PlayerInstance */
private byte _siegeState = 0;
@@ -555,7 +555,7 @@ public class PlayerInstance extends Playable
private TradeList _activeTradeList;
private ItemContainer _activeWarehouse;
private volatile Map<Integer, ManufactureItem> _manufactureItems;
private Map<Integer, ManufactureItem> _manufactureItems;
private String _storeName = "";
private TradeList _sellList;
private TradeList _buyList;
@@ -633,7 +633,7 @@ public class PlayerInstance extends Playable
private long _clanCreateExpiryTime;
private int _powerGrade = 0;
private volatile EnumIntBitmask<ClanPrivilege> _clanPrivileges = new EnumIntBitmask<>(ClanPrivilege.class, false);
private EnumIntBitmask<ClanPrivilege> _clanPrivileges = new EnumIntBitmask<>(ClanPrivilege.class, false);
/** PlayerInstance's pledge class (knight, Baron, etc.) */
private int _pledgeClass = 0;
@@ -710,7 +710,7 @@ public class PlayerInstance extends Playable
private byte _handysBlockCheckerEventArena = -1;
/** new race ticket **/
private final int _race[] = new int[2];
private final int[] _race = new int[2];
private final BlockList _blockList = new BlockList(this);
@@ -1033,27 +1033,24 @@ public class PlayerInstance extends Playable
result |= RelationChanged.RELATION_ATTACKER;
}
}
if ((clan != null) && (targetClan != null))
if ((clan != null) && (targetClan != null) && (target.getPledgeType() != Clan.SUBUNIT_ACADEMY) && (getPledgeType() != Clan.SUBUNIT_ACADEMY))
{
if ((target.getPledgeType() != Clan.SUBUNIT_ACADEMY) && (getPledgeType() != Clan.SUBUNIT_ACADEMY))
final ClanWar war = clan.getWarWith(target.getClan().getId());
if (war != null)
{
ClanWar war = clan.getWarWith(target.getClan().getId());
if (war != null)
switch (war.getState())
{
switch (war.getState())
case DECLARATION:
case BLOOD_DECLARATION:
{
case DECLARATION:
case BLOOD_DECLARATION:
{
result |= RelationChanged.RELATION_DECLARED_WAR;
break;
}
case MUTUAL:
{
result |= RelationChanged.RELATION_DECLARED_WAR;
result |= RelationChanged.RELATION_MUTUAL_WAR;
break;
}
result |= RelationChanged.RELATION_DECLARED_WAR;
break;
}
case MUTUAL:
{
result |= RelationChanged.RELATION_DECLARED_WAR;
result |= RelationChanged.RELATION_MUTUAL_WAR;
break;
}
}
}
@@ -1477,7 +1474,7 @@ public class PlayerInstance extends Playable
}
/** List of all QuestState instance that needs to be notified of this PlayerInstance's or its pet's death */
private volatile Set<QuestState> _notifyQuestOfDeathList;
private Set<QuestState> _notifyQuestOfDeathList;
/**
* Add QuestState instance that is to be notified of PlayerInstance's death.
@@ -1635,11 +1632,7 @@ public class PlayerInstance extends Playable
public boolean isRegisteredOnThisSiegeField(int val)
{
if ((_siegeSide != val) && ((_siegeSide < 81) || (_siegeSide > 89)))
{
return false;
}
return true;
return (_siegeSide != val) && ((_siegeSide < 81) || (_siegeSide > 89));
}
public int getSiegeSide()
@@ -2037,7 +2030,7 @@ public class PlayerInstance extends Playable
/**
* Update the overloaded status of the PlayerInstance.
* @param broadcast TODO
* @param broadcast
*/
public void refreshOverloaded(boolean broadcast)
{
@@ -2248,9 +2241,9 @@ public class PlayerInstance extends Playable
/**
* Set the template of the PlayerInstance.
* @param Id The Identifier of the PlayerTemplate to set to the PlayerInstance
* @param id The Identifier of the PlayerTemplate to set to the PlayerInstance
*/
public void setClassId(int Id)
public void setClassId(int id)
{
if (!_subclassLock.tryLock())
{
@@ -2259,7 +2252,7 @@ public class PlayerInstance extends Playable
try
{
if ((_lvlJoinedAcademy != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, Id))
if ((_lvlJoinedAcademy != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, id))
{
if (_lvlJoinedAcademy <= 16)
{
@@ -2287,11 +2280,11 @@ public class PlayerInstance extends Playable
}
if (isSubClassActive())
{
getSubClasses().get(_classIndex).setClassId(Id);
getSubClasses().get(_classIndex).setClassId(id);
}
setTarget(this);
broadcastPacket(new MagicSkillUse(this, 5103, 1, 1000, 0));
setClassTemplate(Id);
setClassTemplate(id);
if (getClassId().level() == 3)
{
sendPacket(SystemMessageId.CONGRATULATIONS_YOU_VE_COMPLETED_YOUR_THIRD_CLASS_TRANSFER_QUEST);
@@ -3180,7 +3173,6 @@ public class PlayerInstance extends Playable
{
CursedWeaponsManager.getInstance().activate(this, newitem);
}
// Combat Flag
else if (FortSiegeManager.getInstance().isCombat(item.getId()))
{
@@ -3609,25 +3601,15 @@ public class PlayerInstance extends Playable
item.dropMe(this, (getX() + Rnd.get(50)) - 25, (getY() + Rnd.get(50)) - 25, getZ() + 20);
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable()))
{
if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
{
ItemsAutoDestroy.getInstance().addItem(item);
}
ItemsAutoDestroy.getInstance().addItem(item);
}
// protection against auto destroy dropped item
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
if (!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
{
item.setProtected(false);
}
else
{
item.setProtected(true);
}
item.setProtected(item.isEquipable() && (!item.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
}
else
{
@@ -3698,23 +3680,13 @@ public class PlayerInstance extends Playable
item.dropMe(this, x, y, z);
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()))
if ((Config.AUTODESTROY_ITEM_AFTER > 0) && Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getId()) && ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable()))
{
if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
{
ItemsAutoDestroy.getInstance().addItem(item);
}
ItemsAutoDestroy.getInstance().addItem(item);
}
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
if (!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM))
{
item.setProtected(false);
}
else
{
item.setProtected(true);
}
item.setProtected(item.isEquipable() && (!item.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
}
else
{
@@ -4067,7 +4039,7 @@ public class PlayerInstance extends Playable
// Update relation.
final int relation = getRelation(player);
Integer oldrelation = getKnownRelations().get(player.getObjectId());
final Integer oldrelation = getKnownRelations().get(player.getObjectId());
if ((oldrelation == null) || (oldrelation != relation))
{
final RelationChanged rc = new RelationChanged();
@@ -4362,12 +4334,9 @@ public class PlayerInstance extends Playable
}
// You can pickup only 1 combat flag
if (FortSiegeManager.getInstance().isCombat(target.getId()))
if (FortSiegeManager.getInstance().isCombat(target.getId()) && !FortSiegeManager.getInstance().checkIfCanPickup(this))
{
if (!FortSiegeManager.getInstance().checkIfCanPickup(this))
{
return;
}
return;
}
if ((target.getItemLootShedule() != null) && ((target.getOwnerId() == getObjectId()) || isInLooterParty(target.getOwnerId())))
@@ -4695,20 +4664,13 @@ public class PlayerInstance extends Playable
{
final ItemInstance legs = getLegsArmorInstance();
final ItemInstance armor = getChestArmorInstance();
if ((armor != null) && (legs != null))
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.HEAVY) && (armor.getItemType() == ArmorType.HEAVY))
{
if ((legs.getItemType() == ArmorType.HEAVY) && (armor.getItemType() == ArmorType.HEAVY))
{
return true;
}
return true;
}
if (armor != null)
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.HEAVY)))
{
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.HEAVY)))
{
return true;
}
return true;
}
return false;
}
@@ -4717,20 +4679,13 @@ public class PlayerInstance extends Playable
{
final ItemInstance legs = getLegsArmorInstance();
final ItemInstance armor = getChestArmorInstance();
if ((armor != null) && (legs != null))
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.LIGHT) && (armor.getItemType() == ArmorType.LIGHT))
{
if ((legs.getItemType() == ArmorType.LIGHT) && (armor.getItemType() == ArmorType.LIGHT))
{
return true;
}
return true;
}
if (armor != null)
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.LIGHT)))
{
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.LIGHT)))
{
return true;
}
return true;
}
return false;
}
@@ -4739,20 +4694,13 @@ public class PlayerInstance extends Playable
{
final ItemInstance legs = getLegsArmorInstance();
final ItemInstance armor = getChestArmorInstance();
if ((armor != null) && (legs != null))
if ((armor != null) && (legs != null) && (legs.getItemType() == ArmorType.MAGIC) && (armor.getItemType() == ArmorType.MAGIC))
{
if ((legs.getItemType() == ArmorType.MAGIC) && (armor.getItemType() == ArmorType.MAGIC))
{
return true;
}
return true;
}
if (armor != null)
if ((armor != null) && ((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.MAGIC)))
{
if (((_inventory.getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem().getBodyPart() == Item.SLOT_FULL_ARMOR) && (armor.getItemType() == ArmorType.MAGIC)))
{
return true;
}
return true;
}
return false;
}
@@ -5205,29 +5153,29 @@ public class PlayerInstance extends Playable
public void updatePvPStatus(Creature target)
{
final PlayerInstance player_target = target.getActingPlayer();
if (player_target == null)
final PlayerInstance targetPlayer = target.getActingPlayer();
if (targetPlayer == null)
{
return;
}
if (this == player_target)
if (this == targetPlayer)
{
return;
}
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && player_target.isEvil()) || (isEvil() && player_target.isGood())))
if (Config.FACTION_SYSTEM_ENABLED && target.isPlayer() && ((isGood() && targetPlayer.isEvil()) || (isEvil() && targetPlayer.isGood())))
{
return;
}
if (_isInDuel && (player_target.getDuelId() == getDuelId()))
if (_isInDuel && (targetPlayer.getDuelId() == getDuelId()))
{
return;
}
if ((!isInsideZone(ZoneId.PVP) || !player_target.isInsideZone(ZoneId.PVP)) && (player_target.getReputation() >= 0))
if ((!isInsideZone(ZoneId.PVP) || !targetPlayer.isInsideZone(ZoneId.PVP)) && (targetPlayer.getReputation() >= 0))
{
if (checkIfPvP(player_target))
if (checkIfPvP(targetPlayer))
{
setPvpFlagLasts(System.currentTimeMillis() + Config.PVP_PVP_TIME);
}
@@ -5447,12 +5395,9 @@ public class PlayerInstance extends Playable
public PlayerInstance getActiveRequester()
{
final PlayerInstance requester = _activeRequester;
if (requester != null)
if ((requester != null) && requester.isRequestExpired() && (_activeTradeList == null))
{
if (requester.isRequestExpired() && (_activeTradeList == null))
{
_activeRequester = null;
}
_activeRequester = null;
}
return _activeRequester;
}
@@ -5497,7 +5442,7 @@ public class PlayerInstance extends Playable
*/
public boolean isRequestExpired()
{
return !(_requestExpireTime > GameTimeController.getInstance().getGameTicks());
return _requestExpireTime <= GameTimeController.getInstance().getGameTicks();
}
/**
@@ -6567,16 +6512,13 @@ public class PlayerInstance extends Playable
}
// Restore Subclass Data (cannot be done earlier in function)
if (restoreSubClassData(player))
if (restoreSubClassData(player) && (activeClassId != player.getBaseClass()))
{
if (activeClassId != player.getBaseClass())
for (SubClass subClass : player.getSubClasses().values())
{
for (SubClass subClass : player.getSubClasses().values())
if (subClass.getClassId() == activeClassId)
{
if (subClass.getClassId() == activeClassId)
{
player.setClassIndex(subClass.getClassIndex());
}
player.setClassIndex(subClass.getClassIndex());
}
}
}
@@ -7173,7 +7115,7 @@ public class PlayerInstance extends Playable
delete.execute();
}
int buff_index = 0;
int buffIndex = 0;
final List<Long> storedSkills = new ArrayList<>();
final long currentTime = System.currentTimeMillis();
@@ -7240,7 +7182,7 @@ public class PlayerInstance extends Playable
statement.setInt(8, 0); // Store type 0, active buffs/debuffs.
statement.setInt(9, _classIndex);
statement.setInt(10, ++buff_index);
statement.setInt(10, ++buffIndex);
statement.addBatch();
}
}
@@ -7268,7 +7210,7 @@ public class PlayerInstance extends Playable
statement.setDouble(7, t.getStamp());
statement.setInt(8, 1); // Restore type 1, skill reuse.
statement.setInt(9, _classIndex);
statement.setInt(10, ++buff_index);
statement.setInt(10, ++buffIndex);
statement.addBatch();
}
}
@@ -7542,15 +7484,12 @@ public class PlayerInstance extends Playable
// Add the Skill object to the Creature _skills and its Func objects to the calculator set of the Creature
addSkill(skill);
if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM))
if (Config.SKILL_CHECK_ENABLE && (!canOverrideCond(PlayerCondOverride.SKILL_CONDITIONS) || Config.SKILL_CHECK_GM) && !SkillTreesData.getInstance().isSkillAllowed(this, skill))
{
if (!SkillTreesData.getInstance().isSkillAllowed(this, skill))
Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
if (Config.SKILL_CHECK_REMOVE)
{
Util.handleIllegalPlayerAction(this, "Player " + getName() + " has invalid skill " + skill.getName() + " (" + skill.getId() + "/" + skill.getLevel() + "), class:" + ClassListData.getInstance().getClass(getClassId()).getClassName(), IllegalActionPunishmentType.BROADCAST);
if (Config.SKILL_CHECK_REMOVE)
{
removeSkill(skill);
}
removeSkill(skill);
}
}
}
@@ -8130,11 +8069,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is in olympia and olympia start
if (attacker.isPlayer() && attacker.getActingPlayer().isInOlympiadMode())
{
if (_inOlympiadMode && _OlympiadStart && (((PlayerInstance) attacker).getOlympiadGameId() == getOlympiadGameId()))
{
return true;
}
return false;
return _inOlympiadMode && _OlympiadStart && (((PlayerInstance) attacker).getOlympiadGameId() == getOlympiadGameId());
}
if (_isOnCustomEvent && (getTeam() == attacker.getTeam()))
@@ -8220,13 +8155,10 @@ public class PlayerInstance extends Playable
}
}
if (attacker instanceof DefenderInstance)
if ((attacker instanceof DefenderInstance) && (_clan != null))
{
if (_clan != null)
{
final Siege siege = SiegeManager.getInstance().getSiege(this);
return ((siege != null) && siege.checkIsAttacker(_clan));
}
final Siege siege = SiegeManager.getInstance().getSiege(this);
return ((siege != null) && siege.checkIsAttacker(_clan));
}
if (attacker instanceof GuardInstance)
@@ -8425,18 +8357,15 @@ public class PlayerInstance extends Playable
sendPacket(ActionFailed.STATIC_PACKET);
// Upon failed conditions, next action is called.
if ((skill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this))
if ((skill.getNextAction() != NextActionType.NONE) && (target != this) && target.isAutoAttackable(this) && ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO)))
{
if ((getAI().getNextIntention() == null) || (getAI().getNextIntention().getCtrlIntention() != CtrlIntention.AI_INTENTION_MOVE_TO))
if (skill.getNextAction() == NextActionType.ATTACK)
{
if (skill.getNextAction() == NextActionType.ATTACK)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
else if (skill.getNextAction() == NextActionType.CAST)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target, item, false, false);
}
getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, target);
}
else if (skill.getNextAction() == NextActionType.CAST)
{
getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target, item, false, false);
}
}
@@ -8469,9 +8398,9 @@ public class PlayerInstance extends Playable
return true;
}
public boolean isInLooterParty(int LooterId)
public boolean isInLooterParty(int looterId)
{
final PlayerInstance looter = World.getInstance().getPlayer(LooterId);
final PlayerInstance looter = World.getInstance().getPlayer(looterId);
// if PlayerInstance is in a CommandChannel
if (isInParty() && _party.isInCommandChannel() && (looter != null))
@@ -8887,9 +8816,9 @@ public class PlayerInstance extends Playable
return _apprentice;
}
public void setApprentice(int apprentice_id)
public void setApprentice(int apprenticeId)
{
_apprentice = apprentice_id;
_apprentice = apprenticeId;
}
public int getSponsor()
@@ -8897,9 +8826,9 @@ public class PlayerInstance extends Playable
return _sponsor;
}
public void setSponsor(int sponsor_id)
public void setSponsor(int sponsorId)
{
_sponsor = sponsor_id;
_sponsor = sponsorId;
}
public int getBookMarkSlot()
@@ -9941,12 +9870,7 @@ public class PlayerInstance extends Playable
public boolean isRentedPet()
{
if (_taskRentPet != null)
{
return true;
}
return false;
return _taskRentPet != null;
}
public void stopWaterTask()
@@ -9972,12 +9896,7 @@ public class PlayerInstance extends Playable
public boolean isInWater()
{
if (_taskWater != null)
{
return true;
}
return false;
return _taskWater != null;
}
public void checkWaterState()
@@ -10392,12 +10311,11 @@ public class PlayerInstance extends Playable
}
}
public void broadcastSnoop(ChatType type, String name, String _text)
public void broadcastSnoop(ChatType type, String name, String text)
{
if (!_snoopListener.isEmpty())
{
final Snoop sn = new Snoop(getObjectId(), getName(), type, name, _text);
final Snoop sn = new Snoop(getObjectId(), getName(), type, name, text);
for (PlayerInstance pci : _snoopListener)
{
if (pci != null)
@@ -11564,43 +11482,40 @@ public class PlayerInstance extends Playable
{
Collection<Skill> currentSkills = getAllSkills();
if (isTransformed())
if (isTransformed() && !_transformSkills.isEmpty())
{
if (!_transformSkills.isEmpty())
// Include transformation skills and those skills that are allowed during transformation.
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
// Revelation skills.
if (isDualClassActive())
{
// Include transformation skills and those skills that are allowed during transformation.
currentSkills = currentSkills.stream().filter(Skill::allowOnTransform).collect(Collectors.toList());
// Revelation skills.
if (isDualClassActive())
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
if (revelationSkill != 0)
{
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_DUAL_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
else if (!isSubClassActive())
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_DUAL_CLASS, 0);
if (revelationSkill != 0)
{
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
// Include transformation skills.
currentSkills.addAll(_transformSkills.values());
}
else if (!isSubClassActive())
{
int revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_1_MAIN_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
revelationSkill = getVariables().getInt(PlayerVariables.REVELATION_SKILL_2_MAIN_CLASS, 0);
if (revelationSkill != 0)
{
addSkill(SkillData.getInstance().getSkill(revelationSkill, 1), false);
}
}
// Include transformation skills.
currentSkills.addAll(_transformSkills.values());
}
//@formatter:off
@@ -12065,6 +11980,11 @@ public class PlayerInstance extends Playable
}
}
public Collection<TeleportBookmark> getTeleportBookmarks()
{
return _tpbookmarks.values();
}
@Override
public void sendInfo(PlayerInstance player)
{
@@ -12698,19 +12618,6 @@ public class PlayerInstance extends Playable
return _multiSocialTarget;
}
public Collection<TeleportBookmark> getTeleportBookmarks()
{
return _tpbookmarks.values();
}
public int getBookmarkslot()
{
return _bookmarkslot;
}
/**
* @return
*/
public int getQuestInventoryLimit()
{
return Config.INVENTORY_MAXIMUM_QUEST_ITEMS;
@@ -49,8 +49,8 @@ public class SchemeBufferInstance extends Npc
// Simple hack to use createscheme bypass with a space.
command = command.replace("createscheme ", "createscheme;");
StringTokenizer st = new StringTokenizer(command, ";");
String currentCommand = st.nextToken();
final StringTokenizer st = new StringTokenizer(command, ";");
final String currentCommand = st.nextToken();
if (currentCommand.startsWith("menu"))
{
@@ -189,7 +189,7 @@ public class SchemeBufferInstance extends Npc
return;
}
final Map<String, ArrayList<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
final Map<String, List<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
if (schemes != null)
{
if (schemes.size() == Config.BUFFER_MAX_SCHEMES)
@@ -218,7 +218,7 @@ public class SchemeBufferInstance extends Npc
try
{
final String schemeName = st.nextToken();
final Map<String, ArrayList<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
final Map<String, List<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
if ((schemes != null) && schemes.containsKey(schemeName))
{
@@ -257,14 +257,14 @@ public class SchemeBufferInstance extends Npc
{
final StringBuilder sb = new StringBuilder(200);
final Map<String, ArrayList<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
final Map<String, List<Integer>> schemes = SchemeBufferTable.getInstance().getPlayerSchemes(player.getObjectId());
if ((schemes == null) || schemes.isEmpty())
{
sb.append("<font color=\"LEVEL\">You haven't defined any scheme.</font>");
}
else
{
for (Map.Entry<String, ArrayList<Integer>> scheme : schemes.entrySet())
for (Map.Entry<String, List<Integer>> scheme : schemes.entrySet())
{
final int cost = getFee(scheme.getValue());
sb.append("<font color=\"LEVEL\">" + scheme.getKey() + " [" + scheme.getValue().size() + " skill(s)]" + ((cost > 0) ? " - cost: " + NumberFormat.getInstance(Locale.ENGLISH).format(cost) : "") + "</font><br1>");
@@ -429,7 +429,7 @@ public class SchemeBufferInstance extends Npc
* @param list : A list of skill ids.
* @return a global fee for all skills contained in list.
*/
private static int getFee(ArrayList<Integer> list)
private static int getFee(List<Integer> list)
{
if (Config.BUFFER_STATIC_BUFF_COST > 0)
{
@@ -154,28 +154,17 @@ public class SiegeFlagInstance extends Npc
public void reduceCurrentHp(double damage, Creature attacker, Skill skill)
{
super.reduceCurrentHp(damage, attacker, skill);
if (canTalk())
if (canTalk() && (((getCastle() != null) && getCastle().getSiege().isInProgress()) || ((getFort() != null) && getFort().getSiege().isInProgress())) && (_clan != null))
{
if (((getCastle() != null) && getCastle().getSiege().isInProgress()) || ((getFort() != null) && getFort().getSiege().isInProgress()))
{
if (_clan != null)
{
// send warning to owners of headquarters that theirs base is under attack
_clan.broadcastToOnlineMembers(new SystemMessage(SystemMessageId.SIEGE_CAMP_IS_UNDER_ATTACK));
setCanTalk(false);
ThreadPool.schedule(new ScheduleTalkTask(), 20000);
}
}
// send warning to owners of headquarters that theirs base is under attack
_clan.broadcastToOnlineMembers(new SystemMessage(SystemMessageId.SIEGE_CAMP_IS_UNDER_ATTACK));
setCanTalk(false);
ThreadPool.schedule(new ScheduleTalkTask(), 20000);
}
}
private class ScheduleTalkTask implements Runnable
{
public ScheduleTalkTask()
{
}
@Override
public void run()
{
@@ -32,13 +32,12 @@ public class VillageMasterDElfInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return pclass.getRace() == Race.DARK_ELF;
return pClass.getRace() == Race.DARK_ELF;
}
}
@@ -32,13 +32,12 @@ public class VillageMasterDwarfInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return pclass.getRace() == Race.DWARF;
return pClass.getRace() == Race.DWARF;
}
}
@@ -34,24 +34,22 @@ public class VillageMasterFighterInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return (pclass.getRace() == Race.HUMAN) || (pclass.getRace() == Race.ELF);
return (pClass.getRace() == Race.HUMAN) || (pClass.getRace() == Race.ELF);
}
@Override
protected final boolean checkVillageMasterTeachType(ClassId pclass)
protected final boolean checkVillageMasterTeachType(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return CategoryData.getInstance().isInCategory(CategoryType.FIGHTER_GROUP, pclass.getId());
return CategoryData.getInstance().isInCategory(CategoryType.FIGHTER_GROUP, pClass.getId());
}
}
@@ -395,7 +395,7 @@ public class VillageMasterInstance extends NpcInstance
}
}
}
catch (Exception NumberFormatException)
catch (Exception nfe)
{
LOGGER.warning(VillageMasterInstance.class.getName() + ": Wrong numeric values for command " + command);
}
@@ -554,19 +554,15 @@ public class VillageMasterInstance extends NpcInstance
allowAddition = false;
}
if (allowAddition)
if (allowAddition && !player.getSubClasses().isEmpty())
{
if (!player.getSubClasses().isEmpty())
for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
{
for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
final SubClass subClass = subList.next();
if (subClass.getLevel() < 75)
{
final SubClass subClass = subList.next();
if (subClass.getLevel() < 75)
{
allowAddition = false;
break;
}
allowAddition = false;
break;
}
}
}
@@ -896,7 +892,7 @@ public class VillageMasterInstance extends NpcInstance
}
}
Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
final Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
if (unavailableClasses != null)
{
subclasses.removeAll(unavailableClasses);
@@ -977,12 +973,12 @@ public class VillageMasterInstance extends NpcInstance
return found;
}
protected boolean checkVillageMasterRace(ClassId pclass)
protected boolean checkVillageMasterRace(ClassId pClass)
{
return true;
}
protected boolean checkVillageMasterTeachType(ClassId pclass)
protected boolean checkVillageMasterTeachType(ClassId pClass)
{
return true;
}
@@ -34,24 +34,22 @@ public class VillageMasterMysticInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return (pclass.getRace() == Race.HUMAN) || (pclass.getRace() == Race.ELF);
return (pClass.getRace() == Race.HUMAN) || (pClass.getRace() == Race.ELF);
}
@Override
protected final boolean checkVillageMasterTeachType(ClassId pclass)
protected final boolean checkVillageMasterTeachType(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return CategoryData.getInstance().isInCategory(CategoryType.MAGE_GROUP, pclass.getId());
return CategoryData.getInstance().isInCategory(CategoryType.MAGE_GROUP, pClass.getId());
}
}
@@ -32,13 +32,12 @@ public class VillageMasterOrcInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return pclass.getRace() == Race.ORC;
return pClass.getRace() == Race.ORC;
}
}
@@ -34,24 +34,22 @@ public class VillageMasterPriestInstance extends VillageMasterInstance
}
@Override
protected final boolean checkVillageMasterRace(ClassId pclass)
protected final boolean checkVillageMasterRace(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return (pclass.getRace() == Race.HUMAN) || (pclass.getRace() == Race.ELF);
return (pClass.getRace() == Race.HUMAN) || (pClass.getRace() == Race.ELF);
}
@Override
protected final boolean checkVillageMasterTeachType(ClassId pclass)
protected final boolean checkVillageMasterTeachType(ClassId pClass)
{
if (pclass == null)
if (pClass == null)
{
return false;
}
return CategoryData.getInstance().isInCategory(CategoryType.CLERIC_GROUP, pclass.getId());
return CategoryData.getInstance().isInCategory(CategoryType.CLERIC_GROUP, pClass.getId());
}
}
@@ -49,7 +49,7 @@ public class PetStat extends SummonStat
return false;
}
SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
final SystemMessage sm = new SystemMessage(SystemMessageId.YOUR_PET_GAINED_S1_XP);
sm.addLong(finalExp);
getActiveChar().updateAndBroadcastStatus(1);
getActiveChar().sendPacket(sm);
@@ -70,8 +70,8 @@ public class ProductList
return (_allowedNpcs != null) && _allowedNpcs.contains(npcId);
}
//public Set<Integer> getNpcsAllowed()
//{
// return _allowedNpcs;
//}
// public Set<Integer> getNpcsAllowed()
// {
// return _allowedNpcs;
// }
}
@@ -163,7 +163,7 @@ public class Clan implements IIdentifiable, INamable
private ClanRewardBonus _lastMembersOnlineBonus = null;
private ClanRewardBonus _lastHuntingBonus = null;
private volatile ClanVariables _vars;
private ClanVariables _vars;
/**
* Called if a clan is referenced only by id. In this case all other data needs to be fetched from db
@@ -1290,11 +1290,6 @@ public class Clan implements IIdentifiable, INamable
*/
public Skill[] getAllSkills()
{
if (_skills == null)
{
return new Skill[0];
}
return _skills.values().toArray(new Skill[_skills.values().size()]);
}
@@ -1431,12 +1426,9 @@ public class Clan implements IIdentifiable, INamable
{
try
{
if ((temp != null) && temp.isOnline())
if ((temp != null) && temp.isOnline() && (skill.getMinPledgeClass() <= temp.getPlayerInstance().getPledgeClass()))
{
if (skill.getMinPledgeClass() <= temp.getPlayerInstance().getPledgeClass())
{
temp.getPlayerInstance().addSkill(skill, false); // Skill is not saved to player DB
}
temp.getPlayerInstance().addSkill(skill, false); // Skill is not saved to player DB
}
}
catch (NullPointerException e)
@@ -1803,7 +1795,7 @@ public class Clan implements IIdentifiable, INamable
*/
public SubPledge getSubPledge(int pledgeType)
{
return _subPledges == null ? null : _subPledges.get(pledgeType);
return _subPledges.get(pledgeType);
}
/**
@@ -1813,11 +1805,6 @@ public class Clan implements IIdentifiable, INamable
*/
public SubPledge getSubPledge(String pledgeName)
{
if (_subPledges == null)
{
return null;
}
for (SubPledge sp : _subPledges.values())
{
if (sp.getName().equalsIgnoreCase(pledgeName))
@@ -1834,11 +1821,6 @@ public class Clan implements IIdentifiable, INamable
*/
public SubPledge[] getAllSubPledges()
{
if (_subPledges == null)
{
return new SubPledge[0];
}
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
}
@@ -2038,16 +2020,10 @@ public class Clan implements IIdentifiable, INamable
for (ClanMember cm : _members.values())
{
if (cm.isOnline())
if (cm.isOnline() && (cm.getPowerGrade() == rank) && (cm.getPlayerInstance() != null))
{
if (cm.getPowerGrade() == rank)
{
if (cm.getPlayerInstance() != null)
{
cm.getPlayerInstance().getClanPrivileges().setBitmask(privs);
cm.getPlayerInstance().sendPacket(new UserInfo(cm.getPlayerInstance()));
}
}
cm.getPlayerInstance().getClanPrivileges().setBitmask(privs);
cm.getPlayerInstance().sendPacket(new UserInfo(cm.getPlayerInstance()));
}
}
broadcastClanStatus();
@@ -2078,7 +2054,7 @@ public class Clan implements IIdentifiable, INamable
*/
public RankPrivs[] getAllRankPrivs()
{
return _privs == null ? new RankPrivs[0] : _privs.values().toArray(new RankPrivs[_privs.values().size()]);
return _privs.values().toArray(new RankPrivs[_privs.values().size()]);
}
public int getLeaderSubPledge(int leaderId)
@@ -2277,13 +2253,10 @@ public class Clan implements IIdentifiable, INamable
return false;
}
final Clan leaderClan = player.getClan();
if (leaderClan.getAllyPenaltyExpiryTime() > System.currentTimeMillis())
if ((leaderClan.getAllyPenaltyExpiryTime() > System.currentTimeMillis()) && (leaderClan.getAllyPenaltyType() == PENALTY_TYPE_DISMISS_CLAN))
{
if (leaderClan.getAllyPenaltyType() == PENALTY_TYPE_DISMISS_CLAN)
{
player.sendPacket(SystemMessageId.YOU_MAY_NOT_ACCEPT_ANY_CLAN_WITHIN_A_DAY_AFTER_EXPELLING_ANOTHER_CLAN);
return false;
}
player.sendPacket(SystemMessageId.YOU_MAY_NOT_ACCEPT_ANY_CLAN_WITHIN_A_DAY_AFTER_EXPELLING_ANOTHER_CLAN);
return false;
}
if (target == null)
{
@@ -2507,92 +2480,74 @@ public class Clan implements IIdentifiable, INamable
case 0:
{
// Upgrade to 1
if ((player.getSp() >= 1000) && (player.getAdena() >= 150000) && (_members.size() >= 1))
if ((player.getSp() >= 1000) && (player.getAdena() >= 150000) && (_members.size() >= 1) && player.reduceAdena("ClanLvl", 150000, player.getTarget(), true))
{
if (player.reduceAdena("ClanLvl", 150000, player.getTarget(), true))
{
player.setSp(player.getSp() - 1000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(1000);
player.sendPacket(sp);
increaseClanLevel = true;
}
player.setSp(player.getSp() - 1000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(1000);
player.sendPacket(sp);
increaseClanLevel = true;
}
break;
}
case 1:
{
// Upgrade to 2
if ((player.getSp() >= 15000) && (player.getAdena() >= 300000) && (_members.size() >= 1))
if ((player.getSp() >= 15000) && (player.getAdena() >= 300000) && (_members.size() >= 1) && player.reduceAdena("ClanLvl", 300000, player.getTarget(), true))
{
if (player.reduceAdena("ClanLvl", 300000, player.getTarget(), true))
{
player.setSp(player.getSp() - 15000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(15000);
player.sendPacket(sp);
increaseClanLevel = true;
}
player.setSp(player.getSp() - 15000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(15000);
player.sendPacket(sp);
increaseClanLevel = true;
}
break;
}
case 2:
{
// Upgrade to 3
if ((player.getSp() >= 100000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1))
// Upgrade to 3 (itemId 1419 == Blood Mark)
if ((player.getSp() >= 100000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1) && player.destroyItemByItemId("ClanLvl", 1419, 100, player.getTarget(), true))
{
// itemId 1419 == Blood Mark
if (player.destroyItemByItemId("ClanLvl", 1419, 100, player.getTarget(), true))
{
player.setSp(player.getSp() - 100000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(100000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
player.setSp(player.getSp() - 100000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(100000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
break;
}
case 3:
{
// Upgrade to 4
if ((player.getSp() >= 1000000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1))
// Upgrade to 4 (itemId 1419 == Blood Mark)
if ((player.getSp() >= 1000000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1) && player.destroyItemByItemId("ClanLvl", 1419, 5000, player.getTarget(), true))
{
// itemId 1419 == Blood Mark
if (player.destroyItemByItemId("ClanLvl", 1419, 5000, player.getTarget(), true))
{
player.setSp(player.getSp() - 1000000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(1000000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
player.setSp(player.getSp() - 1000000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(1000000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
break;
}
case 4:
{
// Upgrade to 5
if ((player.getSp() >= 5000000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1))
// Upgrade to 5 (itemId 1419 == Blood Mark)
if ((player.getSp() >= 5000000) && (player.getInventory().getItemByItemId(1419) != null) && (_members.size() >= 1) && player.destroyItemByItemId("ClanLvl", 1419, 10000, player.getTarget(), true))
{
// itemId 1419 == Blood Mark
if (player.destroyItemByItemId("ClanLvl", 1419, 10000, player.getTarget(), true))
{
player.setSp(player.getSp() - 5000000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(5000000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
player.setSp(player.getSp() - 5000000);
final SystemMessage sp = new SystemMessage(SystemMessageId.YOUR_SP_HAS_DECREASED_BY_S1);
sp.addInt(5000000);
player.sendPacket(sp);
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_DISAPPEARED);
sm.addItemName(1419);
player.sendPacket(sm);
increaseClanLevel = true;
}
break;
}
@@ -998,7 +998,7 @@ public class Duel
if (_partyDuel)
{
boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
final boolean teamdefeated = player.getParty().getMembers().stream().anyMatch(member -> member.getDuelState() == DUELSTATE_DUELLING);
if (teamdefeated)
{

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