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

View File

@ -124,7 +124,7 @@ public class CemeteryMonsters extends AbstractNpcAI
{
for (int i = 0; i < 6; i++)
{
Npc raider = addSpawn(ADEN_RAIDER, killer, true, 180000, false);
final Npc raider = addSpawn(ADEN_RAIDER, killer, true, 180000, false);
addAttackPlayerDesire(raider, killer);
}
break;

View File

@ -42,7 +42,7 @@ public class ApherusLookout extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = null;
final String htmltext = null;
if (event.equals("open_bag"))
{
if (getRandom(100) < 7)
@ -58,11 +58,11 @@ public class ApherusLookout extends AbstractNpcAI
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isPet)
{
Npc aPackage = addSpawn(APHERUS_PACKAGE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
final Npc aPackage = addSpawn(APHERUS_PACKAGE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
aPackage.setIsImmobilized(true);
Npc bPackage = addSpawn(APHERUS_PACKAGE1, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
final Npc bPackage = addSpawn(APHERUS_PACKAGE1, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
bPackage.setIsImmobilized(true);
Npc cPackage = addSpawn(APHERUS_PACKAGE2, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
final Npc cPackage = addSpawn(APHERUS_PACKAGE2, npc.getX(), npc.getY(), npc.getZ(), 0, true, 120000, false);
cPackage.setIsImmobilized(true);
return super.onKill(npc, killer, isPet);
}

View File

@ -70,7 +70,7 @@ public class Hardin extends AbstractNpcAI
if (event.equals("list"))
{
StringBuilder classes = new StringBuilder();
final StringBuilder classes = new StringBuilder();
for (ClassId c : ClassId.values())
{
if ((((c.level() != 4) && (c.getRace() != Race.ERTHEIA)) //

View File

@ -64,9 +64,9 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
{
for (int zoneId = 60142; zoneId <= 60165; zoneId++)
{
ZoneType zone = ZoneManager.getInstance().getZoneById(zoneId);
final ZoneType zone = ZoneManager.getInstance().getZoneById(zoneId);
_roomInfo.put(zone, new zoneInfo());
String zoneName = zone.getName().toLowerCase().replace(" ", "_");
final String zoneName = zone.getName().toLowerCase().replace(" ", "_");
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName), null));
}
}
@ -131,7 +131,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
{
try
{
zoneInfo currentInfo = _roomInfo.get(_zone);
final zoneInfo currentInfo = _roomInfo.get(_zone);
switch (currentInfo.getZoneStage())
{
case 0:
@ -169,7 +169,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
if (currentInfo.getCurrentMonitorizedDamage() >= 10)
{
_zone.broadcastPacket(new ExShowScreenMessage(NpcStringId.DEMONIC_SYSTEM_WILL_ACTIVATE, ExShowScreenMessage.TOP_CENTER, 3000));
String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
final String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
_templates.stream().forEach(t -> t.despawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName)));
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName + "_demonic"), null));
_zone.getPlayersInside().forEach(temp -> temp.sendPacket(new ExSendUIEvent(temp, false, false, 600, 0, NpcStringId.DEMONIC_SYSTEM_ACTIVATED)));
@ -193,7 +193,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
player.sendPacket(new ExSendUIEvent(player));
}
}
String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
final String zoneName = _zone.getName().toLowerCase().replace(" ", "_");
_templates.stream().forEach(t -> t.despawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName + "_demonic")));
_templates.stream().forEach(t -> t.spawn(g -> String.valueOf(g.getName()).equalsIgnoreCase(zoneName), null));
return;
@ -219,14 +219,14 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
if (currentZone.getKey().isInsideZone(npc))
{
final zoneInfo currentInfo = currentZone.getValue();
int currentPoints = currentInfo.getCurrentPoints();
final int currentPoints = currentInfo.getCurrentPoints();
if (currentPoints == 300)
{
if (currentInfo.getZoneStage() < 1)
{
return super.onKill(npc, killer, isSummon);
}
int currentDamage = currentInfo.getCurrentMonitorizedDamage();
final int currentDamage = currentInfo.getCurrentMonitorizedDamage();
int calcDamage = currentDamage + 1;
if (calcDamage >= 10)
{
@ -262,7 +262,7 @@ public class HarnakUndergroundRuinsZone extends AbstractNpcAI
if (npc.getDisplayEffect() > 0)
{
MonsterInstance copy = (MonsterInstance) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), 0, true, 0, false);
final MonsterInstance copy = (MonsterInstance) addSpawn(npc.getId(), npc.getX(), npc.getY(), npc.getZ(), 0, true, 0, false);
copy.setTarget(killer);
copy.addDamageHate(killer, 500, 99999);
copy.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, killer);

View File

@ -672,7 +672,7 @@ public class Raina extends AbstractNpcAI
{
final int currentBaseId = player.getBaseClass();
final ClassId baseCID = ClassId.getClassId(currentBaseId);
int baseClassId = (CategoryData.getInstance().isInCategory(CategoryType.FOURTH_CLASS_GROUP, baseCID.getId()) || CategoryData.getInstance().isInCategory(CategoryType.FIFTH_CLASS_GROUP, baseCID.getId()) || CategoryData.getInstance().isInCategory(CategoryType.SIXTH_CLASS_GROUP, baseCID.getId())) ? baseCID.getParent().getId() : currentBaseId;
final int baseClassId = (CategoryData.getInstance().isInCategory(CategoryType.FOURTH_CLASS_GROUP, baseCID.getId()) || CategoryData.getInstance().isInCategory(CategoryType.FIFTH_CLASS_GROUP, baseCID.getId()) || CategoryData.getInstance().isInCategory(CategoryType.SIXTH_CLASS_GROUP, baseCID.getId())) ? baseCID.getParent().getId() : currentBaseId;
final Set<ClassId> availSubs = getSubclasses(player, baseClassId);
@ -830,7 +830,7 @@ public class Raina extends AbstractNpcAI
}
}
Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
final Set<ClassId> unavailableClasses = subclassSetMap.get(pClass);
if (unavailableClasses != null)
{
subclasses.removeAll(unavailableClasses);

View File

@ -408,7 +408,7 @@ public class Anakim extends AbstractNpcAI
randomSpawn = _spawns.get(Rnd.get(_spawns.size()));
if (randomSpawn != null)
{
Npc remnant = addSpawn(REMNANT, randomSpawn.getX(), randomSpawn.getY(), randomSpawn.getZ(), randomSpawn.getHeading(), true, 0, false, 0);
final Npc remnant = addSpawn(REMNANT, randomSpawn.getX(), randomSpawn.getY(), randomSpawn.getZ(), randomSpawn.getHeading(), true, 0, false, 0);
_remnants.add(remnant);
}
}
@ -426,13 +426,13 @@ public class Anakim extends AbstractNpcAI
}
case "cancel_timers":
{
QuestTimer activityTimer = getQuestTimer("check_activity_task", null, null);
final QuestTimer activityTimer = getQuestTimer("check_activity_task", null, null);
if (activityTimer != null)
{
activityTimer.cancel();
}
QuestTimer forceEnd = getQuestTimer("end_anakim", null, null);
final QuestTimer forceEnd = getQuestTimer("end_anakim", null, null);
if (forceEnd != null)
{
forceEnd.cancel();
@ -588,7 +588,7 @@ public class Anakim extends AbstractNpcAI
}
if (!BOSS_ZONE.isInsideZone(npc)) // Npc moved out of the zone
{
Spawn spawn = npc.getSpawn();
final Spawn spawn = npc.getSpawn();
if (spawn != null)
{
npc.teleToLocation(spawn.getX(), spawn.getY(), spawn.getZ());
@ -661,13 +661,13 @@ public class Anakim extends AbstractNpcAI
private long calcReuseFromDays(int day1Minute, int day1Hour, int day1Day, int day2Minute, int day2Hour, int day2Day)
{
Calendar now = Calendar.getInstance();
Calendar day1 = (Calendar) now.clone();
final Calendar now = Calendar.getInstance();
final Calendar day1 = (Calendar) now.clone();
day1.set(Calendar.MINUTE, day1Minute);
day1.set(Calendar.HOUR_OF_DAY, day1Hour);
day1.set(Calendar.DAY_OF_WEEK, day1Day);
Calendar day2 = (Calendar) day1.clone();
final Calendar day2 = (Calendar) day1.clone();
day2.set(Calendar.MINUTE, day2Minute);
day2.set(Calendar.HOUR_OF_DAY, day2Hour);
day2.set(Calendar.DAY_OF_WEEK, day2Day);

View File

@ -150,7 +150,7 @@ public class BalokWarzone extends AbstractInstance
case "stage_last_send_minions":
{
Npc minion = _minionList.get(Rnd.get(_minionList.size()));
final Npc minion = _minionList.get(Rnd.get(_minionList.size()));
if (minion != null)
{
minion.setRunning();
@ -183,14 +183,14 @@ public class BalokWarzone extends AbstractInstance
{
for (int i = 0; i < 4; i++)
{
Npc disciple = addSpawn(HELL_DISCIPLE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 600000, false, world.getId());
final Npc disciple = addSpawn(HELL_DISCIPLE, npc.getX(), npc.getY(), npc.getZ(), 0, true, 600000, false, world.getId());
addAttackPlayerDesire(disciple, player);
}
break;
}
case "imprission_minions":
{
int[] randomJail = PRISONS_SPAWN[Rnd.get(PRISONS_SPAWN.length)]; // Random jail
final int[] randomJail = PRISONS_SPAWN[Rnd.get(PRISONS_SPAWN.length)]; // Random jail
player.teleToLocation(randomJail[0], randomJail[1], randomJail[2]);
world.broadcastPacket(new ExShowScreenMessage("$s1, locked away in the prison.".replace("$s1", player.getName()), 5000));
break;
@ -209,7 +209,7 @@ public class BalokWarzone extends AbstractInstance
{
for (int[] a : MINION_SPAWN)
{
Npc minion = addSpawn(MINION, a[0], a[1], a[2], a[3], false, 0, false, world.getId());
final Npc minion = addSpawn(MINION, a[0], a[1], a[2], a[3], false, 0, false, world.getId());
_minionList.add(minion);
INVINCIBILITY_ACTIVATION.getSkill().applyEffects(minion, minion);
world.setStatus(2);

View File

@ -434,7 +434,7 @@ public class Lilith extends AbstractNpcAI
randomSpawn = _spawns.get(Rnd.get(_spawns.size()));
if (randomSpawn != null)
{
Npc remnant = addSpawn(REMNANT, randomSpawn.getX(), randomSpawn.getY(), randomSpawn.getZ(), randomSpawn.getHeading(), true, 0, false, 0);
final Npc remnant = addSpawn(REMNANT, randomSpawn.getX(), randomSpawn.getY(), randomSpawn.getZ(), randomSpawn.getHeading(), true, 0, false, 0);
_remnants.add(remnant);
}
}
@ -452,13 +452,13 @@ public class Lilith extends AbstractNpcAI
}
case "cancel_timers":
{
QuestTimer activityTimer = getQuestTimer("check_activity_task", null, null);
final QuestTimer activityTimer = getQuestTimer("check_activity_task", null, null);
if (activityTimer != null)
{
activityTimer.cancel();
}
QuestTimer forceEnd = getQuestTimer("end_lilith", null, null);
final QuestTimer forceEnd = getQuestTimer("end_lilith", null, null);
if (forceEnd != null)
{
forceEnd.cancel();
@ -604,7 +604,7 @@ public class Lilith extends AbstractNpcAI
}
if (!BOSS_ZONE.isInsideZone(npc)) // Npc moved out of the zone
{
Spawn spawn = npc.getSpawn();
final Spawn spawn = npc.getSpawn();
if (spawn != null)
{
npc.teleToLocation(spawn.getX(), spawn.getY(), spawn.getZ());
@ -677,13 +677,13 @@ public class Lilith extends AbstractNpcAI
private long calcReuseFromDays(int day1Minute, int day1Hour, int day1Day, int day2Minute, int day2Hour, int day2Day)
{
Calendar now = Calendar.getInstance();
Calendar day1 = (Calendar) now.clone();
final Calendar now = Calendar.getInstance();
final Calendar day1 = (Calendar) now.clone();
day1.set(Calendar.MINUTE, day1Minute);
day1.set(Calendar.HOUR_OF_DAY, day1Hour);
day1.set(Calendar.DAY_OF_WEEK, day1Day);
Calendar day2 = (Calendar) day1.clone();
final Calendar day2 = (Calendar) day1.clone();
day2.set(Calendar.MINUTE, day2Minute);
day2.set(Calendar.HOUR_OF_DAY, day2Hour);
day2.set(Calendar.DAY_OF_WEEK, day2Day);

View File

@ -279,7 +279,7 @@ public class Lindvior extends AbstractNpcAI
LOGGER.warning(getName() + ": Character: " + attacker.getName() + " attacked: " + npc.getName() + " wich is out of the boss zone!");
}
double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100;
final double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100;
if ((percent <= 80) && (_status == 0))
{
_zoneLair.broadcastPacket(new OnEventTrigger(RED_ZONE_EFFECT, true));
@ -466,7 +466,7 @@ public class Lindvior extends AbstractNpcAI
{
synchronized (_chargedValues)
{
int index = npc.getScriptValue();
final int index = npc.getScriptValue();
if (!hasFlag(_chargedMask, 1 << index))
{
_chargedValues[index] += caster.isGM() ? (30 / 4) + 2 : (1 / 4) + 2;
@ -707,7 +707,7 @@ public class Lindvior extends AbstractNpcAI
}
case "stage_1_activate_generator":
{
int index = npc.getScriptValue();
final int index = npc.getScriptValue();
if (!hasFlag(_activeMask, 1 << index))
{
_activeMask |= 1 << index;
@ -740,7 +740,7 @@ public class Lindvior extends AbstractNpcAI
{
_skillCastTask = ThreadPool.scheduleAtFixedRate(() -> _generatorSpawn.forEach(generators ->
{
int index = generators.getScriptValue();
final int index = generators.getScriptValue();
if (!generators.isCastingNow() && (generators.getEffectList().getBuffInfoBySkillId(SKILL_RECHARGE_POSIBLE.getSkillId()) == null) && !hasFlag(_chargedMask, 1 << index))
{
// TODO Need core implemented combo skill packet.
@ -878,7 +878,7 @@ public class Lindvior extends AbstractNpcAI
private void sendEventTrigger(boolean status, int... triggers)
{
IClientOutgoingPacket[] pakets = new IClientOutgoingPacket[triggers.length];
final IClientOutgoingPacket[] pakets = new IClientOutgoingPacket[triggers.length];
for (int i = 0; i < triggers.length; i++)
{
pakets[i] = new OnEventTrigger(triggers[i], status);

View File

@ -68,7 +68,7 @@ public class LindviorBoss extends AbstractNpcAI
@Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon)
{
double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100;
final double percent = ((npc.getCurrentHp() - damage) / npc.getMaxHp()) * 100;
final int chance = getRandom(100);
switch (npc.getId())
{

View File

@ -296,7 +296,7 @@ public class Trasken extends AbstractNpcAI
super();
_zoneLair = ZoneManager.getInstance().getZoneById(ZONE_ID, NoSummonFriendZone.class);
_zoneLair2 = ZoneManager.getInstance().getZoneById(ZONE_ID_HEART, NoSummonFriendZone.class);
int[] creature = new int[]
final int[] creature = new int[]
{
TRASKEN,
TIE,
@ -344,7 +344,7 @@ public class Trasken extends AbstractNpcAI
private void init()
{
int size = _zoneLair.getPlayersInside().size();
final int size = _zoneLair.getPlayersInside().size();
if ((size >= 14) && (size <= 28))
{
_playersToEnter = 7;

View File

@ -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())

View File

@ -65,7 +65,7 @@ public class RudolphsBlessing extends LongTimeEvent
if (takeItems(player, ITEM_REQUIREMENT.getId(), ITEM_REQUIREMENT.getCount()))
{
SkillCaster.triggerCast(player, player, RUDOLPH_TRYUCK.getSkill());
Skill rudolphsBlessing = SkillData.getInstance().getSkill(23297, 1);
final Skill rudolphsBlessing = SkillData.getInstance().getSkill(23297, 1);
rudolphsBlessing.applyEffects(player, player);
}
startQuestTimer("rudolph_eat", 10 * 60 * 1000, null, player);

View File

@ -199,7 +199,7 @@ public class SavingSanta extends LongTimeEvent
continue;
}
int result = pl.getEffectList().getBuffInfoBySkillId(23019).getSkill().getLevel() - skill.getLevel();
final int result = pl.getEffectList().getBuffInfoBySkillId(23019).getSkill().getLevel() - skill.getLevel();
if (result == 0)
{
@ -216,7 +216,7 @@ public class SavingSanta extends LongTimeEvent
}
else if ((result == 1) || (result == -2))
{
int level = (pl.isAffectedBySkill(23022) ? (pl.getEffectList().getBuffInfoBySkillId(23022).getSkill().getLevel() + 1) : 1);
final int level = (pl.isAffectedBySkill(23022) ? (pl.getEffectList().getBuffInfoBySkillId(23022).getSkill().getLevel() + 1) : 1);
pl.broadcastPacket(new MagicSkillUse(pl, pl, 23022, level, 3000, 1));
SkillData.getInstance().getSkill(23022, level).applyEffects(pl, pl);
@ -324,7 +324,7 @@ public class SavingSanta extends LongTimeEvent
{
if (_rewardedPlayers.containsKey(pl.getAccountName()))
{
long elapsedTimeSinceLastRewarded = System.currentTimeMillis() - _rewardedPlayers.get(pl.getAccountName());
final long elapsedTimeSinceLastRewarded = System.currentTimeMillis() - _rewardedPlayers.get(pl.getAccountName());
if (elapsedTimeSinceLastRewarded < MIN_TIME_BETWEEN_2_REWARDS)
{
continue;
@ -339,10 +339,10 @@ public class SavingSanta extends LongTimeEvent
continue;
}
}
int locx = (int) (pl.getX() + (Math.pow(-1, getRandom(1, 2)) * 50));
int locy = (int) (pl.getY() + (Math.pow(-1, getRandom(1, 2)) * 50));
int heading = Util.calculateHeadingFrom(locx, locy, pl.getX(), pl.getY());
Npc santa = addSpawn(HOLIDAY_SANTA_ID, locx, locy, pl.getZ(), heading, false, 30000);
final int locx = (int) (pl.getX() + (Math.pow(-1, getRandom(1, 2)) * 50));
final int locy = (int) (pl.getY() + (Math.pow(-1, getRandom(1, 2)) * 50));
final int heading = Util.calculateHeadingFrom(locx, locy, pl.getX(), pl.getY());
final Npc santa = addSpawn(HOLIDAY_SANTA_ID, locx, locy, pl.getZ(), heading, false, 30000);
_rewardedPlayers.put(pl.getAccountName(), System.currentTimeMillis());
player.getVariables().set("LAST_SANTA_REWARD", System.currentTimeMillis());
startQuestTimer("SantaRewarding0", 500, santa, pl);
@ -446,7 +446,7 @@ public class SavingSanta extends LongTimeEvent
{
if (_blessedPlayers.containsKey(plb.getAccountName()))
{
long elapsedTimeSinceLastBlessed = currentTime - _blessedPlayers.get(plb.getAccountName());
final long elapsedTimeSinceLastBlessed = currentTime - _blessedPlayers.get(plb.getAccountName());
if (elapsedTimeSinceLastBlessed < MIN_TIME_BETWEEN_2_BLESSINGS)
{
continue;
@ -504,12 +504,12 @@ public class SavingSanta extends LongTimeEvent
{
for (PlayerInstance playerr : World.getInstance().getVisibleObjects(tree, PlayerInstance.class))
{
int xxMin = tree.getX() - 60;
int yyMin = tree.getY() - 60;
int xxMax = tree.getX() + 60;
int yyMax = tree.getY() + 60;
int playerX = playerr.getX();
int playerY = playerr.getY();
final int xxMin = tree.getX() - 60;
final int yyMin = tree.getY() - 60;
final int xxMax = tree.getX() + 60;
final int yyMax = tree.getY() + 60;
final int playerX = playerr.getX();
final int playerY = playerr.getY();
if ((playerX > xxMin) && (playerX < xxMax) && (playerY > yyMin) && (playerY < yyMax))
{
@ -528,7 +528,7 @@ public class SavingSanta extends LongTimeEvent
for (ItemHolder item : TREE_REQUIRED_ITEMS)
{
long pieceCount = player.getInventory().getInventoryItemCount(item.getId(), -1);
final long pieceCount = player.getInventory().getInventoryItemCount(item.getId(), -1);
if (pieceCount >= item.getCount())
{
itemsOk = itemsOk + 1;
@ -573,7 +573,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SpecialTree"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Special Christmas Tree</font></td><td width=40><img src=\"Icon.etc_x_mas_tree_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
final long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
int itemsOk = 0;
if (pieceCount >= 10)
@ -613,7 +613,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SantaHat"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Santa's Hat</font></td><td width=40><img src=\"Icon.Accessory_santas_cap_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
final long pieceCount = player.getInventory().getInventoryItemCount(X_MAS_TREE1, -1);
int itemsOk = 0;
if (pieceCount >= 10)
@ -651,7 +651,7 @@ public class SavingSanta extends LongTimeEvent
else if (event.equalsIgnoreCase("SavingSantaHat"))
{
htmltext = "<html><title>Christmas Event</title><body><br><br><table width=260><tr><td></td><td width=40></td><td width=40></td></tr><tr><td><font color=LEVEL>Saving Santa's Hat</font></td><td width=40><img src=\"Icon.Accessory_santas_cap_i00\" width=32 height=32></td><td width=40></td></tr></table><br><br><table width=260>";
long pieceCount = player.getInventory().getAdena();
final long pieceCount = player.getInventory().getAdena();
int itemsOk = 0;
if (pieceCount >= 50000)

View File

@ -86,9 +86,9 @@ public class SkillTransfer extends AbstractNpcAI
return;
}
int pomanderId = PORMANDERS[index].getId();
final int pomanderId = PORMANDERS[index].getId();
// remove unsused HolyPomander
PlayerInventory inv = player.getInventory();
final PlayerInventory inv = player.getInventory();
for (ItemInstance itemI : inv.getAllItemsByItemId(pomanderId))
{
inv.destroyItem("[HolyPomander - remove]", itemI, player, null);

View File

@ -730,7 +730,6 @@ public class MasterHandler
catch (Exception e)
{
LOGGER.log(Level.WARNING, "Failed loading handler: " + c.getSimpleName(), e);
continue;
}
}
}

View File

@ -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)

View File

@ -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)
{

View File

@ -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

View File

@ -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>");
}

View File

@ -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)

View File

@ -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"))

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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());

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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]);

View File

@ -102,7 +102,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);
@ -204,7 +204,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)
{

View File

@ -36,7 +36,7 @@ public class DisableSkill extends AbstractEffect
public DisableSkill(StatsSet params)
{
String disable = params.getString("disable");
final String disable = params.getString("disable");
if ((disable != null) && !disable.isEmpty())
{
disableSkills = new HashSet<>();

View File

@ -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<>();

View File

@ -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<>();

View File

@ -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))

View File

@ -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))

View File

@ -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)

View File

@ -279,7 +279,7 @@ public class AltarOfShilen extends AbstractInstance
final Instance world = npc.getInstanceWorld();
if (world != null)
{
int npcId = npc.getId();
final int npcId = npc.getId();
if (!killedMonsters.containsKey(npcId))
{
killedMonsters.put(npcId, 1);
@ -412,7 +412,7 @@ public class AltarOfShilen extends AbstractInstance
public String onFirstTalk(Npc npc, PlayerInstance player)
{
final Instance world = npc.getInstanceWorld();
String htmltext = null;
final String htmltext = null;
if (isInInstance(world))
{
switch (npc.getId())

View File

@ -103,13 +103,13 @@ public class CrystalCavernsEmeraldSquare extends AbstractInstance
{
case "HP_REGEN_TIMER":
{
int value = ((baseId == 5) || (baseId == 6)) ? 5 : baseId;
final int value = ((baseId == 5) || (baseId == 6)) ? 5 : baseId;
npc.getStat().addFixedValue(Stats.REGENERATE_HP_RATE, Double.valueOf(value * 1000));
break;
}
case "SUPPORT_SPAWN_TIMER":
{
int supportVal = npcVars.getInt("SUPPORT_VALUE", 0);
final int supportVal = npcVars.getInt("SUPPORT_VALUE", 0);
if (supportVal > 3)
{

View File

@ -166,7 +166,7 @@ public class KartiaHelperElise extends AbstractNpcAI
final Map<WorldObject, Integer> hpMap = new HashMap<>();
instance.getAliveNpcs(KARTIA_FRIENDS).forEach(friend -> hpMap.put(friend, friend != null ? friend.getCurrentHpPercent() : 100));
hpMap.put(plr, plr != null ? plr.getCurrentHpPercent() : 100);
Map<WorldObject, Integer> sortedHpMap = Util.sortByValue(hpMap, false);
final Map<WorldObject, Integer> sortedHpMap = Util.sortByValue(hpMap, false);
// See if any friends are below 80% HP and add to list of people to heal.
final List<WorldObject> peopleToHeal = new ArrayList<>();
@ -195,12 +195,12 @@ public class KartiaHelperElise extends AbstractNpcAI
{
if (personToHeal.getInstanceType() == InstanceType.PlayerInstance)
{
PlayerInstance thePlayer = (PlayerInstance) personToHeal;
final PlayerInstance thePlayer = (PlayerInstance) personToHeal;
thePlayer.setCurrentHp((thePlayer.getMaxHp() * .20) + thePlayer.getCurrentHp());
}
else
{
Npc npcToHeal = (Npc) personToHeal;
final Npc npcToHeal = (Npc) personToHeal;
npcToHeal.setCurrentHp((npcToHeal.getMaxHp() * .20) + npcToHeal.getCurrentHp());
}
}

View File

@ -46,7 +46,7 @@ public class Q00032_AnObviousLie extends Quest
// Misc
private static final int MIN_LVL = 45;
// Reward
private static final Map<String, Integer> EARS = new HashMap<>();
private static final Map<String, Integer> EARS = new HashMap<>();
static
{
EARS.put("cat", 6843); // Cat Ears

View File

@ -81,7 +81,7 @@ public class Q00245_ComeToMe extends Quest
{
if (player.isMentor() && event.equals("30847-13.html"))
{
PlayerInstance mentee = getCurrentMentee(player);
final PlayerInstance mentee = getCurrentMentee(player);
if (mentee != null)
{
if (player.destroyItemByItemId("quest_245", CRYSTAL_A, 100, npc, true))
@ -94,7 +94,7 @@ public class Q00245_ComeToMe extends Quest
return "30847-12.html";
}
QuestState qs = getQuestState(player, false);
final QuestState qs = getQuestState(player, false);
if (qs == null)
{
return event;
@ -151,7 +151,7 @@ public class Q00245_ComeToMe extends Quest
}
else if (player.isMentee())
{
PlayerInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
final PlayerInstance mentor = MentorManager.getInstance().getMentor(player.getObjectId()).getPlayerInstance();
if ((mentor != null) && mentor.isOnline() && Util.checkIfInRange(200, npc, mentor, true))
{
htmltext = "30847-10.html";
@ -239,7 +239,7 @@ public class Q00245_ComeToMe extends Quest
{
if (killer.isMentee())
{
PlayerInstance mentor = MentorManager.getInstance().getMentor(killer.getObjectId()).getPlayerInstance();
final PlayerInstance mentor = MentorManager.getInstance().getMentor(killer.getObjectId()).getPlayerInstance();
if ((mentor != null) && Util.checkIfInRange(500, killer, mentor, false))
{
giveItems(killer, CRYSTALS_OF_EXPERIENCE, 1);

View File

@ -221,6 +221,7 @@ public class Q00336_CoinsOfMagic extends Quest
{
return "30702-02a.html";
}
break;
}
case WAREHOUSE_KEEPER_SORINT:
{
@ -1345,28 +1346,28 @@ public class Q00336_CoinsOfMagic extends Quest
* @param npcId
* @param weightPoint
* @param base
* @param ITEM_1_1
* @param ITEM_1_2
* @param ITEM_1_MUL
* @param ITEM_2
* @param ITEM_3
* @param ITEM_4
* @param item1a
* @param item1b
* @param item1Mul
* @param item2
* @param item3
* @param item4
* @return
*/
private String shortFirstSteps(QuestState qs, int npcId, int weightPoint, int base, int ITEM_1_1, int ITEM_1_2, int ITEM_1_MUL, int ITEM_2, int ITEM_3, int ITEM_4)
private String shortFirstSteps(QuestState qs, int npcId, int weightPoint, int base, int item1a, int item1b, int item1Mul, int item2, int item3, int item4)
{
final PlayerInstance player = qs.getPlayer();
switch (qs.getInt(PARAM_2))
{
case 42:
{
if ((getQuestItemsCount(player, ITEM_1_1) >= (base * ITEM_1_MUL)) && ((ITEM_1_2 == 0) || (getQuestItemsCount(player, ITEM_1_2) >= base)))
if ((getQuestItemsCount(player, item1a) >= (base * item1Mul)) && ((item1b == 0) || (getQuestItemsCount(player, item1b) >= base)))
{
qs.set(FLAG, 1);
takeItems(player, ITEM_1_1, base * ITEM_1_MUL);
if (ITEM_1_2 > 0)
takeItems(player, item1a, base * item1Mul);
if (item1b > 0)
{
takeItems(player, ITEM_1_2, base);
takeItems(player, item1b, base);
}
qs.set(WEIGHT_POINT, weightPoint);
int param1 = getRandom(3) + 1;
@ -1379,10 +1380,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 31:
{
if (getQuestItemsCount(player, ITEM_2) >= base)
if (getQuestItemsCount(player, item2) >= base)
{
qs.set(FLAG, 1);
takeItems(player, ITEM_2, base);
takeItems(player, item2, base);
qs.set(WEIGHT_POINT, weightPoint);
int param1 = getRandom(3) + 1;
param1 += (getRandom(3) + 1) * 4;
@ -1394,10 +1395,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 21:
{
if (getQuestItemsCount(player, ITEM_3) >= base)
if (getQuestItemsCount(player, item3) >= base)
{
qs.set(FLAG, 1);
takeItems(player, ITEM_3, base);
takeItems(player, item3, base);
qs.set(WEIGHT_POINT, weightPoint);
int param1 = getRandom(3) + 1;
param1 += (getRandom(3) + 1) * 4;
@ -1409,10 +1410,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 11:
{
if (getQuestItemsCount(player, ITEM_4) >= base)
if (getQuestItemsCount(player, item4) >= base)
{
qs.set(FLAG, 1);
takeItems(player, ITEM_4, base);
takeItems(player, item4, base);
qs.set(WEIGHT_POINT, weightPoint);
int param1 = getRandom(3) + 1;
param1 += (getRandom(3) + 1) * 4;
@ -1430,28 +1431,28 @@ public class Q00336_CoinsOfMagic extends Quest
* @param qs
* @param npcId
* @param mul
* @param ITEM_1
* @param ITEM_1_MUL
* @param REWARD_1
* @param ITEM_2
* @param REWARD_2
* @param ITEM_3
* @param REWARD_3
* @param ITEM_4
* @param REWARD_4
* @param item1
* @param item1Mul
* @param reward1
* @param item2
* @param reward2
* @param item3
* @param reward3
* @param item4
* @param reward4
* @return
*/
private String shortSecondStepOneItem(QuestState qs, int npcId, int mul, int ITEM_1, int ITEM_1_MUL, int REWARD_1, int ITEM_2, int REWARD_2, int ITEM_3, int REWARD_3, int ITEM_4, int REWARD_4)
private String shortSecondStepOneItem(QuestState qs, int npcId, int mul, int item1, int item1Mul, int reward1, int item2, int reward2, int item3, int reward3, int item4, int reward4)
{
final PlayerInstance player = qs.getPlayer();
switch (qs.getInt(PARAM_2))
{
case 42:
{
if (getQuestItemsCount(player, ITEM_1) >= (10 * mul * ITEM_1_MUL))
if (getQuestItemsCount(player, item1) >= (10 * mul * item1Mul))
{
takeItems(player, ITEM_1, 10 * mul * ITEM_1_MUL);
giveItems(player, REWARD_1, 1 * mul);
takeItems(player, item1, 10 * mul * item1Mul);
giveItems(player, reward1, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1459,10 +1460,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 31:
{
if (getQuestItemsCount(player, ITEM_2) >= (5 * mul))
if (getQuestItemsCount(player, item2) >= (5 * mul))
{
takeItems(player, ITEM_2, 5 * mul);
giveItems(player, REWARD_2, 1 * mul);
takeItems(player, item2, 5 * mul);
giveItems(player, reward2, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1470,10 +1471,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 21:
{
if (getQuestItemsCount(player, ITEM_3) >= (5 * mul))
if (getQuestItemsCount(player, item3) >= (5 * mul))
{
takeItems(player, ITEM_3, 5 * mul);
giveItems(player, REWARD_3, 1 * mul);
takeItems(player, item3, 5 * mul);
giveItems(player, reward3, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1481,10 +1482,10 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 11:
{
if (getQuestItemsCount(player, ITEM_4) >= (5 * mul))
if (getQuestItemsCount(player, item4) >= (5 * mul))
{
takeItems(player, ITEM_4, 5 * mul);
giveItems(player, REWARD_4, 1 * mul);
takeItems(player, item4, 5 * mul);
giveItems(player, reward4, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1498,32 +1499,32 @@ public class Q00336_CoinsOfMagic extends Quest
* @param qs
* @param npcId
* @param mul
* @param ITEM_1_1
* @param ITEM_1_2
* @param REWARD_1
* @param ITEM_2_1
* @param ITEM_2_2
* @param REWARD_2
* @param ITEM_3_1
* @param ITEM_3_2
* @param REWARD_3
* @param ITEM_4_1
* @param ITEM_4_2
* @param REWARD_4
* @param item1a
* @param item1b
* @param reward1
* @param item2a
* @param item2b
* @param reward2
* @param item3a
* @param item3b
* @param reward3
* @param item4a
* @param item4b
* @param reward4
* @return
*/
private String shortSecondStepTwoItems(QuestState qs, int npcId, int mul, int ITEM_1_1, int ITEM_1_2, int REWARD_1, int ITEM_2_1, int ITEM_2_2, int REWARD_2, int ITEM_3_1, int ITEM_3_2, int REWARD_3, int ITEM_4_1, int ITEM_4_2, int REWARD_4)
private String shortSecondStepTwoItems(QuestState qs, int npcId, int mul, int item1a, int item1b, int reward1, int item2a, int item2b, int reward2, int item3a, int item3b, int reward3, int item4a, int item4b, int reward4)
{
final PlayerInstance player = qs.getPlayer();
switch (qs.getInt(PARAM_2))
{
case 42:
{
if ((getQuestItemsCount(player, ITEM_1_1) >= (10 * mul)) && (getQuestItemsCount(player, ITEM_1_2) >= (10 * mul)))
if ((getQuestItemsCount(player, item1a) >= (10 * mul)) && (getQuestItemsCount(player, item1b) >= (10 * mul)))
{
takeItems(player, ITEM_1_1, 10 * mul);
takeItems(player, ITEM_1_2, 10 * mul);
giveItems(player, REWARD_1, 1 * mul);
takeItems(player, item1a, 10 * mul);
takeItems(player, item1b, 10 * mul);
giveItems(player, reward1, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1531,11 +1532,11 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 31:
{
if ((getQuestItemsCount(player, ITEM_2_1) >= (5 * mul)) && (getQuestItemsCount(player, ITEM_2_2) >= (5 * mul)))
if ((getQuestItemsCount(player, item2a) >= (5 * mul)) && (getQuestItemsCount(player, item2b) >= (5 * mul)))
{
takeItems(player, ITEM_2_1, 5 * mul);
takeItems(player, ITEM_2_2, 5 * mul);
giveItems(player, REWARD_2, 1 * mul);
takeItems(player, item2a, 5 * mul);
takeItems(player, item2b, 5 * mul);
giveItems(player, reward2, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1543,11 +1544,11 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 21:
{
if ((getQuestItemsCount(player, ITEM_3_1) >= (5 * mul)) && (getQuestItemsCount(player, ITEM_3_2) >= (5 * mul)))
if ((getQuestItemsCount(player, item3a) >= (5 * mul)) && (getQuestItemsCount(player, item3b) >= (5 * mul)))
{
takeItems(player, ITEM_3_1, 5 * mul);
takeItems(player, ITEM_3_2, 5 * mul);
giveItems(player, REWARD_3, 1 * mul);
takeItems(player, item3a, 5 * mul);
takeItems(player, item3b, 5 * mul);
giveItems(player, reward3, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1555,11 +1556,11 @@ public class Q00336_CoinsOfMagic extends Quest
}
case 11:
{
if ((getQuestItemsCount(player, ITEM_4_1) >= (5 * mul)) && (getQuestItemsCount(player, ITEM_4_2) >= (5 * mul)))
if ((getQuestItemsCount(player, item4a) >= (5 * mul)) && (getQuestItemsCount(player, item4b) >= (5 * mul)))
{
takeItems(player, ITEM_4_1, 5 * mul);
takeItems(player, ITEM_4_2, 5 * mul);
giveItems(player, REWARD_4, 1 * mul);
takeItems(player, item4a, 5 * mul);
takeItems(player, item4b, 5 * mul);
giveItems(player, reward4, 1 * mul);
playSound(player, QuestSound.ITEMSOUND_QUEST_MIDDLE);
return npcId + "-07.html";
}
@ -1573,13 +1574,13 @@ public class Q00336_CoinsOfMagic extends Quest
* @param qs
* @param npcId
* @param flag
* @param ITEM_1
* @param ITEM_2
* @param ITEM_3
* @param ITEM_4
* @param item1
* @param item2
* @param item3
* @param item4
* @return
*/
private String shortThirdStep(QuestState qs, int npcId, int flag, int ITEM_1, int ITEM_2, int ITEM_3, int ITEM_4)
private String shortThirdStep(QuestState qs, int npcId, int flag, int item1, int item2, int item3, int item4)
{
final PlayerInstance player = qs.getPlayer();
qs.set(PARAM_3, 0);
@ -1591,22 +1592,22 @@ public class Q00336_CoinsOfMagic extends Quest
{
case 42:
{
giveItems(player, ITEM_1, 1);
giveItems(player, item1, 1);
break;
}
case 31:
{
giveItems(player, ITEM_2, 1);
giveItems(player, item2, 1);
break;
}
case 21:
{
giveItems(player, ITEM_3, 1);
giveItems(player, item3, 1);
break;
}
case 11:
{
giveItems(player, ITEM_4, 1);
giveItems(player, item4, 1);
break;
}
}

View File

@ -149,8 +149,8 @@ public class Q00350_EnhanceYourWeapon extends Quest
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = event;
QuestState qs = getQuestState(player, false);
final String htmltext = event;
final QuestState qs = getQuestState(player, false);
if (event.endsWith("-04.htm"))
{
qs.startQuest();
@ -257,7 +257,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
if (Item != null)
{
// Prepare inventory update packet
InventoryUpdate playerIU = new InventoryUpdate();
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addRemovedItem(Item);
// Add new crystal to the killer's inventory
@ -275,7 +275,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
}
// Send system message
SystemMessage sms = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
final SystemMessage sms = new SystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
sms.addItemName(giveid);
player.sendPacket(sms);
@ -295,7 +295,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
SoulCrystal ret = null;
for (ItemInstance item : player.getInventory().getItems())
{
int itemId = item.getId();
final int itemId = item.getId();
if (!SOUL_CRYSTALS.containsKey(itemId))
{
continue;
@ -360,7 +360,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
return;
}
Map<PlayerInstance, SoulCrystal> players = new HashMap<>();
final Map<PlayerInstance, SoulCrystal> players = new HashMap<>();
int maxSCLevel = 0;
// TODO: what if mob support last_hit + party?
@ -374,7 +374,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
continue;
}
SoulCrystal sc = getSCForPlayer(pl);
final SoulCrystal sc = getSCForPlayer(pl);
if (sc == null)
{
continue;
@ -389,7 +389,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
}
else
{
SoulCrystal sc = getSCForPlayer(killer);
final SoulCrystal sc = getSCForPlayer(killer);
if (sc != null)
{
players.put(killer, sc);
@ -400,7 +400,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
}
}
// Init some useful vars
LevelingInfo mainlvlInfo = NPC_LEVELING_INFO.get(mob.getId()).get(maxSCLevel);
final LevelingInfo mainlvlInfo = NPC_LEVELING_INFO.get(mob.getId()).get(maxSCLevel);
if (mainlvlInfo == null)
{
@ -419,7 +419,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
}
// Fail if the killer isn't in the _absorbersList of this Attackable and mob is not boss
AbsorberInfo ai = mob.getAbsorbersList().get(killer.getObjectId());
final AbsorberInfo ai = mob.getAbsorbersList().get(killer.getObjectId());
boolean isSuccess = true;
if ((ai == null) || (ai.getObjectId() != killer.getObjectId()))
{
@ -448,7 +448,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
// among those who have crystals, only. However, this might actually be correct (same as retail).
if (killer.getParty() != null)
{
PlayerInstance lucky = killer.getParty().getMembers().get(getRandom(killer.getParty().getMemberCount()));
final PlayerInstance lucky = killer.getParty().getMembers().get(getRandom(killer.getParty().getMemberCount()));
levelCrystal(lucky, players.get(lucky), mob);
}
else
@ -461,11 +461,11 @@ public class Q00350_EnhanceYourWeapon extends Quest
{
if (killer.getParty() != null)
{
List<PlayerInstance> luckyParty = new ArrayList<>();
final List<PlayerInstance> luckyParty = new ArrayList<>();
luckyParty.addAll(killer.getParty().getMembers());
while ((getRandom(100) < 33) && !luckyParty.isEmpty())
{
PlayerInstance lucky = luckyParty.remove(getRandom(luckyParty.size()));
final PlayerInstance lucky = luckyParty.remove(getRandom(luckyParty.size()));
if (players.containsKey(lucky))
{
levelCrystal(lucky, players.get(lucky), mob);
@ -508,19 +508,19 @@ public class Q00350_EnhanceYourWeapon extends Quest
{
try
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setIgnoringComments(true);
File file = new File(Config.DATAPACK_ROOT, "data/LevelUpCrystalData.xml");
final File file = new File(Config.DATAPACK_ROOT, "data/LevelUpCrystalData.xml");
if (!file.exists())
{
LOGGER.severe("[EnhanceYourWeapon] Missing LevelUpCrystalData.xml. The quest wont work without it!");
return;
}
Document doc = factory.newDocumentBuilder().parse(file);
Node first = doc.getFirstChild();
final Document doc = factory.newDocumentBuilder().parse(file);
final Node first = doc.getFirstChild();
if ((first != null) && "list".equalsIgnoreCase(first.getNodeName()))
{
for (Node n = first.getFirstChild(); n != null; n = n.getNextSibling())
@ -531,14 +531,14 @@ public class Q00350_EnhanceYourWeapon extends Quest
{
if ("item".equalsIgnoreCase(d.getNodeName()))
{
NamedNodeMap attrs = d.getAttributes();
final NamedNodeMap attrs = d.getAttributes();
Node att = attrs.getNamedItem("itemId");
if (att == null)
{
LOGGER.severe("[EnhanceYourWeapon] Missing itemId in Crystal List, skipping");
continue;
}
int itemId = Integer.parseInt(attrs.getNamedItem("itemId").getNodeValue());
final int itemId = Integer.parseInt(attrs.getNamedItem("itemId").getNodeValue());
att = attrs.getNamedItem("level");
if (att == null)
@ -546,7 +546,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
LOGGER.severe("[EnhanceYourWeapon] Missing level in Crystal List itemId: " + itemId + ", skipping");
continue;
}
int level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
final int level = Integer.parseInt(attrs.getNamedItem("level").getNodeValue());
att = attrs.getNamedItem("leveledItemId");
if (att == null)
@ -554,7 +554,7 @@ public class Q00350_EnhanceYourWeapon extends Quest
LOGGER.severe("[EnhanceYourWeapon] Missing leveledItemId in Crystal List itemId: " + itemId + ", skipping");
continue;
}
int leveledItemId = Integer.parseInt(attrs.getNamedItem("leveledItemId").getNodeValue());
final int leveledItemId = Integer.parseInt(attrs.getNamedItem("leveledItemId").getNodeValue());
SOUL_CRYSTALS.put(itemId, new SoulCrystal(level, itemId, leveledItemId));
}
@ -574,8 +574,8 @@ public class Q00350_EnhanceYourWeapon extends Quest
continue;
}
int npcId = Integer.parseInt(att.getNodeValue());
Map<Integer, LevelingInfo> temp = new HashMap<>();
final int npcId = Integer.parseInt(att.getNodeValue());
final Map<Integer, LevelingInfo> temp = new HashMap<>();
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
boolean isSkillNeeded = false;
@ -604,17 +604,17 @@ public class Q00350_EnhanceYourWeapon extends Quest
isSkillNeeded = Boolean.parseBoolean(att.getNodeValue());
}
Node att1 = attrs.getNamedItem("maxLevel");
Node att2 = attrs.getNamedItem("levelList");
final Node att1 = attrs.getNamedItem("maxLevel");
final Node att2 = attrs.getNamedItem("levelList");
if ((att1 == null) && (att2 == null))
{
LOGGER.severe("[EnhanceYourWeapon] Missing maxlevel/levelList in NPC List npcId: " + npcId + ", skipping");
continue;
}
LevelingInfo info = new LevelingInfo(absorbType, isSkillNeeded, chance);
final LevelingInfo info = new LevelingInfo(absorbType, isSkillNeeded, chance);
if (att1 != null)
{
int maxLevel = Integer.parseInt(att1.getNodeValue());
final int maxLevel = Integer.parseInt(att1.getNodeValue());
for (int i = 0; i <= maxLevel; i++)
{
temp.put(i, info);
@ -622,8 +622,8 @@ public class Q00350_EnhanceYourWeapon extends Quest
}
else if (att2 != null)
{
StringTokenizer st = new StringTokenizer(att2.getNodeValue(), ",");
int tokenCount = st.countTokens();
final StringTokenizer st = new StringTokenizer(att2.getNodeValue(), ",");
final int tokenCount = st.countTokens();
for (int i = 0; i < tokenCount; i++)
{
Integer value = Integer.decode(st.nextToken().trim());

View File

@ -35,7 +35,8 @@ public class Q00357_WarehouseKeepersAmbition extends Quest
// Item
private static final int JADE_CRYSTAL = 5867;
// Monsters
private final Map<Integer, Double> DROP_DATA = new HashMap<>();
private static final Map<Integer, Double> DROP_DATA = new HashMap<>();
static
{
DROP_DATA.put(20594, 0.577); // Forest Runner
DROP_DATA.put(20595, 0.6); // Fline Elder

View File

@ -90,7 +90,7 @@ public class Q00454_CompletelyLost extends Quest
final PlayerInstance leader = npc.getVariables().getObject("leader", PlayerInstance.class);
if (leader != null)
{
double dist = Util.calculateDistance(npc, leader, false, false);
final double dist = Util.calculateDistance(npc, leader, false, false);
if (dist > 1000)
{
if (((dist > 5000) && (dist < 6900)) || ((dist > 31000) && (dist < 32000)))

View File

@ -205,7 +205,7 @@ public class Q00457_LostAndFound extends Quest
public String onTalk(Npc npc, PlayerInstance player)
{
String htmltext = getNoQuestMsg(player);
QuestState qs = getQuestState(player, true);
final QuestState qs = getQuestState(player, true);
switch (qs.getState())
{

View File

@ -307,10 +307,10 @@ public class Q00482_RecertificationOfValue extends Quest
final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1))
{
int npcId = npc.getId();
final int npcId = npc.getId();
String variable = String.valueOf(npcId); // i3
int currentValue = qs.getInt(variable);
final String variable = String.valueOf(npcId); // i3
final int currentValue = qs.getInt(variable);
if (currentValue < 10)
{
qs.set(variable, String.valueOf(currentValue + 1)); // IncreaseNPCLogByID

View File

@ -66,7 +66,7 @@ public class Q00624_TheFinestIngredientsPart1 extends Quest
{
final QuestState qs = getQuestState(player, false);
String htmltext = null;
if(qs != null)
if (qs != null)
{
switch (event)
{

View File

@ -95,7 +95,7 @@ public class Q00625_TheFinestIngredientsPart2 extends Quest
{
if (hasItem(player, SPECIAL_YETI_MEAT))
{
int random = getRandom(1000);
final int random = getRandom(1000);
if (random < 167)
{
rewardItems(player, GREATER_DYE_OF_STR_1);
@ -141,7 +141,7 @@ public class Q00625_TheFinestIngredientsPart2 extends Quest
{
qs.setCond(2, true);
takeItem(player, FOOD_FOR_BUMBALUMP);
Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC);
final Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC);
umpaloopa.setSummoner(player);
htmltext = event;
}
@ -232,7 +232,7 @@ public class Q00625_TheFinestIngredientsPart2 extends Quest
{
if (!isBumbalumpSpawned())
{
Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC);
final Npc umpaloopa = addSpawn(ICICLE_EMPEROR_BUMBALUMP, ICICLE_EMPEROR_BUMBALUMP_LOC);
umpaloopa.setSummoner(talker);
htmltext = "31542-02.html";
}

View File

@ -103,7 +103,8 @@ public class Q00699_GuardianOfTheSkies extends Quest
{
if (npc.getId() == VALDSTONE)
{
int amount = 0, chance = getRandom(1000);
int amount = 0;
final int chance = getRandom(1000);
if (chance < 215)
{
amount = getRandom(10) + 90;

View File

@ -124,10 +124,10 @@ public class Q00700_CursedLife extends Quest
}
case State.STARTED:
{
long bones = getQuestItemsCount(player, SWALLOWED_BONES);
long ribs = getQuestItemsCount(player, SWALLOWED_STERNUM);
long skulls = getQuestItemsCount(player, SWALLOWED_SKULL);
long sum = bones + ribs + skulls;
final long bones = getQuestItemsCount(player, SWALLOWED_BONES);
final long ribs = getQuestItemsCount(player, SWALLOWED_STERNUM);
final long skulls = getQuestItemsCount(player, SWALLOWED_SKULL);
final long sum = bones + ribs + skulls;
if (sum > 0)
{
giveAdena(player, ((bones * SWALLOWED_BONES_ADENA) + (ribs * SWALLOWED_STERNUM_ADENA) + (skulls * SWALLOWED_SKULL_ADENA) + (sum >= 10 ? BONUS : 0)), true);
@ -242,8 +242,8 @@ public class Q00700_CursedLife extends Quest
}
else
{
Integer[] chances = MONSTERS.get(npc.getId());
int chance = getRandom(1000);
final Integer[] chances = MONSTERS.get(npc.getId());
final int chance = getRandom(1000);
if (chance < chances[0])
{
giveItems(player, SWALLOWED_BONES, 1);

View File

@ -160,8 +160,8 @@ public class Q00702_ATrapForRevenge extends Quest
}
else if (event.equalsIgnoreCase("32555-15.html"))
{
int i0 = getRandom(1000);
int i1 = getRandom(1000);
final int i0 = getRandom(1000);
final int i1 = getRandom(1000);
if ((i0 >= 500) && (i1 >= 600))
{
@ -194,6 +194,7 @@ public class Q00702_ATrapForRevenge extends Quest
giveAdena(player, getRandom(49917) + 125000, false);
if (i1 < 210)
{
// Do nothing.
}
else if (i1 < 340)
{
@ -241,6 +242,7 @@ public class Q00702_ATrapForRevenge extends Quest
giveAdena(player, getRandom(49917) + 25000, false);
if (i1 < 210)
{
// Do nothing.
}
else if (i1 < 340)
{

View File

@ -41,7 +41,7 @@ public class Q10274_CollectingInTheAir extends Quest
private static final int BLUE = 13859;
private static final int GREEN = 13860;
// Monsters
private static final int MOBS[] =
private static final int[] MOBS =
{
18684, // Red Star Stone
18685, // Red Star Stone

View File

@ -183,8 +183,8 @@ public class Q10304_ForForgottenHeroes extends Quest
final QuestState qs = getQuestState(player, false);
if (qs != null)
{
int cond = qs.getCond();
int npcId = npc.getId();
final int cond = qs.getCond();
final int npcId = npc.getId();
if (player.isInsideRadius3D(npc, Config.ALT_PARTY_RANGE))
{
if ((npcId == YUI) && (cond == 2))

View File

@ -190,7 +190,7 @@ public class Q10339_FightingTheForgotten extends Quest
public Set<NpcLogListHolder> getNpcLogList(PlayerInstance player)
{
final QuestState qs = getQuestState(player, false);
if(qs != null)
if (qs != null)
{
final Set<NpcLogListHolder> npcLogList = new HashSet<>(1);
npcLogList.add(new NpcLogListHolder(NpcStringId.ELIMINATING_THE_ANCIENT_GHOSTS, qs.getMemoState()));

View File

@ -120,7 +120,7 @@ public class Q10377_TheInvadedExecutionGrounds extends Quest
@Override
public String onFirstTalk(Npc npc, PlayerInstance player)
{
QuestState qs = getQuestState(player, false);
final QuestState qs = getQuestState(player, false);
if (qs != null)
{
switch (npc.getId())

View File

@ -135,7 +135,7 @@ public class Q10462_TemperARustingBlade extends Quest
{
final PlayerInstance player = event.getPlayer();
final QuestState qs = getQuestState(player, false);
ItemInstance item = qs.getPlayer().getInventory().getItemByItemId(PRACTICE_WEAPON);
final ItemInstance item = qs.getPlayer().getInventory().getItemByItemId(PRACTICE_WEAPON);
if ((item != null) && qs.isCond(1) && item.isAugmented())
{
qs.setCond(2, true);

View File

@ -183,6 +183,6 @@ public class Q10707_FlamesOfSorrow extends Quest
public String onFirstTalk(Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, false);
return(qs != null) && qs.isCond(1) ? "19545.html" : "19545-no.html";
return (qs != null) && qs.isCond(1) ? "19545.html" : "19545-no.html";
}
}

View File

@ -549,7 +549,7 @@ public class Q10751_WindsOfFateEncounters extends Quest
final PlayerInstance player = event.getPlayer();
final QuestState qs = getQuestState(player, false);
if ((qs == null) && player.getRace() == Race.ERTHEIA && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.FIRST_CLASS_GROUP)))
if ((qs == null) && (player.getRace() == Race.ERTHEIA) && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.FIRST_CLASS_GROUP)))
{
showOnScreenMsg(player, NpcStringId.QUEEN_NAVARI_HAS_SENT_A_LETTER_NCLICK_THE_QUESTION_MARK_ICON_TO_READ, ExShowScreenMessage.TOP_CENTER, 10000);
player.sendPacket(new TutorialShowQuestionMark(getId()));

View File

@ -572,7 +572,7 @@ public class Q10752_WindsOfFateAPromise extends Quest
final PlayerInstance player = event.getPlayer();
final QuestState qs = getQuestState(player, false);
if ((qs == null) && player.getRace() == Race.ERTHEIA && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)))
if ((qs == null) && (player.getRace() == Race.ERTHEIA) && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.THIRD_CLASS_GROUP)))
{
if (player.isMageClass())
{

View File

@ -835,7 +835,7 @@ public class Q10753_WindsOfFateChoices extends Quest
final PlayerInstance player = event.getPlayer();
final QuestState qs = getQuestState(player, false);
if ((qs == null) && player.getRace() == Race.ERTHEIA && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)))
if ((qs == null) && (player.getRace() == Race.ERTHEIA) && (player.getLevel() >= MIN_LEVEL) && (player.isInCategory(CategoryType.FOURTH_CLASS_GROUP)))
{
if (player.isMageClass())
{

View File

@ -64,7 +64,7 @@ public class Q10755_LettersFromTheQueenWindyHill extends LetterQuest
return null;
}
String htmltext = event;
final String htmltext = event;
switch (event)
{
case "30037-02.html":

View File

@ -64,7 +64,7 @@ public class Q10760_LettersFromTheQueenOrcBarracks extends LetterQuest
return null;
}
String htmltext = event;
final String htmltext = event;
switch (event)
{
case "30037-02.html":

View File

@ -48,7 +48,7 @@ public class Q10790_AMercenaryHelper extends Quest
private static final int NEEDLE_STAKATO_WORKER = 21514;
private static final int NEEDLE_STAKATO_SOLDIER = 21515;
private static final int NEEDLE_STAKATO_DRONE = 21516;
private static final Map<Integer, Integer> MOBS_REQUIRED = new HashMap<>();
private static final Map<Integer, Integer> MOBS_REQUIRED = new HashMap<>();
static
{
MOBS_REQUIRED.put(SPLINTER_STAKATO, 50);

View File

@ -55,7 +55,7 @@ public class Q10796_TheEyeThatDefiedTheGods extends Quest
{
return null;
}
String htmltext = event;
final String htmltext = event;
switch (event)
{
case "31616-02.htm":

View File

@ -60,7 +60,7 @@ public class Q10797_CrossingFate extends Quest
{
return null;
}
String htmltext = event;
final String htmltext = event;
switch (event)
{
case "31683-02.htm":

View File

@ -131,7 +131,7 @@ public class Q10801_TheDimensionalWarpPart1 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -131,7 +131,7 @@ public class Q10802_TheDimensionalWarpPart2 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -133,7 +133,7 @@ public class Q10803_TheDimensionalWarpPart3 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -133,7 +133,7 @@ public class Q10804_TheDimensionalWarpPart4 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -133,7 +133,7 @@ public class Q10805_TheDimensionalWarpPart5 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -131,7 +131,7 @@ public class Q10806_TheDimensionalWarpPart6 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -131,7 +131,7 @@ public class Q10807_TheDimensionalWarpPart7 extends Quest
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
Party party = killer.getParty();
final Party party = killer.getParty();
if (party != null)
{
party.getMembers().forEach(p -> onKill(npc, p));

View File

@ -276,28 +276,25 @@ public abstract class AirShipController extends AbstractNpcAI
@Override
public String onEnterZone(Creature creature, ZoneType zone)
{
if (creature instanceof ControllableAirShipInstance)
if ((creature instanceof ControllableAirShipInstance) && (_dockedShip == null))
{
if (_dockedShip == null)
_dockedShip = (ControllableAirShipInstance) creature;
_dockedShip.setInDock(_dockZone);
_dockedShip.setOustLoc(_oustLoc);
// Ship is not empty - display movie to passengers and dock
if (!_dockedShip.isEmpty())
{
_dockedShip = (ControllableAirShipInstance) creature;
_dockedShip.setInDock(_dockZone);
_dockedShip.setOustLoc(_oustLoc);
if (_movie != null)
{
playMovie(_dockedShip.getPassengers(), _movie);
}
// Ship is not empty - display movie to passengers and dock
if (!_dockedShip.isEmpty())
{
if (_movie != null)
{
playMovie(_dockedShip.getPassengers(), _movie);
}
ThreadPool.schedule(_decayTask, 1000);
}
else
{
_departSchedule = ThreadPool.schedule(_departTask, DEPART_INTERVAL);
}
ThreadPool.schedule(_decayTask, 1000);
}
else
{
_departSchedule = ThreadPool.schedule(_departTask, DEPART_INTERVAL);
}
}
return null;
@ -306,20 +303,17 @@ public abstract class AirShipController extends AbstractNpcAI
@Override
public String onExitZone(Creature creature, ZoneType zone)
{
if (creature instanceof ControllableAirShipInstance)
if ((creature instanceof ControllableAirShipInstance) && creature.equals(_dockedShip))
{
if (creature.equals(_dockedShip))
if (_departSchedule != null)
{
if (_departSchedule != null)
{
_departSchedule.cancel(false);
_departSchedule = null;
}
_dockedShip.setInDock(0);
_dockedShip = null;
_isBusy = false;
_departSchedule.cancel(false);
_departSchedule = null;
}
_dockedShip.setInDock(0);
_dockedShip = null;
_isBusy = false;
}
return null;
}
@ -358,14 +352,11 @@ public abstract class AirShipController extends AbstractNpcAI
}
}
}
if (_arrivalPath == null)
else if (!ZoneManager.getInstance().getZoneById(_dockZone, ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ))
{
if (!ZoneManager.getInstance().getZoneById(_dockZone, ScriptZone.class).isInsideZone(_shipSpawnX, _shipSpawnY, _shipSpawnZ))
{
LOGGER.warning(getName() + ": Arrival path is null and spawn point not in zone " + _dockZone + ", controller disabled");
_isBusy = true;
return;
}
LOGGER.warning(getName() + ": Arrival path is null and spawn point not in zone " + _dockZone + ", controller disabled");
_isBusy = true;
return;
}
if (_departPath != null)

View File

@ -1755,7 +1755,7 @@ public class Config
}
Arrays.sort(ENCHANT_BLACKLIST);
DISABLE_OVER_ENCHANTING = Character.getBoolean("DisableOverEnchanting", true);
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++)
@ -3400,11 +3400,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);
@ -3413,11 +3413,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);
@ -3426,11 +3426,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);

View File

@ -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
{

View File

@ -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);

View File

@ -366,8 +366,9 @@ public class RecipeController
{
Thread.sleep(_delay);
}
catch (InterruptedException e)
catch (Exception e)
{
// Ignore.
}
finally
{

View File

@ -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);

View File

@ -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)
{

View File

@ -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;
}

View File

@ -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();
}

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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)

View File

@ -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;

View File

@ -89,7 +89,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;
@ -107,7 +107,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;
// Soul crystal

View File

@ -1249,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)
@ -2956,7 +2956,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;
@ -4415,7 +4415,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);

View File

@ -698,7 +698,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;
@ -1551,12 +1551,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);

View File

@ -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;

View File

@ -461,7 +461,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;
@ -550,7 +550,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;
@ -628,7 +628,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;
@ -711,7 +711,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);
@ -1021,27 +1021,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;
}
}
}
@ -1485,7 +1482,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.
@ -1643,11 +1640,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()
@ -2065,7 +2058,7 @@ public class PlayerInstance extends Playable
/**
* Update the overloaded status of the PlayerInstance.
* @param broadcast TODO
* @param broadcast
*/
public void refreshOverloaded(boolean broadcast)
{
@ -2355,9 +2348,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())
{
@ -2366,7 +2359,7 @@ public class PlayerInstance extends Playable
try
{
if ((getLvlJoinedAcademy() != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, Id))
if ((getLvlJoinedAcademy() != 0) && (_clan != null) && CategoryData.getInstance().isInCategory(CategoryType.THIRD_CLASS_GROUP, id))
{
if (_lvlJoinedAcademy <= 16)
{
@ -2394,11 +2387,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);
@ -3292,7 +3285,6 @@ public class PlayerInstance extends Playable
{
CursedWeaponsManager.getInstance().activate(this, newitem);
}
// Combat Flag
else if (FortSiegeManager.getInstance().isCombat(item.getId()))
{
@ -3736,25 +3728,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
{
@ -3825,23 +3807,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
{
@ -4194,7 +4166,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();
@ -4489,12 +4461,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())))
@ -4821,20 +4790,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;
}
@ -4843,20 +4805,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;
}
@ -4865,20 +4820,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;
}
@ -5333,29 +5281,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);
}
@ -5575,12 +5523,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;
}
@ -5625,7 +5570,7 @@ public class PlayerInstance extends Playable
*/
public boolean isRequestExpired()
{
return !(_requestExpireTime > GameTimeController.getInstance().getGameTicks());
return _requestExpireTime <= GameTimeController.getInstance().getGameTicks();
}
/**
@ -6695,16 +6640,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());
}
}
}
@ -7288,7 +7230,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();
@ -7355,7 +7297,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();
}
}
@ -7383,7 +7325,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();
}
}
@ -7657,15 +7599,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);
}
}
}
@ -8259,11 +8198,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()))
@ -8349,13 +8284,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)
@ -8561,18 +8493,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);
}
}
@ -8605,9 +8534,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))
@ -9023,9 +8952,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()
@ -9033,9 +8962,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()
@ -10087,12 +10016,7 @@ public class PlayerInstance extends Playable
public boolean isRentedPet()
{
if (_taskRentPet != null)
{
return true;
}
return false;
return _taskRentPet != null;
}
public void stopWaterTask()
@ -10118,12 +10042,7 @@ public class PlayerInstance extends Playable
public boolean isInWater()
{
if (_taskWater != null)
{
return true;
}
return false;
return _taskWater != null;
}
public void checkWaterState()
@ -10549,12 +10468,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)
@ -11802,43 +11720,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
@ -12303,6 +12218,11 @@ public class PlayerInstance extends Playable
}
}
public Collection<TeleportBookmark> getTeleportBookmarks()
{
return _tpbookmarks.values();
}
@Override
public void sendInfo(PlayerInstance player)
{
@ -12936,19 +12856,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;

View File

@ -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);

View File

@ -140,7 +140,7 @@ public enum ClassId implements IIdentifiable
FORTUNE_SEEKER(117, false, Race.DWARF, BOUNTY_HUNTER),
MAESTRO(118, false, Race.DWARF, WARSMITH),
MALE_SOLDIER(123, false, Race.KAMAEL, null),
FEMALE_SOLDIER(124, false, Race.KAMAEL, null),
TROOPER(125, false, Race.KAMAEL, MALE_SOLDIER),
@ -155,7 +155,7 @@ public enum ClassId implements IIdentifiable
TRICKSTER(134, false, Race.KAMAEL, ARBALESTER),
INSPECTOR(135, false, Race.KAMAEL, WARDER),
JUDICATOR(136, false, Race.KAMAEL, INSPECTOR),
SIGEL_KNIGHT(139, false, null, null),
TYRR_WARRIOR(140, false, null, null),
OTHELL_ROGUE(141, false, null, null),
@ -164,7 +164,7 @@ public enum ClassId implements IIdentifiable
ISS_ENCHANTER(144, false, null, null),
WYNN_SUMMONER(145, false, null, null),
AEORE_HEALER(146, false, null, null),
SIGEL_PHOENIX_KNIGHT(148, false, Race.HUMAN, PHOENIX_KNIGHT),
SIGEL_HELL_KNIGHT(149, false, Race.HUMAN, HELL_KNIGHT),
SIGEL_EVA_TEMPLAR(150, false, Race.ELF, EVA_TEMPLAR),

View File

@ -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;
// }
}

View File

@ -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)
{

View File

@ -382,13 +382,13 @@ public class Fishing
// calculate a position in front of the player with a random distance
final int distMin = FishingData.getInstance().getBaitDistanceMin();
final int distMax = FishingData.getInstance().getBaitDistanceMax();
int distance = Rnd.get(distMin, distMax);
final int distance = Rnd.get(distMin, distMax);
final double angle = Util.convertHeadingToDegree(_player.getHeading());
final double radian = Math.toRadians(angle);
final double sin = Math.sin(radian);
final double cos = Math.cos(radian);
int baitX = (int) (_player.getX() + (cos * distance));
int baitY = (int) (_player.getY() + (sin * distance));
final int baitX = (int) (_player.getX() + (cos * distance));
final int baitY = (int) (_player.getY() + (sin * distance));
// search for fishing zone
FishingZone fishingZone = null;
@ -411,7 +411,7 @@ public class Fishing
}
}
int baitZ = computeBaitZ(_player, baitX, baitY, fishingZone, waterZone);
final int baitZ = computeBaitZ(_player, baitX, baitY, fishingZone, waterZone);
if (baitZ == Integer.MIN_VALUE)
{
_player.sendPacket(SystemMessageId.YOU_CAN_T_FISH_HERE);

View File

@ -636,7 +636,7 @@ public class InstanceTemplate extends ListenersContainer implements IIdentifiabl
// player < party < command channel
for (GroupType t : GroupType.values())
{
if (t != playerGroup && groupMaskContains(t))
if ((t != playerGroup) && groupMaskContains(t))
{
return t;
}

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