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)