Prohibit parameter assignments.

This commit is contained in:
MobiusDevelopment
2020-05-10 03:29:34 +00:00
parent 2d73110d15
commit 33bbf97afb
1756 changed files with 12542 additions and 10025 deletions
@@ -12,8 +12,11 @@ org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled
org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnull.secondary=
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary=
org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
@@ -24,6 +27,8 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotatedTypeArgumentToUnannotated=info
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
@@ -75,12 +80,14 @@ org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning
org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning
org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.parameterAssignment=warning
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
@@ -96,17 +103,23 @@ org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarningsNotFullyAnalysed=info
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=warning
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning
org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled
org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=disabled
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=disabled
@@ -55,13 +55,9 @@ public class Bernarde extends AbstractNpcAI
&& (player.getInventory().getInventoryItemCount(DARION_BADGE, -1, false) >= 5) //
&& player.exchangeItemsById("Quest", npc, DARION_BADGE, 5, HOLY_WATER, 1, true))
{
event = "32300-02b.htm";
return "32300-02b.htm";
}
else
{
event = "32300-02c.htm";
}
break;
return "32300-02c.htm";
}
case "Treasure":
{
@@ -71,13 +67,11 @@ public class Bernarde extends AbstractNpcAI
takeItems(player, TREASURE, -1);
return "32300-02d.htm";
}
event = "32300-02e.htm";
break;
return "32300-02e.htm";
}
case "rumors":
{
event = "32300-" + HellboundEngine.getInstance().getLevel() + "r.htm";
break;
return "32300-" + HellboundEngine.getInstance().getLevel() + "r.htm";
}
}
return event;
@@ -106,11 +106,12 @@ public class DarkWaterDragon extends AbstractNpcAI
cancelQuestTimer("2", npc, null);
cancelQuestTimer("3", npc, null);
cancelQuestTimer("4", npc, null);
MY_TRACKING_SET.remove(npc.getObjectId());
player = ID_MAP.remove(npc.getObjectId());
if (player != null)
final PlayerInstance removed = ID_MAP.remove(npc.getObjectId());
if (removed != null)
{
((Attackable) npc).doItemDrop(NpcData.getInstance().getTemplate(18485), player);
((Attackable) npc).doItemDrop(NpcData.getInstance().getTemplate(18485), removed);
}
npc.deleteMe();
@@ -359,6 +359,7 @@ public class Beleth extends AbstractNpcAI
{
_minions.clear();
Npc spawn;
int a = 0;
for (int i = 0; i < 16; i++)
{
@@ -366,12 +367,12 @@ public class Beleth extends AbstractNpcAI
final int x = (int) ((650 * Math.cos(i * 0.39)) + 16323);
final int y = (int) ((650 * Math.sin(i * 0.39)) + 213170);
npc = addSpawn(FAKE_BELETH, new Location(x, y, -9357, 49152));
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(x, y, -9357, 49152));
_minions.add(spawn);
if (a >= 2)
{
npc.setOverloaded(true);
spawn.setOverloaded(true);
a = 0;
}
}
@@ -382,33 +383,31 @@ public class Beleth extends AbstractNpcAI
{
xm[i] = (int) ((1700 * Math.cos((i * 1.57) + 0.78)) + 16323);
ym[i] = (int) ((1700 * Math.sin((i * 1.57) + 0.78)) + 213170);
npc = addSpawn(FAKE_BELETH, new Location(xm[i], ym[i], -9357, 49152));
npc.setImmobilized(true);
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(xm[i], ym[i], -9357, 49152));
spawn.setImmobilized(true);
_minions.add(spawn);
}
xm[4] = (xm[0] + xm[1]) / 2;
ym[4] = (ym[0] + ym[1]) / 2;
npc = addSpawn(FAKE_BELETH, new Location(xm[4], ym[4], -9357, 49152));
npc.setImmobilized(true);
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(xm[4], ym[4], -9357, 49152));
spawn.setImmobilized(true);
_minions.add(spawn);
xm[5] = (xm[1] + xm[2]) / 2;
ym[5] = (ym[1] + ym[2]) / 2;
npc = addSpawn(FAKE_BELETH, new Location(xm[5], ym[5], -9357, 49152));
npc.setImmobilized(true);
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(xm[5], ym[5], -9357, 49152));
spawn.setImmobilized(true);
_minions.add(spawn);
xm[6] = (xm[2] + xm[3]) / 2;
ym[6] = (ym[2] + ym[3]) / 2;
npc = addSpawn(FAKE_BELETH, new Location(xm[6], ym[6], -9357, 49152));
npc.setImmobilized(true);
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(xm[6], ym[6], -9357, 49152));
spawn.setImmobilized(true);
_minions.add(spawn);
xm[7] = (xm[3] + xm[0]) / 2;
ym[7] = (ym[3] + ym[0]) / 2;
npc = addSpawn(FAKE_BELETH, new Location(xm[7], ym[7], -9357, 49152));
npc.setImmobilized(true);
_minions.add(npc);
spawn = addSpawn(FAKE_BELETH, new Location(xm[7], ym[7], -9357, 49152));
spawn.setImmobilized(true);
_minions.add(spawn);
xm[8] = (xm[0] + xm[4]) / 2;
ym[8] = (ym[0] + ym[4]) / 2;
_minions.add(addSpawn(FAKE_BELETH, new Location(xm[8], ym[8], -9357, 49152)));
@@ -50,7 +50,7 @@ public class Survivor extends AbstractNpcAI
{
if (player.getLevel() < MIN_LEVEL)
{
event = "32632-3.htm";
return "32632-3.htm";
}
else if (player.getAdena() < 150000)
{
@@ -919,8 +919,7 @@ public class RainbowSpringsChateau extends ClanHallSiegeEngine
{
_nextSiege.cancel(true);
}
date -= 3600000;
setRegistrationEndString(date);
setRegistrationEndString(date - 3600000);
_nextSiege = ThreadPool.schedule(new SetFinalAttackers(), _rainbow.getNextSiegeTime());
}
@@ -57,8 +57,9 @@ public class AdminBuffs implements IAdminCommandHandler
private static final String FONT_RED2 = "</font>";
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
if (command.startsWith("admin_getbuffs"))
{
final StringTokenizer st = new StringTokenizer(command, " ");
@@ -993,8 +993,9 @@ public class AdminEditChar implements IAdminCommandHandler
activeChar.sendPacket(html);
}
private void showCharacterInfo(PlayerInstance activeChar, PlayerInstance player)
private void showCharacterInfo(PlayerInstance activeChar, PlayerInstance targetPlayer)
{
PlayerInstance player = targetPlayer;
if (player == null)
{
final WorldObject target = activeChar.getTarget();
@@ -101,8 +101,9 @@ public class AdminEffects implements IAdminCommandHandler
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
final StringTokenizer st = new StringTokenizer(command);
st.nextToken();
@@ -159,10 +159,10 @@ public class AdminFightCalculator implements IAdminCommandHandler
private void handleShow(String params, PlayerInstance activeChar)
{
params = params.trim();
String trimmedParams = params.trim();
Creature npc1 = null;
Creature npc2 = null;
if (params.isEmpty())
if (trimmedParams.isEmpty())
{
npc1 = activeChar;
npc2 = (Creature) activeChar.getTarget();
@@ -176,7 +176,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
{
int mid1 = 0;
int mid2 = 0;
final StringTokenizer st = new StringTokenizer(params);
final StringTokenizer st = new StringTokenizer(trimmedParams);
mid1 = Integer.parseInt(st.nextToken());
mid2 = Integer.parseInt(st.nextToken());
npc1 = new MonsterInstance(NpcData.getInstance().getTemplate(mid1));
@@ -290,7 +290,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage();
final StringBuilder replyMSG = new StringBuilder(1000);
replyMSG.append("<html><title>Selected mobs to fight</title><body><table>");
if (params.isEmpty())
if (trimmedParams.isEmpty())
{
replyMSG.append("<tr><td width=140>Parameter</td><td width=70>me</td><td width=70>target</td></tr>");
}
@@ -320,7 +320,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
replyMSG.append("</tr></table><center><br>");
if (params.isEmpty())
if (trimmedParams.isEmpty())
{
replyMSG.append("<button value=\"Retry\" action=\"bypass -h admin_fight_calculator_show\" width=100 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
}
@@ -333,7 +333,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
adminReply.setHtml(replyMSG.toString());
activeChar.sendPacket(adminReply);
if (params.length() != 0)
if (trimmedParams.length() != 0)
{
((MonsterInstance) npc1).deleteMe();
((MonsterInstance) npc2).deleteMe();
@@ -51,8 +51,9 @@ public class AdminFortSiege implements IAdminCommandHandler
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken(); // Get actual command
@@ -37,9 +37,10 @@ public class AdminInstanceZone implements IAdminCommandHandler
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
final String target = (activeChar.getTarget() != null) ? activeChar.getTarget().getName() : "no-target";
String command = commandValue;
GMAudit.auditGMAction(activeChar.getName(), command, target, "");
if (command.startsWith("admin_instancezone_clear"))
{
@@ -69,8 +69,9 @@ public class AdminSiege implements IAdminCommandHandler
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
final StringTokenizer st = new StringTokenizer(command, " ");
command = st.nextToken(); // Get actual command
@@ -82,8 +82,9 @@ public class AdminSkill implements IAdminCommandHandler
private static Skill[] adminSkills;
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
if (command.equals("admin_show_skills"))
{
showMainPage(activeChar);
@@ -277,9 +278,9 @@ public class AdminSkill implements IAdminCommandHandler
/**
* TODO: Externalize HTML
* @param activeChar the active Game Master.
* @param page
* @param pageValue
*/
private void removeSkillsPage(PlayerInstance activeChar, int page)
private void removeSkillsPage(PlayerInstance activeChar, int pageValue)
{
final WorldObject target = activeChar.getTarget();
if ((target == null) || !target.isPlayer())
@@ -297,6 +298,7 @@ public class AdminSkill implements IAdminCommandHandler
maxPages++;
}
int page = pageValue;
if (page > maxPages)
{
page = maxPages;
@@ -470,7 +470,7 @@ public class AdminSpawn implements IAdminCommandHandler
}
}
private void spawnMonster(PlayerInstance activeChar, String monsterId, int respawnTime, int mobCount, boolean permanent)
private void spawnMonster(PlayerInstance activeChar, String monsterIdValue, int respawnTime, int mobCount, boolean permanentValue)
{
WorldObject target = activeChar.getTarget();
if (target == null)
@@ -479,6 +479,7 @@ public class AdminSpawn implements IAdminCommandHandler
}
NpcTemplate template;
String monsterId = monsterIdValue;
if (monsterId.matches("[0-9]*"))
{
// First parameter was an ID number
@@ -503,6 +504,8 @@ public class AdminSpawn implements IAdminCommandHandler
spawn.setAmount(mobCount);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
boolean permanent = permanentValue;
if (activeChar.getInstanceId() > 0)
{
spawn.setInstanceId(activeChar.getInstanceId());
@@ -44,8 +44,9 @@ public class AdminTerritoryWar implements IAdminCommandHandler
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
public boolean useAdminCommand(String commandValue, PlayerInstance activeChar)
{
String command = commandValue;
final StringTokenizer st = new StringTokenizer(command);
command = st.nextToken();
if (command.equals("admin_territory_war"))
@@ -224,7 +224,7 @@ public class NpcViewMod implements IBypassHandler
return sb.toString();
}
private void sendNpcDropList(PlayerInstance player, Npc npc, DropType dropType, int page)
private void sendNpcDropList(PlayerInstance player, Npc npc, DropType dropType, int pageValue)
{
final List<DropHolder> dropList = npc.getTemplate().getDropList(dropType);
if (dropList == null)
@@ -249,6 +249,7 @@ public class NpcViewMod implements IBypassHandler
pagesSb.append("</tr></table>");
}
int page = pageValue;
if (page >= pages)
{
page = pages - 1;
@@ -78,7 +78,7 @@ public class RentPet implements IBypassHandler
return false;
}
public static void tryRentPet(PlayerInstance player, int value)
public static void tryRentPet(PlayerInstance player, int petValue)
{
if ((player == null) || player.hasSummon() || player.isMounted() || player.isRentedPet() || player.isTransformed() || player.isCursedWeaponEquipped())
{
@@ -106,6 +106,7 @@ public class RentPet implements IBypassHandler
1800
};
int value = petValue;
if (value > 10)
{
petId = 12526;
@@ -42,7 +42,7 @@ public class ChatGeneral implements IChatHandler
};
@Override
public void handleChat(ChatType type, PlayerInstance activeChar, String params, String text)
public void handleChat(ChatType type, PlayerInstance activeChar, String paramsValue, String text)
{
boolean vcdUsed = false;
if (text.startsWith("."))
@@ -50,6 +50,7 @@ public class ChatGeneral implements IChatHandler
final StringTokenizer st = new StringTokenizer(text);
final IVoicedCommandHandler vch;
String command = "";
String params = paramsValue;
if (st.countTokens() > 1)
{
command = st.nextToken().substring(1);
@@ -176,8 +176,9 @@ public class ClanBoard implements IWriteBoardHandler
}
}
private void clanList(PlayerInstance player, int index)
private void clanList(PlayerInstance player, int indexValue)
{
int index = indexValue;
if (index < 1)
{
index = 1;
@@ -36,8 +36,8 @@ public class AreaSummon implements ITargetTypeHandler
public WorldObject[] getTargetList(Skill skill, Creature creature, boolean onlyFirst, Creature target)
{
final List<Creature> targetList = new ArrayList<>();
target = creature.getSummon();
if ((target == null) || !target.isServitor() || target.isDead())
final Creature targetCreature = creature.getSummon();
if ((targetCreature == null) || !targetCreature.isServitor() || targetCreature.isDead())
{
return EMPTY_TARGET_LIST;
}
@@ -46,13 +46,13 @@ public class AreaSummon implements ITargetTypeHandler
{
return new Creature[]
{
target
targetCreature
};
}
final boolean srcInArena = (creature.isInsideZone(ZoneId.PVP) && !creature.isInsideZone(ZoneId.SIEGE));
final int maxTargets = skill.getAffectLimit();
World.getInstance().forEachVisibleObjectInRange(target, Creature.class, skill.getAffectRange(), obj ->
World.getInstance().forEachVisibleObjectInRange(targetCreature, Creature.class, skill.getAffectRange(), obj ->
{
if (obj == creature)
{
@@ -198,45 +198,42 @@ public class Q00126_TheNameOfEvil2 extends Quest
case "DO_One":
{
qs.set("DO", "1");
event = "32122-4d.html";
break;
return "32122-4d.html";
}
case "MI_One":
{
qs.set("MI", "1");
event = "32122-4f.html";
break;
return "32122-4f.html";
}
case "FA_One":
{
qs.set("FA", "1");
event = "32122-4h.html";
break;
return "32122-4h.html";
}
case "SOL_One":
{
qs.set("SOL", "1");
event = "32122-4j.html";
break;
return "32122-4j.html";
}
case "FA2_One":
{
qs.set("FA2", "1");
if (qs.isCond(14) && (qs.getInt("DO") > 0) && (qs.getInt("MI") > 0) && (qs.getInt("FA") > 0) && (qs.getInt("SOL") > 0) && (qs.getInt("FA2") > 0))
{
event = "32122-4n.html";
qs.setCond(15, true);
}
else
{
event = "32122-4m.html";
qs.unset("DO");
qs.unset("MI");
qs.unset("FA");
qs.unset("SOL");
qs.unset("FA2");
return "32122-4n.html";
}
qs.unset("DO");
qs.unset("MI");
qs.unset("FA");
qs.unset("SOL");
qs.unset("FA2");
break;
return "32122-4m.html";
}
case "32122-4m.html":
{
@@ -250,45 +247,42 @@ public class Q00126_TheNameOfEvil2 extends Quest
case "FA_Two":
{
qs.set("FA", "1");
event = "32122-5a.html";
break;
return "32122-5a.html";
}
case "SOL_Two":
{
qs.set("SOL", "1");
event = "32122-5c.html";
break;
return "32122-5c.html";
}
case "TI_Two":
{
qs.set("TI", "1");
event = "32122-5e.html";
break;
return "32122-5e.html";
}
case "SOL2_Two":
{
qs.set("SOL2", "1");
event = "32122-5g.html";
break;
return "32122-5g.html";
}
case "FA2_Two":
{
qs.set("FA2", "1");
if (qs.isCond(15) && (qs.getInt("FA") > 0) && (qs.getInt("SOL") > 0) && (qs.getInt("TI") > 0) && (qs.getInt("SOL2") > 0) && (qs.getInt("FA2") > 0))
{
event = "32122-5j.html";
qs.setCond(16, true);
}
else
{
event = "32122-5i.html";
qs.unset("FA");
qs.unset("SOL");
qs.unset("TI");
qs.unset("SOL2");
qs.unset("FA2");
return "32122-5j.html";
}
qs.unset("FA");
qs.unset("SOL");
qs.unset("TI");
qs.unset("SOL2");
qs.unset("FA2");
break;
return "32122-5i.html";
}
case "32122-5i.html":
{
@@ -302,45 +296,42 @@ public class Q00126_TheNameOfEvil2 extends Quest
case "SOL_Three":
{
qs.set("SOL", "1");
event = "32122-6a.html";
break;
return "32122-6a.html";
}
case "FA_Three":
{
qs.set("FA", "1");
event = "32122-6c.html";
break;
return "32122-6c.html";
}
case "MI_Three":
{
qs.set("MI", "1");
event = "32122-6e.html";
break;
return "32122-6e.html";
}
case "FA2_Three":
{
qs.set("FA2", "1");
event = "32122-6g.html";
break;
return "32122-6g.html";
}
case "MI2_Three":
{
qs.set("MI2", "1");
if (qs.isCond(16) && (qs.getInt("SOL") > 0) && (qs.getInt("FA") > 0) && (qs.getInt("MI") > 0) && (qs.getInt("FA2") > 0) && (qs.getInt("MI2") > 0))
{
event = "32122-6j.html";
qs.setCond(17, true);
}
else
{
event = "32122-6i.html";
qs.unset("SOL");
qs.unset("FA");
qs.unset("MI");
qs.unset("FA2");
qs.unset("MI2");
return "32122-6j.html";
}
qs.unset("SOL");
qs.unset("FA");
qs.unset("MI");
qs.unset("FA2");
qs.unset("MI2");
break;
return "32122-6i.html";
}
case "32122-6i.html":
{
@@ -383,30 +383,32 @@ public class Q00384_WarehouseKeepersPastime extends Quest
private String fillBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1))
{
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
else
{
html = html.replace("<?Cell" + (i0 + 1) + "?>", "?");
result = result.replace("<?Cell" + (i0 + 1) + "?>", "?");
}
}
return html;
return result;
}
private String colorBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff");
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
result = result.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff");
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
return html;
return result;
}
private String beforeReward(PlayerInstance player, QuestState qs, int num, int npcId)
@@ -320,30 +320,32 @@ public class Q00386_StolenDignity extends Quest
private String fillBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1))
{
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
else
{
html = html.replace("<?Cell" + (i0 + 1) + "?>", "?");
result = result.replace("<?Cell" + (i0 + 1) + "?>", "?");
}
}
return html;
return result;
}
private String colorBoard(QuestState qs, String html)
{
String result = html;
for (int i0 = 0; i0 < 9; i0 += 1)
{
final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
html = html.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
result = result.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
result = result.replace("<?Cell" + (i0 + 1) + "?>", Integer.toString(i1));
}
return html;
return result;
}
private String beforeReward(PlayerInstance player, QuestState qs, int num)
@@ -260,7 +260,7 @@ public class Q00511_AwlUnderFoot extends Quest
return null;
}
protected String enterInstance(PlayerInstance player, int[] coords, FortDungeon dungeon, String ret)
protected String enterInstance(PlayerInstance player, int[] coords, FortDungeon dungeon, String retValue)
{
// check for existing instances for this player
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
@@ -275,16 +275,19 @@ public class Q00511_AwlUnderFoot extends Quest
teleportPlayer(player, coords, world.getInstanceId());
return "";
}
// New instance
if (retValue != null)
{
return retValue;
}
final String ret = checkConditions(player);
if (ret != null)
{
return ret;
}
ret = checkConditions(player);
if (ret != null)
{
return ret;
}
final Party party = player.getParty();
world = new FAUWorld();
final Instance instance = InstanceManager.getInstance().createDynamicInstance(dungeon.getInstanceId());
@@ -341,8 +341,9 @@ public class Q00660_AidingTheFloranVillage extends Quest
return htmltext;
}
private void tradeItems(PlayerInstance player, long required, long itemCount1, long itemCount2, long itemCount3)
private void tradeItems(PlayerInstance player, long requiredValue, long itemCount1, long itemCount2, long itemCount3)
{
long required = requiredValue;
if (itemCount1 < required)
{
takeItems(player, WATCHING_EYES, itemCount1);
@@ -238,7 +238,7 @@ public class Q00726_LightWithinTheDarkness extends Quest
return null;
}
protected String enterInstance(PlayerInstance player, String template, int[] coords, FortDungeon dungeon, String ret)
protected String enterInstance(PlayerInstance player, String template, int[] coords, FortDungeon dungeon, String retValue)
{
InstanceWorld world = InstanceManager.getInstance().getPlayerWorld(player);
if (world != null)
@@ -252,15 +252,17 @@ public class Q00726_LightWithinTheDarkness extends Quest
return "";
}
if (retValue != null)
{
return retValue;
}
final String ret = checkConditions(player);
if (ret != null)
{
return ret;
}
ret = checkConditions(player);
if (ret != null)
{
return ret;
}
final Party party = player.getParty();
world = new PAWORLD();
final Instance instance = InstanceManager.getInstance().createDynamicInstance(dungeon.getInstanceId());
@@ -101,13 +101,9 @@ public class Q10272_LightFragment extends Quest
if (getQuestItemsCount(player, Inventory.ADENA_ID) >= 10000)
{
takeItems(player, Inventory.ADENA_ID, 10000);
event = "32566-05.html";
return "32566-05.html";
}
else
{
event = "32566-04a.html";
}
break;
return "32566-04a.html";
}
case "32567-04.html":
{
@@ -128,7 +124,7 @@ public class Q10272_LightFragment extends Quest
}
else
{
event = "32557-04.html";
return "32557-04.html";
}
break;
}
@@ -93,7 +93,7 @@ public class DarkElfChange1 extends AbstractNpcAI
player.broadcastUserInfo();
}
}
event = npc.getId() + "-" + suffix + ".html";
return npc.getId() + "-" + suffix + ".html";
}
}
return event;
@@ -112,7 +112,7 @@ public class DarkElfChange2 extends AbstractNpcAI
player.broadcastUserInfo();
}
}
event = "30474-" + suffix + ".html";
return "30474-" + suffix + ".html";
}
}
return event;
@@ -59,12 +59,14 @@ public class HexUtils
/**
* Method to generate the hexadecimal character presentation of a byte
* @param data byte to generate the hexadecimal character presentation from
* @param dstHexChars the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with 2 elements is created
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @param dstHexCharsValue the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with 2 elements is created
* @param dstOffsetValue offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] b2HexChars(byte data, char[] dstHexChars, int dstOffset)
public static char[] b2HexChars(byte data, char[] dstHexCharsValue, int dstOffsetValue)
{
char[] dstHexChars = dstHexCharsValue;
int dstOffset = dstOffsetValue;
if (dstHexChars == null)
{
dstHexChars = new char[2];
@@ -92,12 +94,14 @@ public class HexUtils
/**
* Method to generate the hexadecimal character presentation of an integer
* @param data integer to generate the hexadecimal character presentation from
* @param dstHexChars the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with 8 elements is created
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @param dstHexCharsValue the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with 8 elements is created
* @param dstOffsetValue offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] int2HexChars(int data, char[] dstHexChars, int dstOffset)
public static char[] int2HexChars(int data, char[] dstHexCharsValue, int dstOffsetValue)
{
char[] dstHexChars = dstHexCharsValue;
int dstOffset = dstOffsetValue;
if (dstHexChars == null)
{
dstHexChars = new char[8];
@@ -108,6 +112,7 @@ public class HexUtils
b2HexChars((byte) ((data & 0x00FF0000) >> 16), dstHexChars, dstOffset + 2);
b2HexChars((byte) ((data & 0x0000FF00) >> 8), dstHexChars, dstOffset + 4);
b2HexChars((byte) (data & 0x000000FF), dstHexChars, dstOffset + 6);
return dstHexChars;
}
@@ -129,12 +134,14 @@ public class HexUtils
* @param data byte array to generate the hexadecimal character presentation from
* @param offset offset where to start in data array
* @param len number of bytes to generate the hexadecimal character presentation from
* @param dstHexChars the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with len*2 elements is created
* @param dstOffset offset at which the hexadecimal character presentation is copied to dstHexChars
* @param dstHexCharsValue the char array the hexadecimal character presentation should be copied to, if this is null, dstOffset is ignored and a new char array with len*2 elements is created
* @param dstOffsetValue offset at which the hexadecimal character presentation is copied to dstHexChars
* @return the char array the hexadecimal character presentation was copied to
*/
public static char[] bArr2HexChars(byte[] data, int offset, int len, char[] dstHexChars, int dstOffset)
public static char[] bArr2HexChars(byte[] data, int offset, int len, char[] dstHexCharsValue, int dstOffsetValue)
{
char[] dstHexChars = dstHexCharsValue;
int dstOffset = dstOffsetValue;
if (dstHexChars == null)
{
dstHexChars = new char[len * 2];
@@ -157,8 +164,10 @@ public class HexUtils
return bArr2AsciiChars(data, offset, len, new char[len], 0);
}
public static char[] bArr2AsciiChars(byte[] data, int offset, int len, char[] dstAsciiChars, int dstOffset)
public static char[] bArr2AsciiChars(byte[] data, int offset, int len, char[] dstAsciiCharsValue, int dstOffsetValue)
{
char[] dstAsciiChars = dstAsciiCharsValue;
int dstOffset = dstOffsetValue;
if (dstAsciiChars == null)
{
dstAsciiChars = new char[len];
@@ -1130,6 +1130,7 @@ public class BlowfishEngine
* @param xr
* @param table
*/
@SuppressWarnings("all")
private void processTable(int xl, int xr, int[] table)
{
final int size = table.length;
@@ -499,9 +499,9 @@ public class GameServer
INSTANCE = new GameServer();
}
private void printSection(String s)
private void printSection(String section)
{
s = "=[ " + s + " ]";
String s = "=[ " + section + " ]";
while (s.length() < 61)
{
s = "-" + s;
@@ -1980,10 +1980,10 @@ public class SevenSignsFestival implements SpawnListener
* Returns the running instance of a festival for the given Oracle and festivalID.<br>
* A <b>null</b> value is returned if there are no participants in that festival.
* @param oracle
* @param festivalId
* @param festivalIdValue
* @return DarknessFestival festivalInst
*/
public DarknessFestival getFestivalInstance(int oracle, int festivalId)
public DarknessFestival getFestivalInstance(int oracle, int festivalIdValue)
{
if (!_festivalInitialized)
{
@@ -1994,6 +1994,7 @@ public class SevenSignsFestival implements SpawnListener
* Compute the offset if a Dusk instance is required. ID: 0 1 2 3 4 Dusk 1:1011121314 Dawn 2:2021222324
*/
int festivalId = festivalIdValue;
festivalId += (oracle == SevenSigns.CABAL_DUSK) ? 10 : 20;
return _festivalInstances.get(festivalId);
}
@@ -101,11 +101,7 @@ public class Shutdown extends Thread
*/
public Shutdown(int seconds, boolean restart)
{
if (seconds < 0)
{
seconds = 0;
}
_secondsShut = seconds;
_secondsShut = Math.max(0, seconds);
_shutdownMode = restart ? GM_RESTART : GM_SHUTDOWN;
}
@@ -485,13 +485,14 @@ public abstract class AbstractAI implements Ctrl
* Move the actor to Pawn server side AND client side by sending Server->Client packet MoveToPawn <i>(broadcast)</i>.<br>
* <font color=#FF0000><b><u>Caution</u>: Low level function, used by AI subclasses</b></font>
* @param pawn
* @param offset
* @param offsetValue
*/
public void moveToPawn(WorldObject pawn, int offset)
public void moveToPawn(WorldObject pawn, int offsetValue)
{
// Check if actor can move
if (!_actor.isMovementDisabled())
{
int offset = offsetValue;
if (offset < 10)
{
offset = 10;
@@ -325,13 +325,14 @@ public class AttackableAI extends CreatureAI
/**
* Set the Intention of this CreatureAI and create an AI Task executed every 1s (call onEvtThink method) for this Attackable.<br>
* <font color=#FF0000><b><u>Caution</u>: If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</b></font>
* @param intention The new Intention to set to the AI
* @param newIntention The new Intention to set to the AI
* @param arg0 The first parameter of the Intention
* @param arg1 The second parameter of the Intention
*/
@Override
synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
synchronized void changeIntention(CtrlIntention newIntention, Object arg0, Object arg1)
{
CtrlIntention intention = newIntention;
if ((intention == AI_INTENTION_IDLE) || (intention == AI_INTENTION_ACTIVE))
{
// Check if actor is not dead
@@ -359,7 +360,6 @@ public class AttackableAI extends CreatureAI
// Cancel the AI
_actor.detachAI();
return;
}
}
@@ -994,10 +994,10 @@ public class CreatureAI extends AbstractAI
* <li>PLayerAI, SummonAI</li>
* </ul>
* @param target The targeted WorldObject
* @param offset The Interact area radius
* @param offsetValue The Interact area radius
* @return True if a movement must be done
*/
protected boolean maybeMoveToPawn(WorldObject target, int offset)
protected boolean maybeMoveToPawn(WorldObject target, int offsetValue)
{
// Get the distance between the current position of the Creature and the target (x,y)
if (target == null)
@@ -1005,12 +1005,12 @@ public class CreatureAI extends AbstractAI
// LOGGER.warning("maybeMoveToPawn: target == NULL!");
return false;
}
if (offset < 0)
if (offsetValue < 0)
{
return false; // skill radius -1
}
int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
if (target.isCreature())
{
offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
@@ -1057,6 +1057,7 @@ public class CreatureAI extends AbstractAI
}
stopFollow();
int offset = offsetValue;
if (target.isCreature() && !target.isDoor())
{
if (((Creature) target).isMoving())
@@ -152,27 +152,30 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
}
// Get the owner if the target is a summon
if (target.isSummon())
Creature currentTarget = target;
if (currentTarget.isSummon())
{
final PlayerInstance owner = ((Summon) target).getOwner();
final PlayerInstance owner = ((Summon) currentTarget).getOwner();
if (_actor.isInsideRadius3D(owner, 1000))
{
target = owner;
currentTarget = owner;
}
}
return (!target.isPlayable() || !((Playable) target).isSilentMovingAffected() || _actor.isInsideRadius2D(target, 250)) && _actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target);
return (!currentTarget.isPlayable() || !((Playable) currentTarget).isSilentMovingAffected() || _actor.isInsideRadius2D(currentTarget, 250)) && _actor.isAutoAttackable(currentTarget) && GeoEngine.getInstance().canSeeTarget(_actor, currentTarget);
}
/**
* Set the Intention of this CreatureAI and create an AI Task executed every 1s (call onEvtThink method) for this Attackable.<br>
* <font color=#FF0000><b><u>Caution</u>: If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</b></font>
* @param intention The new Intention to set to the AI
* @param newIntention The new Intention to set to the AI
* @param arg0 The first parameter of the Intention
* @param arg1 The second parameter of the Intention
*/
@Override
synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
synchronized void changeIntention(CtrlIntention newIntention, Object arg0, Object arg1)
{
CtrlIntention intention = newIntention;
if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
{
// Check if actor is not dead
@@ -728,8 +731,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
me.addDamageHate(target, 0, aggro);
// Get the hate of the actor against the target
aggro = me.getHating(target);
if (aggro <= 0)
if (me.getHating(target) <= 0)
{
if (me.getMostHated() == null)
{
@@ -780,8 +782,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
me.addDamageHate(aggroed, 0, aggro);
}
aggro = me.getHating(mostHated);
if (aggro <= 0)
if (me.getHating(mostHated) <= 0)
{
_globalAggro = -25;
me.clearAggroList();
@@ -137,35 +137,37 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
// Get the owner if the target is a summon
if (target.isSummon())
Creature currentTarget = target;
if (currentTarget.isSummon())
{
final PlayerInstance owner = ((Summon) target).getOwner();
final PlayerInstance owner = ((Summon) currentTarget).getOwner();
if (_actor.isInsideRadius3D(owner, 1000))
{
target = owner;
currentTarget = owner;
}
}
// Check if the target isn't in silent move mode AND too far (>100)
if (target.isPlayable() && ((Playable) target).isSilentMovingAffected() && !_actor.isInsideRadius2D(target, 250))
if (currentTarget.isPlayable() && ((Playable) currentTarget).isSilentMovingAffected() && !_actor.isInsideRadius2D(currentTarget, 250))
{
return false;
}
// Los Check Here
return (_actor.isAutoAttackable(target) && GeoEngine.getInstance().canSeeTarget(_actor, target));
return (_actor.isAutoAttackable(currentTarget) && GeoEngine.getInstance().canSeeTarget(_actor, currentTarget));
}
/**
* Set the Intention of this CreatureAI and create an AI Task executed every 1s (call onEvtThink method) for this Attackable.<br>
* <font color=#FF0000><b><u>Caution</u>: If actor _knowPlayer isn't EMPTY, AI_INTENTION_IDLE will be change in AI_INTENTION_ACTIVE</b></font>
* @param intention The new Intention to set to the AI
* @param newIntention The new Intention to set to the AI
* @param arg0 The first parameter of the Intention
* @param arg1 The second parameter of the Intention
*/
@Override
synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
synchronized void changeIntention(CtrlIntention newIntention, Object arg0, Object arg1)
{
CtrlIntention intention = newIntention;
if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
{
// Check if actor is not dead
@@ -198,7 +200,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
// Cancel the AI
_actor.detachAI();
return;
}
}
@@ -731,8 +732,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
me.addDamageHate(target, 0, aggro);
// Get the hate of the actor against the target
aggro = me.getHating(target);
if (aggro <= 0)
if (me.getHating(target) <= 0)
{
if (me.getMostHated() == null)
{
@@ -783,8 +783,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
me.addDamageHate(aggroed, 0, aggro);
}
aggro = me.getHating(mostHated);
if (aggro <= 0)
if (me.getHating(mostHated) <= 0)
{
_globalAggro = -25;
me.clearAggroList();
@@ -155,8 +155,9 @@ public class MultisellData implements IXmlReader
return NUMERIC_FILTER;
}
private final Entry parseEntry(Node n, int entryId, ListContainer list)
private final Entry parseEntry(Node node, int entryId, ListContainer list)
{
Node n = node;
final Node first = n.getFirstChild();
final Entry entry = new Entry(entryId);
NamedNodeMap attrs;
@@ -98,6 +98,7 @@ public class SendMessageLocalisationData implements IXmlReader
// Consider using proper SystemMessages where possible.
String[] searchMessage;
String[] replacementMessage;
String localisation = message;
boolean found;
for (Entry<String[], String[]> entry : localisations.entrySet())
{
@@ -107,7 +108,7 @@ public class SendMessageLocalisationData implements IXmlReader
// Exact match.
if (searchMessage.length == 1)
{
if (searchMessage[0].equals(message))
if (searchMessage[0].equals(localisation))
{
return replacementMessage[0];
}
@@ -117,7 +118,7 @@ public class SendMessageLocalisationData implements IXmlReader
found = true;
for (String part : searchMessage)
{
if (!message.contains(part))
if (!localisation.contains(part))
{
found = false;
break;
@@ -127,12 +128,13 @@ public class SendMessageLocalisationData implements IXmlReader
{
for (int i = 0; i < searchMessage.length; i++)
{
message = message.replace(searchMessage[i], replacementMessage[i]);
localisation = localisation.replace(searchMessage[i], replacementMessage[i]);
}
break;
}
}
}
return localisation;
}
}
return message;
@@ -343,10 +343,11 @@ public class SkillTreeData implements IXmlReader
skillTree.putAll(_commonSkillTree);
final LinkedList<ClassId> classSequence = new LinkedList<>();
while (classId != null)
ClassId currentClassId = classId;
while (currentClassId != null)
{
classSequence.addFirst(classId);
classId = _parentClassMap.get(classId);
classSequence.addFirst(currentClassId);
currentClassId = _parentClassMap.get(currentClassId);
}
for (ClassId cid : classSequence)
@@ -510,7 +510,7 @@ public class AugmentationData
}
}
private Augmentation generateRandomWeaponAugmentation(int lifeStoneLevel, int lifeStoneGrade, int lifeStoneId, ItemInstance item)
private Augmentation generateRandomWeaponAugmentation(int level, int lifeStoneGrade, int lifeStoneId, ItemInstance item)
{
int stat12 = 0;
int stat34 = 0;
@@ -709,7 +709,7 @@ public class AugmentationData
boolean generateGlow = false;
// life stone level is used for stat Id and skill level, but here the max level is 9
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
int lifeStoneLevel = Math.min(level, 9);
switch (lifeStoneGrade)
{
@@ -883,7 +883,7 @@ public class AugmentationData
return new Augmentation(((stat34 << 16) + stat12));
}
private Augmentation generateRandomAccessoryAugmentation(int lifeStoneLevel, int bodyPart, int lifeStoneId)
private Augmentation generateRandomAccessoryAugmentation(int level, int bodyPart, int lifeStoneId)
{
int stat12 = 0;
int stat34 = 0;
@@ -952,7 +952,7 @@ public class AugmentationData
}
return new Augmentation(((stat34 << 16) + stat12));
}
lifeStoneLevel = Math.min(lifeStoneLevel, 9);
int lifeStoneLevel = Math.min(level, 9);
int base = 0;
int skillsLength = 0;
@@ -184,19 +184,20 @@ public abstract class DocumentBase
_tables.put(name, table);
}
protected void parseTemplate(Node n, Object template)
protected void parseTemplate(Node node, Object template)
{
parseTemplate(n, template, null);
parseTemplate(node, template, null);
}
protected void parseTemplate(Node n, Object template, EffectScope effectScope)
protected void parseTemplate(Node node, Object template, EffectScope effectScope)
{
Condition condition = null;
n = n.getFirstChild();
Node n = node.getFirstChild();
if (n == null)
{
return;
}
if ("cond".equalsIgnoreCase(n.getNodeName()))
{
condition = parseCondition(n.getFirstChild(), template);
@@ -332,13 +333,14 @@ public abstract class DocumentBase
/**
* Parse effect's parameters.
* @param n the node to start the parsing
* @param node the node to start the parsing
* @param template the effect template
* @return the list of parameters if any, {@code null} otherwise
*/
private StatSet parseParameters(Node n, Object template)
private StatSet parseParameters(Node node, Object template)
{
StatSet parameters = null;
Node n = node;
while ((n != null))
{
// Parse all parameters.
@@ -360,8 +362,9 @@ public abstract class DocumentBase
return parameters == null ? StatSet.EMPTY_STATSET : parameters;
}
protected Condition parseCondition(Node n, Object template)
protected Condition parseCondition(Node node, Object template)
{
Node n = node;
while ((n != null) && (n.getNodeType() != Node.ELEMENT_NODE))
{
n = n.getNextSibling();
@@ -409,12 +412,14 @@ public abstract class DocumentBase
}
}
}
return condition;
}
protected Condition parseLogicAnd(Node n, Object template)
protected Condition parseLogicAnd(Node node, Object template)
{
final ConditionLogicAnd cond = new ConditionLogicAnd();
Node n = node;
for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
{
if (n.getNodeType() == Node.ELEMENT_NODE)
@@ -429,9 +434,10 @@ public abstract class DocumentBase
return cond;
}
protected Condition parseLogicOr(Node n, Object template)
protected Condition parseLogicOr(Node node, Object template)
{
final ConditionLogicOr cond = new ConditionLogicOr();
Node n = node;
for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
{
if (n.getNodeType() == Node.ELEMENT_NODE)
@@ -446,8 +452,9 @@ public abstract class DocumentBase
return cond;
}
protected Condition parseLogicNot(Node n, Object template)
protected Condition parseLogicNot(Node node, Object template)
{
Node n = node;
for (n = n.getFirstChild(); n != null; n = n.getNextSibling())
{
if (n.getNodeType() == Node.ELEMENT_NODE)
@@ -93,8 +93,9 @@ public class DocumentItem extends DocumentBase
}
}
protected void parseItem(Node n) throws InvocationTargetException
protected void parseItem(Node node) throws InvocationTargetException
{
Node n = node;
final int itemId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
final String className = n.getAttributes().getNamedItem("type").getNodeValue();
final String itemName = n.getAttributes().getNamedItem("name").getNodeValue();
@@ -116,8 +116,9 @@ public class DocumentSkill extends DocumentBase
}
}
protected void parseSkill(Node n)
protected void parseSkill(Node node)
{
Node n = node;
final NamedNodeMap attrs = n.getAttributes();
int enchantLevels1 = 0;
int enchantLevels2 = 0;
@@ -484,19 +484,26 @@ public class GeoEngine
/**
* Simple check for origin to target visibility.
* @param gox : origin X geodata coordinate
* @param goy : origin Y geodata coordinate
* @param goz : origin Z geodata coordinate
* @param goxValue : origin X geodata coordinate
* @param goyValue : origin Y geodata coordinate
* @param gozValue : origin Z geodata coordinate
* @param oheight : origin height (if instance of {@link Character})
* @param gtx : target X geodata coordinate
* @param gty : target Y geodata coordinate
* @param gtz : target Z geodata coordinate
* @param gtxValue : target X geodata coordinate
* @param gtyValue : target Y geodata coordinate
* @param gtzValue : target Z geodata coordinate
* @param theight : target height (if instance of {@link Character})
* @param instanceId
* @return {@code boolean} : True, when target can be seen.
*/
private final boolean checkSee(int gox, int goy, int goz, double oheight, int gtx, int gty, int gtz, double theight, int instanceId)
private final boolean checkSee(int goxValue, int goyValue, int gozValue, double oheight, int gtxValue, int gtyValue, int gtzValue, double theight, int instanceId)
{
int goz = gozValue;
int gtz = gtzValue;
int gox = goxValue;
int goy = goyValue;
int gtx = gtxValue;
int gty = gtyValue;
// get line of sight Z coordinates
double losoz = goz + ((oheight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
double lostz = gtz + ((theight * Config.PART_OF_CHARACTER_HEIGHT) / 100);
@@ -166,10 +166,10 @@ final class GeoEnginePathfinding extends GeoEngine
/**
* Create list of node locations as result of calculated buffer node tree.
* @param target : the entry point
* @param node : the entry point
* @return List<NodeLoc> : list of node location
*/
private static List<Location> constructPath(Node target)
private static List<Location> constructPath(Node node)
{
// create empty list
final LinkedList<Location> list = new LinkedList<>();
@@ -179,6 +179,7 @@ final class GeoEnginePathfinding extends GeoEngine
int dy = 0;
// get target parent
Node target = node;
Node parent = target.getParent();
// while parent exists
@@ -50,8 +50,9 @@ public class BypassHandler implements IHandler<IBypassHandler, String>
}
@Override
public IBypassHandler getHandler(String command)
public IBypassHandler getHandler(String commandValue)
{
String command = commandValue;
if (command.contains(" "))
{
command = command.substring(0, command.indexOf(' '));
@@ -50,8 +50,9 @@ public class TelnetHandler implements IHandler<ITelnetHandler, String>
}
@Override
public ITelnetHandler getHandler(String command)
public ITelnetHandler getHandler(String commandValue)
{
String command = commandValue;
if (command.contains(" "))
{
command = command.substring(0, command.indexOf(' '));
@@ -64,13 +64,14 @@ public class CastleManager implements InstanceListManager
return findNearestCastleIndex(obj, Long.MAX_VALUE);
}
public int findNearestCastleIndex(WorldObject obj, long maxDistance)
public int findNearestCastleIndex(WorldObject obj, long maxDistanceValue)
{
int index = getCastleIndex(obj);
if (index < 0)
{
double distance;
Castle castle;
double distance;
long maxDistance = maxDistanceValue;
for (int i = 0; i < _castles.size(); i++)
{
castle = _castles.get(i);
@@ -41,13 +41,14 @@ public class FortManager implements InstanceListManager
return findNearestFortIndex(obj, Long.MAX_VALUE);
}
public int findNearestFortIndex(WorldObject obj, long maxDistance)
public int findNearestFortIndex(WorldObject obj, long maxDistanceValue)
{
int index = getFortIndex(obj);
if (index < 0)
{
double distance;
Fort fort;
double distance;
long maxDistance = maxDistanceValue;
for (int i = 0; i < _forts.size(); i++)
{
fort = _forts.get(i);
@@ -1367,8 +1367,9 @@ public class FourSepulchersManager
}
}
protected byte minuteSelect(byte min)
protected byte minuteSelect(byte value)
{
byte min = value;
if ((min % 5) != 0) // if doesn't divides on 5 fully
{
// mad table for selecting proper minutes...
@@ -1466,17 +1467,17 @@ public class FourSepulchersManager
return min;
}
public void managerSay(byte min)
public void managerSay(byte value)
{
// for attack phase, sending message every 5 minutes
if (_inAttackTime)
{
if (min < 5)
if (value < 5)
{
return; // do not shout when < 5 minutes
}
min = minuteSelect(min);
final byte min = minuteSelect(value);
NpcStringId msg = NpcStringId.MINUTE_S_HAVE_PASSED;
if (min == 90)
{
@@ -392,18 +392,20 @@ public class Lottery
}
}
public int[] decodeNumbers(int enchant, int type2)
public int[] decodeNumbers(int enchantValue, int type2Value)
{
final int[] res = new int[5];
int id = 0;
int nr = 1;
int enchant = enchantValue;
while (enchant > 0)
{
final int val = enchant / 2;
if (val != Math.round((double) enchant / 2))
if (val != ((double) enchant / 2))
{
res[id++] = nr;
res[id] = nr;
id++;
}
enchant /= 2;
nr++;
@@ -411,12 +413,14 @@ public class Lottery
nr = 17;
int type2 = type2Value;
while (type2 > 0)
{
final int val = type2 / 2;
if (val != ((double) type2 / 2))
{
res[id++] = nr;
res[id] = nr;
id++;
}
type2 /= 2;
nr++;
@@ -168,22 +168,7 @@ public class AutoSpawnHandler
*/
public AutoSpawnInstance registerSpawn(int npcId, int[][] spawnPoints, int initialDelay, int respawnDelay, int despawnDelay)
{
if (initialDelay < 0)
{
initialDelay = DEFAULT_INITIAL_SPAWN;
}
if (respawnDelay < 0)
{
respawnDelay = DEFAULT_RESPAWN;
}
if (despawnDelay < 0)
{
despawnDelay = DEFAULT_DESPAWN;
}
final AutoSpawnInstance newSpawn = new AutoSpawnInstance(npcId, initialDelay, respawnDelay, despawnDelay);
final AutoSpawnInstance newSpawn = new AutoSpawnInstance(npcId, initialDelay < 0 ? DEFAULT_INITIAL_SPAWN : initialDelay, respawnDelay < 0 ? DEFAULT_RESPAWN : respawnDelay, despawnDelay < 0 ? DEFAULT_DESPAWN : despawnDelay);
if (spawnPoints != null)
{
for (int[] spawnPoint : spawnPoints)
@@ -725,18 +725,18 @@ public class Party extends AbstractPlayerGroup
* <li>Get the PlayerInstance owner of the ServitorInstance (if necessary)</li>
* <li>Calculate the Experience and SP reward distribution rate</li>
* <li>Add Experience and SP to the PlayerInstance</li><br>
* @param xpReward The Experience reward to distribute
* @param spReward The SP reward to distribute
* @param xpRewardValue The Experience reward to distribute
* @param spRewardValue The SP reward to distribute
* @param rewardedMembers The list of PlayerInstance to reward
* @param topLvl
* @param partyDmg
* @param target
*/
public void distributeXpAndSp(double xpReward, double spReward, List<PlayerInstance> rewardedMembers, int topLvl, long partyDmg, Attackable target)
public void distributeXpAndSp(double xpRewardValue, double spRewardValue, List<PlayerInstance> rewardedMembers, int topLvl, long partyDmg, Attackable target)
{
final List<PlayerInstance> validMembers = getValidMembers(rewardedMembers, topLvl);
xpReward *= getExpBonus(validMembers.size());
spReward *= getSpBonus(validMembers.size());
double xpReward = xpRewardValue * getExpBonus(validMembers.size());
double spReward = spRewardValue * getSpBonus(validMembers.size());
int sqLevelSum = 0;
for (PlayerInstance member : validMembers)
{
@@ -48,7 +48,7 @@ public class Petition
public Petition(PlayerInstance petitioner, String petitionText, int petitionType)
{
_id = IdFactory.getNextId();
_type = PetitionType.values()[--petitionType];
_type = PetitionType.values()[petitionType - 1];
_content = petitionText;
_petitioner = petitioner;
}
@@ -189,25 +189,28 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
{
synchronized (this)
{
if (x > World.MAP_MAX_X)
int spawnX = x;
if (spawnX > World.MAP_MAX_X)
{
x = World.MAP_MAX_X - 5000;
spawnX = World.MAP_MAX_X - 5000;
}
if (x < World.MAP_MIN_X)
if (spawnX < World.MAP_MIN_X)
{
x = World.MAP_MIN_X + 5000;
spawnX = World.MAP_MIN_X + 5000;
}
if (y > World.MAP_MAX_Y)
int spawnY = y;
if (spawnY > World.MAP_MAX_Y)
{
y = World.MAP_MAX_Y - 5000;
spawnY = World.MAP_MAX_Y - 5000;
}
if (y < World.MAP_MIN_Y)
if (spawnY < World.MAP_MIN_Y)
{
y = World.MAP_MIN_Y + 5000;
spawnY = World.MAP_MIN_Y + 5000;
}
// Set the x,y,z position of the WorldObject. If flagged with _isSpawned, setXYZ will automatically update world region, so avoid that.
setXYZ(x, y, z);
setXYZ(spawnX, spawnY, z);
}
// Spawn and update its _worldregion
@@ -515,24 +518,27 @@ public abstract class WorldObject extends ListenersContainer implements IIdentif
public void setXYZInvisible(int x, int y, int z)
{
if (x > World.MAP_MAX_X)
int correctX = x;
if (correctX > World.MAP_MAX_X)
{
x = World.MAP_MAX_X - 5000;
correctX = World.MAP_MAX_X - 5000;
}
if (x < World.MAP_MIN_X)
if (correctX < World.MAP_MIN_X)
{
x = World.MAP_MIN_X + 5000;
}
if (y > World.MAP_MAX_Y)
{
y = World.MAP_MAX_Y - 5000;
}
if (y < World.MAP_MIN_Y)
{
y = World.MAP_MIN_Y + 5000;
correctX = World.MAP_MIN_X + 5000;
}
setXYZ(x, y, z);
int correctY = y;
if (correctY > World.MAP_MAX_Y)
{
correctY = World.MAP_MAX_Y - 5000;
}
if (correctY < World.MAP_MIN_Y)
{
correctY = World.MAP_MIN_Y + 5000;
}
setXYZ(correctX, correctY, z);
setSpawned(false);
}
@@ -646,9 +646,9 @@ public class Attackable extends Npc
* Adds damage and hate to the attacker aggression list for this character.
* @param attacker The Creature that gave damages to this Attackable
* @param damage The number of damages given by the attacker Creature
* @param aggro The hate (=damage) given by the attacker Creature
* @param aggroValue The hate (=damage) given by the attacker Creature
*/
public void addDamageHate(Creature attacker, int damage, int aggro)
public void addDamageHate(Creature attacker, int damage, int aggroValue)
{
if ((attacker == null) || (attacker == this))
{
@@ -668,6 +668,7 @@ public class Attackable extends Npc
// Traps does not cause aggro
// making this hack because not possible to determine if damage made by trap
// so just check for triggered trap here
int aggro = aggroValue;
final PlayerInstance targetPlayer = attacker.getActingPlayer();
if ((targetPlayer == null) || (targetPlayer.getTrap() == null) || !targetPlayer.getTrap().isTriggered())
{
@@ -725,8 +726,7 @@ public class Attackable extends Npc
ai.addHate(amount);
}
amount = getHating(mostHated);
if (amount >= 0)
if (getHating(mostHated) >= 0)
{
((AttackableAI) getAI()).setGlobalAggro(-25);
clearAggroList();
@@ -768,6 +768,7 @@ public class Attackable extends Npc
{
return;
}
final AggroInfo ai = _aggroList.get(target);
if (ai != null)
{
@@ -657,15 +657,20 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* <li>Send a Server->Client packet TeleportToLocationt to the Creature AND to all PlayerInstance in its _KnownPlayers</li>
* <li>Modify the position of the pet if necessary</li>
* </ul>
* @param x
* @param y
* @param z
* @param heading
* @param xValue
* @param yValue
* @param zValue
* @param headingValue
* @param instanceId
* @param randomOffset
*/
public void teleToLocation(int x, int y, int z, int heading, int instanceId, int randomOffset)
public void teleToLocation(int xValue, int yValue, int zValue, int headingValue, int instanceId, int randomOffset)
{
int x = xValue;
int y = yValue;
int z = zValue;
int heading = headingValue;
setInstanceId(instanceId);
if (_isPendingRevive)
@@ -1524,11 +1529,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
beginCast(skill, true, target, targets);
}
private void beginCast(Skill skill, boolean simultaneously)
private void beginCast(Skill skill, boolean isSimultaneous)
{
if (!checkDoCastConditions(skill))
{
if (simultaneously)
if (isSimultaneous)
{
setCastingSimultaneouslyNow(false);
}
@@ -1544,6 +1549,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
// Override casting type
boolean simultaneously = isSimultaneous;
if (skill.isSimultaneousCast() && !simultaneously)
{
simultaneously = true;
@@ -1624,6 +1630,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
}
}
beginCast(skill, simultaneously, target, targets);
}
@@ -4119,9 +4126,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
if ((object != null) && !object.isSpawned())
{
object = null;
_target = null;
return;
}
_target = object;
}
@@ -4170,12 +4177,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* <li>AI : onIntentionMoveTo(Location), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
* <li>FollowTask</li>
* </ul>
* @param x The X position of the destination
* @param y The Y position of the destination
* @param z The Y position of the destination
* @param offset The size of the interaction area of the Creature targeted
* @param xValue The X position of the destination
* @param yValue The Y position of the destination
* @param zValue The Y position of the destination
* @param offsetValue The size of the interaction area of the Creature targeted
*/
public void moveToLocation(int x, int y, int z, int offset)
public void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
{
// Get the Move Speed of the Creature
final double speed = _stat.getMoveSpeed();
@@ -4184,6 +4191,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return;
}
int x = xValue;
int y = yValue;
int z = zValue;
int offset = offsetValue;
// Get current position of the Creature
final int curX = getX();
final int curY = getY();
@@ -4641,13 +4653,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
* <li>if attack isn't aborted and hit isn't missed, manage attack or cast break of the target (calculating rate, sending message...)</li>
* </ul>
* @param target The Creature targeted
* @param damage Number of HP to reduce
* @param damageValue Number of HP to reduce
* @param crit True if hit is critical
* @param miss True if hit is missed
* @param soulshot True if SoulShot are charged
* @param shld True if shield is efficient
*/
public void onHitTimer(Creature target, int damage, boolean crit, boolean miss, boolean soulshot, byte shld)
public void onHitTimer(Creature target, int damageValue, boolean crit, boolean miss, boolean soulshot, byte shld)
{
// If the attacker/target is dead or use fake death, notify the AI with EVT_CANCEL
// and send a Server->Client packet ActionFailed (if attacker is a PlayerInstance)
@@ -4690,6 +4702,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
}
// Send message about damage/crit or miss
int damage = damageValue;
sendDamageMessage(target, damage, false, crit, miss);
// Check Raidboss attack Creature will be petrified if attacking a raid that's more than 8 levels lower
@@ -6293,6 +6306,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return;
}
if (skill.checkCondition(this, target, false))
{
if (isSkillDisabled(skill))
@@ -6313,25 +6327,26 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return;
}
Creature skillTarget = target;
for (WorldObject obj : targets)
{
if ((obj != null) && obj.isCreature())
{
target = (Creature) obj;
skillTarget = (Creature) obj;
break;
}
}
if (Config.ALT_VALIDATE_TRIGGER_SKILLS && isPlayable() && (target != null) && target.isPlayable())
if (Config.ALT_VALIDATE_TRIGGER_SKILLS && isPlayable() && (skillTarget != null) && skillTarget.isPlayable())
{
final PlayerInstance player = getActingPlayer();
if (!player.checkPvpSkill(target, skill))
if (!player.checkPvpSkill(skillTarget, skill))
{
return;
}
}
broadcastPacket(new MagicSkillUse(this, target, skill.getDisplayId(), skill.getLevel(), 0, 0));
broadcastPacket(new MagicSkillUse(this, skillTarget, skill.getDisplayId(), skill.getLevel(), 0, 0));
broadcastPacket(new MagicSkillLaunched(this, skill.getDisplayId(), skill.getLevel(), targets));
// Launch the magic skill and calculate its effects
@@ -770,8 +770,7 @@ public class Npc extends Creature
public void insertObjectIdAndShowChatWindow(PlayerInstance player, String content)
{
// Send a Server->Client packet NpcHtmlMessage to the PlayerInstance in order to display the message of the NpcInstance
content = content.replaceAll("%objectId%", String.valueOf(getObjectId()));
player.sendPacket(new NpcHtmlMessage(getObjectId(), content));
player.sendPacket(new NpcHtmlMessage(getObjectId(), content.replaceAll("%objectId%", String.valueOf(getObjectId()))));
}
/**
@@ -114,8 +114,9 @@ public class FortCommanderInstance extends DefenderInstance
}
@Override
public void addDamage(Creature attacker, int damage, Skill skill)
public void addDamage(Creature creature, int damage, Skill skill)
{
Creature attacker = creature;
final Spawn spawn = getSpawn();
if ((spawn != null) && canTalk())
{
@@ -143,13 +143,14 @@ public class GuardInstance extends Attackable
* @param player The PlayerInstance that start an action on the GuardInstance
*/
@Override
public void onAction(PlayerInstance player, boolean interact)
public void onAction(PlayerInstance player, boolean interactValue)
{
if (!canTarget(player))
{
return;
}
boolean interact = interactValue;
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_GUARDS_ENABLED && ((player.isGood() && getTemplate().isClan(Config.FACTION_EVIL_TEAM_NAME)) || (player.isEvil() && getTemplate().isClan(Config.FACTION_GOOD_TEAM_NAME))))
{
interact = false;
@@ -207,6 +208,7 @@ public class GuardInstance extends Attackable
}
}
}
// Send a Server->Client ActionFailed to the PlayerInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}
@@ -790,19 +790,18 @@ public class PetInstance extends Summon
}
}
public void dropItemHere(ItemInstance dropit, boolean protect)
public void dropItemHere(ItemInstance item, boolean protect)
{
dropit = _inventory.dropItem("Drop", dropit.getObjectId(), dropit.getCount(), getOwner(), this);
if (dropit == null)
final ItemInstance dropit = _inventory.dropItem("Drop", item.getObjectId(), item.getCount(), getOwner(), this);
if (dropit != null)
{
return;
if (protect)
{
dropit.getDropProtection().protect(getOwner());
}
LOGGER_PET.finer("Item id to drop: " + dropit.getId() + " amount: " + dropit.getCount());
dropit.dropMe(this, getX(), getY(), getZ() + 100);
}
if (protect)
{
dropit.getDropProtection().protect(getOwner());
}
LOGGER_PET.finer("Item id to drop: " + dropit.getId() + " amount: " + dropit.getCount());
dropit.dropMe(this, getX(), getY(), getZ() + 100);
}
public void dropItemHere(ItemInstance dropit)
@@ -1955,13 +1955,15 @@ public class PlayerInstance extends Playable
/**
* Set the Karma of the PlayerInstance and send a Server->Client packet StatusUpdate (broadcast).
* @param karma
* @param value
*/
@Override
public void setKarma(int karma)
public void setKarma(int value)
{
// Notify to scripts.
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerKarmaChanged(this, getKarma(), karma), this);
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerKarmaChanged(this, getKarma(), value), this);
int karma = value;
if (karma < 0)
{
karma = 0;
@@ -2668,12 +2670,7 @@ public class PlayerInstance extends Playable
*/
public void setExp(long exp)
{
if (exp < 0)
{
exp = 0;
}
getStat().setExp(exp);
getStat().setExp(Math.max(0, exp));
}
/**
@@ -2720,12 +2717,7 @@ public class PlayerInstance extends Playable
*/
public void setSp(long sp)
{
if (sp < 0)
{
sp = 0;
}
super.getStat().setSp(sp);
super.getStat().setSp(Math.max(0, sp));
}
/**
@@ -3372,8 +3364,8 @@ public class PlayerInstance extends Playable
*/
public boolean destroyItem(String process, ItemInstance item, long count, WorldObject reference, boolean sendMessage)
{
item = _inventory.destroyItem(process, item, count, this, reference);
if (item == null)
final ItemInstance destoyedItem = _inventory.destroyItem(process, item, count, this, reference);
if (destoyedItem == null)
{
if (sendMessage)
{
@@ -3386,7 +3378,7 @@ public class PlayerInstance extends Playable
if (!Config.FORCE_INVENTORY_UPDATE)
{
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addItem(item);
playerIU.addItem(destoyedItem);
sendPacket(playerIU);
}
else
@@ -3406,13 +3398,13 @@ public class PlayerInstance extends Playable
if (count > 1)
{
sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
sm.addItemName(item);
sm.addItemName(destoyedItem);
sm.addLong(count);
}
else
{
sm = new SystemMessage(SystemMessageId.S1_HAS_DISAPPEARED);
sm.addItemName(item);
sm.addItemName(destoyedItem);
}
sendPacket(sm);
}
@@ -3673,8 +3665,8 @@ public class PlayerInstance extends Playable
*/
public boolean dropItem(String process, ItemInstance item, WorldObject reference, boolean sendMessage, boolean protectItem)
{
item = _inventory.dropItem(process, item, this, reference);
if (item == null)
final ItemInstance droppedItem = _inventory.dropItem(process, item, this, reference);
if (droppedItem == null)
{
if (sendMessage)
{
@@ -3683,33 +3675,33 @@ public class PlayerInstance extends Playable
return false;
}
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()) && ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable()))
droppedItem.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(droppedItem.getId()) && ((droppedItem.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !droppedItem.isEquipable()))
{
ItemsAutoDestroy.getInstance().addItem(item);
ItemsAutoDestroy.getInstance().addItem(droppedItem);
}
// protection against auto destroy dropped item
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
item.setProtected(!(!item.isEquipable() || (item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM)));
droppedItem.setProtected(droppedItem.isEquipable() && (!droppedItem.isEquipable() || !Config.DESTROY_EQUIPABLE_PLAYER_ITEM));
}
else
{
item.setProtected(true);
droppedItem.setProtected(true);
}
// retail drop protection
if (protectItem)
{
item.getDropProtection().protect(this);
droppedItem.getDropProtection().protect(this);
}
// Send inventory update packet
if (!Config.FORCE_INVENTORY_UPDATE)
{
final InventoryUpdate playerIU = new InventoryUpdate();
playerIU.addItem(item);
playerIU.addItem(droppedItem);
sendPacket(playerIU);
}
else
@@ -3726,7 +3718,7 @@ public class PlayerInstance extends Playable
if (sendMessage)
{
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_DROPPED_S1);
sm.addItemName(item);
sm.addItemName(droppedItem);
sendPacket(sm);
}
@@ -4714,11 +4706,12 @@ public class PlayerInstance extends Playable
* <li>Add the PlayerInstance to the _statusListener of the new target if it's a Creature</li>
* <li>Target the new WorldObject (add the target to the PlayerInstance _target, _knownObject and PlayerInstance to _KnownObject of the WorldObject)</li>
* </ul>
* @param newTarget The WorldObject to target
* @param worldObject The WorldObject to target
*/
@Override
public void setTarget(WorldObject newTarget)
public void setTarget(WorldObject worldObject)
{
WorldObject newTarget = worldObject;
if (newTarget != null)
{
final boolean isInParty = newTarget.isPlayer() && isInParty() && _party.containsPlayer(newTarget.getActingPlayer());
@@ -7994,23 +7987,21 @@ public class PlayerInstance extends Playable
return false;
}
slot--;
final Henna henna = _henna[slot];
final Henna henna = _henna[slot - 1];
if (henna == null)
{
return false;
}
_henna[slot] = null;
_henna[slot - 1] = null;
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CHAR_HENNA))
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
ps.setInt(1, getObjectId());
ps.setInt(2, slot + 1);
ps.setInt(3, _classIndex);
ps.execute();
statement.setInt(1, getObjectId());
statement.setInt(2, slot);
statement.setInt(3, _classIndex);
statement.execute();
}
catch (Exception e)
{
@@ -44,10 +44,10 @@ public class SchemeBufferInstance extends Npc
}
@Override
public void onBypassFeedback(PlayerInstance player, String command)
public void onBypassFeedback(PlayerInstance player, String commandValue)
{
// Simple hack to use createscheme bypass with a space.
command = command.replace("createscheme ", "createscheme;");
final String command = commandValue.replace("createscheme ", "createscheme;");
final StringTokenizer st = new StringTokenizer(command, ";");
final String currentCommand = st.nextToken();
@@ -299,10 +299,10 @@ public class SchemeBufferInstance extends Npc
* @param player : The player to make checks on.
* @param groupType : The group of skills to select.
* @param schemeName : The scheme to make check.
* @param page The page.
* @param pageValue The page.
* @return a String representing skills available to selection for a given groupType.
*/
private String getGroupSkillList(PlayerInstance player, String groupType, String schemeName, int page)
private String getGroupSkillList(PlayerInstance player, String groupType, String schemeName, int pageValue)
{
// Retrieve the entire skills list based on group type.
List<Integer> skills = SchemeBufferTable.getInstance().getSkillsIdsByType(groupType);
@@ -313,6 +313,7 @@ public class SchemeBufferInstance extends Npc
// Calculate page number.
final int max = countPagesNumber(skills.size(), PAGE_LIMIT);
int page = pageValue;
if (page > max)
{
page = max;
@@ -223,11 +223,12 @@ public class SepulcherNpcInstance extends Npc
{
setInvul(false);
reduceCurrentHp(getMaxHp() + 1, player, null);
PlayerInstance leader = player;
if ((player.getParty() != null) && !player.getParty().isLeader(player))
{
player = player.getParty().getLeader();
leader = player.getParty().getLeader();
}
player.addItem("Quest", HALLS_KEY, 1, player, true);
leader.addItem("Quest", HALLS_KEY, 1, leader, true);
break;
}
default:
@@ -41,19 +41,20 @@ public class PlayableStat extends CreatureStat
super(activeChar);
}
public boolean addExp(long value)
public boolean addExp(long amount)
{
final TerminateReturn term = EventDispatcher.getInstance().notifyEvent(new OnPlayableExpChanged(getActiveChar(), getExp(), getExp() + value), getActiveChar(), TerminateReturn.class);
final TerminateReturn term = EventDispatcher.getInstance().notifyEvent(new OnPlayableExpChanged(getActiveChar(), getExp(), getExp() + amount), getActiveChar(), TerminateReturn.class);
if ((term != null) && term.terminate())
{
return false;
}
if (((getExp() + value) < 0) || ((value > 0) && (getExp() == (getExpForLevel(getMaxLevel()) - 1))))
if (((getExp() + amount) < 0) || ((amount > 0) && (getExp() == (getExpForLevel(getMaxLevel()) - 1))))
{
return true;
}
long value = amount;
if ((getExp() + value) >= getExpForLevel(getMaxLevel()))
{
value = getExpForLevel(getMaxLevel()) - 1 - getExp();
@@ -77,6 +78,7 @@ public class PlayableStat extends CreatureStat
level = --tmp;
break;
}
if ((level != getLevel()) && (level >= minimumLevel))
{
addLevel((byte) (level - getLevel()));
@@ -85,8 +87,9 @@ public class PlayableStat extends CreatureStat
return true;
}
public boolean removeExp(long value)
public boolean removeExp(long amount)
{
long value = amount;
if ((getExp() - value) < 0)
{
value = getExp() - 1;
@@ -131,8 +134,9 @@ public class PlayableStat extends CreatureStat
return expRemoved || spRemoved;
}
public boolean addLevel(byte value)
public boolean addLevel(byte amount)
{
byte value = amount;
if ((getLevel() + value) > (getMaxLevel() - 1))
{
if (getLevel() < (getMaxLevel() - 1))
@@ -171,19 +175,21 @@ public class PlayableStat extends CreatureStat
return true;
}
public boolean addSp(long value)
public boolean addSp(long amount)
{
if (value < 0)
if (amount < 0)
{
LOGGER.warning("wrong usage");
return false;
}
final long currentSp = getSp();
if (currentSp >= Config.MAX_SP)
{
return false;
}
long value = amount;
if (currentSp > (Config.MAX_SP - value))
{
value = Config.MAX_SP - currentSp;
@@ -193,14 +199,15 @@ public class PlayableStat extends CreatureStat
return true;
}
public boolean removeSp(long value)
public boolean removeSp(long amount)
{
final long currentSp = getSp();
if (currentSp < value)
if (currentSp < amount)
{
value = currentSp;
setSp(getSp() - currentSp);
return true;
}
setSp(getSp() - value);
setSp(getSp() - amount);
return true;
}
@@ -113,7 +113,7 @@ public class PlayerStat extends PlayableStat
return true;
}
public boolean addExpAndSp(double addToExp, double addToSp, boolean useBonuses)
public boolean addExpAndSp(double addToExpValue, double addToSpValue, boolean useBonuses)
{
final PlayerInstance player = getActiveChar();
@@ -123,6 +123,9 @@ public class PlayerStat extends PlayableStat
return false;
}
double addToExp = addToExpValue;
double addToSp = addToSpValue;
// Premium rates
if (player.hasPremiumStatus())
{
@@ -477,9 +480,10 @@ public class PlayerStat extends PlayableStat
@Override
public void setLevel(byte value)
{
if (value > (ExperienceData.getInstance().getMaxLevel() - 1))
byte level = value;
if (level > (ExperienceData.getInstance().getMaxLevel() - 1))
{
value = (byte) (ExperienceData.getInstance().getMaxLevel() - 1);
level = (byte) (ExperienceData.getInstance().getMaxLevel() - 1);
}
if (getActiveChar().isSubClassActive())
@@ -488,7 +492,7 @@ public class PlayerStat extends PlayableStat
}
else
{
super.setLevel(value);
super.setLevel(level);
}
}
@@ -727,9 +731,9 @@ public class PlayerStat extends PlayableStat
/*
* Set current vitality points to this value if quiet = true - does not send system messages
*/
public void setVitalityPoints(int points, boolean quiet)
public void setVitalityPoints(int value, boolean quiet)
{
points = Math.min(Math.max(points, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
final int points = Math.min(Math.max(value, MIN_VITALITY_POINTS), MAX_VITALITY_POINTS);
if (points == _vitalityPoints)
{
return;
@@ -740,13 +744,14 @@ public class PlayerStat extends PlayableStat
getActiveChar().sendPacket(new ExVitalityPointInfo(getVitalityPoints()));
}
public synchronized void updateVitalityPoints(float points, boolean useRates, boolean quiet)
public synchronized void updateVitalityPoints(float value, boolean useRates, boolean quiet)
{
if ((points == 0) || !Config.ENABLE_VITALITY)
if ((value == 0) || !Config.ENABLE_VITALITY)
{
return;
}
float points = value;
if (useRates)
{
if (getActiveChar().isLucky())
@@ -101,7 +101,8 @@ public class PlayerStatus extends PlayableStatus
}
}
int fullValue = (int) value;
double amount = value;
int fullValue = (int) amount;
int tDmg = 0;
int mpDam = 0;
if ((attacker != null) && (attacker != getActiveChar()))
@@ -137,27 +138,27 @@ public class PlayerStatus extends PlayableStatus
final Summon summon = getActiveChar().getSummon();
if (getActiveChar().hasServitor() && Util.checkIfInRange(1000, getActiveChar(), summon, true))
{
tDmg = ((int) value * (int) getActiveChar().getStat().calcStat(Stat.TRANSFER_DAMAGE_PERCENT, 0, null, null)) / 100;
tDmg = ((int) amount * (int) getActiveChar().getStat().calcStat(Stat.TRANSFER_DAMAGE_PERCENT, 0, null, null)) / 100;
// Only transfer dmg up to current HP, it should not be killed
tDmg = Math.min((int) summon.getCurrentHp() - 1, tDmg);
if (tDmg > 0)
{
summon.reduceCurrentHp(tDmg, attacker, null);
value -= tDmg;
fullValue = (int) value; // reduce the announced value here as player will get a message about summon damage
amount -= tDmg;
fullValue = (int) amount; // reduce the announced value here as player will get a message about summon damage
}
}
mpDam = ((int) value * (int) getActiveChar().getStat().calcStat(Stat.MANA_SHIELD_PERCENT, 0, null, null)) / 100;
mpDam = ((int) amount * (int) getActiveChar().getStat().calcStat(Stat.MANA_SHIELD_PERCENT, 0, null, null)) / 100;
if (mpDam > 0)
{
mpDam = (int) (value - mpDam);
mpDam = (int) (amount - mpDam);
if (mpDam > getActiveChar().getCurrentMp())
{
getActiveChar().sendPacket(SystemMessageId.MP_BECAME_0_AND_THE_ARCANE_SHIELD_IS_DISAPPEARING);
getActiveChar().stopSkillEffects(true, 1556);
value = mpDam - getActiveChar().getCurrentMp();
amount = mpDam - getActiveChar().getCurrentMp();
getActiveChar().setCurrentMp(0);
}
else
@@ -173,7 +174,7 @@ public class PlayerStatus extends PlayableStatus
final PlayerInstance caster = getActiveChar().getTransferingDamageTo();
if ((caster != null) && (getActiveChar().getParty() != null) && Util.checkIfInRange(1000, getActiveChar(), caster, true) && !caster.isDead() && (getActiveChar() != caster) && getActiveChar().getParty().getMembers().contains(caster))
{
int transferDmg = Math.min((int) caster.getCurrentHp() - 1, ((int) value * (int) getActiveChar().getStat().calcStat(Stat.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100);
int transferDmg = Math.min((int) caster.getCurrentHp() - 1, ((int) amount * (int) getActiveChar().getStat().calcStat(Stat.TRANSFER_DAMAGE_TO_PLAYER, 0, null, null)) / 100);
if (transferDmg > 0)
{
int membersInRange = 0;
@@ -201,22 +202,22 @@ public class PlayerStatus extends PlayableStatus
if (membersInRange > 0)
{
caster.reduceCurrentHp(transferDmg / membersInRange, attacker, null);
value -= transferDmg;
fullValue = (int) value;
amount -= transferDmg;
fullValue = (int) amount;
}
}
}
if (!ignoreCP && (attacker.isPlayable() || attacker.isFakePlayer()))
{
if (_currentCp >= value)
if (_currentCp >= amount)
{
setCurrentCp(_currentCp - value); // Set Cp to diff of Cp vs value
value = 0; // No need to subtract anything from Hp
setCurrentCp(_currentCp - amount); // Set Cp to diff of Cp vs value
amount = 0; // No need to subtract anything from Hp
}
else
{
value -= _currentCp; // Get diff from value vs Cp; will apply diff to Hp
amount -= _currentCp; // Get diff from value vs Cp; will apply diff to Hp
setCurrentCp(0, false); // Set Cp to 0
}
}
@@ -252,10 +253,10 @@ public class PlayerStatus extends PlayableStatus
}
}
if (value > 0)
if (amount > 0)
{
value = getCurrentHp() - value;
if (value <= 0)
amount = getCurrentHp() - amount;
if (amount <= 0)
{
if (getActiveChar().isInDuel())
{
@@ -271,14 +272,14 @@ public class PlayerStatus extends PlayableStatus
// let the DuelManager know of his defeat
DuelManager.getInstance().onPlayerDefeat(getActiveChar());
value = 1;
amount = 1;
}
else
{
value = 0;
amount = 0;
}
}
setCurrentHp(value);
setCurrentHp(amount);
}
if ((getActiveChar().getCurrentHp() < 0.5) && !isHPConsumption)
@@ -337,7 +338,7 @@ public class PlayerStatus extends PlayableStatus
setCurrentCp(newCp, true);
}
public void setCurrentCp(double newCp, boolean broadcastPacket)
public void setCurrentCp(double value, boolean broadcastPacket)
{
// Get the Max CP of the Creature
final int currentCp = (int) _currentCp;
@@ -350,11 +351,7 @@ public class PlayerStatus extends PlayableStatus
return;
}
if (newCp < 0)
{
newCp = 0;
}
final double newCp = Math.max(0, value);
if (newCp >= maxCp)
{
// Set the RegenActive flag to false
@@ -37,9 +37,8 @@ public class SiegeFlagStatus extends NpcStatus
{
if (getActiveChar().isAdvancedHeadquarter())
{
value /= 2.;
super.reduceHp(value / 2, attacker, awake, isDOT, isHpConsumption);
}
super.reduceHp(value, attacker, awake, isDOT, isHpConsumption);
}
@@ -37,7 +37,7 @@ public class SummonStatus extends PlayableStatus
}
@Override
public void reduceHp(double value, Creature attacker, boolean awake, boolean isDOT, boolean isHPConsumption)
public void reduceHp(double amount, Creature attacker, boolean awake, boolean isDOT, boolean isHPConsumption)
{
if ((attacker == null) || getActiveChar().isDead())
{
@@ -50,6 +50,7 @@ public class SummonStatus extends PlayableStatus
attackerPlayer.setDuelState(Duel.DUELSTATE_INTERRUPTED);
}
double value = amount;
final PlayerInstance caster = getActiveChar().getTransferingDamageTo();
if (getActiveChar().getOwner().getParty() != null)
{
@@ -108,6 +109,7 @@ public class SummonStatus extends PlayableStatus
value -= transferDmg;
}
}
super.reduceHp(value, attacker, awake, isDOT, isHPConsumption);
}
@@ -868,13 +868,13 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
return _collisionHeightGrown;
}
public static boolean isAssignableTo(Class<?> sub, Class<?> clazz)
public static boolean isAssignableTo(Class<?> subValue, Class<?> clazz)
{
// If clazz represents an interface
if (clazz.isInterface())
{
// check if obj implements the clazz interface
for (Class<?> interface1 : sub.getInterfaces())
for (Class<?> interface1 : subValue.getInterfaces())
{
if (clazz.getName().equals(interface1.getName()))
{
@@ -884,13 +884,13 @@ public class NpcTemplate extends CreatureTemplate implements IIdentifiable
}
else
{
Class<?> sub = subValue;
do
{
if (sub.getName().equals(clazz.getName()))
{
return true;
}
sub = sub.getSuperclass();
}
while (sub != null);
@@ -99,9 +99,9 @@ public class SubClass
{
if (expValue > (ExperienceData.getInstance().getExpForLevel(MAX_LEVEL + 1) - 1))
{
expValue = ExperienceData.getInstance().getExpForLevel(MAX_LEVEL + 1) - 1;
_exp = ExperienceData.getInstance().getExpForLevel(MAX_LEVEL + 1) - 1;
return;
}
_exp = expValue;
}
@@ -119,13 +119,14 @@ public class SubClass
{
if (levelValue > MAX_LEVEL)
{
levelValue = MAX_LEVEL;
_level = MAX_LEVEL;
return;
}
else if (levelValue < Config.BASE_SUBCLASS_LEVEL)
{
levelValue = Config.BASE_SUBCLASS_LEVEL;
_level = Config.BASE_SUBCLASS_LEVEL;
return;
}
_level = levelValue;
}
@@ -1151,8 +1151,9 @@ public class Clan implements IIdentifiable, INamable
}
}
private void storeNotice(String notice, boolean enabled)
private void storeNotice(String noticeValue, boolean enabled)
{
String notice = noticeValue;
if (notice == null)
{
notice = "";
@@ -1827,10 +1828,10 @@ public class Clan implements IIdentifiable, INamable
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
}
public SubPledge createSubPledge(PlayerInstance player, int pledgeType, int leaderId, String subPledgeName)
public SubPledge createSubPledge(PlayerInstance player, int pledgeTypeValue, int leaderId, String subPledgeName)
{
SubPledge subPledge = null;
pledgeType = getAvailablePledgeTypes(pledgeType);
final int pledgeType = getAvailablePledgeTypes(pledgeTypeValue);
if (pledgeType == 0)
{
if (pledgeType == SUBUNIT_ACADEMY)
@@ -1907,8 +1908,7 @@ public class Clan implements IIdentifiable, INamable
}
case SUBUNIT_ROYAL1:
{
pledgeType = getAvailablePledgeTypes(SUBUNIT_ROYAL2);
break;
return getAvailablePledgeTypes(SUBUNIT_ROYAL2);
}
case SUBUNIT_ROYAL2:
{
@@ -1916,18 +1916,15 @@ public class Clan implements IIdentifiable, INamable
}
case SUBUNIT_KNIGHT1:
{
pledgeType = getAvailablePledgeTypes(SUBUNIT_KNIGHT2);
break;
return getAvailablePledgeTypes(SUBUNIT_KNIGHT2);
}
case SUBUNIT_KNIGHT2:
{
pledgeType = getAvailablePledgeTypes(SUBUNIT_KNIGHT3);
break;
return getAvailablePledgeTypes(SUBUNIT_KNIGHT3);
}
case SUBUNIT_KNIGHT3:
{
pledgeType = getAvailablePledgeTypes(SUBUNIT_KNIGHT4);
break;
return getAvailablePledgeTypes(SUBUNIT_KNIGHT4);
}
case SUBUNIT_KNIGHT4:
{
@@ -283,9 +283,10 @@ public class Auction
*/
private void returnItem(String clanName, long quantity, boolean penalty)
{
long amount = quantity;
if (penalty)
{
quantity *= 0.9; // take 10% tax fee if needed
amount *= 0.9; // take 10% tax fee if needed
}
final Clan clan = ClanTable.getInstance().getClanByName(clanName);
@@ -304,8 +305,8 @@ public class Auction
// avoid overflow on return
final long limit = MAX_ADENA - cwh.getAdena();
quantity = Math.min(quantity, limit);
cwh.addItem("Outbidded", ADENA_ID, quantity, null, null);
amount = Math.min(amount, limit);
cwh.addItem("Outbidded", ADENA_ID, amount, null, null);
}
/**
@@ -271,9 +271,9 @@ public class Castle extends AbstractResidence
// This method add to the treasury
/**
* Add amount to castle instance's treasury (warehouse).
* @param amount
* @param amountValue
*/
public void addToTreasury(long amount)
public void addToTreasury(long amountValue)
{
// check if owned
if (_ownerId <= 0)
@@ -281,6 +281,7 @@ public class Castle extends AbstractResidence
return;
}
long amount = amountValue;
if (getName().equalsIgnoreCase("Schuttgart") || getName().equalsIgnoreCase("Goddard"))
{
final Castle rune = CastleManager.getInstance().getCastle("rune");
@@ -314,16 +315,17 @@ public class Castle extends AbstractResidence
/**
* Add amount to castle instance's treasury (warehouse), no tax paying.
* @param amount
* @param amountValue
* @return
*/
public boolean addToTreasuryNoTax(long amount)
public boolean addToTreasuryNoTax(long amountValue)
{
if (_ownerId <= 0)
{
return false;
}
long amount = amountValue;
if (amount < 0)
{
amount *= -1;
@@ -333,16 +335,13 @@ public class Castle extends AbstractResidence
}
_treasury -= amount;
}
else if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
if ((_treasury + amount) > Inventory.MAX_ADENA)
{
_treasury = Inventory.MAX_ADENA;
}
else
{
_treasury += amount;
}
_treasury += amount;
}
try (Connection con = DatabaseFactory.getConnection();
@@ -356,6 +355,7 @@ public class Castle extends AbstractResidence
{
LOGGER.log(Level.WARNING, e.getMessage(), e);
}
return true;
}
@@ -186,10 +186,10 @@ public class Hero
}
}
private String calcFightTime(long fightTime)
private String calcFightTime(long fightTimeValue)
{
final String format = String.format("%%0%dd", 2);
fightTime /= 1000;
final long fightTime = fightTimeValue / 1000;
return String.format(format, (fightTime % 3600) / 60) + ":" + String.format(format, fightTime % 60);
}
@@ -190,8 +190,9 @@ public class NevitSystem implements IUniqueId
}
}
public synchronized void startNevitEffect(int time)
public synchronized void startNevitEffect(int timeValue)
{
int time = timeValue;
if (getEffectTime() > 0)
{
stopNevitEffectTask(false);
@@ -1837,9 +1837,9 @@ public abstract class AbstractScript extends ManagedScript
* Add a temporary spawn of the specified NPC.
* @param summoner the NPC that requires this spawn
* @param npcId the ID of the NPC to spawn
* @param x the X coordinate of the spawn location
* @param y the Y coordinate of the spawn location
* @param z the Z coordinate (height) of the spawn location
* @param xValue the X coordinate of the spawn location
* @param yValue the Y coordinate of the spawn location
* @param zValue the Z coordinate (height) of the spawn location
* @param heading the heading of the NPC
* @param randomOffset if {@code true}, adds +/- 50~100 to X/Y coordinates of the spawn location
* @param despawnDelay time in milliseconds till the NPC is despawned (0 - only despawned on server shutdown)
@@ -1850,16 +1850,18 @@ public abstract class AbstractScript extends ManagedScript
* @see #addSpawn(int, int, int, int, int, boolean, long)
* @see #addSpawn(int, int, int, int, int, boolean, long, boolean)
*/
public static Npc addSpawn(Npc summoner, int npcId, int x, int y, int z, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
public static Npc addSpawn(Npc summoner, int npcId, int xValue, int yValue, int zValue, int heading, boolean randomOffset, long despawnDelay, boolean isSummonSpawn, int instanceId)
{
try
{
if ((x == 0) && (y == 0))
if ((xValue == 0) && (yValue == 0))
{
LOGGER.log(Level.SEVERE, "addSpawn(): invalid spawn coordinates for NPC #" + npcId + "!");
return null;
}
int x = xValue;
int y = yValue;
if (randomOffset)
{
int offset = Rnd.get(50, 100);
@@ -1879,7 +1881,7 @@ public abstract class AbstractScript extends ManagedScript
final Spawn spawn = new Spawn(npcId);
spawn.setInstanceId(instanceId);
spawn.setHeading(heading);
spawn.setXYZ(x, y, z);
spawn.setXYZ(x, y, zValue);
spawn.stopRespawn();
final Npc npc = spawn.doSpawn(isSummonSpawn);
@@ -2212,11 +2214,11 @@ public abstract class AbstractScript extends ManagedScript
* Give a reward to player using multipliers.
* @param player the player to whom to give the item
* @param itemId the ID of the item to give
* @param count the amount of items to give
* @param countValue the amount of items to give
*/
public static void rewardItems(PlayerInstance player, int itemId, long count)
public static void rewardItems(PlayerInstance player, int itemId, long countValue)
{
if (count <= 0)
if (countValue <= 0)
{
return;
}
@@ -2227,6 +2229,7 @@ public abstract class AbstractScript extends ManagedScript
return;
}
long count = countValue;
try
{
if (itemId == Inventory.ADENA_ID)
@@ -2468,29 +2471,29 @@ public abstract class AbstractScript extends ManagedScript
return true;
}
minAmount *= Config.RATE_QUEST_DROP;
maxAmount *= Config.RATE_QUEST_DROP;
dropChance *= Config.RATE_QUEST_DROP; // TODO separate configs for rate and amount
long minAmountWithBonus = (long) (minAmount * Config.RATE_QUEST_DROP);
long maxAmountWithBonus = (long) (maxAmount * Config.RATE_QUEST_DROP);
long dropChanceWithBonus = (long) (dropChance * Config.RATE_QUEST_DROP); // TODO separate configs for rate and amount
if ((npc != null) && Config.CHAMPION_ENABLE && npc.isChampion())
{
if ((itemId == Inventory.ADENA_ID) || (itemId == Inventory.ANCIENT_ADENA_ID))
{
dropChance *= Config.CHAMPION_ADENAS_REWARDS_CHANCE;
minAmount *= Config.CHAMPION_ADENAS_REWARDS_AMOUNT;
maxAmount *= Config.CHAMPION_ADENAS_REWARDS_AMOUNT;
dropChanceWithBonus *= Config.CHAMPION_ADENAS_REWARDS_CHANCE;
minAmountWithBonus *= Config.CHAMPION_ADENAS_REWARDS_AMOUNT;
maxAmountWithBonus *= Config.CHAMPION_ADENAS_REWARDS_AMOUNT;
}
else
{
dropChance *= Config.CHAMPION_REWARDS_CHANCE;
minAmount *= Config.CHAMPION_REWARDS_AMOUNT;
maxAmount *= Config.CHAMPION_REWARDS_AMOUNT;
dropChanceWithBonus *= Config.CHAMPION_REWARDS_CHANCE;
minAmountWithBonus *= Config.CHAMPION_REWARDS_AMOUNT;
maxAmountWithBonus *= Config.CHAMPION_REWARDS_AMOUNT;
}
}
long amountToGive = (minAmount == maxAmount) ? minAmount : Rnd.get(minAmount, maxAmount);
long amountToGive = (minAmountWithBonus == maxAmountWithBonus) ? minAmountWithBonus : Rnd.get(minAmountWithBonus, maxAmountWithBonus);
final double random = Rnd.nextDouble();
// Inventory slot check (almost useless for non-stacking items)
if ((dropChance >= random) && (amountToGive > 0) && player.getInventory().validateCapacityByItemId(itemId))
if ((dropChanceWithBonus >= random) && (amountToGive > 0) && player.getInventory().validateCapacityByItemId(itemId))
{
if ((limit > 0) && ((currentCount + amountToGive) > limit))
{
@@ -212,11 +212,12 @@ public class EventDispatcher
* @param listeners
* @param event
* @param returnBackClass
* @param callback
* @param callbackValue
* @return
*/
private <T extends AbstractEventReturn> T notifyToListeners(Queue<AbstractEventListener> listeners, IBaseEvent event, Class<T> returnBackClass, T callback)
private <T extends AbstractEventReturn> T notifyToListeners(Queue<AbstractEventListener> listeners, IBaseEvent event, Class<T> returnBackClass, T callbackValue)
{
T callback = callbackValue;
for (AbstractEventListener listener : listeners)
{
try
@@ -484,8 +484,9 @@ public class Instance
}
}
private void parseInstance(Node n) throws Exception
private void parseInstance(Node node) throws Exception
{
Node n = node;
_templateId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
Node a = n.getAttributes().getNamedItem("ejectTime");
if (a != null)
@@ -758,11 +759,12 @@ public class Instance
}
}
protected void doCheckTimeUp(int remaining)
protected void doCheckTimeUp(int value)
{
CreatureSay cs = null;
int timeLeft;
int interval;
int remaining = value;
if (_players.isEmpty() && (_emptyDestroyTime == 0))
{
remaining = 0;
@@ -69,8 +69,9 @@ public class AuctionDateGenerator
return calcDestTime(_calendar.getTimeInMillis(), date, TimeUnit.MILLISECONDS.convert(_interval, TimeUnit.DAYS));
}
private long calcDestTime(long time, long date, long add)
private long calcDestTime(long timeValue, long date, long add)
{
long time = timeValue;
if (time < date)
{
time += ((date - time) / add) * add;
@@ -76,13 +76,14 @@ public abstract class ItemContainer
}
/**
* @param filter
* @param filterValue
* @param filters
* @return the quantity of items in the inventory
*/
@SafeVarargs
public final int getSize(Predicate<ItemInstance> filter, Predicate<ItemInstance>... filters)
public final int getSize(Predicate<ItemInstance> filterValue, Predicate<ItemInstance>... filters)
{
Predicate<ItemInstance> filter = filterValue;
for (Predicate<ItemInstance> additionalFilter : filters)
{
filter = filter.and(additionalFilter);
@@ -237,32 +238,33 @@ public abstract class ItemContainer
*/
public ItemInstance addItem(String process, ItemInstance item, PlayerInstance actor, Object reference)
{
final ItemInstance olditem = getItemByItemId(item.getId());
ItemInstance newItem = item;
final ItemInstance olditem = getItemByItemId(newItem.getId());
// If stackable item is found in inventory just add to current quantity
if ((olditem != null) && olditem.isStackable())
{
final long count = item.getCount();
final long count = newItem.getCount();
olditem.changeCount(process, count, actor, reference);
olditem.setLastChange(ItemInstance.MODIFIED);
// And destroys the item
ItemTable.getInstance().destroyItem(process, item, actor, reference);
item.updateDatabase();
item = olditem;
ItemTable.getInstance().destroyItem(process, newItem, actor, reference);
newItem.updateDatabase();
newItem = olditem;
}
else // If item hasn't be found in inventory, create new one
{
item.setOwnerId(process, getOwnerId(), actor, reference);
item.setItemLocation(getBaseLocation());
item.setLastChange(ItemInstance.ADDED);
newItem.setOwnerId(process, getOwnerId(), actor, reference);
newItem.setItemLocation(getBaseLocation());
newItem.setLastChange((ItemInstance.ADDED));
// Add item in inventory
addItem(item);
addItem(newItem);
}
refreshWeight();
return item;
return newItem;
}
/**
@@ -320,13 +322,13 @@ public abstract class ItemContainer
* Transfers item to another inventory
* @param process string Identifier of process triggering this action
* @param objectId Item Identifier of the item to be transfered
* @param count Quantity of items to be transfered
* @param countValue Quantity of items to be transfered
* @param target the item container where the item will be moved.
* @param actor Player requesting the item transfer
* @param reference Object Object referencing current action like NPC selling item or previous item in transformation
* @return ItemInstance corresponding to the new item or the updated item in inventory
*/
public ItemInstance transferItem(String process, int objectId, long count, ItemContainer target, PlayerInstance actor, Object reference)
public ItemInstance transferItem(String process, int objectId, long countValue, ItemContainer target, PlayerInstance actor, Object reference)
{
if (target == null)
{
@@ -349,6 +351,7 @@ public abstract class ItemContainer
}
// Check if requested quantity is available
long count = countValue;
if (count > sourceitem.getCount())
{
count = sourceitem.getCount();
@@ -446,24 +446,25 @@ public class PlayerInventory extends Inventory
@Override
public ItemInstance addItem(String process, ItemInstance item, PlayerInstance actor, Object reference)
{
item = super.addItem(process, item, actor, reference);
if ((item != null) && (item.getId() == ADENA_ID) && !item.equals(_adena))
final ItemInstance addedItem = super.addItem(process, item, actor, reference);
if (addedItem != null)
{
_adena = item;
if ((addedItem.getId() == ADENA_ID) && !addedItem.equals(_adena))
{
_adena = addedItem;
}
else if ((addedItem.getId() == ANCIENT_ADENA_ID) && !addedItem.equals(_ancientAdena))
{
_ancientAdena = addedItem;
}
if (actor != null)
{
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, addedItem), actor);
}
}
if ((item != null) && (item.getId() == ANCIENT_ADENA_ID) && !item.equals(_ancientAdena))
{
_ancientAdena = item;
}
if (item != null)
{
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemAdd(actor, item), actor);
}
return item;
return addedItem;
}
/**
@@ -571,7 +572,7 @@ public class PlayerInventory extends Inventory
@Override
public ItemInstance destroyItem(String process, ItemInstance item, long count, PlayerInstance actor, Object reference)
{
item = super.destroyItem(process, item, count, actor, reference);
final ItemInstance destroyedItem = super.destroyItem(process, item, count, actor, reference);
if ((_adena != null) && (_adena.getCount() <= 0))
{
@@ -584,11 +585,12 @@ public class PlayerInventory extends Inventory
}
// Notify to scripts
if (item != null)
if (destroyedItem != null)
{
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemDestroy(actor, item), item.getItem());
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemDestroy(actor, destroyedItem), destroyedItem.getItem());
}
return item;
return destroyedItem;
}
/**
@@ -634,7 +636,7 @@ public class PlayerInventory extends Inventory
@Override
public ItemInstance dropItem(String process, ItemInstance item, PlayerInstance actor, Object reference)
{
item = super.dropItem(process, item, actor, reference);
final ItemInstance droppedItem = super.dropItem(process, item, actor, reference);
if ((_adena != null) && ((_adena.getCount() <= 0) || (_adena.getOwnerId() != getOwnerId())))
{
@@ -647,12 +649,12 @@ public class PlayerInventory extends Inventory
}
// Notify to scripts
if (item != null)
if (droppedItem != null)
{
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemDrop(actor, item, item.getLocation()), item.getItem());
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerItemDrop(actor, droppedItem, droppedItem.getLocation()), droppedItem.getItem());
}
return item;
return droppedItem;
}
/**
@@ -177,15 +177,16 @@ public class QuestState
/**
* Add parameter used in quests.
* @param var String pointing out the name of the variable for quest
* @param value String pointing out the value of the variable for quest
* @param val String pointing out the value of the variable for quest
*/
public void setInternal(String var, String value)
public void setInternal(String var, String val)
{
if (_vars == null)
{
_vars = new HashMap<>();
}
String value = val;
if (value == null)
{
value = "";
@@ -211,15 +212,16 @@ public class QuestState
* If the key doesn't exist, the couple is added/created in the database</li>
* <ul>
* @param var String indicating the name of the variable for quest
* @param value String indicating the value of the variable for quest
* @param val String indicating the value of the variable for quest
*/
public void set(String var, String value)
public void set(String var, String val)
{
if (_vars == null)
{
_vars = new HashMap<>();
}
String value = val;
if (value == null)
{
value = "";
@@ -78,15 +78,16 @@ public enum BaseStat
public static BaseStat valueOfXml(String name)
{
name = name.intern();
final String internName = name.intern();
for (BaseStat s : values())
{
if (s.getValue().equalsIgnoreCase(name))
if (s.getValue().equalsIgnoreCase(internName))
{
return s;
}
}
throw new NoSuchElementException("Unknown name '" + name + "' for enum BaseStats");
throw new NoSuchElementException("Unknown name '" + internName + "' for enum BaseStats");
}
protected static final class STR implements IBaseStatFunction
@@ -1921,8 +1921,8 @@ public class Formulas
public static boolean calcCancelSuccess(BuffInfo info, int cancelMagicLvl, int rate, Skill skill)
{
// Lvl Bonus Modifier.
rate *= info.getSkill().getMagicLevel() > 0 ? 1 + ((cancelMagicLvl - info.getSkill().getMagicLevel()) / 100.) : 1;
return Rnd.get(100) < Util.constrain(rate, skill.getMinChance(), skill.getMaxChance());
final int chance = (int) (rate * (info.getSkill().getMagicLevel() > 0 ? 1 + ((cancelMagicLvl - info.getSkill().getMagicLevel()) / 100.) : 1));
return Rnd.get(100) < Util.constrain(chance, skill.getMinChance(), skill.getMaxChance());
}
/**
@@ -1996,7 +1996,7 @@ public class Formulas
final double karmaLooseMul = KarmaData.getInstance().getMultiplier(player.getLevel());
if (exp > 0) // Received exp
{
exp /= Config.RATE_KARMA_LOST;
return (int) ((Math.abs(exp / Config.RATE_KARMA_LOST) / karmaLooseMul) / 30);
}
return (int) ((Math.abs(exp) / karmaLooseMul) / 30);
}
@@ -211,15 +211,15 @@ public enum Stat
public static Stat valueOfXml(String name)
{
name = name.intern();
String internName = name.intern();
for (Stat s : values())
{
if (s.getValue().equals(name))
if (s.getValue().equals(internName))
{
return s;
}
}
throw new NoSuchElementException("Unknown name '" + name + "' for enum BaseStats");
throw new NoSuchElementException("Unknown name '" + internName + "' for enum BaseStats");
}
}
@@ -81,7 +81,8 @@ public abstract class AbstractHtmlPacket implements IClientOutgoingPacket
if (!html.contains("<html") && !html.startsWith("..\\L2"))
{
html = "<html><body>" + html + "</body></html>";
_html = "<html><body>" + html + "</body></html>";
return;
}
_html = html;
@@ -17,6 +17,7 @@
package org.l2jmobius.gameserver.network.serverpackets;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import org.l2jmobius.commons.network.PacketWriter;
@@ -40,13 +41,11 @@ public class MagicSkillLaunched implements IClientOutgoingPacket
_objectId = creature.getObjectId();
_skillId = skillId;
_skillLevel = skillLevel;
//@formatter:off
if (targets == null)
{
targets = new WorldObject[] { creature };
_targets = Collections.singletonList(creature);
return;
}
//@formatter:on
_targets = Arrays.asList(targets);
}
@@ -59,6 +58,7 @@ public class MagicSkillLaunched implements IClientOutgoingPacket
public boolean write(PacketWriter packet)
{
OutgoingPackets.MAGIC_SKILL_LAUNCHED.writeId(packet);
packet.writeD(_objectId);
packet.writeD(_skillId);
packet.writeD(_skillLevel);
@@ -148,16 +148,17 @@ public class ScriptEngineManager implements IXmlReader
}
}
public void executeScript(Path sourceFile) throws Exception
public void executeScript(Path sourceFiles) throws Exception
{
if (!sourceFile.isAbsolute())
Path path = sourceFiles;
if (!path.isAbsolute())
{
sourceFile = SCRIPT_FOLDER.resolve(sourceFile);
path = SCRIPT_FOLDER.resolve(path);
}
sourceFile = sourceFile.toAbsolutePath();
path = path.toAbsolutePath();
final Entry<Path, Throwable> error = _javaExecutionContext.executeScript(sourceFile);
final Entry<Path, Throwable> error = _javaExecutionContext.executeScript(path);
if (error != null)
{
throw new Exception("ScriptEngine: " + error.getKey() + " failed execution!", error.getValue());
@@ -103,19 +103,20 @@ final class ScriptingFileManager implements StandardJavaFileManager
return _wrapped.getJavaFileForOutput(location, className, kind, sibling);
}
if (className.contains("/"))
String javaName = className;
if (javaName.contains("/"))
{
className = className.replace('/', '.');
javaName = javaName.replace('/', '.');
}
ScriptingOutputFileObject fileObject;
if (sibling != null)
{
fileObject = new ScriptingOutputFileObject(Paths.get(sibling.getName()), className, className.substring(className.lastIndexOf('.') + 1));
fileObject = new ScriptingOutputFileObject(Paths.get(sibling.getName()), javaName, javaName.substring(javaName.lastIndexOf('.') + 1));
}
else
{
fileObject = new ScriptingOutputFileObject(null, className, className.substring(className.lastIndexOf('.') + 1));
fileObject = new ScriptingOutputFileObject(null, javaName, javaName.substring(javaName.lastIndexOf('.') + 1));
}
_classOutputs.add(fileObject);
@@ -100,7 +100,7 @@ public class SecondaryPasswordAuth
}
}
public boolean savePassword(String password)
public boolean savePassword(String value)
{
if (passwordExist())
{
@@ -109,14 +109,13 @@ public class SecondaryPasswordAuth
return false;
}
if (!validatePassword(password))
if (!validatePassword(value))
{
_activeClient.sendPacket(new Ex2ndPasswordAck(Ex2ndPasswordAck.WRONG_PATTERN));
return false;
}
password = cryptPassword(password);
final String password = cryptPassword(value);
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
@@ -173,12 +172,11 @@ public class SecondaryPasswordAuth
return false;
}
newPassword = cryptPassword(newPassword);
final String password = cryptPassword(newPassword);
try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
statement.setString(1, password);
statement.setString(2, _activeClient.getAccountName());
statement.setString(3, VAR_PWD);
statement.execute();
@@ -189,14 +187,14 @@ public class SecondaryPasswordAuth
return false;
}
_password = newPassword;
_password = password;
_authed = false;
return true;
}
public boolean checkPassword(String password, boolean skipAuth)
public boolean checkPassword(String value, boolean skipAuth)
{
password = cryptPassword(password);
final String password = cryptPassword(value);
if (!password.equals(_password))
{
_wrongAttempts++;
@@ -73,10 +73,11 @@ public class AttackStanceTaskManager
/**
* Removes the attack stance task.
* @param actor the actor
* @param creature the actor
*/
public void removeAttackStanceTask(Creature actor)
public void removeAttackStanceTask(Creature creature)
{
Creature actor = creature;
if (actor != null)
{
if (actor.isSummon())
@@ -89,11 +90,12 @@ public class AttackStanceTaskManager
/**
* Checks for attack stance task.
* @param actor the actor
* @param creature the actor
* @return {@code true} if the character has an attack stance task, {@code false} otherwise
*/
public boolean hasAttackStanceTask(Creature actor)
public boolean hasAttackStanceTask(Creature creature)
{
Creature actor = creature;
if (actor != null)
{
if (actor.isSummon())
@@ -136,13 +136,14 @@ public class SystemPanel extends JPanel
static String getDurationBreakdown(long millis)
{
final long days = TimeUnit.MILLISECONDS.toDays(millis);
millis -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(millis);
millis -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(millis);
millis -= TimeUnit.MINUTES.toMillis(minutes);
final long seconds = TimeUnit.MILLISECONDS.toSeconds(millis);
long remaining = millis;
final long days = TimeUnit.MILLISECONDS.toDays(remaining);
remaining -= TimeUnit.DAYS.toMillis(days);
final long hours = TimeUnit.MILLISECONDS.toHours(remaining);
remaining -= TimeUnit.HOURS.toMillis(hours);
final long minutes = TimeUnit.MILLISECONDS.toMinutes(remaining);
remaining -= TimeUnit.MINUTES.toMillis(minutes);
final long seconds = TimeUnit.MILLISECONDS.toSeconds(remaining);
return (days + "d " + hours + "h " + minutes + "m " + seconds + "s");
}
}
@@ -112,10 +112,11 @@ public class Broadcast
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T SEND Server->Client packet to this Creature (to do this use method toSelfAndKnownPlayers)</b></font>
* @param creature
* @param mov
* @param radius
* @param radiusValue
*/
public static void toKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radius)
public static void toKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radiusValue)
{
int radius = radiusValue;
if (radius < 0)
{
radius = 1500;
@@ -145,8 +146,9 @@ public class Broadcast
}
// To improve performance we are comparing values of radius^2 instead of calculating sqrt all the time
public static void toSelfAndKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radius)
public static void toSelfAndKnownPlayersInRadius(Creature creature, IClientOutgoingPacket mov, int radiusValue)
{
int radius = radiusValue;
if (radius < 0)
{
radius = 600;
@@ -149,7 +149,7 @@ public class HtmlUtil
/**
* Gets the HTML representation of a gauge.
* @param width the width
* @param current the current value
* @param currentValue the current value
* @param max the max value
* @param displayAsPercentage if {@code true} the text in middle will be displayed as percent else it will be displayed as "current / max"
* @param backgroundImage the background image
@@ -158,9 +158,9 @@ public class HtmlUtil
* @param top the top adjustment
* @return the HTML
*/
private static String getGauge(int width, long current, long max, boolean displayAsPercentage, String backgroundImage, String image, long imageHeight, long top)
private static String getGauge(int width, long currentValue, long max, boolean displayAsPercentage, String backgroundImage, String image, long imageHeight, long top)
{
current = Math.min(current, max);
final long current = Math.min(currentValue, max);
final StringBuilder sb = new StringBuilder();
sb.append("<table width=");
sb.append(width);
@@ -231,7 +231,7 @@ public class HtmlUtil
return createPage(Arrays.asList(elements), elements.length, page, elementsPerPage, pagerFunction, bodyFunction);
}
public static <T> PageResult createPage(Iterable<T> elements, int size, int page, int elementsPerPage, Function<Integer, String> pagerFunction, Function<T, String> bodyFunction)
public static <T> PageResult createPage(Iterable<T> elements, int size, int pageValue, int elementsPerPage, Function<Integer, String> pagerFunction, Function<T, String> bodyFunction)
{
int pages = size / elementsPerPage;
if ((elementsPerPage * pages) < size)
@@ -256,6 +256,7 @@ public class HtmlUtil
}
}
int page = pageValue;
if (page >= pages)
{
page = pages - 1;
@@ -51,13 +51,14 @@ public class Locator
/**
* Find the directory or jar a given resource has been loaded from.
* @param c the classloader to be consulted for the source.
* @param classLoader the classloader to be consulted for the source.
* @param resource the resource whose location is required.
* @return the file with the resource source or null if we cannot determine the location.
* @since Ant 1.6
*/
public static File getResourceSource(ClassLoader c, String resource)
public static File getResourceSource(ClassLoader classLoader, String resource)
{
ClassLoader c = classLoader;
if (c == null)
{
c = Locator.class.getClassLoader();
@@ -98,12 +99,13 @@ public class Locator
* <p>
* Swallows '%' that are not followed by two characters, doesn't deal with non-ASCII characters.
* </p>
* @param uri the URI designating a file in the local filesystem.
* @param uriValue the URI designating a file in the local filesystem.
* @return the local file system path for the file.
* @since Ant 1.6
*/
public static String fromURI(String uri)
public static String fromURI(String uriValue)
{
String uri = uriValue;
URL url = null;
try
{
@@ -113,10 +115,12 @@ public class Locator
{
// Ignore malformed exception
}
if ((url == null) || !("file".equals(url.getProtocol())))
{
throw new IllegalArgumentException("Can only handle valid file: URIs");
}
final StringBuilder buf = new StringBuilder(url.getHost());
if (buf.length() > 0)
{
@@ -125,13 +129,12 @@ public class Locator
final String file = url.getFile();
final int queryPos = file.indexOf('?');
buf.append((queryPos < 0) ? file : file.substring(0, queryPos));
uri = buf.toString().replace('/', File.separatorChar);
if ((File.pathSeparatorChar == ';') && uri.startsWith("\\") && (uri.length() > 2) && Character.isLetter(uri.charAt(1)) && (uri.lastIndexOf(':') > -1))
{
uri = uri.substring(1);
}
return decodeUri(uri);
}

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