Prohibit parameter assignments.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -897,7 +897,7 @@ public class Valakas extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
public void callSkillAI(NpcInstance npc, Creature c2, Skill skill)
|
||||
public void callSkillAI(NpcInstance npc, Creature creature, Skill skill)
|
||||
{
|
||||
final QuestTimer timer = getQuestTimer("launch_random_skill", npc, null);
|
||||
if (npc == null)
|
||||
@@ -914,16 +914,18 @@ public class Valakas extends Quest
|
||||
return;
|
||||
}
|
||||
|
||||
if ((c2 == null) || c2.isDead() || (timer == null))
|
||||
Creature currentTarget = creature;
|
||||
if ((currentTarget == null) || currentTarget.isDead() || (timer == null))
|
||||
{
|
||||
c2 = getRandomTarget(npc); // just in case if hate AI fail
|
||||
currentTarget = getRandomTarget(npc); // just in case if hate AI fail
|
||||
if (timer == null)
|
||||
{
|
||||
startQuestTimer("launch_random_skill", 500, npc, null, true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
final Creature target = c2;
|
||||
|
||||
final Creature target = currentTarget;
|
||||
if ((target == null) || target.isDead())
|
||||
{
|
||||
return;
|
||||
|
||||
+2
-1
@@ -179,7 +179,7 @@ public class NewbieHelper extends Quest
|
||||
}
|
||||
|
||||
String htmltext = event;
|
||||
player = qs1.getPlayer();
|
||||
// player = qs1.getPlayer();
|
||||
|
||||
final int ex = qs2.getInt("Ex");
|
||||
final int classId = qs1.getPlayer().getClassId().getId();
|
||||
@@ -241,6 +241,7 @@ public class NewbieHelper extends Quest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
|
||||
+25
-17
@@ -36,7 +36,7 @@ import org.l2jmobius.gameserver.network.serverpackets.CreatureSay;
|
||||
|
||||
public class SummonMinions extends Quest
|
||||
{
|
||||
private static int HasSpawned;
|
||||
private static int hasSpawned;
|
||||
private static Set<Integer> myTrackingSet = new CopyOnWriteArraySet<>(); // Used to track instances of npcs
|
||||
private final Map<Integer, List<PlayerInstance>> _attackersList = new ConcurrentHashMap<>();
|
||||
private static final Map<Integer, Integer[]> MINIONS = new HashMap<>();
|
||||
@@ -148,20 +148,22 @@ public class SummonMinions extends Quest
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final int npcObjId = npc.getObjectId();
|
||||
|
||||
if (MINIONS.containsKey(npcId))
|
||||
{
|
||||
if (!myTrackingSet.contains(npcObjId)) // this allows to handle multiple instances of npc
|
||||
{
|
||||
myTrackingSet.add(npcObjId);
|
||||
HasSpawned = npcObjId;
|
||||
hasSpawned = npcObjId;
|
||||
}
|
||||
if (HasSpawned == npcObjId)
|
||||
|
||||
if (hasSpawned == npcObjId)
|
||||
{
|
||||
if ((npcId == 22030) || (npcId == 22032) || (npcId == 22038)) // mobs that summon minions only on certain hp
|
||||
{
|
||||
if (npc.getStatus().getCurrentHp() < (npc.getMaxHp() / 2))
|
||||
{
|
||||
HasSpawned = 0;
|
||||
hasSpawned = 0;
|
||||
if (Rnd.get(100) < 33) // mobs that summon minions only on certain chance
|
||||
{
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
@@ -177,13 +179,15 @@ public class SummonMinions extends Quest
|
||||
}
|
||||
else if ((npcId == 22257) || (npcId == 22258) || (npcId == 22259) || (npcId == 22260) || (npcId == 22261) || (npcId == 22262) || (npcId == 22263) || (npcId == 22264) || (npcId == 22265) || (npcId == 22266))
|
||||
{
|
||||
PlayerInstance currentAttacker = attacker;
|
||||
if (isPet)
|
||||
{
|
||||
attacker = attacker.getPet().getOwner();
|
||||
currentAttacker = attacker.getPet().getOwner();
|
||||
}
|
||||
if (attacker.getParty() != null)
|
||||
|
||||
if (currentAttacker.getParty() != null)
|
||||
{
|
||||
for (PlayerInstance member : attacker.getParty().getPartyMembers())
|
||||
for (PlayerInstance member : currentAttacker.getParty().getPartyMembers())
|
||||
{
|
||||
if (_attackersList.get(npcObjId) == null)
|
||||
{
|
||||
@@ -200,30 +204,30 @@ public class SummonMinions extends Quest
|
||||
else if (_attackersList.get(npcObjId) == null)
|
||||
{
|
||||
final List<PlayerInstance> player = new ArrayList<>();
|
||||
player.add(attacker);
|
||||
player.add(currentAttacker);
|
||||
_attackersList.put(npcObjId, player);
|
||||
}
|
||||
else if (!_attackersList.get(npcObjId).contains(attacker))
|
||||
else if (!_attackersList.get(npcObjId).contains(currentAttacker))
|
||||
{
|
||||
_attackersList.get(npcObjId).add(attacker);
|
||||
_attackersList.get(npcObjId).add(currentAttacker);
|
||||
}
|
||||
if (((attacker.getParty() != null) && (attacker.getParty().getMemberCount() > 2)) || (_attackersList.get(npcObjId).size() > 2)) // Just to make sure..
|
||||
|
||||
if (((currentAttacker.getParty() != null) && (currentAttacker.getParty().getMemberCount() > 2)) || (_attackersList.get(npcObjId).size() > 2)) // Just to make sure..
|
||||
{
|
||||
HasSpawned = 0;
|
||||
hasSpawned = 0;
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
for (Integer minion : minions)
|
||||
{
|
||||
final Attackable newNpc = (Attackable) addSpawn(minion, npc.getX() + Rnd.get(-150, 150), npc.getY() + Rnd.get(-150, 150), npc.getZ(), 0, false, 0);
|
||||
newNpc.setRunning();
|
||||
newNpc.addDamageHate(attacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, attacker);
|
||||
newNpc.addDamageHate(currentAttacker, 0, 999);
|
||||
newNpc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, currentAttacker);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
// mobs without special conditions
|
||||
else // mobs without special conditions
|
||||
{
|
||||
HasSpawned = 0;
|
||||
hasSpawned = 0;
|
||||
final Integer[] minions = MINIONS.get(npcId);
|
||||
if (npcId != 20767)
|
||||
{
|
||||
@@ -249,10 +253,12 @@ public class SummonMinions extends Quest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (_attackersList.get(npcObjId) != null)
|
||||
{
|
||||
_attackersList.get(npcObjId).clear();
|
||||
}
|
||||
|
||||
return super.onAttack(npc, attacker, damage, isPet);
|
||||
}
|
||||
|
||||
@@ -261,10 +267,12 @@ public class SummonMinions extends Quest
|
||||
{
|
||||
final int npcId = npc.getNpcId();
|
||||
final int npcObjId = npc.getObjectId();
|
||||
|
||||
if (MINIONS.containsKey(npcId))
|
||||
{
|
||||
myTrackingSet.remove(npcObjId);
|
||||
}
|
||||
|
||||
return super.onKill(npc, killer, isPet);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -164,8 +164,8 @@ public class Q242_PossessorOfAPreciousSoul extends Quest
|
||||
// Spawn Fallen Unicorn
|
||||
else if (event.equals("sfu"))
|
||||
{
|
||||
npc = addSpawn(FALLEN_UNICORN, 85884, -76588, -3470, 0, false, 0);
|
||||
npc.getSpawn().startRespawn();
|
||||
final NpcInstance unicorn = addSpawn(FALLEN_UNICORN, 85884, -76588, -3470, 0, false, 0);
|
||||
unicorn.getSpawn().startRespawn();
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+101
-74
@@ -408,119 +408,144 @@ public class Q335_TheSongOfTheHunter extends Quest
|
||||
return event;
|
||||
}
|
||||
|
||||
String htmltext = event;
|
||||
final int state = st.getState();
|
||||
if ("30744_03.htm".equalsIgnoreCase(event) && (state == 1))
|
||||
if ("30744_03.htm".equals(htmltext))
|
||||
{
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS1) == 0)
|
||||
if (state == 1)
|
||||
{
|
||||
st.giveItems(TEST_INSTRUCTIONS1, 1);
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS1) == 0)
|
||||
{
|
||||
st.giveItems(TEST_INSTRUCTIONS1, 1);
|
||||
}
|
||||
st.setState(State.STARTED);
|
||||
st.set("cond", "1");
|
||||
st.playSound("ItemSound.quest_accept");
|
||||
}
|
||||
st.setState(State.STARTED);
|
||||
st.set("cond", "1");
|
||||
st.playSound("ItemSound.quest_accept");
|
||||
}
|
||||
else if ("30744_09.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
else if ("30744_09.htm".equals(htmltext))
|
||||
{
|
||||
if (GetCurrentRequest(st, REQUESTS1) != null)
|
||||
if (state == 2)
|
||||
{
|
||||
return "30744_09a.htm";
|
||||
if (GetCurrentRequest(st, REQUESTS1) != null)
|
||||
{
|
||||
return "30744_09a.htm";
|
||||
}
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS2) == 0)
|
||||
{
|
||||
st.playSound("ItemSound.quest_middle");
|
||||
st.giveItems(TEST_INSTRUCTIONS2, 1);
|
||||
}
|
||||
}
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS2) == 0)
|
||||
}
|
||||
else if ("30744_16.htm".equals(htmltext))
|
||||
{
|
||||
if (state == 2)
|
||||
{
|
||||
if (st.getQuestItemsCount(LAUREL_LEAF_PIN) >= 20)
|
||||
{
|
||||
st.giveItems(57, 20000);
|
||||
htmltext = "30744_17.htm";
|
||||
}
|
||||
st.playSound("ItemSound.quest_finish");
|
||||
st.exitQuest(true);
|
||||
}
|
||||
}
|
||||
else if ("30746_03.htm".equals(htmltext))
|
||||
{
|
||||
if (state == 2)
|
||||
{
|
||||
if ((st.getQuestItemsCount(CIRCLE_HUNTER_LICENSE1) == 0) && (st.getQuestItemsCount(CIRCLE_HUNTER_LICENSE2) == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (st.getQuestItemsCount(CYBELLINS_DAGGER) == 0)
|
||||
{
|
||||
st.giveItems(CYBELLINS_DAGGER, 1);
|
||||
}
|
||||
if (st.getQuestItemsCount(CYBELLINS_REQUEST) == 0)
|
||||
{
|
||||
st.giveItems(CYBELLINS_REQUEST, 1);
|
||||
}
|
||||
for (int i : Q_BLOOD_CRYSTAL)
|
||||
{
|
||||
st.takeItems(i, -1);
|
||||
}
|
||||
st.playSound("ItemSound.quest_middle");
|
||||
st.giveItems(TEST_INSTRUCTIONS2, 1);
|
||||
st.giveItems(Q_BLOOD_CRYSTAL[1], 1);
|
||||
}
|
||||
}
|
||||
else if ("30744_16.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
else if ("30746_06.htm".equals(htmltext))
|
||||
{
|
||||
if (st.getQuestItemsCount(LAUREL_LEAF_PIN) >= 20)
|
||||
if (state == 2)
|
||||
{
|
||||
st.giveItems(57, 20000);
|
||||
event = "30744_17.htm";
|
||||
}
|
||||
st.playSound("ItemSound.quest_finish");
|
||||
st.exitQuest(true);
|
||||
}
|
||||
else if ("30746_03.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
{
|
||||
if ((st.getQuestItemsCount(CIRCLE_HUNTER_LICENSE1) == 0) && (st.getQuestItemsCount(CIRCLE_HUNTER_LICENSE2) == 0))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (st.getQuestItemsCount(CYBELLINS_DAGGER) == 0)
|
||||
{
|
||||
st.giveItems(CYBELLINS_DAGGER, 1);
|
||||
}
|
||||
if (st.getQuestItemsCount(CYBELLINS_REQUEST) == 0)
|
||||
{
|
||||
st.giveItems(CYBELLINS_REQUEST, 1);
|
||||
}
|
||||
for (int i : Q_BLOOD_CRYSTAL)
|
||||
{
|
||||
st.takeItems(i, -1);
|
||||
}
|
||||
st.playSound("ItemSound.quest_middle");
|
||||
st.giveItems(Q_BLOOD_CRYSTAL[1], 1);
|
||||
}
|
||||
else if ("30746_06.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
{
|
||||
if (!Blood_Crystal2Adena(st, Get_Blood_Crystal_Level(st)))
|
||||
{
|
||||
return null;
|
||||
if (!Blood_Crystal2Adena(st, Get_Blood_Crystal_Level(st)))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("30746_10.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
else if ("30746_10.htm".equals(htmltext))
|
||||
{
|
||||
st.takeItems(CYBELLINS_DAGGER, -1);
|
||||
st.takeItems(CYBELLINS_REQUEST, -1);
|
||||
for (int i : Q_BLOOD_CRYSTAL)
|
||||
if (state == 2)
|
||||
{
|
||||
st.takeItems(i, -1);
|
||||
st.takeItems(CYBELLINS_DAGGER, -1);
|
||||
st.takeItems(CYBELLINS_REQUEST, -1);
|
||||
for (int i : Q_BLOOD_CRYSTAL)
|
||||
{
|
||||
st.takeItems(i, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("30745_02.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
else if ("30745_02.htm".equals(htmltext))
|
||||
{
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS2) > 0)
|
||||
if (state == 2)
|
||||
{
|
||||
return "30745_03.htm";
|
||||
if (st.getQuestItemsCount(TEST_INSTRUCTIONS2) > 0)
|
||||
{
|
||||
return "30745_03.htm";
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ("30745_05b.htm".equalsIgnoreCase(event) && (state == 2))
|
||||
else if ("30745_05b.htm".equals(htmltext))
|
||||
{
|
||||
if (st.getQuestItemsCount(LAUREL_LEAF_PIN) > 0)
|
||||
if (state == 2)
|
||||
{
|
||||
st.takeItems(LAUREL_LEAF_PIN, 1);
|
||||
}
|
||||
for (Request r : REQUESTS1)
|
||||
{
|
||||
st.takeItems(r.request_id, -1);
|
||||
st.takeItems(r.request_item, -1);
|
||||
}
|
||||
for (Request r : REQUESTS2)
|
||||
{
|
||||
st.takeItems(r.request_id, -1);
|
||||
st.takeItems(r.request_item, -1);
|
||||
if (st.getQuestItemsCount(LAUREL_LEAF_PIN) > 0)
|
||||
{
|
||||
st.takeItems(LAUREL_LEAF_PIN, 1);
|
||||
}
|
||||
for (Request r : REQUESTS1)
|
||||
{
|
||||
st.takeItems(r.request_id, -1);
|
||||
st.takeItems(r.request_item, -1);
|
||||
}
|
||||
for (Request r : REQUESTS2)
|
||||
{
|
||||
st.takeItems(r.request_id, -1);
|
||||
st.takeItems(r.request_item, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (state == 2)
|
||||
{
|
||||
if ("30745-list1".equalsIgnoreCase(event) && (state == 2))
|
||||
if ("30745-list1".equals(htmltext))
|
||||
{
|
||||
GenList(st);
|
||||
return FormatList(st, REQUESTS1);
|
||||
}
|
||||
if ("30745-list2".equalsIgnoreCase(event) && (state == 2))
|
||||
if ("30745-list2".equals(htmltext))
|
||||
{
|
||||
GenList(st);
|
||||
return FormatList(st, REQUESTS2);
|
||||
}
|
||||
if (event.startsWith("30745-request-") && (state == 2))
|
||||
if (htmltext.startsWith("30745-request-"))
|
||||
{
|
||||
event = event.replaceFirst("30745-request-", "");
|
||||
htmltext = htmltext.replaceFirst("30745-request-", "");
|
||||
int requestId;
|
||||
try
|
||||
{
|
||||
requestId = Integer.parseInt(event);
|
||||
requestId = Integer.parseInt(htmltext);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -534,7 +559,8 @@ public class Q335_TheSongOfTheHunter extends Quest
|
||||
return "30745-" + requestId + ".htm";
|
||||
}
|
||||
}
|
||||
return event;
|
||||
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -975,11 +1001,12 @@ public class Q335_TheSongOfTheHunter extends Quest
|
||||
return result;
|
||||
}
|
||||
|
||||
private static int[] unpackInt(int a, int bits)
|
||||
private static int[] unpackInt(int value, int bits)
|
||||
{
|
||||
final int m = 32 / bits;
|
||||
final int mval = (int) Math.pow(2.0, bits);
|
||||
final int[] result = new int[m];
|
||||
int a = value;
|
||||
for (int i = m; i > 0; --i)
|
||||
{
|
||||
final int next = a;
|
||||
|
||||
+3
-2
@@ -437,10 +437,11 @@ public class Q384_WarehouseKeepersPastime extends Quest
|
||||
{
|
||||
final String[] playerArray = st.getString("playerArray").split("");
|
||||
final String[] board = st.getString("board").split("");
|
||||
String result = htmltext;
|
||||
for (int i = 1; i < 10; i++)
|
||||
{
|
||||
htmltext = htmltext.replace("<?Cell" + i + "?>", (Util.contains(playerArray, board[i])) ? board[i] : "?");
|
||||
result = result.replace("<?Cell" + i + "?>", (Util.contains(playerArray, board[i])) ? board[i] : "?");
|
||||
}
|
||||
return htmltext;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1178,6 +1178,7 @@ public class BlowfishEngine
|
||||
* @param xr
|
||||
* @param table
|
||||
*/
|
||||
@SuppressWarnings("all")
|
||||
private void processTable(int xl, int xr, int[] table)
|
||||
{
|
||||
final int size = table.length;
|
||||
|
||||
@@ -62,28 +62,30 @@ public class LoginCrypt
|
||||
|
||||
public int encrypt(byte[] raw, int offset, int size) throws IOException
|
||||
{
|
||||
int newSize = size;
|
||||
// reserve checksum
|
||||
size += 4;
|
||||
newSize += 4;
|
||||
|
||||
if (_static)
|
||||
{
|
||||
// reserve for XOR "key"
|
||||
size += 4;
|
||||
newSize += 4;
|
||||
|
||||
// padding
|
||||
size += 8 - (size % 8);
|
||||
NewCrypt.encXORPass(raw, offset, size, Rnd.nextInt());
|
||||
_staticCrypt.crypt(raw, offset, size);
|
||||
newSize += 8 - (newSize % 8);
|
||||
NewCrypt.encXORPass(raw, offset, newSize, Rnd.nextInt());
|
||||
_staticCrypt.crypt(raw, offset, newSize);
|
||||
|
||||
_static = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
// padding
|
||||
size += 8 - (size % 8);
|
||||
NewCrypt.appendChecksum(raw, offset, size);
|
||||
_crypt.crypt(raw, offset, size);
|
||||
newSize += 8 - (newSize % 8);
|
||||
NewCrypt.appendChecksum(raw, offset, newSize);
|
||||
_crypt.crypt(raw, offset, newSize);
|
||||
}
|
||||
return size;
|
||||
|
||||
return newSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ public class SelectorThread<T extends MMOClient<?>>extends Thread
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("all")
|
||||
private final void acceptConnection(SelectionKey key, MMOConnection<T> con)
|
||||
{
|
||||
final ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
|
||||
|
||||
@@ -106,9 +106,9 @@ public class Util
|
||||
return number;
|
||||
}
|
||||
|
||||
public static void printSection(String s)
|
||||
public static void printSection(String section)
|
||||
{
|
||||
s = "=[ " + s + " ]";
|
||||
String s = "=[ " + section + " ]";
|
||||
while (s.length() < 61)
|
||||
{
|
||||
s = "-" + s;
|
||||
|
||||
@@ -110,11 +110,8 @@ public class Shutdown extends Thread
|
||||
*/
|
||||
private Shutdown(int seconds, boolean restart)
|
||||
{
|
||||
if (seconds < 0)
|
||||
{
|
||||
seconds = 0;
|
||||
}
|
||||
_secondsShut = seconds;
|
||||
_secondsShut = Math.max(0, seconds);
|
||||
|
||||
if (restart)
|
||||
{
|
||||
_shutdownMode = GM_RESTART;
|
||||
|
||||
@@ -424,13 +424,14 @@ 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;
|
||||
|
||||
@@ -305,13 +305,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
|
||||
public void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
public 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
|
||||
@@ -336,7 +337,6 @@ public class AttackableAI extends CreatureAI
|
||||
|
||||
// Cancel the AI
|
||||
_accessor.detachAI();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -926,10 +926,10 @@ public class CreatureAI extends AbstractAI
|
||||
* <b><u>Example of use</u>:</b><br>
|
||||
* <li>PLayerAI, SummonAI</li><br>
|
||||
* @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)
|
||||
@@ -939,12 +939,12 @@ public class CreatureAI extends AbstractAI
|
||||
}
|
||||
|
||||
// skill radius -1
|
||||
if (offset < 0)
|
||||
if (offsetValue < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int offsetWithCollision = offset + _actor.getTemplate().getCollisionRadius();
|
||||
int offsetWithCollision = offsetValue + _actor.getTemplate().getCollisionRadius();
|
||||
if (target instanceof Creature)
|
||||
{
|
||||
offsetWithCollision += ((Creature) target).getTemplate().getCollisionRadius();
|
||||
@@ -998,7 +998,7 @@ public class CreatureAI extends AbstractAI
|
||||
}
|
||||
|
||||
stopFollow();
|
||||
|
||||
int offset = offsetValue;
|
||||
if ((target instanceof Creature) && !(target instanceof DoorInstance))
|
||||
{
|
||||
if (((Creature) target).isMoving())
|
||||
|
||||
@@ -168,38 +168,41 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
}
|
||||
|
||||
// Get the owner if the target is a summon
|
||||
if (target instanceof Summon)
|
||||
Creature currentTarget = target;
|
||||
if (currentTarget instanceof Summon)
|
||||
{
|
||||
final PlayerInstance owner = ((Summon) target).getOwner();
|
||||
final PlayerInstance owner = ((Summon) currentTarget).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
{
|
||||
target = owner;
|
||||
currentTarget = owner;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the target is a PlayerInstance
|
||||
if (target instanceof PlayerInstance)
|
||||
if (currentTarget instanceof PlayerInstance)
|
||||
{
|
||||
// Check if the target isn't in silent move mode AND too far (>100)
|
||||
if (((PlayerInstance) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
|
||||
if (((PlayerInstance) currentTarget).isSilentMoving() && !_actor.isInsideRadius(currentTarget, 250, false, false))
|
||||
{
|
||||
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
|
||||
public synchronized void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
public 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
|
||||
@@ -232,7 +235,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
|
||||
// Cancel the AI
|
||||
_accessor.detachAI();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -907,6 +909,7 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final Attackable me = (Attackable) _actor;
|
||||
if (target != null)
|
||||
{
|
||||
@@ -914,8 +917,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)
|
||||
{
|
||||
@@ -967,8 +969,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();
|
||||
|
||||
@@ -123,35 +123,37 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
|
||||
}
|
||||
|
||||
// Get the owner if the target is a summon
|
||||
if (target instanceof Summon)
|
||||
Creature currentTarget = target;
|
||||
if (currentTarget instanceof Summon)
|
||||
{
|
||||
final PlayerInstance owner = ((Summon) target).getOwner();
|
||||
final PlayerInstance owner = ((Summon) currentTarget).getOwner();
|
||||
if (_actor.isInsideRadius(owner, 1000, true, false))
|
||||
{
|
||||
target = owner;
|
||||
currentTarget = owner;
|
||||
}
|
||||
}
|
||||
|
||||
// Check if the target is a PlayerInstance and if the target isn't in silent move mode AND too far (>100)
|
||||
if ((target instanceof PlayerInstance) && ((PlayerInstance) target).isSilentMoving() && !_actor.isInsideRadius(target, 250, false, false))
|
||||
if ((currentTarget instanceof PlayerInstance) && ((PlayerInstance) currentTarget).isSilentMoving() && !_actor.isInsideRadius(currentTarget, 250, false, false))
|
||||
{
|
||||
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
|
||||
public void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
|
||||
public void changeIntention(CtrlIntention newIntention, Object arg0, Object arg1)
|
||||
{
|
||||
CtrlIntention intention = newIntention;
|
||||
((Attackable) _actor).setReturningToSpawnPoint(false);
|
||||
if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
|
||||
{
|
||||
@@ -722,8 +724,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)
|
||||
{
|
||||
@@ -774,8 +775,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();
|
||||
|
||||
+2
-2
@@ -229,7 +229,7 @@ public class ClanBBSManager extends BaseBBSManager
|
||||
send1002(activeChar, clan.getNotice(), "", "");
|
||||
}
|
||||
|
||||
private void sendClanList(PlayerInstance activeChar, int index)
|
||||
private void sendClanList(PlayerInstance activeChar, int indexValue)
|
||||
{
|
||||
String content = HtmCache.getInstance().getHtm(CB_PATH + "clan/clanlist.htm");
|
||||
|
||||
@@ -242,6 +242,7 @@ public class ClanBBSManager extends BaseBBSManager
|
||||
}
|
||||
|
||||
content = content.replace("%homebar%", sb.toString());
|
||||
int index = indexValue;
|
||||
if (index < 1)
|
||||
{
|
||||
index = 1;
|
||||
@@ -303,7 +304,6 @@ public class ClanBBSManager extends BaseBBSManager
|
||||
}
|
||||
|
||||
sb.append("</tr></table>");
|
||||
|
||||
content = content.replace("%clanlist%", sb.toString());
|
||||
separateAndSend(content, activeChar);
|
||||
}
|
||||
|
||||
+5
-3
@@ -315,7 +315,7 @@ public class MailBBSManager extends BaseBBSManager
|
||||
showMailList(activeChar, page, type, "", "");
|
||||
}
|
||||
|
||||
private void showMailList(PlayerInstance activeChar, int page, MailType type, String sType, String search)
|
||||
private void showMailList(PlayerInstance activeChar, int pageValue, MailType type, String sType, String search)
|
||||
{
|
||||
List<Mail> letters;
|
||||
if (!sType.equals("") && !search.equals(""))
|
||||
@@ -346,6 +346,7 @@ public class MailBBSManager extends BaseBBSManager
|
||||
|
||||
final int countMails = getCountLetters(activeChar.getObjectId(), type, sType, search);
|
||||
final int maxpage = getMaxPageId(countMails);
|
||||
int page = pageValue;
|
||||
if (page > maxpage)
|
||||
{
|
||||
page = maxpage;
|
||||
@@ -522,7 +523,7 @@ public class MailBBSManager extends BaseBBSManager
|
||||
send1002(activeChar, " ", "Re: " + letter.subject, "0");
|
||||
}
|
||||
|
||||
public void sendLetter(String recipients, String subject, String message, PlayerInstance activeChar)
|
||||
public void sendLetter(String recipients, String subjectValue, String messageValue, PlayerInstance activeChar)
|
||||
{
|
||||
// Current time.
|
||||
final long currentDate = Calendar.getInstance().getTimeInMillis();
|
||||
@@ -546,13 +547,14 @@ public class MailBBSManager extends BaseBBSManager
|
||||
}
|
||||
|
||||
// Edit subject, if none.
|
||||
String subject = subjectValue;
|
||||
if ((subject == null) || subject.isEmpty())
|
||||
{
|
||||
subject = "(no subject)";
|
||||
}
|
||||
|
||||
// Edit message.
|
||||
message = message.replace("\n", "<br1>");
|
||||
String message = messageValue.replace("\n", "<br1>");
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
|
||||
@@ -73,16 +73,17 @@ public class SkillTable
|
||||
public int getMaxLevel(int magicId, int level)
|
||||
{
|
||||
Skill temp;
|
||||
while (level < 100)
|
||||
int result = level;
|
||||
while (result < 100)
|
||||
{
|
||||
level++;
|
||||
temp = _skills.get(getSkillHashCode(magicId, level));
|
||||
result++;
|
||||
temp = _skills.get(getSkillHashCode(magicId, result));
|
||||
if (temp == null)
|
||||
{
|
||||
return level - 1;
|
||||
return result - 1;
|
||||
}
|
||||
}
|
||||
return level;
|
||||
return result;
|
||||
}
|
||||
|
||||
private static final WeaponType[] weaponDbMasks =
|
||||
|
||||
@@ -139,9 +139,10 @@ public abstract class DocumentBase
|
||||
_tables.put(name, table);
|
||||
}
|
||||
|
||||
protected void parseTemplate(Node n, Object template)
|
||||
protected void parseTemplate(Node node, Object template)
|
||||
{
|
||||
Condition condition = null;
|
||||
Node n = node;
|
||||
n = n.getFirstChild();
|
||||
if (n == null)
|
||||
{
|
||||
@@ -416,8 +417,9 @@ public abstract class DocumentBase
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -470,9 +472,10 @@ public abstract class DocumentBase
|
||||
return null;
|
||||
}
|
||||
|
||||
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)
|
||||
@@ -489,9 +492,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)
|
||||
@@ -508,8 +512,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)
|
||||
@@ -878,8 +883,9 @@ public abstract class DocumentBase
|
||||
}
|
||||
}
|
||||
|
||||
protected Lambda getLambda(Node n, Object template)
|
||||
protected Lambda getLambda(Node node, Object template)
|
||||
{
|
||||
Node n = node;
|
||||
final Node nval = n.getAttributes().getNamedItem("val");
|
||||
if (nval != null)
|
||||
{
|
||||
@@ -917,6 +923,7 @@ public abstract class DocumentBase
|
||||
{
|
||||
return new LambdaConst(Double.parseDouble(getValue(field, template)));
|
||||
}
|
||||
|
||||
// failed
|
||||
throw new IllegalArgumentException("Unknown value " + val);
|
||||
}
|
||||
|
||||
@@ -149,8 +149,9 @@ final class DocumentItem extends DocumentBase
|
||||
}
|
||||
}
|
||||
|
||||
protected void parseItem(Node n)
|
||||
protected void parseItem(Node node)
|
||||
{
|
||||
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();
|
||||
|
||||
@@ -113,8 +113,9 @@ final 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);
|
||||
|
||||
+3
-2
@@ -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
|
||||
|
||||
+2
-9
@@ -209,22 +209,15 @@ public class AutoAnnouncementHandler
|
||||
private final AutoAnnouncementInstance registerAnnouncement(int id, String announcementTexts, long chatDelay)
|
||||
{
|
||||
AutoAnnouncementInstance announcementInst = null;
|
||||
if (chatDelay < 0)
|
||||
{
|
||||
chatDelay = DEFAULT_ANNOUNCEMENT_DELAY;
|
||||
}
|
||||
|
||||
if (_registeredAnnouncements.containsKey(id))
|
||||
{
|
||||
announcementInst = _registeredAnnouncements.get(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
announcementInst = new AutoAnnouncementInstance(id, announcementTexts, chatDelay);
|
||||
announcementInst = new AutoAnnouncementInstance(id, announcementTexts, chatDelay < 0 ? DEFAULT_ANNOUNCEMENT_DELAY : chatDelay);
|
||||
}
|
||||
|
||||
_registeredAnnouncements.put(id, announcementInst);
|
||||
|
||||
return announcementInst;
|
||||
}
|
||||
|
||||
@@ -256,6 +249,7 @@ public class AutoAnnouncementHandler
|
||||
{
|
||||
LOGGER.warning("Could not Delete Auto Announcement in Database, Reason: " + e);
|
||||
}
|
||||
|
||||
return removeAnnouncement(announcementInst);
|
||||
}
|
||||
|
||||
@@ -273,7 +267,6 @@ public class AutoAnnouncementHandler
|
||||
|
||||
_registeredAnnouncements.remove(announcementInst.getDefaultId());
|
||||
announcementInst.setActive(false);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,18 +126,13 @@ public class AutoChatHandler implements SpawnListener
|
||||
private final AutoChatInstance registerChat(int npcId, NpcInstance npcInst, String[] chatTexts, long chatDelay)
|
||||
{
|
||||
AutoChatInstance chatInst = null;
|
||||
if (chatDelay < 0)
|
||||
{
|
||||
chatDelay = DEFAULT_CHAT_DELAY;
|
||||
}
|
||||
|
||||
if (_registeredChats.containsKey(npcId))
|
||||
{
|
||||
chatInst = _registeredChats.get(npcId);
|
||||
}
|
||||
else
|
||||
{
|
||||
chatInst = new AutoChatInstance(npcId, chatTexts, chatDelay, (npcInst == null));
|
||||
chatInst = new AutoChatInstance(npcId, chatTexts, chatDelay < 0 ? DEFAULT_CHAT_DELAY : chatDelay, (npcInst == null));
|
||||
}
|
||||
|
||||
if (npcInst != null)
|
||||
@@ -146,7 +141,6 @@ public class AutoChatHandler implements SpawnListener
|
||||
}
|
||||
|
||||
_registeredChats.put(npcId, chatInst);
|
||||
|
||||
return chatInst;
|
||||
}
|
||||
|
||||
|
||||
+1
-6
@@ -141,12 +141,7 @@ public class AdminAnnouncements implements IAdminCommandHandler
|
||||
}
|
||||
case "admin_announce":
|
||||
{
|
||||
// Call method from another class
|
||||
if (Config.GM_ANNOUNCER_NAME)
|
||||
{
|
||||
command = command + " [ " + activeChar.getName() + " ]";
|
||||
}
|
||||
Announcements.getInstance().handleAnnounce(command, 15);
|
||||
Announcements.getInstance().handleAnnounce(Config.GM_ANNOUNCER_NAME ? command + " [ " + activeChar.getName() + " ]" : command, 15);
|
||||
return true;
|
||||
}
|
||||
case "admin_critannounce":
|
||||
|
||||
+4
-2
@@ -903,7 +903,7 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
return false;
|
||||
}
|
||||
|
||||
private void listCharacters(PlayerInstance activeChar, int page)
|
||||
private void listCharacters(PlayerInstance activeChar, int pageValue)
|
||||
{
|
||||
final List<PlayerInstance> onlinePlayersList = new ArrayList<>();
|
||||
for (PlayerInstance actualPlayer : World.getInstance().getAllPlayers())
|
||||
@@ -927,6 +927,7 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
}
|
||||
|
||||
// Check if number of users changed
|
||||
int page = pageValue;
|
||||
if (page > maxPages)
|
||||
{
|
||||
page = maxPages;
|
||||
@@ -1343,8 +1344,9 @@ public class AdminEditChar implements IAdminCommandHandler
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
+4
-2
@@ -1210,8 +1210,9 @@ public class AdminEditNpc implements IAdminCommandHandler
|
||||
activeChar.sendPacket(adminReply);
|
||||
}
|
||||
|
||||
private void updateDropData(PlayerInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
|
||||
private void updateDropData(PlayerInstance activeChar, int npcIdValue, int itemId, int min, int max, int category, int chance)
|
||||
{
|
||||
int npcId = npcIdValue;
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
final PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");
|
||||
@@ -1363,7 +1364,7 @@ public class AdminEditNpc implements IAdminCommandHandler
|
||||
}
|
||||
}
|
||||
|
||||
private void showNpcSkillList(PlayerInstance activeChar, int npcId, int page)
|
||||
private void showNpcSkillList(PlayerInstance activeChar, int npcId, int pageValue)
|
||||
{
|
||||
final NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
|
||||
if (npcData == null)
|
||||
@@ -1381,6 +1382,7 @@ public class AdminEditNpc implements IAdminCommandHandler
|
||||
maxPages++;
|
||||
}
|
||||
|
||||
int page = pageValue;
|
||||
if (page > maxPages)
|
||||
{
|
||||
page = maxPages;
|
||||
|
||||
+6
-6
@@ -184,10 +184,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.length() == 0)
|
||||
if (trimmedParams.length() == 0)
|
||||
{
|
||||
npc1 = activeChar;
|
||||
npc2 = (Creature) activeChar.getTarget();
|
||||
@@ -202,7 +202,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(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(mid1));
|
||||
@@ -345,7 +345,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
|
||||
replyMSG.append("<body>");
|
||||
replyMSG.append("<table>");
|
||||
|
||||
if (params.length() == 0)
|
||||
if (trimmedParams.length() == 0)
|
||||
{
|
||||
replyMSG.append("<tr><td width=140>Parameter</td><td width=70>me</td><td width=70>target</td></tr>");
|
||||
}
|
||||
@@ -388,7 +388,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
|
||||
replyMSG.append("</table>");
|
||||
replyMSG.append("<center><br>");
|
||||
|
||||
if (params.length() == 0)
|
||||
if (trimmedParams.length() == 0)
|
||||
{
|
||||
replyMSG.append("<button value=\"Retry\" action=\"bypass -h admin_fight_calculator_show\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
|
||||
}
|
||||
@@ -402,7 +402,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();
|
||||
|
||||
+2
-1
@@ -52,8 +52,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
|
||||
|
||||
|
||||
+2
-1
@@ -46,8 +46,9 @@ public class AdminManor 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();
|
||||
|
||||
|
||||
+2
-1
@@ -64,8 +64,9 @@ public class AdminSiege implements IAdminCommandHandler
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@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
|
||||
|
||||
|
||||
+2
-1
@@ -232,7 +232,7 @@ public class AdminSkill implements IAdminCommandHandler
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
|
||||
private void removeSkillsPage(PlayerInstance activeChar, int page)
|
||||
private void removeSkillsPage(PlayerInstance activeChar, int pageValue)
|
||||
{
|
||||
// TODO: Externalize HTML
|
||||
final WorldObject target = activeChar.getTarget();
|
||||
@@ -255,6 +255,7 @@ public class AdminSkill implements IAdminCommandHandler
|
||||
maxPages++;
|
||||
}
|
||||
|
||||
int page = pageValue;
|
||||
if (page > maxPages)
|
||||
{
|
||||
page = maxPages;
|
||||
|
||||
+2
-1
@@ -260,7 +260,7 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
return ADMIN_COMMANDS;
|
||||
}
|
||||
|
||||
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 permanent)
|
||||
{
|
||||
WorldObject target = activeChar.getTarget();
|
||||
if (target == null)
|
||||
@@ -273,6 +273,7 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
}
|
||||
|
||||
NpcTemplate template1;
|
||||
String monsterId = monsterIdValue;
|
||||
if (monsterId.matches("[0-9]*"))
|
||||
{
|
||||
// First parameter was an ID number
|
||||
|
||||
+7
-6
@@ -65,7 +65,7 @@ public class Continuous implements ISkillHandler
|
||||
};
|
||||
|
||||
@Override
|
||||
public void useSkill(Creature creature, Skill skill2, WorldObject[] targets)
|
||||
public void useSkill(Creature creature, Skill skillValue, WorldObject[] targets)
|
||||
{
|
||||
if (creature == null)
|
||||
{
|
||||
@@ -78,10 +78,11 @@ public class Continuous implements ISkillHandler
|
||||
player = (PlayerInstance) creature;
|
||||
}
|
||||
|
||||
if (skill2.getEffectId() != 0)
|
||||
Skill usedSkill = skillValue;
|
||||
if (usedSkill.getEffectId() != 0)
|
||||
{
|
||||
final int skillLevel = skill2.getEffectLvl();
|
||||
final int skillEffectId = skill2.getEffectId();
|
||||
final int skillLevel = usedSkill.getEffectLvl();
|
||||
final int skillEffectId = usedSkill.getEffectId();
|
||||
Skill skill;
|
||||
if (skillLevel == 0)
|
||||
{
|
||||
@@ -94,11 +95,11 @@ public class Continuous implements ISkillHandler
|
||||
|
||||
if (skill != null)
|
||||
{
|
||||
skill2 = skill;
|
||||
usedSkill = skill;
|
||||
}
|
||||
}
|
||||
|
||||
final Skill skill = skill2;
|
||||
final Skill skill = usedSkill;
|
||||
final boolean bss = creature.checkBss();
|
||||
final boolean sps = creature.checkSps();
|
||||
final boolean ss = creature.checkSs();
|
||||
|
||||
+6
-5
@@ -1525,9 +1525,10 @@ public class FourSepulchersManager extends GrandBossManager
|
||||
}
|
||||
}
|
||||
|
||||
protected byte minuteSelect(byte min)
|
||||
protected byte minuteSelect(byte value)
|
||||
{
|
||||
if ((min % 5) != 0)// if doesn't divides on 5 fully
|
||||
byte min = value;
|
||||
if ((min % 5) != 0) // if doesn't divides on 5 fully
|
||||
{
|
||||
// mad table for selecting proper minutes...
|
||||
// may be there is a better way to do this
|
||||
@@ -1624,17 +1625,17 @@ public class FourSepulchersManager extends GrandBossManager
|
||||
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);
|
||||
String msg = min + " minute(s) have passed.";
|
||||
if (min == 90)
|
||||
{
|
||||
|
||||
+2
-3
@@ -88,13 +88,12 @@ public class PetitionManager
|
||||
|
||||
public Petition(PlayerInstance petitioner, String petitionText, int petitionType)
|
||||
{
|
||||
petitionType--;
|
||||
_id = IdFactory.getNextId();
|
||||
if (petitionType >= PetitionType.values().length)
|
||||
if ((petitionType - 1) >= PetitionType.values().length)
|
||||
{
|
||||
LOGGER.warning("PetitionManager:Petition : invalid petition type (received type was +1) : " + petitionType);
|
||||
}
|
||||
_type = PetitionType.values()[petitionType];
|
||||
_type = PetitionType.values()[petitionType - 1];
|
||||
_content = petitionText;
|
||||
_petitioner = petitioner;
|
||||
}
|
||||
|
||||
+6
-5
@@ -226,6 +226,7 @@ public class RaidBossSpawnManager
|
||||
return;
|
||||
}
|
||||
|
||||
double hp = currentHP;
|
||||
final int bossId = spawnDat.getNpcId();
|
||||
final long time = Calendar.getInstance().getTimeInMillis();
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
@@ -237,19 +238,19 @@ public class RaidBossSpawnManager
|
||||
final double bonus = raidboss.getStat().calcStat(Stat.MAX_HP, 1, raidboss, null);
|
||||
|
||||
// if new spawn, the currentHp is equal to maxHP/bonus, so set it to max
|
||||
if ((int) (bonus * currentHP) == raidboss.getMaxHp())
|
||||
if ((int) (bonus * hp) == raidboss.getMaxHp())
|
||||
{
|
||||
currentHP = (raidboss.getMaxHp());
|
||||
hp = (raidboss.getMaxHp());
|
||||
}
|
||||
|
||||
raidboss.setCurrentHp(currentHP);
|
||||
raidboss.setCurrentHp(hp);
|
||||
raidboss.setCurrentMp(currentMP);
|
||||
raidboss.setRaidStatus(RaidBossStatus.ALIVE);
|
||||
|
||||
_bosses.put(bossId, raidboss);
|
||||
|
||||
final StatSet info = new StatSet();
|
||||
info.set("currentHP", currentHP);
|
||||
info.set("currentHP", hp);
|
||||
info.set("currentMP", currentMP);
|
||||
info.set("respawnTime", 0);
|
||||
_storedInfo.put(bossId, info);
|
||||
@@ -277,7 +278,7 @@ public class RaidBossSpawnManager
|
||||
statement.setInt(5, spawnDat.getZ());
|
||||
statement.setInt(6, spawnDat.getHeading());
|
||||
statement.setLong(7, respawnTime);
|
||||
statement.setDouble(8, currentHP);
|
||||
statement.setDouble(8, hp);
|
||||
statement.setDouble(9, currentMP);
|
||||
statement.execute();
|
||||
}
|
||||
|
||||
@@ -145,28 +145,29 @@ public class ChanceSkillList extends ConcurrentHashMap<Skill, ChanceCondition>
|
||||
{
|
||||
if (skill.calcWeaponDependancy(_owner))
|
||||
{
|
||||
if (skill.triggerAnotherSkill()) // should we use this skill or this skill is just referring to another one ...
|
||||
Skill castedSkill = skill;
|
||||
if (castedSkill.triggerAnotherSkill()) // should we use this skill or this skill is just referring to another one ...
|
||||
{
|
||||
skill = _owner.getSkills().get(skill.getTriggeredId());
|
||||
if (skill == null)
|
||||
castedSkill = _owner.getSkills().get(castedSkill.getTriggeredId());
|
||||
if (castedSkill == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(skill.getSkillType());
|
||||
final WorldObject[] targets = skill.getTargetList(_owner, false, target);
|
||||
_owner.broadcastPacket(new MagicSkillLaunched(_owner, skill.getDisplayId(), skill.getLevel(), targets));
|
||||
_owner.broadcastPacket(new MagicSkillUse(_owner, (Creature) targets[0], skill.getDisplayId(), skill.getLevel(), 0, 0));
|
||||
final ISkillHandler handler = SkillHandler.getInstance().getSkillHandler(castedSkill.getSkillType());
|
||||
final WorldObject[] targets = castedSkill.getTargetList(_owner, false, target);
|
||||
_owner.broadcastPacket(new MagicSkillLaunched(_owner, castedSkill.getDisplayId(), castedSkill.getLevel(), targets));
|
||||
_owner.broadcastPacket(new MagicSkillUse(_owner, (Creature) targets[0], castedSkill.getDisplayId(), castedSkill.getLevel(), 0, 0));
|
||||
|
||||
// Launch the magic skill and calculate its effects
|
||||
if (handler != null)
|
||||
{
|
||||
handler.useSkill(_owner, skill, targets);
|
||||
handler.useSkill(_owner, castedSkill, targets);
|
||||
}
|
||||
else
|
||||
{
|
||||
skill.useSkill(_owner, targets);
|
||||
castedSkill.useSkill(_owner, targets);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,27 +98,27 @@ public class ObjectPosition
|
||||
*/
|
||||
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 (correctX < World.MAP_MIN_X)
|
||||
{
|
||||
correctX = World.MAP_MIN_X + 5000;
|
||||
}
|
||||
|
||||
if (x < World.MAP_MIN_X)
|
||||
int correctY = y;
|
||||
if (correctY > World.MAP_MAX_Y)
|
||||
{
|
||||
x = World.MAP_MIN_X + 5000;
|
||||
correctY = World.MAP_MAX_Y - 5000;
|
||||
}
|
||||
if (correctY < World.MAP_MIN_Y)
|
||||
{
|
||||
correctY = World.MAP_MIN_Y + 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;
|
||||
}
|
||||
|
||||
setWorldPosition(x, y, z);
|
||||
setWorldPosition(correctX, correctY, z);
|
||||
_activeObject.setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -184,20 +184,21 @@ public class Party
|
||||
*/
|
||||
private PlayerInstance getCheckedNextLooter(int itemId, Creature target)
|
||||
{
|
||||
for (int i = 0; i < _members.size(); i++)
|
||||
for (@SuppressWarnings("unused")
|
||||
PlayerInstance member : _members)
|
||||
{
|
||||
if (++_itemLastLoot >= _members.size())
|
||||
{
|
||||
_itemLastLoot = 0;
|
||||
}
|
||||
|
||||
PlayerInstance member;
|
||||
PlayerInstance player;
|
||||
try
|
||||
{
|
||||
member = _members.get(_itemLastLoot);
|
||||
if (member.getInventory().validateCapacityByItemId(itemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE, target, member, true))
|
||||
player = _members.get(_itemLastLoot);
|
||||
if (player.getInventory().validateCapacityByItemId(itemId) && Util.checkIfInRange(Config.ALT_PARTY_RANGE, target, player, true))
|
||||
{
|
||||
return member;
|
||||
return player;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -691,20 +692,20 @@ public class Party
|
||||
* <li>Add Experience and SP to the PlayerInstance</li><br>
|
||||
* <font color=#FF0000><b><u>Caution</u>: This method DOESN'T GIVE rewards to PetInstance</b></font><br>
|
||||
* Exception are PetInstances that leech from the owner's XP; they get the exp indirectly, via the owner's exp gain
|
||||
* @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
|
||||
*/
|
||||
public void distributeXpAndSp(long xpReward, int spReward, List<Playable> rewardedMembers, int topLvl)
|
||||
public void distributeXpAndSp(long xpRewardValue, int spRewardValue, List<Playable> rewardedMembers, int topLvl)
|
||||
{
|
||||
SummonInstance summon = null;
|
||||
final List<Playable> validMembers = getValidMembers(rewardedMembers, topLvl);
|
||||
float penalty;
|
||||
double sqLevel;
|
||||
double preCalculation;
|
||||
xpReward *= getExpBonus(validMembers.size());
|
||||
spReward *= getSpBonus(validMembers.size());
|
||||
int xpReward = (int) (xpRewardValue * getExpBonus(validMembers.size()));
|
||||
int spReward = (int) (spRewardValue * getSpBonus(validMembers.size()));
|
||||
double sqLevelSum = 0;
|
||||
for (Playable character : validMembers)
|
||||
{
|
||||
|
||||
@@ -1406,10 +1406,10 @@ public abstract class Skill
|
||||
* <li>ITEM</li><br>
|
||||
* @param creature The Creature who use the skill
|
||||
* @param onlyFirst
|
||||
* @param target
|
||||
* @param targetCreature
|
||||
* @return
|
||||
*/
|
||||
public WorldObject[] getTargetList(Creature creature, boolean onlyFirst, Creature target)
|
||||
public WorldObject[] getTargetList(Creature creature, boolean onlyFirst, Creature targetCreature)
|
||||
{
|
||||
// to avoid attacks during oly start period
|
||||
if ((creature instanceof PlayerInstance) && _isOffensive && (((PlayerInstance) creature).isInOlympiadMode() && !((PlayerInstance) creature).isOlympiadStart()))
|
||||
@@ -1427,6 +1427,7 @@ public abstract class Skill
|
||||
};
|
||||
}
|
||||
|
||||
Creature target = targetCreature;
|
||||
switch (_targetType)
|
||||
{
|
||||
// The skill can only be used on the Creature targeted, or on the caster itself
|
||||
|
||||
@@ -69,11 +69,11 @@ public class StoreTradeList
|
||||
_items.add(item);
|
||||
}
|
||||
|
||||
public void replaceItem(int itemID, int price)
|
||||
public void replaceItem(int itemID, int priceValue)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
int price = priceValue;
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getItemId() == itemID)
|
||||
{
|
||||
if (price < (item.getReferencePrice() / 2))
|
||||
@@ -88,9 +88,8 @@ public class StoreTradeList
|
||||
|
||||
public synchronized boolean decreaseCount(int itemID, int count)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getItemId() == itemID)
|
||||
{
|
||||
if (item.getCount() < count)
|
||||
@@ -105,9 +104,8 @@ public class StoreTradeList
|
||||
|
||||
public void restoreCount(int time)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getCountDecrease() && (item.getTime() == time))
|
||||
{
|
||||
item.restoreInitCount();
|
||||
@@ -170,9 +168,8 @@ public class StoreTradeList
|
||||
|
||||
public int getPriceForItemId(int itemId)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getItemId() == itemId)
|
||||
{
|
||||
return item.getPriceToSell();
|
||||
@@ -183,9 +180,8 @@ public class StoreTradeList
|
||||
|
||||
public boolean countDecrease(int itemId)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getItemId() == itemId)
|
||||
{
|
||||
return item.getCountDecrease();
|
||||
@@ -208,9 +204,8 @@ public class StoreTradeList
|
||||
|
||||
public ItemInstance getItem(int objectId)
|
||||
{
|
||||
for (int i = 0; i < _items.size(); i++)
|
||||
for (final ItemInstance item : _items)
|
||||
{
|
||||
final ItemInstance item = _items.get(i);
|
||||
if (item.getObjectId() == objectId)
|
||||
{
|
||||
return item;
|
||||
@@ -250,9 +245,9 @@ public class StoreTradeList
|
||||
{
|
||||
boolean bool = false;
|
||||
ItemInstance temp;
|
||||
for (int y = 0; y < _items.size(); y++)
|
||||
for (ItemInstance _item : _items)
|
||||
{
|
||||
temp = _items.get(y);
|
||||
temp = _item;
|
||||
if (temp.getObjectId() == objId)
|
||||
{
|
||||
bool = true;
|
||||
|
||||
@@ -242,24 +242,28 @@ public abstract class WorldObject
|
||||
{
|
||||
// Set the x,y,z position of the WorldObject spawn and update its _worldregion
|
||||
_visible = true;
|
||||
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;
|
||||
}
|
||||
if (y > World.MAP_MAX_Y)
|
||||
{
|
||||
y = World.MAP_MAX_Y - 5000;
|
||||
}
|
||||
if (y < World.MAP_MIN_Y)
|
||||
{
|
||||
y = World.MAP_MIN_Y + 5000;
|
||||
spawnX = World.MAP_MIN_X + 5000;
|
||||
}
|
||||
|
||||
getPosition().setWorldPosition(x, y, z);
|
||||
int spawnY = y;
|
||||
if (spawnY > World.MAP_MAX_Y)
|
||||
{
|
||||
spawnY = World.MAP_MAX_Y - 5000;
|
||||
}
|
||||
if (spawnY < World.MAP_MIN_Y)
|
||||
{
|
||||
spawnY = World.MAP_MIN_Y + 5000;
|
||||
}
|
||||
|
||||
getPosition().setWorldPosition(spawnX, spawnY, z);
|
||||
getPosition().setWorldRegion(World.getInstance().getRegion(getPosition().getWorldPosition()));
|
||||
}
|
||||
|
||||
|
||||
@@ -934,9 +934,9 @@ public class Attackable extends NpcInstance
|
||||
* Add damage and hate to the attacker AggroInfo of the Attackable _aggroList.
|
||||
* @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)
|
||||
{
|
||||
@@ -954,6 +954,7 @@ public class Attackable extends NpcInstance
|
||||
}
|
||||
|
||||
// If aggro is negative, its comming from SEE_SPELL, buffs use constant 150
|
||||
int aggro = aggroValue;
|
||||
if (aggro < 0)
|
||||
{
|
||||
ai._hate -= (aggro * 150) / (getLevel() + 7);
|
||||
@@ -1015,6 +1016,7 @@ public class Attackable extends NpcInstance
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE, null, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if (target == null) // whole aggrolist
|
||||
{
|
||||
final Creature mostHated = getMostHated();
|
||||
@@ -1032,15 +1034,13 @@ public class Attackable extends NpcInstance
|
||||
ai._hate -= amount;
|
||||
}
|
||||
|
||||
amount = getHating(mostHated);
|
||||
if (amount <= 0)
|
||||
if (getHating(mostHated) <= 0)
|
||||
{
|
||||
((AttackableAI) getAI()).setGlobalAggro(-25);
|
||||
clearAggroList();
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
setWalking();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2847,14 +2847,15 @@ public class Attackable extends NpcInstance
|
||||
|
||||
/**
|
||||
* Calculate the Experience and SP to distribute to attacker (PlayerInstance, SummonInstance or Party) of the Attackable.
|
||||
* @param diff The difference of level between attacker (PlayerInstance, SummonInstance or Party) and the Attackable
|
||||
* @param diffValue The difference of level between attacker (PlayerInstance, SummonInstance or Party) and the Attackable
|
||||
* @param damage The damages given by the attacker (PlayerInstance, SummonInstance or Party)
|
||||
* @return
|
||||
*/
|
||||
private int[] calculateExpAndSp(int diff, long damage)
|
||||
private int[] calculateExpAndSp(int diffValue, long damage)
|
||||
{
|
||||
double xp;
|
||||
double sp;
|
||||
int diff = diffValue;
|
||||
if (diff < -5)
|
||||
{
|
||||
diff = -5; // makes possible to use ALT_GAME_EXPONENT configuration
|
||||
|
||||
@@ -606,12 +606,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <li>Set the x,y,z position of the WorldObject and if necessary modify its _worldRegion</li>
|
||||
* <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><br>
|
||||
* @param x the x
|
||||
* @param y the y
|
||||
* @param z the z
|
||||
* @param xValue the x
|
||||
* @param yValue the y
|
||||
* @param zValue the z
|
||||
* @param allowRandomOffset the allow random offset
|
||||
*/
|
||||
public void teleToLocation(int x, int y, int z, boolean allowRandomOffset)
|
||||
public void teleToLocation(int xValue, int yValue, int zValue, boolean allowRandomOffset)
|
||||
{
|
||||
if (Config.TW_DISABLE_GK)
|
||||
{
|
||||
@@ -646,12 +646,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
|
||||
getAI().setIntention(CtrlIntention.AI_INTENTION_ACTIVE);
|
||||
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
int z = zValue;
|
||||
if (Config.RESPAWN_RANDOM_ENABLED && allowRandomOffset)
|
||||
{
|
||||
x += Rnd.get(-Config.RESPAWN_RANDOM_MAX_OFFSET, Config.RESPAWN_RANDOM_MAX_OFFSET);
|
||||
y += Rnd.get(-Config.RESPAWN_RANDOM_MAX_OFFSET, Config.RESPAWN_RANDOM_MAX_OFFSET);
|
||||
}
|
||||
|
||||
z += 5;
|
||||
|
||||
// Send a Server->Client packet TeleportToLocationt to the Creature AND to all PlayerInstance in the _KnownPlayers of the Creature
|
||||
@@ -2836,17 +2838,18 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
*/
|
||||
public void setTitle(String value)
|
||||
{
|
||||
if (value == null)
|
||||
String title = value;
|
||||
if (title == null)
|
||||
{
|
||||
value = "";
|
||||
title = "";
|
||||
}
|
||||
|
||||
if ((this instanceof PlayerInstance) && (value.length() > 16))
|
||||
if ((this instanceof PlayerInstance) && (title.length() > 16))
|
||||
{
|
||||
value = value.substring(0, 15);
|
||||
title = title.substring(0, 15);
|
||||
}
|
||||
|
||||
_title = value; // public void setTitle(String value) { _title = value; }
|
||||
_title = title;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5403,10 +5406,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <b><u>Overriden in</u>:</b><br>
|
||||
* <br>
|
||||
* <li>PlayerInstance : Remove the PlayerInstance from the old target _statusListener and add it to the new target if it was a Creature</li><br>
|
||||
* @param object L2object to target
|
||||
* @param worldObject WorldObject to target
|
||||
*/
|
||||
public void setTarget(WorldObject object)
|
||||
public void setTarget(WorldObject worldObject)
|
||||
{
|
||||
WorldObject object = worldObject;
|
||||
if ((object != null) && !object.isVisible())
|
||||
{
|
||||
object = null;
|
||||
@@ -5487,12 +5491,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <b><u>Example of use</u>:</b><br>
|
||||
* <li>AI : onIntentionMoveTo(L2CharPosition), onIntentionPickUp(WorldObject), onIntentionInteract(WorldObject)</li>
|
||||
* <li>FollowTask</li><br>
|
||||
* @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
|
||||
*/
|
||||
protected void moveToLocation(int x, int y, int z, int offset)
|
||||
protected void moveToLocation(int xValue, int yValue, int zValue, int offsetValue)
|
||||
{
|
||||
// Block movement during Event start
|
||||
if (this instanceof PlayerInstance)
|
||||
@@ -5534,6 +5538,11 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
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();
|
||||
@@ -6143,13 +6152,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
* <li>If attack isn't aborted and hit isn't missed, reduce HP of the target and calculate reflection damage to reduce HP of attacker if necessary</li>
|
||||
* <li>if attack isn't aborted and hit isn't missed, manage attack or cast break of the target (calculating rate, sending message...)</li><br>
|
||||
* @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
|
||||
*/
|
||||
protected void onHitTimer(Creature target, int damage, boolean crit, boolean miss, boolean soulshot, boolean shld)
|
||||
protected void onHitTimer(Creature target, int damageValue, boolean crit, boolean miss, boolean soulshot, boolean 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)
|
||||
@@ -6187,6 +6196,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
|
||||
// If attack isn't aborted, send a message system (critical hit, missed...) to attacker/target if they are PlayerInstance
|
||||
if (!isAttackAborted())
|
||||
{
|
||||
int damage = damageValue;
|
||||
if (Config.ALLOW_RAID_BOSS_PETRIFIED && ((this instanceof PlayerInstance) || (this instanceof Summon))) // Check if option is True Or False.
|
||||
{
|
||||
boolean toBeCursed = false;
|
||||
|
||||
@@ -436,11 +436,7 @@ public abstract class Summon extends Playable
|
||||
|
||||
public void setAttackRange(int range)
|
||||
{
|
||||
if (range < 36)
|
||||
{
|
||||
range = 36;
|
||||
}
|
||||
_attackRange = range;
|
||||
_attackRange = Math.max(36, range);
|
||||
}
|
||||
|
||||
public void setFollowStatus(boolean value)
|
||||
|
||||
+2
-8
@@ -91,7 +91,7 @@ public class ControllableMobInstance extends MonsterInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reduceCurrentHp(double i, Creature attacker, boolean awake)
|
||||
public void reduceCurrentHp(double value, Creature attacker, boolean awake)
|
||||
{
|
||||
if (_isInvul || isDead())
|
||||
{
|
||||
@@ -103,13 +103,7 @@ public class ControllableMobInstance extends MonsterInstance
|
||||
stopSleeping(null);
|
||||
}
|
||||
|
||||
i = getCurrentHp() - i;
|
||||
if (i < 0)
|
||||
{
|
||||
i = 0;
|
||||
}
|
||||
|
||||
setCurrentHp(i);
|
||||
setCurrentHp(Math.max(0, getCurrentHp() - value));
|
||||
|
||||
if (isDead())
|
||||
{
|
||||
|
||||
+2
-1
@@ -63,8 +63,9 @@ public class GourdInstance extends MonsterInstance
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reduceCurrentHp(double damage, Creature attacker, boolean awake)
|
||||
public void reduceCurrentHp(double damageValue, Creature attacker, boolean awake)
|
||||
{
|
||||
double damage = damageValue;
|
||||
if (!attacker.getName().equalsIgnoreCase(_name))
|
||||
{
|
||||
damage = 0;
|
||||
|
||||
+3
-2
@@ -218,9 +218,9 @@ public class MerchantInstance extends FolkInstance
|
||||
/**
|
||||
* Try rent pet.
|
||||
* @param player the player
|
||||
* @param value the value
|
||||
* @param val the value
|
||||
*/
|
||||
public void tryRentPet(PlayerInstance player, int value)
|
||||
public void tryRentPet(PlayerInstance player, int val)
|
||||
{
|
||||
if ((player == null) || (player.getPet() != null) || player.isMounted() || player.isRentedPet())
|
||||
{
|
||||
@@ -248,6 +248,7 @@ public class MerchantInstance extends FolkInstance
|
||||
1800
|
||||
};
|
||||
|
||||
int value = val;
|
||||
if (value > 10)
|
||||
{
|
||||
petId = 12526;
|
||||
|
||||
+2
-4
@@ -1626,9 +1626,8 @@ public class NpcInstance 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.replace("%objectId%", String.valueOf(getObjectId()));
|
||||
final NpcHtmlMessage npcReply = new NpcHtmlMessage(getObjectId());
|
||||
npcReply.setHtml(content);
|
||||
npcReply.setHtml(content.replace("%objectId%", String.valueOf(getObjectId())));
|
||||
player.sendPacket(npcReply);
|
||||
}
|
||||
|
||||
@@ -1785,9 +1784,8 @@ public class NpcInstance extends Creature
|
||||
return;
|
||||
}
|
||||
|
||||
questId = qs.getQuest().getName();
|
||||
final String stateId = State.getStateName(qs.getState());
|
||||
final String path = Config.DATAPACK_ROOT + "/data/scripts/quests/" + questId + "/" + stateId + ".htm";
|
||||
final String path = Config.DATAPACK_ROOT + "/data/scripts/quests/" + qs.getQuest().getName() + "/" + stateId + ".htm";
|
||||
content = HtmCache.getInstance().getHtm(path);
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -786,12 +786,12 @@ public class PetInstance extends Summon
|
||||
|
||||
/**
|
||||
* Drop item here.
|
||||
* @param dropit the dropit
|
||||
* @param item the dropit
|
||||
* @param protect the protect
|
||||
*/
|
||||
public void dropItemHere(ItemInstance dropit, boolean protect)
|
||||
public void dropItemHere(ItemInstance item, boolean protect)
|
||||
{
|
||||
dropit = _inventory.dropItem("Drop", dropit.getObjectId(), dropit.getCount(), getOwner(), this);
|
||||
ItemInstance dropit = _inventory.dropItem("Drop", item.getObjectId(), item.getCount(), getOwner(), this);
|
||||
if (dropit != null)
|
||||
{
|
||||
if (protect)
|
||||
|
||||
+44
-38
@@ -1531,12 +1531,13 @@ public class PlayerInstance extends Playable
|
||||
/**
|
||||
* Process quest event.
|
||||
* @param quest the quest
|
||||
* @param event the event
|
||||
* @param eventValue the event
|
||||
* @return the quest state
|
||||
*/
|
||||
public QuestState processQuestEvent(String quest, String event)
|
||||
public QuestState processQuestEvent(String quest, String eventValue)
|
||||
{
|
||||
QuestState retval = null;
|
||||
String event = eventValue;
|
||||
if (event == null)
|
||||
{
|
||||
event = "";
|
||||
@@ -2055,10 +2056,11 @@ public class PlayerInstance extends Playable
|
||||
|
||||
/**
|
||||
* Set the Karma of the PlayerInstance and send a Server->Client packet StatusUpdate (broadcast).
|
||||
* @param karma the new karma
|
||||
* @param value the new karma
|
||||
*/
|
||||
public void setKarma(int karma)
|
||||
public void setKarma(int value)
|
||||
{
|
||||
int karma = value;
|
||||
if (karma < 0)
|
||||
{
|
||||
karma = 0;
|
||||
@@ -3345,12 +3347,13 @@ public class PlayerInstance extends Playable
|
||||
/**
|
||||
* Add adena to Inventory of the PlayerInstance and send a Server->Client InventoryUpdate packet to the PlayerInstance.
|
||||
* @param process : String Identifier of process triggering this action
|
||||
* @param count : int Quantity of adena to be added
|
||||
* @param amount : int Quantity of adena to be added
|
||||
* @param reference : WorldObject Object referencing current action like NPC selling item or previous item in transformation
|
||||
* @param sendMessage : boolean Specifies whether to send message to Client about this action
|
||||
*/
|
||||
public void addAdena(String process, int count, WorldObject reference, boolean sendMessage)
|
||||
public void addAdena(String process, int amount, WorldObject reference, boolean sendMessage)
|
||||
{
|
||||
int count = amount;
|
||||
if (count > 0)
|
||||
{
|
||||
if (_inventory.getAdena() == Integer.MAX_VALUE)
|
||||
@@ -3717,8 +3720,8 @@ public class PlayerInstance extends Playable
|
||||
*/
|
||||
public boolean destroyItem(String process, ItemInstance item, WorldObject reference, boolean sendMessage)
|
||||
{
|
||||
item = _inventory.destroyItem(process, item, this, reference);
|
||||
if (item == null)
|
||||
final ItemInstance destoyedItem = _inventory.destroyItem(process, item, this, reference);
|
||||
if (destoyedItem == null)
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
@@ -3731,7 +3734,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
|
||||
@@ -3750,14 +3753,14 @@ public class PlayerInstance extends Playable
|
||||
if (_count > 1)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S2_S1_HAS_DISAPPEARED);
|
||||
sm.addItemName(item.getItemId());
|
||||
sm.addItemName(destoyedItem.getItemId());
|
||||
sm.addNumber(_count);
|
||||
sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_HAS_DISAPPEARED);
|
||||
sm.addItemName(item.getItemId());
|
||||
sm.addItemName(destoyedItem.getItemId());
|
||||
sendPacket(sm);
|
||||
}
|
||||
}
|
||||
@@ -4109,8 +4112,8 @@ public class PlayerInstance extends Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
item = _inventory.dropItem(process, item, this, reference);
|
||||
if (item == null)
|
||||
final ItemInstance droppedItem = _inventory.dropItem(process, item, this, reference);
|
||||
if (droppedItem == null)
|
||||
{
|
||||
if (sendMessage)
|
||||
{
|
||||
@@ -4119,41 +4122,41 @@ public class PlayerInstance extends Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
item.dropMe(this, (getClientX() + Rnd.get(50)) - 25, (getClientY() + Rnd.get(50)) - 25, getClientZ() + 20);
|
||||
if (Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(item.getItemId()))
|
||||
droppedItem.dropMe(this, (getClientX() + Rnd.get(50)) - 25, (getClientY() + Rnd.get(50)) - 25, getClientZ() + 20);
|
||||
if (Config.DESTROY_DROPPED_PLAYER_ITEM && !Config.LIST_PROTECTED_ITEMS.contains(droppedItem.getItemId()))
|
||||
{
|
||||
if (Config.AUTODESTROY_ITEM_AFTER > 0) // autodestroy enabled
|
||||
{
|
||||
if ((item.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !item.isEquipable())
|
||||
if ((droppedItem.isEquipable() && Config.DESTROY_EQUIPABLE_PLAYER_ITEM) || !droppedItem.isEquipable())
|
||||
{
|
||||
ItemsAutoDestroy.getInstance().addItem(item);
|
||||
item.setProtected(false);
|
||||
ItemsAutoDestroy.getInstance().addItem(droppedItem);
|
||||
droppedItem.setProtected(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setProtected(true);
|
||||
droppedItem.setProtected(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setProtected(true);
|
||||
droppedItem.setProtected(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setProtected(true);
|
||||
droppedItem.setProtected(true);
|
||||
}
|
||||
|
||||
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
|
||||
@@ -4170,7 +4173,7 @@ public class PlayerInstance extends Playable
|
||||
if (sendMessage)
|
||||
{
|
||||
final SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_DROPPED_S1);
|
||||
sm.addItemName(item.getItemId());
|
||||
sm.addItemName(droppedItem.getItemId());
|
||||
sendPacket(sm);
|
||||
}
|
||||
|
||||
@@ -5434,12 +5437,13 @@ public class PlayerInstance extends Playable
|
||||
* <li>Remove the PlayerInstance from the _statusListener of the old target if it was a Creature</li>
|
||||
* <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><br>
|
||||
* @param newTarget The WorldObject to target
|
||||
* @param worldObject The WorldObject to target
|
||||
*/
|
||||
@Override
|
||||
public void setTarget(WorldObject newTarget)
|
||||
public void setTarget(WorldObject worldObject)
|
||||
{
|
||||
// Check if the new target is visible
|
||||
WorldObject newTarget = worldObject;
|
||||
if ((newTarget != null) && !newTarget.isVisible())
|
||||
{
|
||||
newTarget = null;
|
||||
@@ -9527,21 +9531,19 @@ public class PlayerInstance extends Playable
|
||||
return false;
|
||||
}
|
||||
|
||||
slot--;
|
||||
|
||||
if (_henna[slot] == null)
|
||||
if (_henna[slot - 1] == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Henna henna = _henna[slot];
|
||||
_henna[slot] = null;
|
||||
Henna henna = _henna[slot - 1];
|
||||
_henna[slot - 1] = null;
|
||||
|
||||
try (Connection con = DatabaseFactory.getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA);
|
||||
statement.setInt(1, getObjectId());
|
||||
statement.setInt(2, slot + 1);
|
||||
statement.setInt(2, slot);
|
||||
statement.setInt(3, getClassIndex());
|
||||
statement.execute();
|
||||
statement.close();
|
||||
@@ -10555,13 +10557,15 @@ public class PlayerInstance extends Playable
|
||||
|
||||
/**
|
||||
* Check if the requested casting is a Pc->Pc skill cast and if it's a valid pvp condition.
|
||||
* @param target WorldObject instance containing the target
|
||||
* @param worldObject WorldObject instance containing the target
|
||||
* @param skill Skill instance with the skill being casted
|
||||
* @param srcIsSummon is Summon - caster?
|
||||
* @return False if the skill is a pvpSkill and target is not a valid pvp target
|
||||
*/
|
||||
public boolean checkPvpSkill(WorldObject target, Skill skill, boolean srcIsSummon)
|
||||
public boolean checkPvpSkill(WorldObject worldObject, Skill skill, boolean srcIsSummon)
|
||||
{
|
||||
WorldObject target = worldObject;
|
||||
|
||||
// Check if player and target are in events and on the same team.
|
||||
if (target instanceof PlayerInstance)
|
||||
{
|
||||
@@ -15315,11 +15319,12 @@ public class PlayerInstance extends Playable
|
||||
|
||||
/**
|
||||
* String to hex.
|
||||
* @param color the color
|
||||
* @param value the color
|
||||
* @return the string
|
||||
*/
|
||||
private String StringToHex(String color)
|
||||
private String StringToHex(String value)
|
||||
{
|
||||
String color = value;
|
||||
switch (color.length())
|
||||
{
|
||||
case 1:
|
||||
@@ -15825,10 +15830,11 @@ public class PlayerInstance extends Playable
|
||||
/**
|
||||
* Sets the end time.
|
||||
* @param process the process
|
||||
* @param value the value
|
||||
* @param time the value
|
||||
*/
|
||||
public void setEndTime(String process, int value)
|
||||
public void setEndTime(String process, int time)
|
||||
{
|
||||
int value = time;
|
||||
if (value > 0)
|
||||
{
|
||||
long endDay;
|
||||
|
||||
+5
-4
@@ -41,10 +41,10 @@ public class SchemeBufferInstance extends FolkInstance
|
||||
}
|
||||
|
||||
@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();
|
||||
@@ -283,10 +283,10 @@ public class SchemeBufferInstance extends FolkInstance
|
||||
* @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);
|
||||
@@ -297,6 +297,7 @@ public class SchemeBufferInstance extends FolkInstance
|
||||
|
||||
// Calculate page number.
|
||||
final int max = Util.countPagesNumber(skills.size(), PAGE_LIMIT);
|
||||
int page = pageValue;
|
||||
if (page > max)
|
||||
{
|
||||
page = max;
|
||||
|
||||
+3
-2
@@ -228,11 +228,12 @@ public class SepulcherNpcInstance extends NpcInstance
|
||||
{
|
||||
setInvul(false);
|
||||
reduceCurrentHp(getMaxHp() + 1, player);
|
||||
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:
|
||||
|
||||
+15
-11
@@ -30,13 +30,14 @@ public class PlayableStat extends CreatureStat
|
||||
super(activeChar);
|
||||
}
|
||||
|
||||
public boolean addExp(long value)
|
||||
public boolean addExp(long amount)
|
||||
{
|
||||
if (((getExp() + value) < 0) || ((value > 0) && (getExp() == (getExpForLevel(ExperienceData.getInstance().getMaxLevel()) - 1))))
|
||||
if (((getExp() + amount) < 0) || ((amount > 0) && (getExp() == (getExpForLevel(ExperienceData.getInstance().getMaxLevel()) - 1))))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
long value = amount;
|
||||
if ((getExp() + value) >= getExpForLevel(ExperienceData.getInstance().getMaxLevel()))
|
||||
{
|
||||
value = getExpForLevel(ExperienceData.getInstance().getMaxLevel()) - 1 - getExp();
|
||||
@@ -62,8 +63,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;
|
||||
@@ -124,8 +126,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) > (ExperienceData.getInstance().getMaxLevel() - 1))
|
||||
{
|
||||
if (getLevel() < (ExperienceData.getInstance().getMaxLevel() - 1))
|
||||
@@ -159,9 +162,9 @@ public class PlayableStat extends CreatureStat
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean addSp(int value)
|
||||
public boolean addSp(int amount)
|
||||
{
|
||||
if (value < 0)
|
||||
if (amount < 0)
|
||||
{
|
||||
LOGGER.info("wrong usage");
|
||||
return false;
|
||||
@@ -173,6 +176,7 @@ public class PlayableStat extends CreatureStat
|
||||
return false;
|
||||
}
|
||||
|
||||
int value = amount;
|
||||
if (currentSp > (Integer.MAX_VALUE - value))
|
||||
{
|
||||
value = Integer.MAX_VALUE - currentSp;
|
||||
@@ -182,15 +186,15 @@ public class PlayableStat extends CreatureStat
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean removeSp(int value)
|
||||
public boolean removeSp(int amount)
|
||||
{
|
||||
final int currentSp = getSp();
|
||||
if (currentSp < value)
|
||||
if (currentSp < amount)
|
||||
{
|
||||
value = currentSp;
|
||||
setSp(getSp() - currentSp);
|
||||
return true;
|
||||
}
|
||||
|
||||
setSp(getSp() - value);
|
||||
setSp(getSp() - amount);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+11
-7
@@ -87,11 +87,11 @@ public class PlayerStat extends PlayableStat
|
||||
* <li>If the PlayerInstance increases it's level, send a Server->Client packet SocialAction (broadcast)</li>
|
||||
* <li>If the PlayerInstance increases it's level, manage the increase level task (Max MP, Max MP, Recommendation, Expertise and beginner skills...)</li>
|
||||
* <li>If the PlayerInstance increases it's level, send a Server->Client packet UserInfo to the PlayerInstance</li><br>
|
||||
* @param addToExp The Experience value to add
|
||||
* @param addToSp The SP value to add
|
||||
* @param addToExpValue The Experience value to add
|
||||
* @param addToSpValue The SP value to add
|
||||
*/
|
||||
@Override
|
||||
public boolean addExpAndSp(long addToExp, int addToSp)
|
||||
public boolean addExpAndSp(long addToExpValue, int addToSpValue)
|
||||
{
|
||||
float ratioTakenByPet = 0;
|
||||
|
||||
@@ -102,6 +102,9 @@ public class PlayerStat extends PlayableStat
|
||||
return false;
|
||||
}
|
||||
|
||||
long addToExp = addToExpValue;
|
||||
int addToSp = addToSpValue;
|
||||
|
||||
// if this player has a pet that takes from the owner's Exp, give the pet Exp now
|
||||
if (player.getPet() instanceof PetInstance)
|
||||
{
|
||||
@@ -333,9 +336,10 @@ public class PlayerStat extends PlayableStat
|
||||
@Override
|
||||
public void setLevel(int value)
|
||||
{
|
||||
if (value > (ExperienceData.getInstance().getMaxLevel() - 1))
|
||||
int level = value;
|
||||
if (level > (ExperienceData.getInstance().getMaxLevel() - 1))
|
||||
{
|
||||
value = ExperienceData.getInstance().getMaxLevel() - 1;
|
||||
level = ExperienceData.getInstance().getMaxLevel() - 1;
|
||||
}
|
||||
|
||||
final PlayerInstance player = getActiveChar();
|
||||
@@ -344,12 +348,12 @@ public class PlayerStat extends PlayableStat
|
||||
final SubClass playerSubclass = player.getSubClasses().get(player.getClassIndex());
|
||||
if (playerSubclass != null)
|
||||
{
|
||||
playerSubclass.setLevel(value);
|
||||
playerSubclass.setLevel(level);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
super.setLevel(value);
|
||||
super.setLevel(level);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+9
-17
@@ -116,17 +116,18 @@ public class CreatureStatus
|
||||
|
||||
/**
|
||||
* Reduce hp.
|
||||
* @param value the value
|
||||
* @param amount the value
|
||||
* @param attacker the attacker
|
||||
* @param awake the awake
|
||||
*/
|
||||
public void reduceHp(double value, Creature attacker, boolean awake)
|
||||
public void reduceHp(double amount, Creature attacker, boolean awake)
|
||||
{
|
||||
if (_creature.isInvul())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
double value = amount;
|
||||
if (_creature instanceof PlayerInstance)
|
||||
{
|
||||
if (((PlayerInstance) _creature).isInDuel())
|
||||
@@ -256,17 +257,11 @@ public class CreatureStatus
|
||||
|
||||
/**
|
||||
* Reduce mp.
|
||||
* @param value the value
|
||||
* @param amount the value
|
||||
*/
|
||||
public void reduceMp(double value)
|
||||
public void reduceMp(double amount)
|
||||
{
|
||||
value = _currentMp - value;
|
||||
if (value < 0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
|
||||
setCurrentMp(value);
|
||||
setCurrentMp(Math.max(0, _currentMp - amount));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -376,21 +371,18 @@ public class CreatureStatus
|
||||
|
||||
/**
|
||||
* Sets the current cp.
|
||||
* @param newCp the new cp
|
||||
* @param value the new cp
|
||||
* @param broadcastPacket the broadcast packet
|
||||
* @param direct the direct
|
||||
*/
|
||||
public void setCurrentCp(double newCp, boolean broadcastPacket, boolean direct)
|
||||
public void setCurrentCp(double value, boolean broadcastPacket, boolean direct)
|
||||
{
|
||||
synchronized (this)
|
||||
{
|
||||
// Get the Max CP of the Creature
|
||||
final int maxCp = _creature.getStat().getMaxCp();
|
||||
if (newCp < 0)
|
||||
{
|
||||
newCp = 0;
|
||||
}
|
||||
|
||||
final double newCp = Math.max(0, value);
|
||||
if ((newCp >= maxCp) && !direct)
|
||||
{
|
||||
// Set the RegenActive flag to false
|
||||
|
||||
+3
-2
@@ -42,7 +42,7 @@ public class PlayerStatus extends PlayableStatus
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reduceHp(double value, Creature attacker, boolean awake)
|
||||
public void reduceHp(double amount, Creature attacker, boolean awake)
|
||||
{
|
||||
if (getActiveChar().isInvul() && (getActiveChar() != attacker))
|
||||
{
|
||||
@@ -89,7 +89,8 @@ public class PlayerStatus extends PlayableStatus
|
||||
}
|
||||
}
|
||||
|
||||
int fullValue = (int) value;
|
||||
double value = amount;
|
||||
int fullValue = (int) amount;
|
||||
if ((attacker != null) && (attacker != getActiveChar()))
|
||||
{
|
||||
// Check and calculate transfered damage
|
||||
|
||||
@@ -92,9 +92,9 @@ public class SubClass
|
||||
{
|
||||
if (expValue > ExperienceData.getInstance().getExpForLevel(Config.MAX_SUBCLASS_LEVEL))
|
||||
{
|
||||
expValue = ExperienceData.getInstance().getExpForLevel(Config.MAX_SUBCLASS_LEVEL);
|
||||
_exp = ExperienceData.getInstance().getExpForLevel(Config.MAX_SUBCLASS_LEVEL);
|
||||
return;
|
||||
}
|
||||
|
||||
_exp = expValue;
|
||||
}
|
||||
|
||||
@@ -112,13 +112,14 @@ public class SubClass
|
||||
{
|
||||
if (levelValue > (Config.MAX_SUBCLASS_LEVEL - 1))
|
||||
{
|
||||
levelValue = Config.MAX_SUBCLASS_LEVEL - 1;
|
||||
_level = Config.MAX_SUBCLASS_LEVEL - 1;
|
||||
return;
|
||||
}
|
||||
else if (levelValue < Config.BASE_SUBCLASS_LEVEL)
|
||||
{
|
||||
levelValue = Config.BASE_SUBCLASS_LEVEL;
|
||||
_level = Config.BASE_SUBCLASS_LEVEL;
|
||||
return;
|
||||
}
|
||||
|
||||
_level = levelValue;
|
||||
}
|
||||
|
||||
|
||||
@@ -854,8 +854,9 @@ public class Clan
|
||||
}
|
||||
}
|
||||
|
||||
private void storeNotice(String notice, boolean enabled)
|
||||
private void storeNotice(String noticeValue, boolean enabled)
|
||||
{
|
||||
String notice = noticeValue;
|
||||
if (notice == null)
|
||||
{
|
||||
notice = "";
|
||||
@@ -919,8 +920,10 @@ public class Clan
|
||||
return (_introduction == null) ? "" : _introduction;
|
||||
}
|
||||
|
||||
public void setIntroduction(String intro, boolean saveOnDb)
|
||||
public void setIntroduction(String value, boolean saveOnDb)
|
||||
{
|
||||
String intro = value;
|
||||
|
||||
if (saveOnDb)
|
||||
{
|
||||
if (intro == null)
|
||||
@@ -1426,10 +1429,10 @@ public class Clan
|
||||
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
|
||||
}
|
||||
|
||||
public SubPledge createSubPledge(PlayerInstance player, int pledgeType, String leaderName, String subPledgeName)
|
||||
public SubPledge createSubPledge(PlayerInstance player, int pledgeTypeValue, String leaderName, String subPledgeName)
|
||||
{
|
||||
SubPledge subPledge = null;
|
||||
pledgeType = getAvailablePledgeTypes(pledgeType);
|
||||
int pledgeType = getAvailablePledgeTypes(pledgeTypeValue);
|
||||
if (pledgeType == 0)
|
||||
{
|
||||
if (pledgeType == SUBUNIT_ACADEMY)
|
||||
@@ -1505,8 +1508,7 @@ public class Clan
|
||||
}
|
||||
case SUBUNIT_ROYAL1:
|
||||
{
|
||||
pledgeType = getAvailablePledgeTypes(SUBUNIT_ROYAL2);
|
||||
break;
|
||||
return getAvailablePledgeTypes(SUBUNIT_ROYAL2);
|
||||
}
|
||||
case SUBUNIT_ROYAL2:
|
||||
{
|
||||
@@ -1514,18 +1516,15 @@ public class Clan
|
||||
}
|
||||
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:
|
||||
{
|
||||
|
||||
@@ -342,15 +342,16 @@ public class Auction
|
||||
*/
|
||||
private void returnItem(String clan, int quantity, boolean penalty)
|
||||
{
|
||||
int amount = quantity;
|
||||
if (penalty)
|
||||
{
|
||||
quantity *= 0.9; // take 10% tax fee if needed
|
||||
amount *= 0.9; // take 10% tax fee if needed
|
||||
}
|
||||
|
||||
// avoid overflow on return
|
||||
final long limit = MAX_ADENA - ClanTable.getInstance().getClanByName(clan).getWarehouse().getAdena();
|
||||
quantity = (int) Math.min(quantity, limit);
|
||||
ClanTable.getInstance().getClanByName(clan).getWarehouse().addItem("Outbidded", ADENA_ID, quantity, null, null);
|
||||
amount = (int) Math.min(amount, limit);
|
||||
ClanTable.getInstance().getClanByName(clan).getWarehouse().addItem("Outbidded", ADENA_ID, amount, null, null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-1
@@ -397,12 +397,13 @@ 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;
|
||||
@@ -417,6 +418,7 @@ public class Lottery
|
||||
|
||||
nr = 17;
|
||||
|
||||
int type2 = type2Value;
|
||||
while (type2 > 0)
|
||||
{
|
||||
final int val = type2 / 2;
|
||||
|
||||
+3
-2
@@ -4387,10 +4387,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 the oracle
|
||||
* @param festivalId the festival id
|
||||
* @param festivalIdValue the festival id
|
||||
* @return DarknessFestival festivalInst
|
||||
*/
|
||||
public DarknessFestival getFestivalInstance(int oracle, int festivalId)
|
||||
public DarknessFestival getFestivalInstance(int oracle, int festivalIdValue)
|
||||
{
|
||||
if (!_festivalInitialized)
|
||||
{
|
||||
@@ -4398,6 +4398,7 @@ public class SevenSignsFestival implements SpawnListener
|
||||
}
|
||||
|
||||
// Compute the offset if a Dusk instance is required. ID: 0 1 2 3 4 Dusk 1: 10 11 12 13 14 Dawn 2: 20 21 22 23 24
|
||||
int festivalId = festivalIdValue;
|
||||
festivalId += oracle == SevenSigns.CABAL_DUSK ? 10 : 20;
|
||||
return _festivalInstances.get(festivalId);
|
||||
}
|
||||
|
||||
+8
-6
@@ -134,15 +134,16 @@ public class Castle
|
||||
|
||||
/**
|
||||
* Add amount to castle instance's treasury (warehouse).
|
||||
* @param amount
|
||||
* @param amountValue
|
||||
*/
|
||||
public void addToTreasury(int amount)
|
||||
public void addToTreasury(int amountValue)
|
||||
{
|
||||
if (_ownerId <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int amount = amountValue;
|
||||
if (_name.equalsIgnoreCase("Schuttgart") || _name.equalsIgnoreCase("Goddard"))
|
||||
{
|
||||
final Castle rune = CastleManager.getInstance().getCastle("rune");
|
||||
@@ -177,16 +178,17 @@ public class Castle
|
||||
|
||||
/**
|
||||
* Add amount to castle instance's treasury (warehouse), no tax paying.
|
||||
* @param amount
|
||||
* @param amountValue
|
||||
* @return
|
||||
*/
|
||||
public boolean addToTreasuryNoTax(int amount)
|
||||
public boolean addToTreasuryNoTax(int amountValue)
|
||||
{
|
||||
if (_ownerId <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int amount = amountValue;
|
||||
if (amount < 0)
|
||||
{
|
||||
amount *= -1;
|
||||
@@ -218,6 +220,7 @@ public class Castle
|
||||
{
|
||||
LOGGER.warning(e.toString());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -703,9 +706,8 @@ public class Castle
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _doors.size(); i++)
|
||||
for (final DoorInstance door : _doors)
|
||||
{
|
||||
final DoorInstance door = _doors.get(i);
|
||||
if (door.getDoorId() == doorId)
|
||||
{
|
||||
return door;
|
||||
|
||||
+14
-12
@@ -177,32 +177,33 @@ public abstract class ItemContainer
|
||||
*/
|
||||
public ItemInstance addItem(String process, ItemInstance item, PlayerInstance actor, WorldObject reference)
|
||||
{
|
||||
final ItemInstance olditem = getItemByItemId(item.getItemId());
|
||||
ItemInstance newItem = item;
|
||||
final ItemInstance olditem = getItemByItemId(newItem.getItemId());
|
||||
|
||||
// If stackable item is found in inventory just add to current quantity
|
||||
if ((olditem != null) && olditem.isStackable())
|
||||
{
|
||||
final int count = item.getCount();
|
||||
final int 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.setLocation(getBaseLocation());
|
||||
item.setLastChange(ItemInstance.ADDED);
|
||||
newItem.setOwnerId(process, getOwnerId(), actor, reference);
|
||||
newItem.setLocation(getBaseLocation());
|
||||
newItem.setLastChange(ItemInstance.ADDED);
|
||||
|
||||
// Add item in inventory
|
||||
addItem(item);
|
||||
addItem(newItem);
|
||||
}
|
||||
|
||||
refreshWeight();
|
||||
return item;
|
||||
return newItem;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -306,13 +307,13 @@ public abstract class ItemContainer
|
||||
* Transfers item to another inventory
|
||||
* @param process : String Identifier of process triggering this action
|
||||
* @param objectId
|
||||
* @param count : int Quantity of items to be transfered
|
||||
* @param amount : int Quantity of items to be transfered
|
||||
* @param target
|
||||
* @param actor : PlayerInstance Player requesting the item transfer
|
||||
* @param reference : WorldObject 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, int count, ItemContainer target, PlayerInstance actor, WorldObject reference)
|
||||
public ItemInstance transferItem(String process, int objectId, int amount, ItemContainer target, PlayerInstance actor, WorldObject reference)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
@@ -335,6 +336,7 @@ public abstract class ItemContainer
|
||||
}
|
||||
|
||||
// Check if requested quantity is available
|
||||
int count = amount;
|
||||
if (count > sourceitem.getCount())
|
||||
{
|
||||
count = sourceitem.getCount();
|
||||
|
||||
+9
-7
@@ -24,8 +24,8 @@ import java.util.List;
|
||||
|
||||
import org.l2jmobius.commons.database.DatabaseFactory;
|
||||
import org.l2jmobius.gameserver.model.TradeList;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.TradeList.TradeItem;
|
||||
import org.l2jmobius.gameserver.model.WorldObject;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.items.Item;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
@@ -399,18 +399,19 @@ public class PlayerInventory extends Inventory
|
||||
@Override
|
||||
public ItemInstance addItem(String process, ItemInstance item, PlayerInstance actor, WorldObject reference)
|
||||
{
|
||||
item = super.addItem(process, item, actor, reference);
|
||||
if ((item != null) && (item.getItemId() == ADENA_ID) && !item.equals(_adena))
|
||||
ItemInstance addedItem = super.addItem(process, item, actor, reference);
|
||||
|
||||
if ((addedItem != null) && (addedItem.getItemId() == ADENA_ID) && !addedItem.equals(_adena))
|
||||
{
|
||||
_adena = item;
|
||||
_adena = addedItem;
|
||||
}
|
||||
|
||||
if ((item != null) && (item.getItemId() == ANCIENT_ADENA_ID) && !item.equals(_ancientAdena))
|
||||
if ((addedItem != null) && (addedItem.getItemId() == ANCIENT_ADENA_ID) && !addedItem.equals(_ancientAdena))
|
||||
{
|
||||
_ancientAdena = item;
|
||||
_ancientAdena = addedItem;
|
||||
}
|
||||
|
||||
return item;
|
||||
return addedItem;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -426,6 +427,7 @@ public class PlayerInventory extends Inventory
|
||||
public ItemInstance addItem(String process, int itemId, int count, PlayerInstance actor, WorldObject reference)
|
||||
{
|
||||
final ItemInstance item = super.addItem(process, itemId, count, actor, reference);
|
||||
|
||||
if ((item != null) && (item.getItemId() == ADENA_ID) && !item.equals(_adena))
|
||||
{
|
||||
_adena = item;
|
||||
|
||||
+7
-4
@@ -1128,12 +1128,15 @@ public class ItemInstance extends WorldObject
|
||||
* <li>Drop item</li>
|
||||
* <li>Call Pet</li><br>
|
||||
* @param dropper the dropper
|
||||
* @param x the x
|
||||
* @param y the y
|
||||
* @param z the z
|
||||
* @param xValue the x
|
||||
* @param yValue the y
|
||||
* @param zValue the z
|
||||
*/
|
||||
public void dropMe(Creature dropper, int x, int y, int z)
|
||||
public void dropMe(Creature dropper, int xValue, int yValue, int zValue)
|
||||
{
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
int z = zValue;
|
||||
if (Config.PATHFINDING && (dropper != null))
|
||||
{
|
||||
final Location dropDest = GeoEngine.getInstance().canMoveToTargetLoc(dropper.getX(), dropper.getY(), dropper.getZ(), x, y, z, dropper.getInstanceId());
|
||||
|
||||
+2
-1
@@ -359,8 +359,9 @@ public class Multisell
|
||||
return list;
|
||||
}
|
||||
|
||||
protected MultiSellEntry parseEntry(Node n)
|
||||
protected MultiSellEntry parseEntry(Node node)
|
||||
{
|
||||
Node n = node;
|
||||
final int entryId = Integer.parseInt(n.getAttributes().getNamedItem("id").getNodeValue());
|
||||
final Node first = n.getFirstChild();
|
||||
final MultiSellEntry entry = new MultiSellEntry();
|
||||
|
||||
@@ -63,15 +63,15 @@ public class QuestSpawn
|
||||
/**
|
||||
* Add spawn for player instance Return object id of newly spawned npc
|
||||
* @param npcId
|
||||
* @param x
|
||||
* @param y
|
||||
* @param z
|
||||
* @param xValue
|
||||
* @param yValue
|
||||
* @param zValue
|
||||
* @param heading
|
||||
* @param randomOffset
|
||||
* @param despawnDelay
|
||||
* @return
|
||||
*/
|
||||
public NpcInstance addSpawn(int npcId, int x, int y, int z, int heading, boolean randomOffset, int despawnDelay)
|
||||
public NpcInstance addSpawn(int npcId, int xValue, int yValue, int zValue, int heading, boolean randomOffset, int despawnDelay)
|
||||
{
|
||||
NpcInstance result = null;
|
||||
|
||||
@@ -82,12 +82,14 @@ public class QuestSpawn
|
||||
{
|
||||
// Sometimes, even if the quest script specifies some xyz (for example npc.getX() etc) by the time the code reaches here, xyz have become 0! Also, a questdev might have purposely set xy to 0,0...however,
|
||||
// the spawn code is coded such that if x=y=0, it looks into location for the spawn loc! This will NOT work with quest spawns! For both of the above cases, we need a fail-safe spawn. For this, we use the default spawn location, which is at the player's loc.
|
||||
if ((x == 0) && (y == 0))
|
||||
if ((xValue == 0) && (yValue == 0))
|
||||
{
|
||||
LOGGER.warning("Failed to adjust bad locks for quest spawn! Spawn aborted!");
|
||||
return null;
|
||||
}
|
||||
|
||||
int x = xValue;
|
||||
int y = yValue;
|
||||
if (randomOffset)
|
||||
{
|
||||
int offset;
|
||||
@@ -114,11 +116,12 @@ public class QuestSpawn
|
||||
offset *= Rnd.get(50, 100);
|
||||
y += offset;
|
||||
}
|
||||
|
||||
final Spawn spawn = new Spawn(template);
|
||||
spawn.setHeading(heading);
|
||||
spawn.setX(x);
|
||||
spawn.setY(y);
|
||||
spawn.setZ(z + 20);
|
||||
spawn.setZ(zValue + 20);
|
||||
spawn.stopRespawn();
|
||||
result = spawn.doSpawn();
|
||||
if (despawnDelay > 0)
|
||||
|
||||
@@ -224,15 +224,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 = "";
|
||||
@@ -250,15 +251,16 @@ public class QuestState
|
||||
* <li>If the key represented by "var" exists in Map "vars", the couple (var,value) is updated in the database. The key is known as existing if the preceding value of the key (given as result of function put()) is not null.<br>
|
||||
* If the key doesn't exist, the couple is added/created in the database</li><br>
|
||||
* @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 = "";
|
||||
@@ -547,9 +549,9 @@ public class QuestState
|
||||
giveItems(itemId, count, 0);
|
||||
}
|
||||
|
||||
public synchronized void giveItems(int itemId, int count, int enchantlevel)
|
||||
public synchronized void giveItems(int itemId, int amount, int enchantlevel)
|
||||
{
|
||||
if (count <= 0)
|
||||
if (amount <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -557,6 +559,7 @@ public class QuestState
|
||||
final int questId = getQuest().getQuestId();
|
||||
|
||||
// If item for reward is gold (ID=57), modify count with rate for quest reward
|
||||
int count = amount;
|
||||
if ((itemId == 57) && ((questId < 217) || (questId > 233)) && ((questId < 401) || (questId > 418)))
|
||||
{
|
||||
count = (int) (count * Config.RATE_QUESTS_REWARD);
|
||||
@@ -609,9 +612,9 @@ public class QuestState
|
||||
* <li>Destroy quantity of items wanted</li>
|
||||
* <li>Send new inventory list to player</li><br>
|
||||
* @param itemId : Identifier of the item
|
||||
* @param count : Quantity of items to destroy
|
||||
* @param amount : Quantity of items to destroy
|
||||
*/
|
||||
public void takeItems(int itemId, int count)
|
||||
public void takeItems(int itemId, int amount)
|
||||
{
|
||||
// Get object item from player's inventory list
|
||||
final ItemInstance item = _player.getInventory().getItemByItemId(itemId);
|
||||
@@ -626,6 +629,7 @@ public class QuestState
|
||||
}
|
||||
|
||||
// Tests on count value in order not to have negative value
|
||||
int count = amount;
|
||||
if ((count < 0) || (count > item.getCount()))
|
||||
{
|
||||
count = item.getCount();
|
||||
@@ -702,9 +706,9 @@ public class QuestState
|
||||
switch (type)
|
||||
{
|
||||
case DROP_DIVMOD:
|
||||
dropChance *= Config.RATE_DROP_QUEST;
|
||||
amount = count * (dropChance / DropData.MAX_CHANCE);
|
||||
if (Rnd.get(DropData.MAX_CHANCE) < (dropChance % DropData.MAX_CHANCE))
|
||||
final int chanceWithQuestRate = (int) (dropChance * Config.RATE_DROP_QUEST);
|
||||
amount = count * (chanceWithQuestRate / DropData.MAX_CHANCE);
|
||||
if (Rnd.get(DropData.MAX_CHANCE) < (chanceWithQuestRate % DropData.MAX_CHANCE))
|
||||
{
|
||||
amount += count;
|
||||
}
|
||||
@@ -802,9 +806,9 @@ public class QuestState
|
||||
switch (type)
|
||||
{
|
||||
case DROP_DIVMOD:
|
||||
dropChance *= Config.RATE_DROP_QUEST;
|
||||
amount = count * (dropChance / DropData.MAX_CHANCE);
|
||||
if (Rnd.get(DropData.MAX_CHANCE) < (dropChance % DropData.MAX_CHANCE))
|
||||
final int chanceWithQuestRate = (int) (dropChance * Config.RATE_DROP_QUEST);
|
||||
amount = count * (chanceWithQuestRate / DropData.MAX_CHANCE);
|
||||
if (Rnd.get(DropData.MAX_CHANCE) < (chanceWithQuestRate % DropData.MAX_CHANCE))
|
||||
{
|
||||
amount += count;
|
||||
}
|
||||
@@ -902,8 +906,6 @@ public class QuestState
|
||||
|
||||
public boolean dropQuestItems(int itemId, int minCount, int maxCount, int neededCount, int dropChance, boolean sound)
|
||||
{
|
||||
dropChance *= Config.RATE_DROP_QUEST / (_player.getParty() != null ? _player.getParty().getMemberCount() : 1);
|
||||
|
||||
final int currentCount = getQuestItemsCount(itemId);
|
||||
if ((neededCount > 0) && (currentCount >= neededCount))
|
||||
{
|
||||
@@ -918,7 +920,8 @@ public class QuestState
|
||||
int itemCount = 0;
|
||||
final int random = Rnd.get(DropData.MAX_CHANCE);
|
||||
|
||||
while (random < dropChance)
|
||||
int chanceWithQuestRate = (int) (dropChance * (Config.RATE_DROP_QUEST / (_player.getParty() != null ? _player.getParty().getMemberCount() : 1)));
|
||||
while (random < chanceWithQuestRate)
|
||||
{
|
||||
// Get the item quantity dropped
|
||||
if (minCount < maxCount)
|
||||
@@ -935,7 +938,7 @@ public class QuestState
|
||||
}
|
||||
|
||||
// Prepare for next iteration if dropChance > DropData.MAX_CHANCE
|
||||
dropChance -= DropData.MAX_CHANCE;
|
||||
chanceWithQuestRate -= DropData.MAX_CHANCE;
|
||||
}
|
||||
|
||||
if (itemCount > 0)
|
||||
|
||||
@@ -81,16 +81,16 @@ public enum BaseStat
|
||||
|
||||
public static final BaseStat valueOfXml(String name)
|
||||
{
|
||||
name = name.intern();
|
||||
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
|
||||
|
||||
@@ -2668,33 +2668,27 @@ public class Formulas
|
||||
{
|
||||
case BLEED:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.BLEED_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.BLEED_VULN, multiplier, target, null);
|
||||
}
|
||||
case POISON:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.POISON_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.POISON_VULN, multiplier, target, null);
|
||||
}
|
||||
case STUN:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.STUN_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.STUN_VULN, multiplier, target, null);
|
||||
}
|
||||
case PARALYZE:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.PARALYZE_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.PARALYZE_VULN, multiplier, target, null);
|
||||
}
|
||||
case ROOT:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.ROOT_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.ROOT_VULN, multiplier, target, null);
|
||||
}
|
||||
case SLEEP:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.SLEEP_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.SLEEP_VULN, multiplier, target, null);
|
||||
}
|
||||
case MUTE:
|
||||
case FEAR:
|
||||
@@ -2702,32 +2696,24 @@ public class Formulas
|
||||
case AGGDEBUFF:
|
||||
case ERASE:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.DERANGEMENT_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.DERANGEMENT_VULN, multiplier, target, null);
|
||||
}
|
||||
case CONFUSION:
|
||||
case CONFUSE_MOB_ONLY:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.CONFUSION_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.CONFUSION_VULN, multiplier, target, null);
|
||||
}
|
||||
case DEBUFF:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.DEBUFF_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.DEBUFF_VULN, multiplier, target, null);
|
||||
}
|
||||
case BUFF:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.BUFF_VULN, multiplier, target, null);
|
||||
break;
|
||||
return target.calcStat(Stat.BUFF_VULN, multiplier, target, null);
|
||||
}
|
||||
case CANCEL:
|
||||
{
|
||||
multiplier = target.calcStat(Stat.CANCEL_VULN, multiplier, target, null);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
return target.calcStat(Stat.CANCEL_VULN, multiplier, target, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,22 +131,7 @@ public class AutoSpawn
|
||||
*/
|
||||
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)
|
||||
|
||||
@@ -525,21 +525,16 @@ public class Spawn
|
||||
}
|
||||
|
||||
/**
|
||||
* @param i delay in seconds
|
||||
* @param value delay in seconds
|
||||
*/
|
||||
public void setRespawnDelay(int i)
|
||||
public void setRespawnDelay(int value)
|
||||
{
|
||||
if (i < 0)
|
||||
if (value < 0)
|
||||
{
|
||||
LOGGER.warning("respawn delay is negative for spawnId:" + _id);
|
||||
}
|
||||
|
||||
if (i < 10)
|
||||
{
|
||||
i = 10;
|
||||
}
|
||||
|
||||
_respawnDelay = i * 1000;
|
||||
_respawnDelay = value < 10 ? 10000 : value * 1000;
|
||||
}
|
||||
|
||||
public NpcInstance getLastSpawn()
|
||||
|
||||
+5
-3
@@ -484,6 +484,7 @@ public class MultiSellChoose extends GameClientPacket
|
||||
}
|
||||
|
||||
// Now modify the enchantment level of products, if necessary
|
||||
int level = enchantLevel;
|
||||
for (MultiSellIngredient ing : templateEntry.getProducts())
|
||||
{
|
||||
// Load the ingredient from the template
|
||||
@@ -495,15 +496,16 @@ public class MultiSellChoose extends GameClientPacket
|
||||
final Item tempItem = ItemTable.getInstance().createDummyItem(newIngredient.getItemId()).getItem();
|
||||
if ((tempItem instanceof Armor) || (tempItem instanceof Weapon))
|
||||
{
|
||||
if ((enchantLevel == 0) && maintainEnchantment)
|
||||
if ((level == 0) && maintainEnchantment)
|
||||
{
|
||||
enchantLevel = ing.getEnchantmentLevel();
|
||||
level = ing.getEnchantmentLevel();
|
||||
}
|
||||
newIngredient.setEnchantmentLevel(enchantLevel);
|
||||
newIngredient.setEnchantmentLevel(level);
|
||||
}
|
||||
}
|
||||
newEntry.addProduct(newIngredient);
|
||||
}
|
||||
|
||||
return newEntry;
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -110,9 +110,9 @@ public class RequestConfirmRefinerItem extends GameClientPacket
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
|
||||
private int getLifeStoneGrade(int itemId)
|
||||
private int getLifeStoneGrade(int itemIdValue)
|
||||
{
|
||||
itemId -= 8723;
|
||||
int itemId = itemIdValue - 8723;
|
||||
if (itemId < 10)
|
||||
{
|
||||
return 0; // normal grade
|
||||
@@ -131,9 +131,9 @@ public class RequestConfirmRefinerItem extends GameClientPacket
|
||||
return 3; // top grade
|
||||
}
|
||||
|
||||
private int getLifeStoneLevel(int itemId)
|
||||
private int getLifeStoneLevel(int itemIdValue)
|
||||
{
|
||||
itemId -= 10 * getLifeStoneGrade(itemId);
|
||||
int itemId = itemIdValue - (10 * getLifeStoneGrade(itemIdValue));
|
||||
itemId -= 8722;
|
||||
return itemId;
|
||||
}
|
||||
|
||||
+4
-4
@@ -335,9 +335,9 @@ public class RequestRefine extends GameClientPacket
|
||||
return true;
|
||||
}
|
||||
|
||||
private int getLifeStoneGrade(int itemId)
|
||||
private int getLifeStoneGrade(int itemIdValue)
|
||||
{
|
||||
itemId -= 8723;
|
||||
int itemId = itemIdValue - 8723;
|
||||
if (itemId < 10)
|
||||
{
|
||||
return 0; // normal grade
|
||||
@@ -356,9 +356,9 @@ public class RequestRefine extends GameClientPacket
|
||||
return 3; // top grade
|
||||
}
|
||||
|
||||
private int getLifeStoneLevel(int itemId)
|
||||
private int getLifeStoneLevel(int itemIdValue)
|
||||
{
|
||||
itemId -= 10 * getLifeStoneGrade(itemId);
|
||||
int itemId = itemIdValue - (10 * getLifeStoneGrade(itemIdValue));
|
||||
itemId -= 8722;
|
||||
return itemId;
|
||||
}
|
||||
|
||||
+6
-5
@@ -145,16 +145,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());
|
||||
|
||||
+5
-4
@@ -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);
|
||||
|
||||
+6
-3
@@ -45,8 +45,9 @@ public class AttackStanceTaskManager
|
||||
ThreadPool.scheduleAtFixedRate(new FightModeScheduler(), 0, 1000);
|
||||
}
|
||||
|
||||
public void addAttackStanceTask(Creature actor)
|
||||
public void addAttackStanceTask(Creature creature)
|
||||
{
|
||||
Creature actor = creature;
|
||||
if (actor instanceof Summon)
|
||||
{
|
||||
final Summon summon = (Summon) actor;
|
||||
@@ -66,8 +67,9 @@ public class AttackStanceTaskManager
|
||||
_attackStanceTasks.put(actor, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void removeAttackStanceTask(Creature actor)
|
||||
public void removeAttackStanceTask(Creature creature)
|
||||
{
|
||||
Creature actor = creature;
|
||||
if (actor instanceof Summon)
|
||||
{
|
||||
final Summon summon = (Summon) actor;
|
||||
@@ -76,8 +78,9 @@ public class AttackStanceTaskManager
|
||||
_attackStanceTasks.remove(actor);
|
||||
}
|
||||
|
||||
public boolean hasAttackStanceTask(Creature actor)
|
||||
public boolean hasAttackStanceTask(Creature creature)
|
||||
{
|
||||
Creature actor = creature;
|
||||
if (actor instanceof Summon)
|
||||
{
|
||||
final Summon summon = (Summon) actor;
|
||||
|
||||
@@ -143,13 +143,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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,10 +105,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, GameServerPacket mov, int radius)
|
||||
public static void toKnownPlayersInRadius(Creature creature, GameServerPacket mov, int radiusValue)
|
||||
{
|
||||
int radius = radiusValue;
|
||||
if (radius < 0)
|
||||
{
|
||||
radius = 1500;
|
||||
@@ -149,8 +150,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, GameServerPacket mov, long radiusSq)
|
||||
public static void toSelfAndKnownPlayersInRadius(Creature creature, GameServerPacket mov, long radiusSqValue)
|
||||
{
|
||||
long radiusSq = radiusSqValue;
|
||||
if (radiusSq < 0)
|
||||
{
|
||||
radiusSq = 360000;
|
||||
|
||||
@@ -38,7 +38,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)
|
||||
@@ -63,6 +63,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);
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -71,7 +71,7 @@ public class TimeAmountInterpreter
|
||||
* Please keep in mind, that this method is primarily designed to be used with heap text builders. Therefore, if the given text builder throws an {@link IOException}, this exception will be wrapped in a {@link RuntimeException} and returned to the caller as an unchecked exception.
|
||||
* @param <T>
|
||||
* @param textBuilder a character sequence builder
|
||||
* @param timeAmount amount of time to be written
|
||||
* @param amount amount of time to be written
|
||||
* @param timeUnit unit of the given amount
|
||||
* @param minConsolidationUnit smallest unit to be included within the description
|
||||
* @param maxConsolidationUnit largest unit to be included within the description
|
||||
@@ -79,10 +79,11 @@ public class TimeAmountInterpreter
|
||||
* @return {@code textBuilder}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private static <T extends Appendable & CharSequence> T appendConsolidated(T textBuilder, long timeAmount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator)
|
||||
private static <T extends Appendable & CharSequence> T appendConsolidated(T textBuilder, long amount, TimeUnit timeUnit, TimeUnit minConsolidationUnit, TimeUnit maxConsolidationUnit, String noTimeUsedIndicator)
|
||||
{
|
||||
try
|
||||
{
|
||||
long timeAmount = amount;
|
||||
if (timeAmount < 1)
|
||||
{
|
||||
return (T) textBuilder.append(noTimeUsedIndicator);
|
||||
@@ -117,6 +118,7 @@ public class TimeAmountInterpreter
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
return textBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,12 +120,12 @@ public class Util
|
||||
/**
|
||||
* Capitalizes the first letter of a string, and returns the result.<br>
|
||||
* (Based on ucfirst() function of PHP)
|
||||
* @param str
|
||||
* @param value
|
||||
* @return String containing the modified string.
|
||||
*/
|
||||
public static String capitalizeFirst(String str)
|
||||
public static String capitalizeFirst(String value)
|
||||
{
|
||||
str = str.trim();
|
||||
String str = value.trim();
|
||||
if ((str.length() > 0) && Character.isLetter(str.charAt(0)))
|
||||
{
|
||||
return str.substring(0, 1).toUpperCase() + str.substring(1);
|
||||
@@ -258,12 +258,13 @@ public class Util
|
||||
|
||||
/**
|
||||
* Return amount of adena formatted with "," delimiter
|
||||
* @param amount
|
||||
* @param value
|
||||
* @return String formatted adena amount
|
||||
*/
|
||||
public static String formatAdena(int amount)
|
||||
public static String formatAdena(int value)
|
||||
{
|
||||
String s = "";
|
||||
int amount = value;
|
||||
int rem = amount % 1000;
|
||||
s = Integer.toString(rem);
|
||||
amount = (amount - rem) / 1000;
|
||||
|
||||
@@ -139,9 +139,10 @@ public class LoginClient extends MMOClient<MMOConnection<LoginClient>>
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean encrypt(ByteBuffer buf, int size)
|
||||
public boolean encrypt(ByteBuffer buf, int sizeValue)
|
||||
{
|
||||
final int offset = buf.position();
|
||||
int size = sizeValue;
|
||||
try
|
||||
{
|
||||
size = _loginCrypt.encrypt(buf.array(), offset, size);
|
||||
|
||||
+5
-4
@@ -100,16 +100,17 @@ public class DBInstallerConsole implements DBOutputInterface
|
||||
*/
|
||||
public DBInstallerConsole(String defDatabase, String dir, String host, String port, String user, String pass, String database, String mode) throws Exception
|
||||
{
|
||||
if ((database == null) || database.isEmpty())
|
||||
String currentDatabase = database;
|
||||
if ((currentDatabase == null) || currentDatabase.isEmpty())
|
||||
{
|
||||
database = defDatabase;
|
||||
currentDatabase = defDatabase;
|
||||
}
|
||||
|
||||
final MySqlConnect connector = new MySqlConnect(host, port, user, pass, database, true);
|
||||
final MySqlConnect connector = new MySqlConnect(host, port, user, pass, currentDatabase, true);
|
||||
_con = connector.getConnection();
|
||||
if ((mode != null) && ("c".equalsIgnoreCase(mode) || "u".equalsIgnoreCase(mode)))
|
||||
{
|
||||
final RunTasks rt = new RunTasks(this, database, dir);
|
||||
final RunTasks rt = new RunTasks(this, currentDatabase, dir);
|
||||
rt.run();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -271,11 +271,13 @@ public class GeoDataConverter
|
||||
* @param x : Geodata X coordinate.
|
||||
* @param y : Geodata Y coordinate.
|
||||
* @param z : Geodata Z coordinate.
|
||||
* @param nswe : NSWE flag to be updated.
|
||||
* @param nsweValue : NSWE flag to be updated.
|
||||
* @return byte : Updated NSWE flag.
|
||||
*/
|
||||
private static byte updateNsweBelow(int x, int y, short z, byte nswe)
|
||||
private static byte updateNsweBelow(int x, int y, short z, byte nsweValue)
|
||||
{
|
||||
byte nswe = nsweValue;
|
||||
|
||||
// calculate virtual layer height
|
||||
final short height = (short) (z + GeoStructure.CELL_IGNORE_HEIGHT);
|
||||
|
||||
|
||||
+3
-2
@@ -186,12 +186,13 @@ public abstract class BaseGameServerRegister
|
||||
|
||||
/**
|
||||
* Show the error.
|
||||
* @param msg the msg
|
||||
* @param message the msg
|
||||
* @param t the t
|
||||
*/
|
||||
public void showError(String msg, Throwable t)
|
||||
public void showError(String message, Throwable t)
|
||||
{
|
||||
String title;
|
||||
String msg = message;
|
||||
if (_bundle != null)
|
||||
{
|
||||
title = _bundle.getString("error");
|
||||
|
||||
+1
-2
@@ -321,7 +321,6 @@ public class GameServerRegister extends BaseGameServerRegister
|
||||
@Override
|
||||
public void showError(String msg, Throwable t)
|
||||
{
|
||||
msg += Config.EOL + "Reason: " + t.getLocalizedMessage();
|
||||
System.out.println("Error: " + msg);
|
||||
System.out.println("Error: " + msg + Config.EOL + "Reason: " + t.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user