Replaced assignments with compound operators.

This commit is contained in:
MobiusDev
2018-09-09 16:47:22 +00:00
parent b50b43a1f9
commit 96a39e7b73
127 changed files with 923 additions and 648 deletions
@@ -181,7 +181,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public void run() public void run()
{ {
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
// test 3 skills if some is lvl 4 // test 3 skills if some is lvl 4
if (_zone.getSkillLevel(i) > 3) if (_zone.getSkillLevel(i) > 3)
@@ -218,7 +218,7 @@ public final class DenOfEvil extends AbstractNpcAI
} }
} }
} }
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
_zone.removeSkill(i); _zone.removeSkill(i);
} }
@@ -90,7 +90,7 @@ public final class Anais extends AbstractNpcAI
final L2Object target = npc.getTarget(); final L2Object target = npc.getTarget();
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null; _nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot); final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1; _pot += 1;
b.setDisplayEffect(1); b.setDisplayEffect(1);
b.setWalking(); b.setWalking();
final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0); final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0);
@@ -1246,7 +1246,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1346,7 +1346,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -311,7 +311,7 @@ public final class Q00386_StolenDignity extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -328,7 +328,7 @@ public final class Q00386_StolenDignity extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
@@ -150,83 +150,83 @@ public final class Q00662_AGameOfCards extends Quest
} }
if (i1 >= 57) if (i1 >= 57)
{ {
i1 = i1 - 56; i1 -= 56;
} }
else if (i1 >= 43) else if (i1 >= 43)
{ {
i1 = i1 - 42; i1 -= 42;
} }
else if (i1 >= 29) else if (i1 >= 29)
{ {
i1 = i1 - 28; i1 -= 28;
} }
else if (i1 >= 15) else if (i1 >= 15)
{ {
i1 = i1 - 14; i1 -= 14;
} }
if (i2 >= 57) if (i2 >= 57)
{ {
i2 = i2 - 56; i2 -= 56;
} }
else if (i2 >= 43) else if (i2 >= 43)
{ {
i2 = i2 - 42; i2 -= 42;
} }
else if (i2 >= 29) else if (i2 >= 29)
{ {
i2 = i2 - 28; i2 -= 28;
} }
else if (i2 >= 15) else if (i2 >= 15)
{ {
i2 = i2 - 14; i2 -= 14;
} }
if (i3 >= 57) if (i3 >= 57)
{ {
i3 = i3 - 56; i3 -= 56;
} }
else if (i3 >= 43) else if (i3 >= 43)
{ {
i3 = i3 - 42; i3 -= 42;
} }
else if (i3 >= 29) else if (i3 >= 29)
{ {
i3 = i3 - 28; i3 -= 28;
} }
else if (i3 >= 15) else if (i3 >= 15)
{ {
i3 = i3 - 14; i3 -= 14;
} }
if (i4 >= 57) if (i4 >= 57)
{ {
i4 = i4 - 56; i4 -= 56;
} }
else if (i4 >= 43) else if (i4 >= 43)
{ {
i4 = i4 - 42; i4 -= 42;
} }
else if (i4 >= 29) else if (i4 >= 29)
{ {
i4 = i4 - 28; i4 -= 28;
} }
else if (i4 >= 15) else if (i4 >= 15)
{ {
i4 = i4 - 14; i4 -= 14;
} }
if (i5 >= 57) if (i5 >= 57)
{ {
i5 = i5 - 56; i5 -= 56;
} }
else if (i5 >= 43) else if (i5 >= 43)
{ {
i5 = i5 - 42; i5 -= 42;
} }
else if (i5 >= 29) else if (i5 >= 29)
{ {
i5 = i5 - 28; i5 -= 28;
} }
else if (i5 >= 15) else if (i5 >= 15)
{ {
i5 = i5 - 14; i5 -= 14;
} }
st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
@@ -256,7 +256,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 2) < 1) if ((i9 % 2) < 1)
{ {
i9 = i9 + 1; i9 += 1;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -268,7 +268,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 4) < 2) if ((i9 % 4) < 2)
{ {
i9 = i9 + 2; i9 += 2;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -280,7 +280,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 8) < 4) if ((i9 % 8) < 4)
{ {
i9 = i9 + 4; i9 += 4;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -292,7 +292,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 16) < 8) if ((i9 % 16) < 8)
{ {
i9 = i9 + 8; i9 += 8;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -304,7 +304,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 32) < 16) if ((i9 % 32) < 16)
{ {
i9 = i9 + 16; i9 += 16;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -326,23 +326,23 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i1 == i2) if (i1 == i2)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 8; i8 += 8;
} }
if (i1 == i3) if (i1 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (i1 == i4) if (i1 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (i1 == i5) if (i1 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
@@ -352,24 +352,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -382,24 +382,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -412,16 +412,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -434,16 +434,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -456,8 +456,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -470,8 +470,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -185,7 +185,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -125,7 +125,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = originalAttackTarget.getX() + newX; newX += originalAttackTarget.getX();
} }
else else
{ {
@@ -134,7 +134,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = originalAttackTarget.getY() + newY; newY += originalAttackTarget.getY();
} }
else else
{ {
@@ -167,20 +167,20 @@ public class FriendlyNpcAI extends L2AttackableAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -197,10 +197,10 @@ public class FriendlyNpcAI extends L2AttackableAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (originalAttackTarget.isMoving()) if (originalAttackTarget.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -757,7 +757,7 @@ public class L2AttackableAI extends L2CharacterAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = target.getX() + newX; newX += target.getX();
} }
else else
{ {
@@ -766,7 +766,7 @@ public class L2AttackableAI extends L2CharacterAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = target.getY() + newY; newY += target.getY();
} }
else else
{ {
@@ -799,20 +799,20 @@ public class L2AttackableAI extends L2CharacterAI
if (target.getX() < posX) if (target.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (target.getY() < posY) if (target.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -813,7 +813,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -102,7 +102,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -199,7 +199,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
final String seconds = String.format(format, FightTime % 60); final String seconds = String.format(format, FightTime % 60);
final String minutes = String.format(format, (FightTime % 3600) / 60); final String minutes = String.format(format, (FightTime % 3600) / 60);
return minutes + ":" + seconds; return minutes + ":" + seconds;
@@ -256,7 +256,7 @@ public final class Formulas
// Autoattack critical depends on level difference at high levels as well. // Autoattack critical depends on level difference at high levels as well.
if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78)) if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78))
{ {
rate = rate + (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125); rate += (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125);
} }
// Autoattack critical rate is limited between 3%-97%. // Autoattack critical rate is limited between 3%-97%.
@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height; final int _y2 = _r.y + _r.height;
// x1->x2 // x1->x2
for (int x = _x1; x < _x2; x = x + STEP) for (int x = _x1; x < _x2; x += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
} }
// y1->y2 // y1->y2
for (int y = _y1; y < _y2; y = y + STEP) for (int y = _y1; y < _y2; y += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);
@@ -87,7 +87,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return angleTarget; return angleTarget;
} }
@@ -127,7 +127,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -137,7 +137,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx)); double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = _in.read(data, receivedBytes, left); newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -181,7 +181,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public void run() public void run()
{ {
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
// test 3 skills if some is lvl 4 // test 3 skills if some is lvl 4
if (_zone.getSkillLevel(i) > 3) if (_zone.getSkillLevel(i) > 3)
@@ -218,7 +218,7 @@ public final class DenOfEvil extends AbstractNpcAI
} }
} }
} }
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
_zone.removeSkill(i); _zone.removeSkill(i);
} }
@@ -90,7 +90,7 @@ public final class Anais extends AbstractNpcAI
final L2Object target = npc.getTarget(); final L2Object target = npc.getTarget();
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null; _nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot); final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1; _pot += 1;
b.setDisplayEffect(1); b.setDisplayEffect(1);
b.setWalking(); b.setWalking();
final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0); final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0);
@@ -1266,7 +1266,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1366,7 +1366,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -311,7 +311,7 @@ public final class Q00386_StolenDignity extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -328,7 +328,7 @@ public final class Q00386_StolenDignity extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
@@ -150,83 +150,83 @@ public final class Q00662_AGameOfCards extends Quest
} }
if (i1 >= 57) if (i1 >= 57)
{ {
i1 = i1 - 56; i1 -= 56;
} }
else if (i1 >= 43) else if (i1 >= 43)
{ {
i1 = i1 - 42; i1 -= 42;
} }
else if (i1 >= 29) else if (i1 >= 29)
{ {
i1 = i1 - 28; i1 -= 28;
} }
else if (i1 >= 15) else if (i1 >= 15)
{ {
i1 = i1 - 14; i1 -= 14;
} }
if (i2 >= 57) if (i2 >= 57)
{ {
i2 = i2 - 56; i2 -= 56;
} }
else if (i2 >= 43) else if (i2 >= 43)
{ {
i2 = i2 - 42; i2 -= 42;
} }
else if (i2 >= 29) else if (i2 >= 29)
{ {
i2 = i2 - 28; i2 -= 28;
} }
else if (i2 >= 15) else if (i2 >= 15)
{ {
i2 = i2 - 14; i2 -= 14;
} }
if (i3 >= 57) if (i3 >= 57)
{ {
i3 = i3 - 56; i3 -= 56;
} }
else if (i3 >= 43) else if (i3 >= 43)
{ {
i3 = i3 - 42; i3 -= 42;
} }
else if (i3 >= 29) else if (i3 >= 29)
{ {
i3 = i3 - 28; i3 -= 28;
} }
else if (i3 >= 15) else if (i3 >= 15)
{ {
i3 = i3 - 14; i3 -= 14;
} }
if (i4 >= 57) if (i4 >= 57)
{ {
i4 = i4 - 56; i4 -= 56;
} }
else if (i4 >= 43) else if (i4 >= 43)
{ {
i4 = i4 - 42; i4 -= 42;
} }
else if (i4 >= 29) else if (i4 >= 29)
{ {
i4 = i4 - 28; i4 -= 28;
} }
else if (i4 >= 15) else if (i4 >= 15)
{ {
i4 = i4 - 14; i4 -= 14;
} }
if (i5 >= 57) if (i5 >= 57)
{ {
i5 = i5 - 56; i5 -= 56;
} }
else if (i5 >= 43) else if (i5 >= 43)
{ {
i5 = i5 - 42; i5 -= 42;
} }
else if (i5 >= 29) else if (i5 >= 29)
{ {
i5 = i5 - 28; i5 -= 28;
} }
else if (i5 >= 15) else if (i5 >= 15)
{ {
i5 = i5 - 14; i5 -= 14;
} }
st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
@@ -256,7 +256,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 2) < 1) if ((i9 % 2) < 1)
{ {
i9 = i9 + 1; i9 += 1;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -268,7 +268,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 4) < 2) if ((i9 % 4) < 2)
{ {
i9 = i9 + 2; i9 += 2;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -280,7 +280,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 8) < 4) if ((i9 % 8) < 4)
{ {
i9 = i9 + 4; i9 += 4;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -292,7 +292,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 16) < 8) if ((i9 % 16) < 8)
{ {
i9 = i9 + 8; i9 += 8;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -304,7 +304,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 32) < 16) if ((i9 % 32) < 16)
{ {
i9 = i9 + 16; i9 += 16;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -326,23 +326,23 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i1 == i2) if (i1 == i2)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 8; i8 += 8;
} }
if (i1 == i3) if (i1 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (i1 == i4) if (i1 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (i1 == i5) if (i1 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
@@ -352,24 +352,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -382,24 +382,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -412,16 +412,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -434,16 +434,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -456,8 +456,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -470,8 +470,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -185,7 +185,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -125,7 +125,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = originalAttackTarget.getX() + newX; newX += originalAttackTarget.getX();
} }
else else
{ {
@@ -134,7 +134,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = originalAttackTarget.getY() + newY; newY += originalAttackTarget.getY();
} }
else else
{ {
@@ -167,20 +167,20 @@ public class FriendlyNpcAI extends L2AttackableAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -197,10 +197,10 @@ public class FriendlyNpcAI extends L2AttackableAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (originalAttackTarget.isMoving()) if (originalAttackTarget.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -757,7 +757,7 @@ public class L2AttackableAI extends L2CharacterAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = target.getX() + newX; newX += target.getX();
} }
else else
{ {
@@ -766,7 +766,7 @@ public class L2AttackableAI extends L2CharacterAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = target.getY() + newY; newY += target.getY();
} }
else else
{ {
@@ -799,20 +799,20 @@ public class L2AttackableAI extends L2CharacterAI
if (target.getX() < posX) if (target.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (target.getY() < posY) if (target.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -813,7 +813,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -102,7 +102,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -199,7 +199,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
final String seconds = String.format(format, FightTime % 60); final String seconds = String.format(format, FightTime % 60);
final String minutes = String.format(format, (FightTime % 3600) / 60); final String minutes = String.format(format, (FightTime % 3600) / 60);
return minutes + ":" + seconds; return minutes + ":" + seconds;
@@ -256,7 +256,7 @@ public final class Formulas
// Autoattack critical depends on level difference at high levels as well. // Autoattack critical depends on level difference at high levels as well.
if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78)) if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78))
{ {
rate = rate + (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125); rate += (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125);
} }
// Autoattack critical rate is limited between 3%-97%. // Autoattack critical rate is limited between 3%-97%.
@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height; final int _y2 = _r.y + _r.height;
// x1->x2 // x1->x2
for (int x = _x1; x < _x2; x = x + STEP) for (int x = _x1; x < _x2; x += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
} }
// y1->y2 // y1->y2
for (int y = _y1; y < _y2; y = y + STEP) for (int y = _y1; y < _y2; y += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);
@@ -87,7 +87,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return angleTarget; return angleTarget;
} }
@@ -127,7 +127,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -137,7 +137,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx)); double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = _in.read(data, receivedBytes, left); newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -181,7 +181,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public void run() public void run()
{ {
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
// test 3 skills if some is lvl 4 // test 3 skills if some is lvl 4
if (_zone.getSkillLevel(i) > 3) if (_zone.getSkillLevel(i) > 3)
@@ -218,7 +218,7 @@ public final class DenOfEvil extends AbstractNpcAI
} }
} }
} }
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
_zone.removeSkill(i); _zone.removeSkill(i);
} }
@@ -90,7 +90,7 @@ public final class Anais extends AbstractNpcAI
final L2Object target = npc.getTarget(); final L2Object target = npc.getTarget();
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null; _nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot); final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1; _pot += 1;
b.setDisplayEffect(1); b.setDisplayEffect(1);
b.setWalking(); b.setWalking();
final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0); final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0);
@@ -1266,7 +1266,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1366,7 +1366,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -311,7 +311,7 @@ public final class Q00386_StolenDignity extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -328,7 +328,7 @@ public final class Q00386_StolenDignity extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
@@ -150,83 +150,83 @@ public final class Q00662_AGameOfCards extends Quest
} }
if (i1 >= 57) if (i1 >= 57)
{ {
i1 = i1 - 56; i1 -= 56;
} }
else if (i1 >= 43) else if (i1 >= 43)
{ {
i1 = i1 - 42; i1 -= 42;
} }
else if (i1 >= 29) else if (i1 >= 29)
{ {
i1 = i1 - 28; i1 -= 28;
} }
else if (i1 >= 15) else if (i1 >= 15)
{ {
i1 = i1 - 14; i1 -= 14;
} }
if (i2 >= 57) if (i2 >= 57)
{ {
i2 = i2 - 56; i2 -= 56;
} }
else if (i2 >= 43) else if (i2 >= 43)
{ {
i2 = i2 - 42; i2 -= 42;
} }
else if (i2 >= 29) else if (i2 >= 29)
{ {
i2 = i2 - 28; i2 -= 28;
} }
else if (i2 >= 15) else if (i2 >= 15)
{ {
i2 = i2 - 14; i2 -= 14;
} }
if (i3 >= 57) if (i3 >= 57)
{ {
i3 = i3 - 56; i3 -= 56;
} }
else if (i3 >= 43) else if (i3 >= 43)
{ {
i3 = i3 - 42; i3 -= 42;
} }
else if (i3 >= 29) else if (i3 >= 29)
{ {
i3 = i3 - 28; i3 -= 28;
} }
else if (i3 >= 15) else if (i3 >= 15)
{ {
i3 = i3 - 14; i3 -= 14;
} }
if (i4 >= 57) if (i4 >= 57)
{ {
i4 = i4 - 56; i4 -= 56;
} }
else if (i4 >= 43) else if (i4 >= 43)
{ {
i4 = i4 - 42; i4 -= 42;
} }
else if (i4 >= 29) else if (i4 >= 29)
{ {
i4 = i4 - 28; i4 -= 28;
} }
else if (i4 >= 15) else if (i4 >= 15)
{ {
i4 = i4 - 14; i4 -= 14;
} }
if (i5 >= 57) if (i5 >= 57)
{ {
i5 = i5 - 56; i5 -= 56;
} }
else if (i5 >= 43) else if (i5 >= 43)
{ {
i5 = i5 - 42; i5 -= 42;
} }
else if (i5 >= 29) else if (i5 >= 29)
{ {
i5 = i5 - 28; i5 -= 28;
} }
else if (i5 >= 15) else if (i5 >= 15)
{ {
i5 = i5 - 14; i5 -= 14;
} }
st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
@@ -256,7 +256,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 2) < 1) if ((i9 % 2) < 1)
{ {
i9 = i9 + 1; i9 += 1;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -268,7 +268,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 4) < 2) if ((i9 % 4) < 2)
{ {
i9 = i9 + 2; i9 += 2;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -280,7 +280,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 8) < 4) if ((i9 % 8) < 4)
{ {
i9 = i9 + 4; i9 += 4;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -292,7 +292,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 16) < 8) if ((i9 % 16) < 8)
{ {
i9 = i9 + 8; i9 += 8;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -304,7 +304,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 32) < 16) if ((i9 % 32) < 16)
{ {
i9 = i9 + 16; i9 += 16;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -326,23 +326,23 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i1 == i2) if (i1 == i2)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 8; i8 += 8;
} }
if (i1 == i3) if (i1 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (i1 == i4) if (i1 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (i1 == i5) if (i1 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
@@ -352,24 +352,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -382,24 +382,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -412,16 +412,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -434,16 +434,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -456,8 +456,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -470,8 +470,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -187,7 +187,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -125,7 +125,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = originalAttackTarget.getX() + newX; newX += originalAttackTarget.getX();
} }
else else
{ {
@@ -134,7 +134,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = originalAttackTarget.getY() + newY; newY += originalAttackTarget.getY();
} }
else else
{ {
@@ -167,20 +167,20 @@ public class FriendlyNpcAI extends L2AttackableAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -197,10 +197,10 @@ public class FriendlyNpcAI extends L2AttackableAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (originalAttackTarget.isMoving()) if (originalAttackTarget.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -757,7 +757,7 @@ public class L2AttackableAI extends L2CharacterAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = target.getX() + newX; newX += target.getX();
} }
else else
{ {
@@ -766,7 +766,7 @@ public class L2AttackableAI extends L2CharacterAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = target.getY() + newY; newY += target.getY();
} }
else else
{ {
@@ -799,20 +799,20 @@ public class L2AttackableAI extends L2CharacterAI
if (target.getX() < posX) if (target.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (target.getY() < posY) if (target.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -813,7 +813,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -102,7 +102,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -199,7 +199,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
final String seconds = String.format(format, FightTime % 60); final String seconds = String.format(format, FightTime % 60);
final String minutes = String.format(format, (FightTime % 3600) / 60); final String minutes = String.format(format, (FightTime % 3600) / 60);
return minutes + ":" + seconds; return minutes + ":" + seconds;
@@ -256,7 +256,7 @@ public final class Formulas
// Autoattack critical depends on level difference at high levels as well. // Autoattack critical depends on level difference at high levels as well.
if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78)) if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78))
{ {
rate = rate + (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125); rate += (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125);
} }
// Autoattack critical rate is limited between 3%-97%. // Autoattack critical rate is limited between 3%-97%.
@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height; final int _y2 = _r.y + _r.height;
// x1->x2 // x1->x2
for (int x = _x1; x < _x2; x = x + STEP) for (int x = _x1; x < _x2; x += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
} }
// y1->y2 // y1->y2
for (int y = _y1; y < _y2; y = y + STEP) for (int y = _y1; y < _y2; y += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);
@@ -87,7 +87,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return angleTarget; return angleTarget;
} }
@@ -127,7 +127,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -137,7 +137,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx)); double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = _in.read(data, receivedBytes, left); newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -181,7 +181,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public void run() public void run()
{ {
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
// test 3 skills if some is lvl 4 // test 3 skills if some is lvl 4
if (_zone.getSkillLevel(i) > 3) if (_zone.getSkillLevel(i) > 3)
@@ -218,7 +218,7 @@ public final class DenOfEvil extends AbstractNpcAI
} }
} }
} }
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
_zone.removeSkill(i); _zone.removeSkill(i);
} }
@@ -90,7 +90,7 @@ public final class Anais extends AbstractNpcAI
final L2Object target = npc.getTarget(); final L2Object target = npc.getTarget();
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null; _nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot); final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1; _pot += 1;
b.setDisplayEffect(1); b.setDisplayEffect(1);
b.setWalking(); b.setWalking();
final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0); final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0);
@@ -1266,7 +1266,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1366,7 +1366,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -311,7 +311,7 @@ public final class Q00386_StolenDignity extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -328,7 +328,7 @@ public final class Q00386_StolenDignity extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
@@ -150,83 +150,83 @@ public final class Q00662_AGameOfCards extends Quest
} }
if (i1 >= 57) if (i1 >= 57)
{ {
i1 = i1 - 56; i1 -= 56;
} }
else if (i1 >= 43) else if (i1 >= 43)
{ {
i1 = i1 - 42; i1 -= 42;
} }
else if (i1 >= 29) else if (i1 >= 29)
{ {
i1 = i1 - 28; i1 -= 28;
} }
else if (i1 >= 15) else if (i1 >= 15)
{ {
i1 = i1 - 14; i1 -= 14;
} }
if (i2 >= 57) if (i2 >= 57)
{ {
i2 = i2 - 56; i2 -= 56;
} }
else if (i2 >= 43) else if (i2 >= 43)
{ {
i2 = i2 - 42; i2 -= 42;
} }
else if (i2 >= 29) else if (i2 >= 29)
{ {
i2 = i2 - 28; i2 -= 28;
} }
else if (i2 >= 15) else if (i2 >= 15)
{ {
i2 = i2 - 14; i2 -= 14;
} }
if (i3 >= 57) if (i3 >= 57)
{ {
i3 = i3 - 56; i3 -= 56;
} }
else if (i3 >= 43) else if (i3 >= 43)
{ {
i3 = i3 - 42; i3 -= 42;
} }
else if (i3 >= 29) else if (i3 >= 29)
{ {
i3 = i3 - 28; i3 -= 28;
} }
else if (i3 >= 15) else if (i3 >= 15)
{ {
i3 = i3 - 14; i3 -= 14;
} }
if (i4 >= 57) if (i4 >= 57)
{ {
i4 = i4 - 56; i4 -= 56;
} }
else if (i4 >= 43) else if (i4 >= 43)
{ {
i4 = i4 - 42; i4 -= 42;
} }
else if (i4 >= 29) else if (i4 >= 29)
{ {
i4 = i4 - 28; i4 -= 28;
} }
else if (i4 >= 15) else if (i4 >= 15)
{ {
i4 = i4 - 14; i4 -= 14;
} }
if (i5 >= 57) if (i5 >= 57)
{ {
i5 = i5 - 56; i5 -= 56;
} }
else if (i5 >= 43) else if (i5 >= 43)
{ {
i5 = i5 - 42; i5 -= 42;
} }
else if (i5 >= 29) else if (i5 >= 29)
{ {
i5 = i5 - 28; i5 -= 28;
} }
else if (i5 >= 15) else if (i5 >= 15)
{ {
i5 = i5 - 14; i5 -= 14;
} }
st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); st.setCond((i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
@@ -256,7 +256,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 2) < 1) if ((i9 % 2) < 1)
{ {
i9 = i9 + 1; i9 += 1;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -268,7 +268,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 4) < 2) if ((i9 % 4) < 2)
{ {
i9 = i9 + 2; i9 += 2;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -280,7 +280,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 8) < 4) if ((i9 % 8) < 4)
{ {
i9 = i9 + 4; i9 += 4;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -292,7 +292,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 16) < 8) if ((i9 % 16) < 8)
{ {
i9 = i9 + 8; i9 += 8;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -304,7 +304,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 32) < 16) if ((i9 % 32) < 16)
{ {
i9 = i9 + 16; i9 += 16;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -326,23 +326,23 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i1 == i2) if (i1 == i2)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 8; i8 += 8;
} }
if (i1 == i3) if (i1 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (i1 == i4) if (i1 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (i1 == i5) if (i1 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
@@ -352,24 +352,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -382,24 +382,24 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i2 == i3) if (i2 == i3)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 4; i8 += 4;
} }
} }
if ((i8 % 4) < 2) if ((i8 % 4) < 2)
{ {
if (i2 == i4) if (i2 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i2 == i5) if (i2 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -412,16 +412,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -434,16 +434,16 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i3 == i4) if (i3 == i4)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
} }
if ((i8 % 2) < 1) if ((i8 % 2) < 1)
{ {
if (i3 == i5) if (i3 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -456,8 +456,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -470,8 +470,8 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i4 == i5) if (i4 == i5)
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -187,7 +187,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -125,7 +125,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = originalAttackTarget.getX() + newX; newX += originalAttackTarget.getX();
} }
else else
{ {
@@ -134,7 +134,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = originalAttackTarget.getY() + newY; newY += originalAttackTarget.getY();
} }
else else
{ {
@@ -167,20 +167,20 @@ public class FriendlyNpcAI extends L2AttackableAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -197,10 +197,10 @@ public class FriendlyNpcAI extends L2AttackableAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (originalAttackTarget.isMoving()) if (originalAttackTarget.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -757,7 +757,7 @@ public class L2AttackableAI extends L2CharacterAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = target.getX() + newX; newX += target.getX();
} }
else else
{ {
@@ -766,7 +766,7 @@ public class L2AttackableAI extends L2CharacterAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = target.getY() + newY; newY += target.getY();
} }
else else
{ {
@@ -799,20 +799,20 @@ public class L2AttackableAI extends L2CharacterAI
if (target.getX() < posX) if (target.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (target.getY() < posY) if (target.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -813,7 +813,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -102,7 +102,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -199,7 +199,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
final String seconds = String.format(format, FightTime % 60); final String seconds = String.format(format, FightTime % 60);
final String minutes = String.format(format, (FightTime % 3600) / 60); final String minutes = String.format(format, (FightTime % 3600) / 60);
return minutes + ":" + seconds; return minutes + ":" + seconds;
@@ -256,7 +256,7 @@ public final class Formulas
// Autoattack critical depends on level difference at high levels as well. // Autoattack critical depends on level difference at high levels as well.
if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78)) if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78))
{ {
rate = rate + (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125); rate += (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125);
} }
// Autoattack critical rate is limited between 3%-97%. // Autoattack critical rate is limited between 3%-97%.
@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height; final int _y2 = _r.y + _r.height;
// x1->x2 // x1->x2
for (int x = _x1; x < _x2; x = x + STEP) for (int x = _x1; x < _x2; x += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
} }
// y1->y2 // y1->y2
for (int y = _y1; y < _y2; y = y + STEP) for (int y = _y1; y < _y2; y += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);
@@ -87,7 +87,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return angleTarget; return angleTarget;
} }
@@ -127,7 +127,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -137,7 +137,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx)); double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = _in.read(data, receivedBytes, left); newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -136,7 +136,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -117,7 +117,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -181,7 +181,7 @@ public final class DenOfEvil extends AbstractNpcAI
@Override @Override
public void run() public void run()
{ {
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
// test 3 skills if some is lvl 4 // test 3 skills if some is lvl 4
if (_zone.getSkillLevel(i) > 3) if (_zone.getSkillLevel(i) > 3)
@@ -221,7 +221,7 @@ public final class DenOfEvil extends AbstractNpcAI
} }
} }
} }
for (int i = SKILL_ID; i <= (SKILL_ID + 4); i = i + 2) for (int i = SKILL_ID; i <= (SKILL_ID + 4); i += 2)
{ {
_zone.removeSkill(i); _zone.removeSkill(i);
} }
@@ -88,7 +88,7 @@ public final class Anais extends AbstractNpcAI
final L2Object target = npc.getTarget(); final L2Object target = npc.getTarget();
_nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null; _nextTarget = (target != null) && target.isPlayer() ? (L2PcInstance) target : null;
final L2Npc b = _divineBurners.get(_pot); final L2Npc b = _divineBurners.get(_pot);
_pot = _pot + 1; _pot += 1;
b.setDisplayEffect(1); b.setDisplayEffect(1);
b.setWalking(); b.setWalking();
final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0); final L2Npc ward = addSpawn(GRAIL_WARD, new Location(b.getX(), b.getY(), b.getZ()), true, 0);
@@ -1164,7 +1164,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1267,7 +1267,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -102,7 +102,7 @@ public final class Pumping extends AbstractEffect
{ {
player.sendPacket(SystemMessageId.DUE_TO_YOUR_REELING_AND_OR_PUMPING_SKILL_BEING_THREE_OR_MORE_LEVELS_HIGHER_THAN_YOUR_FISHING_SKILL_A_50_DAMAGE_PENALTY_WILL_BE_APPLIED); player.sendPacket(SystemMessageId.DUE_TO_YOUR_REELING_AND_OR_PUMPING_SKILL_BEING_THREE_OR_MORE_LEVELS_HIGHER_THAN_YOUR_FISHING_SKILL_A_50_DAMAGE_PENALTY_WILL_BE_APPLIED);
pen = (int) (dmg * 0.05); pen = (int) (dmg * 0.05);
dmg = dmg - pen; dmg -= pen;
} }
if (SS > 1) if (SS > 1)
{ {
@@ -102,7 +102,7 @@ public final class Reeling extends AbstractEffect
{ {
player.sendPacket(SystemMessageId.DUE_TO_YOUR_REELING_AND_OR_PUMPING_SKILL_BEING_THREE_OR_MORE_LEVELS_HIGHER_THAN_YOUR_FISHING_SKILL_A_50_DAMAGE_PENALTY_WILL_BE_APPLIED); player.sendPacket(SystemMessageId.DUE_TO_YOUR_REELING_AND_OR_PUMPING_SKILL_BEING_THREE_OR_MORE_LEVELS_HIGHER_THAN_YOUR_FISHING_SKILL_A_50_DAMAGE_PENALTY_WILL_BE_APPLIED);
pen = (int) (dmg * 0.05); pen = (int) (dmg * 0.05);
dmg = dmg - pen; dmg -= pen;
} }
if (SS > 1) if (SS > 1)
{ {
@@ -781,11 +781,11 @@ public class Q00335_TheSongOfTheHunter extends Quest
} }
} }
i0 = 33520 + i0; i0 += 33520;
i1 = 33520 + i1; i1 += 33520;
i2 = 33520 + i2; i2 += 33520;
i3 = 33520 + i3; i3 += 33520;
i4 = 33520 + i4; i4 += 33520;
htmltext = getHtml(player, "30745-16.html", i0, i1, i2, i3, i4); htmltext = getHtml(player, "30745-16.html", i0, i1, i2, i3, i4);
} }
@@ -793,20 +793,20 @@ public class Q00335_TheSongOfTheHunter extends Quest
{ {
i5 = qs.getMemoState(); i5 = qs.getMemoState();
i0 = i5 % 32; i0 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i1 = i5 % 32; i1 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i2 = i5 % 32; i2 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i3 = i5 % 32; i3 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i4 = i5 % 32; i4 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i0 = 33520 + i0; i0 += 33520;
i1 = 33520 + i1; i1 += 33520;
i2 = 33520 + i2; i2 += 33520;
i3 = 33520 + i3; i3 += 33520;
i4 = 33520 + i4; i4 += 33520;
htmltext = getHtml(player, "30745-16.html", i4, i3, i2, i1, i0); htmltext = getHtml(player, "30745-16.html", i4, i3, i2, i1, i0);
} }
@@ -901,15 +901,15 @@ public class Q00335_TheSongOfTheHunter extends Quest
{ {
i5 = qs.getMemoState(); i5 = qs.getMemoState();
i0 = i5 % 32; i0 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i1 = i5 % 32; i1 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i2 = i5 % 32; i2 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i3 = i5 % 32; i3 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i4 = i5 % 32; i4 = i5 % 32;
i5 = i5 / 32; i5 /= 32;
i0 = 33520 + (i0 + 20); i0 = 33520 + (i0 + 20);
i1 = 33520 + (i1 + 20); i1 = 33520 + (i1 + 20);
i2 = 33520 + (i2 + 20); i2 = 33520 + (i2 + 20);
@@ -985,23 +985,23 @@ public class Q00348_AnArrogantSearch extends Quest
int i0 = memoStateEx % 10; int i0 = memoStateEx % 10;
if (i0 >= 4) if (i0 >= 4)
{ {
i1 = i1 + 6; i1 += 6;
i0 = i0 - 4; i0 -= 4;
i2 = i2 + 1; i2 += 1;
} }
if (i0 >= 2) if (i0 >= 2)
{ {
i0 = i0 - 2; i0 -= 2;
i1 = i1 + 1; i1 += 1;
i2 = i2 + 1; i2 += 1;
} }
if (i0 >= 1) if (i0 >= 1)
{ {
i1 = i1 + 3; i1 += 3;
i2 = i2 + 1; i2 += 1;
i0 = i0 - 1; i0 -= 1;
} }
if (i0 == 0) if (i0 == 0)
@@ -357,7 +357,7 @@ public final class Q00384_WarehouseKeepersPastime extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
int i1 = getNumberFromBingoBoard(qs, i0); int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -374,7 +374,7 @@ public final class Q00384_WarehouseKeepersPastime extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
int i1 = getNumberFromBingoBoard(qs, i0); int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", (isSelectedBingoNumber(qs, i1)) ? "ff0000" : "ffffff");
@@ -320,7 +320,7 @@ public final class Q00386_StolenDignity extends Quest
private String fillBoard(L2PcInstance player, QuestState qs, String html) private String fillBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
if (isSelectedBingoNumber(qs, i1)) if (isSelectedBingoNumber(qs, i1))
@@ -337,7 +337,7 @@ public final class Q00386_StolenDignity extends Quest
private String colorBoard(L2PcInstance player, QuestState qs, String html) private String colorBoard(L2PcInstance player, QuestState qs, String html)
{ {
for (int i0 = 0; i0 < 9; i0 = i0 + 1) for (int i0 = 0; i0 < 9; i0 += 1)
{ {
final int i1 = getNumberFromBingoBoard(qs, i0); final int i1 = getNumberFromBingoBoard(qs, i0);
html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff"); html = html.replace("<?FontColor" + (i0 + 1) + "?>", isSelectedBingoNumber(qs, i1) ? "ff0000" : "ffffff");
@@ -297,7 +297,7 @@ public final class Q00419_GetAPet extends Quest
int i7 = 1; int i7 = 1;
for (int i = 1; i <= randomLinkOffset; i++) for (int i = 1; i <= randomLinkOffset; i++)
{ {
i7 = i7 * 2; i7 *= 2;
} }
if (((i7 & qs.getMemoState()) == 0) && (randomLinkOffset < 18)) if (((i7 & qs.getMemoState()) == 0) && (randomLinkOffset < 18))
@@ -321,7 +321,7 @@ public final class Q00419_GetAPet extends Quest
int i7 = 1; int i7 = 1;
for (int i = 1; i <= randomReplyOffset; i++) for (int i = 1; i <= randomReplyOffset; i++)
{ {
i7 = i7 * 2; i7 *= 2;
} }
if (((i7 & i8) == 0) && (randomReplyOffset < 5)) if (((i7 & i8) == 0) && (randomReplyOffset < 5))
@@ -159,83 +159,83 @@ public final class Q00662_AGameOfCards extends Quest
} }
if (i1 >= 57) if (i1 >= 57)
{ {
i1 = i1 - 56; i1 -= 56;
} }
else if (i1 >= 43) else if (i1 >= 43)
{ {
i1 = i1 - 42; i1 -= 42;
} }
else if (i1 >= 29) else if (i1 >= 29)
{ {
i1 = i1 - 28; i1 -= 28;
} }
else if (i1 >= 15) else if (i1 >= 15)
{ {
i1 = i1 - 14; i1 -= 14;
} }
if (i2 >= 57) if (i2 >= 57)
{ {
i2 = i2 - 56; i2 -= 56;
} }
else if (i2 >= 43) else if (i2 >= 43)
{ {
i2 = i2 - 42; i2 -= 42;
} }
else if (i2 >= 29) else if (i2 >= 29)
{ {
i2 = i2 - 28; i2 -= 28;
} }
else if (i2 >= 15) else if (i2 >= 15)
{ {
i2 = i2 - 14; i2 -= 14;
} }
if (i3 >= 57) if (i3 >= 57)
{ {
i3 = i3 - 56; i3 -= 56;
} }
else if (i3 >= 43) else if (i3 >= 43)
{ {
i3 = i3 - 42; i3 -= 42;
} }
else if (i3 >= 29) else if (i3 >= 29)
{ {
i3 = i3 - 28; i3 -= 28;
} }
else if (i3 >= 15) else if (i3 >= 15)
{ {
i3 = i3 - 14; i3 -= 14;
} }
if (i4 >= 57) if (i4 >= 57)
{ {
i4 = i4 - 56; i4 -= 56;
} }
else if (i4 >= 43) else if (i4 >= 43)
{ {
i4 = i4 - 42; i4 -= 42;
} }
else if (i4 >= 29) else if (i4 >= 29)
{ {
i4 = i4 - 28; i4 -= 28;
} }
else if (i4 >= 15) else if (i4 >= 15)
{ {
i4 = i4 - 14; i4 -= 14;
} }
if (i5 >= 57) if (i5 >= 57)
{ {
i5 = i5 - 56; i5 -= 56;
} }
else if (i5 >= 43) else if (i5 >= 43)
{ {
i5 = i5 - 42; i5 -= 42;
} }
else if (i5 >= 29) else if (i5 >= 29)
{ {
i5 = i5 - 28; i5 -= 28;
} }
else if (i5 >= 15) else if (i5 >= 15)
{ {
i5 = i5 - 14; i5 -= 14;
} }
qs.set("v1", (i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1); qs.set("v1", (i4 * 1000000) + (i3 * 10000) + (i2 * 100) + i1);
qs.set("ExMemoState", i5); qs.set("ExMemoState", i5);
@@ -264,7 +264,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 2) < 1) if ((i9 % 2) < 1)
{ {
i9 = i9 + 1; i9 += 1;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -276,7 +276,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 4) < 2) if ((i9 % 4) < 2)
{ {
i9 = i9 + 2; i9 += 2;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -288,7 +288,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 8) < 4) if ((i9 % 8) < 4)
{ {
i9 = i9 + 4; i9 += 4;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -300,7 +300,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 16) < 8) if ((i9 % 16) < 8)
{ {
i9 = i9 + 8; i9 += 8;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -312,7 +312,7 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if ((i9 % 32) < 16) if ((i9 % 32) < 16)
{ {
i9 = i9 + 16; i9 += 16;
} }
if ((i9 % 32) < 31) if ((i9 % 32) < 31)
{ {
@@ -334,23 +334,23 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (i1 == i2) if (i1 == i2)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 8; i8 += 8;
} }
if (i1 == i3) if (i1 == i3)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (i1 == i4) if (i1 == i4)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (i1 == i5) if (i1 == i5)
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
@@ -358,18 +358,18 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (((i8 % 8) < 4) && (i2 == i3)) if (((i8 % 8) < 4) && (i2 == i3))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 4; i8 += 4;
} }
if (((i8 % 4) < 2) && (i2 == i4)) if (((i8 % 4) < 2) && (i2 == i4))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (((i8 % 2) < 1) && (i2 == i5)) if (((i8 % 2) < 1) && (i2 == i5))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -377,18 +377,18 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (((i8 % 8) < 4) && (i2 == i3)) if (((i8 % 8) < 4) && (i2 == i3))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 4; i8 += 4;
} }
if (((i8 % 4) < 2) && (i2 == i4)) if (((i8 % 4) < 2) && (i2 == i4))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
if (((i8 % 2) < 1) && (i2 == i5)) if (((i8 % 2) < 1) && (i2 == i5))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
@@ -397,13 +397,13 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (((i8 % 4) < 2) && (i3 == i4)) if (((i8 % 4) < 2) && (i3 == i4))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 2; i8 += 2;
} }
if (((i8 % 2) < 1) && (i3 == i5)) if (((i8 % 2) < 1) && (i3 == i5))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
} }
@@ -411,27 +411,27 @@ public final class Q00662_AGameOfCards extends Quest
{ {
if (((i8 % 4) < 2) && (i3 == i4)) if (((i8 % 4) < 2) && (i3 == i4))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 2; i8 += 2;
} }
if (((i8 % 2) < 1) && (i3 == i5)) if (((i8 % 2) < 1) && (i3 == i5))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
if ((i6 % 100) < 10) if ((i6 % 100) < 10)
{ {
if (((i8 % 4) < 2) && ((i8 % 2) < 1) && (i4 == i5)) if (((i8 % 4) < 2) && ((i8 % 2) < 1) && (i4 == i5))
{ {
i6 = i6 + 10; i6 += 10;
i8 = i8 + 1; i8 += 1;
} }
} }
else if (((i6 % 10) == 0) && ((i8 % 4) < 2) && ((i8 % 2) < 1) && (i4 == i5)) else if (((i6 % 10) == 0) && ((i8 % 4) < 2) && ((i8 % 2) < 1) && (i4 == i5))
{ {
i6 = i6 + 1; i6 += 1;
i8 = i8 + 1; i8 += 1;
} }
} }
@@ -252,7 +252,7 @@ public final class Q00692_HowtoOpposeEvil extends Quest
return false; return false;
} }
count = count / minCount; count /= minCount;
takeItems(player, itemId, count * minCount); takeItems(player, itemId, count * minCount);
rewardItems(player, rewardItemId, rewardCount * count); rewardItems(player, rewardItemId, rewardCount * count);
return true; return true;
@@ -185,7 +185,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -924,20 +924,20 @@ public class L2AttackableAI extends L2CharacterAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceId()))
@@ -1213,10 +1213,10 @@ public class L2AttackableAI extends L2CharacterAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (mostHate.isMoving()) if (mostHate.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -1304,7 +1304,7 @@ public class L2AttackableAI extends L2CharacterAI
final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius(); final double srange = sk.getCastRange() + caster.getTemplate().getCollisionRadius();
if (attackTarget.isMoving()) if (attackTarget.isMoving())
{ {
dist2 = dist2 - 30; dist2 -= 30;
} }
if (sk.isContinuous()) if (sk.isContinuous())
@@ -1901,7 +1901,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius(); range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving()) if (obj.isMoving())
{ {
dist2 = dist2 - 70; dist2 -= 70;
} }
} }
catch (NullPointerException e) catch (NullPointerException e)
@@ -1930,7 +1930,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius(); range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving()) if (obj.isMoving())
{ {
dist2 = dist2 - 70; dist2 -= 70;
} }
} }
catch (NullPointerException e) catch (NullPointerException e)
@@ -1969,7 +1969,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + targets.getTemplate().getCollisionRadius(); range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + targets.getTemplate().getCollisionRadius();
if (targets.isMoving()) if (targets.isMoving())
{ {
dist2 = dist2 - 70; dist2 -= 70;
} }
} }
catch (NullPointerException e) catch (NullPointerException e)
@@ -2002,7 +2002,7 @@ public class L2AttackableAI extends L2CharacterAI
range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius(); range = sk.getCastRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving()) if (obj.isMoving())
{ {
dist2 = dist2 - 70; dist2 -= 70;
} }
} }
catch (NullPointerException e) catch (NullPointerException e)
@@ -2118,7 +2118,7 @@ public class L2AttackableAI extends L2CharacterAI
range = actor.getPhysicalAttackRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius(); range = actor.getPhysicalAttackRange() + actor.getTemplate().getCollisionRadius() + obj.getTemplate().getCollisionRadius();
if (obj.isMoving()) if (obj.isMoving())
{ {
dist2 = dist2 - 70; dist2 -= 70;
} }
} }
catch (NullPointerException e) catch (NullPointerException e)
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -14,95 +14,370 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package ai.areas.Gracia.AI.NPC.GeneralDilios; package com.l2jmobius.gameserver.instancemanager;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jmobius.gameserver.enums.ChatType; import com.l2jmobius.Config;
import com.l2jmobius.gameserver.model.L2Spawn; import com.l2jmobius.commons.concurrent.ThreadPool;
import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.enums.Team;
import com.l2jmobius.gameserver.instancemanager.tasks.PenaltyRemoveTask;
import com.l2jmobius.gameserver.model.ArenaParticipantsHolder;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.NpcStringId; import com.l2jmobius.gameserver.model.itemcontainer.PcInventory;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay; import com.l2jmobius.gameserver.model.olympiad.OlympiadManager;
import com.l2jmobius.gameserver.model.zone.ZoneId;
import ai.AbstractNpcAI; import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameAddPlayer;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameChangeTeam;
import com.l2jmobius.gameserver.network.serverpackets.ExCubeGameRemovePlayer;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
/** /**
* Dilios AI * This class manage the player add/remove, team change and event arena status,<br>
* @author JIV, Sephiroth, Apocalipce * as the clearance of the participants list or liberate the arena.
* @author BiggBoss
*/ */
public final class GeneralDilios extends AbstractNpcAI public final class HandysBlockCheckerManager
{ {
private static final int GENERAL_ID = 32549; // All the participants and their team classified by arena
private static final int GUARD_ID = 32619; private static final ArenaParticipantsHolder[] _arenaPlayers = new ArenaParticipantsHolder[4];
private L2Npc _general = null; // Arena votes to start the game
private final Set<L2Spawn> _guards = Collections.newSetFromMap(new ConcurrentHashMap<>()); private static final Map<Integer, Integer> _arenaVotes = new HashMap<>();
private static final NpcStringId[] DILIOS_TEXT = // Arena Status, True = is being used, otherwise, False
private static final Map<Integer, Boolean> _arenaStatus = new HashMap<>();
// Registration request penalty (10 seconds)
protected static Set<Integer> _registrationPenalty = Collections.synchronizedSet(new HashSet<>());
/**
* Return the number of event-start votes for the specified arena id
* @param arenaId
* @return int (number of votes)
*/
public synchronized int getArenaVotes(int arenaId)
{ {
NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_WE_RE_GATHERING_BRAVE_ADVENTURERS_TO_ATTACK_TIAT_S_MOUNTED_TROOP_THAT_S_ROOTED_IN_THE_SEED_OF_DESTRUCTION, return _arenaVotes.get(arenaId);
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_DESTRUCTION_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE,
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_TIATS_MOUNTED_TROOP_IS_CURRENTLY_TRYING_TO_RETAKE_SEED_OF_DESTRUCTION_COMMIT_ALL_THE_AVAILABLE_REINFORCEMENTS_INTO_SEED_OF_DESTRUCTION,
NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_BRAVE_ADVENTURERS_WHO_HAVE_CHALLENGED_THE_SEED_OF_INFINITY_ARE_CURRENTLY_INFILTRATING_THE_HALL_OF_EROSION_THROUGH_THE_DEFENSIVELY_WEAK_HALL_OF_SUFFERING,
// NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_SWEEPING_THE_SEED_OF_INFINITY_IS_CURRENTLY_COMPLETE_TO_THE_HEART_OF_THE_SEED_EKIMUS_IS_BEING_DIRECTLY_ATTACKED_AND_THE_UNDEAD_REMAINING_IN_THE_HALL_OF_SUFFERING_ARE_BEING_ERADICATED,
NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_SEED_OF_INFINITY_IS_CURRENTLY_SECURED_UNDER_THE_FLAG_OF_THE_KEUCEREUS_ALLIANCE
// NpcStringId.MESSENGER_INFORM_THE_PATRONS_OF_THE_KEUCEREUS_ALLIANCE_BASE_THE_RESURRECTED_UNDEAD_IN_THE_SEED_OF_INFINITY_ARE_POURING_INTO_THE_HALL_OF_SUFFERING_AND_THE_HALL_OF_EROSION
// NpcStringId.MESSENGER_INFORM_THE_BROTHERS_IN_KUCEREUS_CLAN_OUTPOST_EKIMUS_IS_ABOUT_TO_BE_REVIVED_BY_THE_RESURRECTED_UNDEAD_IN_SEED_OF_INFINITY_SEND_ALL_REINFORCEMENTS_TO_THE_HEART_AND_THE_HALL_OF_SUFFERING
};
public GeneralDilios()
{
addSpawnId(GENERAL_ID, GUARD_ID);
} }
@Override /**
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) * Add a new vote to start the event for the specified arena id
* @param arena
*/
public synchronized void increaseArenaVotes(int arena)
{ {
if (event.startsWith("command_")) final int newVotes = _arenaVotes.get(arena) + 1;
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
if ((newVotes > (holder.getAllPlayers().size() / 2)) && !holder.getEvent().isStarted())
{ {
int value = Integer.parseInt(event.substring(8)); clearArenaVotes(arena);
if (value < 6) if ((holder.getBlueTeamSize() == 0) || (holder.getRedTeamSize() == 0))
{ {
_general.broadcastPacket(new NpcSay(_general.getObjectId(), ChatType.NPC_GENERAL, GENERAL_ID, NpcStringId.STABBING_THREE_TIMES)); return;
startQuestTimer("guard_animation_0", 3400, null, null); }
if (Config.HBCE_FAIR_PLAY)
{
holder.checkAndShuffle();
}
ThreadPool.execute(holder.getEvent().new StartEvent());
} }
else else
{ {
value = -1; _arenaVotes.put(arena, newVotes);
_general.broadcastPacket(new NpcSay(_general.getObjectId(), ChatType.NPC_SHOUT, GENERAL_ID, DILIOS_TEXT[getRandom(DILIOS_TEXT.length)]));
} }
startQuestTimer("command_" + (value + 1), 60000, null, null);
}
else if (event.startsWith("guard_animation_"))
{
final int value = Integer.parseInt(event.substring(16));
for (L2Spawn guard : _guards)
{
guard.getLastSpawn().broadcastSocialAction(4);
}
if (value < 2)
{
startQuestTimer("guard_animation_" + (value + 1), 1500, null, null);
}
}
return super.onAdvEvent(event, npc, player);
} }
@Override /**
public String onSpawn(L2Npc npc) * Will clear the votes queue (of event start) for the specified arena id
* @param arena
*/
public synchronized void clearArenaVotes(int arena)
{ {
if (npc.getId() == GENERAL_ID) _arenaVotes.put(arena, 0);
}
protected HandysBlockCheckerManager()
{ {
startQuestTimer("command_0", 60000, null, null); // Initialize arena status
_general = npc; _arenaStatus.put(0, false);
_arenaStatus.put(1, false);
_arenaStatus.put(2, false);
_arenaStatus.put(3, false);
// Initialize arena votes
_arenaVotes.put(0, 0);
_arenaVotes.put(1, 0);
_arenaVotes.put(2, 0);
_arenaVotes.put(3, 0);
} }
else if (npc.getId() == GUARD_ID)
/**
* Returns the players holder
* @param arena
* @return ArenaParticipantsHolder
*/
public ArenaParticipantsHolder getHolder(int arena)
{ {
_guards.add(npc.getSpawn()); return _arenaPlayers[arena];
} }
return super.onSpawn(npc);
/**
* Initializes the participants holder
*/
public void startUpParticipantsQueue()
{
for (int i = 0; i < 4; ++i)
{
_arenaPlayers[i] = new ArenaParticipantsHolder(i);
}
}
/**
* Add the player to the specified arena (through the specified arena manager) and send the needed server -> client packets
* @param player
* @param arenaId
* @return
*/
public boolean addPlayerToArena(L2PcInstance player, int arenaId)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
boolean isRed;
for (int i = 0; i < 4; i++)
{
if (_arenaPlayers[i].getAllPlayers().contains(player))
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ALREADY_REGISTERED_ON_THE_MATCH_WAITING_LIST);
msg.addString(player.getName());
player.sendPacket(msg);
return false;
}
}
if (player.isCursedWeaponEquipped())
{
player.sendPacket(SystemMessageId.YOU_CANNOT_REGISTER_WHILE_IN_POSSESSION_OF_A_CURSED_WEAPON);
return false;
}
if (player.isOnEvent() || player.isInOlympiadMode())
{
player.sendMessage("Couldnt register you due other event participation");
return false;
}
if (OlympiadManager.getInstance().isRegistered(player))
{
OlympiadManager.getInstance().unRegisterNoble(player);
player.sendPacket(SystemMessageId.APPLICANTS_FOR_THE_OLYMPIAD_UNDERGROUND_COLISEUM_OR_KRATEI_S_CUBE_MATCHES_CANNOT_REGISTER);
}
// if(UnderGroundColiseum.getInstance().isRegisteredPlayer(player))
// {
// UngerGroundColiseum.getInstance().removeParticipant(player);
// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
// }
// if(KrateiCubeManager.getInstance().isRegisteredPlayer(player))
// {
// KrateiCubeManager.getInstance().removeParticipant(player);
// player.sendPacket(SystemMessageId.COLISEUM_OLYMPIAD_KRATEIS_APPLICANTS_CANNOT_PARTICIPATE));
// }
if (_registrationPenalty.contains(player.getObjectId()))
{
player.sendPacket(SystemMessageId.YOU_MUST_WAIT_10_SECONDS_BEFORE_ATTEMPTING_TO_REGISTER_AGAIN);
return false;
}
if (holder.getBlueTeamSize() < holder.getRedTeamSize())
{
holder.addPlayer(player, 1);
isRed = false;
}
else
{
holder.addPlayer(player, 0);
isRed = true;
}
holder.broadCastPacketToTeam(new ExCubeGameAddPlayer(player, isRed));
return true;
}
}
/**
* Will remove the specified player from the specified team and arena and will send the needed packet to all his team mates / enemy team mates
* @param player
* @param arenaId
* @param team
*/
public void removePlayer(L2PcInstance player, int arenaId, int team)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arenaId];
synchronized (holder)
{
final boolean isRed = team == 0;
holder.removePlayer(player, team);
holder.broadCastPacketToTeam(new ExCubeGameRemovePlayer(player, isRed));
// End event if theres an empty team
final int teamSize = isRed ? holder.getRedTeamSize() : holder.getBlueTeamSize();
if (teamSize == 0)
{
holder.getEvent().endEventAbnormally();
}
_registrationPenalty.add(player.getObjectId());
schedulePenaltyRemoval(player.getObjectId());
}
}
/**
* Will change the player from one team to other (if possible) and will send the needed packets
* @param player
* @param arena
* @param team
*/
public void changePlayerToTeam(L2PcInstance player, int arena, int team)
{
final ArenaParticipantsHolder holder = _arenaPlayers[arena];
synchronized (holder)
{
final boolean isFromRed = holder.getRedPlayers().contains(player);
if (isFromRed && (holder.getBlueTeamSize() == 6))
{
player.sendMessage("The team is full");
return;
}
else if (!isFromRed && (holder.getRedTeamSize() == 6))
{
player.sendMessage("The team is full");
return;
}
final int futureTeam = isFromRed ? 1 : 0;
holder.addPlayer(player, futureTeam);
if (isFromRed)
{
holder.removePlayer(player, 0);
}
else
{
holder.removePlayer(player, 1);
}
holder.broadCastPacketToTeam(new ExCubeGameChangeTeam(player, isFromRed));
}
}
/**
* Will erase all participants from the specified holder
* @param arenaId
*/
public synchronized void clearPaticipantQueueByArenaId(int arenaId)
{
_arenaPlayers[arenaId].clearPlayers();
}
/**
* Returns true if arena is holding an event at this momment
* @param arenaId
* @return boolean
*/
public boolean arenaIsBeingUsed(int arenaId)
{
if ((arenaId < 0) || (arenaId > 3))
{
return false;
}
return _arenaStatus.get(arenaId);
}
/**
* Set the specified arena as being used
* @param arenaId
*/
public void setArenaBeingUsed(int arenaId)
{
_arenaStatus.put(arenaId, true);
}
/**
* Set as free the specified arena for future events
* @param arenaId
*/
public void setArenaFree(int arenaId)
{
_arenaStatus.put(arenaId, false);
}
/**
* Called when played logs out while participating in Block Checker Event
* @param player
*/
public void onDisconnect(L2PcInstance player)
{
final int arena = player.getBlockCheckerArena();
final int team = getHolder(arena).getPlayerTeam(player);
getInstance().removePlayer(player, arena, team);
if (player.getTeam() != Team.NONE)
{
player.stopAllEffects();
// Remove team aura
player.setTeam(Team.NONE);
// Remove the event items
final PcInventory inv = player.getInventory();
if (inv.getItemByItemId(13787) != null)
{
final long count = inv.getInventoryItemCount(13787, 0);
inv.destroyItemByItemId("Handys Block Checker", 13787, count, player, player);
}
if (inv.getItemByItemId(13788) != null)
{
final long count = inv.getInventoryItemCount(13788, 0);
inv.destroyItemByItemId("Handys Block Checker", 13788, count, player, player);
}
player.setInsideZone(ZoneId.PVP, false);
// Teleport Back
player.teleToLocation(-57478, -60367, -2370);
}
}
public void removePenalty(int objectId)
{
_registrationPenalty.remove(objectId);
}
private void schedulePenaltyRemoval(int objId)
{
ThreadPool.schedule(new PenaltyRemoveTask(objId), 10000);
}
/**
* Gets the single instance of {@code HandysBlockCheckerManager}.
* @return single instance of {@code HandysBlockCheckerManager}
*/
public static HandysBlockCheckerManager getInstance()
{
return SingletonHolder._instance;
}
private static class SingletonHolder
{
protected static final HandysBlockCheckerManager _instance = new HandysBlockCheckerManager();
} }
} }
@@ -846,7 +846,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -101,7 +101,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -193,7 +193,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
return String.format(format, (FightTime % 3600) / 60) + ":" + String.format(format, FightTime % 60); return String.format(format, (FightTime % 3600) / 60) + ":" + String.format(format, FightTime % 60);
} }
@@ -780,22 +780,22 @@ public final class Instance
else if ((remaining > 300000) && (emptyTimeLeft > 300000)) else if ((remaining > 300000) && (emptyTimeLeft > 300000))
{ {
interval = 300000; interval = 300000;
remaining = remaining - 300000; remaining -= 300000;
} }
else if ((remaining > 60000) && (emptyTimeLeft > 60000)) else if ((remaining > 60000) && (emptyTimeLeft > 60000))
{ {
interval = 60000; interval = 60000;
remaining = remaining - 60000; remaining -= 60000;
} }
else if ((remaining > 30000) && (emptyTimeLeft > 30000)) else if ((remaining > 30000) && (emptyTimeLeft > 30000))
{ {
interval = 30000; interval = 30000;
remaining = remaining - 30000; remaining -= 30000;
} }
else else
{ {
interval = 10000; interval = 10000;
remaining = remaining - 10000; remaining -= 10000;
} }
} }
else if (remaining > 300000) else if (remaining > 300000)
@@ -805,7 +805,7 @@ public final class Instance
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES);
sm.addString(Integer.toString(timeLeft)); sm.addString(Integer.toString(timeLeft));
Broadcast.toPlayersInInstance(sm, _id); Broadcast.toPlayersInInstance(sm, _id);
remaining = remaining - 300000; remaining -= 300000;
} }
else if (remaining > 60000) else if (remaining > 60000)
{ {
@@ -814,21 +814,21 @@ public final class Instance
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES); final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THIS_DUNGEON_WILL_EXPIRE_IN_S1_MINUTE_S_YOU_WILL_BE_FORCED_OUT_OF_THE_DUNGEON_WHEN_THE_TIME_EXPIRES);
sm.addString(Integer.toString(timeLeft)); sm.addString(Integer.toString(timeLeft));
Broadcast.toPlayersInInstance(sm, _id); Broadcast.toPlayersInInstance(sm, _id);
remaining = remaining - 60000; remaining -= 60000;
} }
else if (remaining > 30000) else if (remaining > 30000)
{ {
timeLeft = remaining / 1000; timeLeft = remaining / 1000;
interval = 30000; interval = 30000;
cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left."); cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left.");
remaining = remaining - 30000; remaining -= 30000;
} }
else else
{ {
timeLeft = remaining / 1000; timeLeft = remaining / 1000;
interval = 10000; interval = 10000;
cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left."); cs = new CreatureSay(0, ChatType.ALLIANCE, "Notice", timeLeft + " seconds left.");
remaining = remaining - 10000; remaining -= 10000;
} }
if (cs != null) if (cs != null)
{ {
@@ -1782,12 +1782,12 @@ public final class Formulas
attack_attribute += 100; attack_attribute += 100;
attack_attribute *= attack_attribute; attack_attribute *= attack_attribute;
attack_attribute_mod = (attack_attribute / 144.0) * attack_attribute_mod; attack_attribute_mod *= (attack_attribute / 144.0);
defence_attribute += 100; defence_attribute += 100;
defence_attribute *= defence_attribute; defence_attribute *= defence_attribute;
defence_attribute_mod = (defence_attribute / 169.0) * defence_attribute_mod; defence_attribute_mod *= (defence_attribute / 169.0);
double attribute_mod_diff = attack_attribute_mod - defence_attribute_mod; double attribute_mod_diff = attack_attribute_mod - defence_attribute_mod;
@@ -112,13 +112,13 @@ public class ZoneCuboid extends L2ZoneForm
final int _y2 = _r.y + _r.height; final int _y2 = _r.y + _r.height;
// x1->x2 // x1->x2
for (int x = _x1; x < _x2; x = x + STEP) for (int x = _x1; x < _x2; x += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y1, z);
dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z); dropDebugItem(Inventory.ADENA_ID, 1, x, _y2, z);
} }
// y1->y2 // y1->y2
for (int y = _y1; y < _y2; y = y + STEP) for (int y = _y1; y < _y2; y += STEP)
{ {
dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x1, y, z);
dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z); dropDebugItem(Inventory.ADENA_ID, 1, _x2, y, z);
@@ -49,21 +49,21 @@ public class ExUISetting implements IClientOutgoingPacket
if (_uiSettings.getCategories().containsKey(category)) if (_uiSettings.getCategories().containsKey(category))
{ {
final List<Integer> catElList1 = _uiSettings.getCategories().get(category); final List<Integer> catElList1 = _uiSettings.getCategories().get(category);
size = size + catElList1.size(); size += catElList1.size();
} }
category++; category++;
size++; size++;
if (_uiSettings.getCategories().containsKey(category)) if (_uiSettings.getCategories().containsKey(category))
{ {
final List<Integer> catElList2 = _uiSettings.getCategories().get(category); final List<Integer> catElList2 = _uiSettings.getCategories().get(category);
size = size + catElList2.size(); size += catElList2.size();
} }
category++; category++;
size = size + 4; size += 4;
if (_uiSettings.getKeys().containsKey(i)) if (_uiSettings.getKeys().containsKey(i))
{ {
final List<ActionKey> keyElList = _uiSettings.getKeys().get(i); final List<ActionKey> keyElList = _uiSettings.getKeys().get(i);
size = size + (keyElList.size() * 20); size += (keyElList.size() * 20);
} }
} }
buffsize = size; buffsize = size;
@@ -83,7 +83,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return angleTarget; return angleTarget;
} }
@@ -97,7 +97,7 @@ public final class Util
{ {
if (degree < 0) if (degree < 0)
{ {
degree = 360 + degree; degree += 360;
} }
return (int) (degree * 182.044444444); return (int) (degree * 182.044444444);
} }
@@ -112,7 +112,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX)); double angleTarget = Math.toDegrees(Math.atan2(toY - fromY, toX - fromX));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -122,7 +122,7 @@ public final class Util
double angleTarget = Math.toDegrees(Math.atan2(dy, dx)); double angleTarget = Math.toDegrees(Math.atan2(dy, dx));
if (angleTarget < 0) if (angleTarget < 0)
{ {
angleTarget = 360 + angleTarget; angleTarget += 360;
} }
return (int) (angleTarget * 182.044444444); return (int) (angleTarget * 182.044444444);
} }
@@ -104,7 +104,7 @@ public class GameServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = _in.read(data, receivedBytes, left); newBytes = _in.read(data, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -1242,7 +1242,7 @@ public class AdminEditChar implements IAdminCommandHandler
name = player.getName(); name = player.getName();
if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
{ {
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -1342,7 +1342,7 @@ public class AdminEditChar implements IAdminCommandHandler
} }
name = player.getName(); name = player.getName();
CharactersFound = CharactersFound + 1; CharactersFound += 1;
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info "); replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info ");
replyMSG.append(name); replyMSG.append(name);
replyMSG.append("\">"); replyMSG.append("\">");
@@ -187,7 +187,7 @@ public class LoginServerThread extends Thread
while ((newBytes != -1) && (receivedBytes < (length - 2))) while ((newBytes != -1) && (receivedBytes < (length - 2)))
{ {
newBytes = in.read(incoming, receivedBytes, left); newBytes = in.read(incoming, receivedBytes, left);
receivedBytes = receivedBytes + newBytes; receivedBytes += newBytes;
left -= newBytes; left -= newBytes;
} }
@@ -125,7 +125,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = originalAttackTarget.getX() + newX; newX += originalAttackTarget.getX();
} }
else else
{ {
@@ -134,7 +134,7 @@ public class FriendlyNpcAI extends L2AttackableAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = originalAttackTarget.getY() + newY; newY += originalAttackTarget.getY();
} }
else else
{ {
@@ -167,20 +167,20 @@ public class FriendlyNpcAI extends L2AttackableAI
if (originalAttackTarget.getX() < posX) if (originalAttackTarget.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (originalAttackTarget.getY() < posY) if (originalAttackTarget.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -197,10 +197,10 @@ public class FriendlyNpcAI extends L2AttackableAI
int range = npc.getPhysicalAttackRange() + combinedCollision; int range = npc.getPhysicalAttackRange() + combinedCollision;
if (originalAttackTarget.isMoving()) if (originalAttackTarget.isMoving())
{ {
range = range + 50; range += 50;
if (npc.isMoving()) if (npc.isMoving())
{ {
range = range + 50; range += 50;
} }
} }
@@ -757,7 +757,7 @@ public class L2AttackableAI extends L2CharacterAI
int newX = combinedCollision + Rnd.get(40); int newX = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newX = target.getX() + newX; newX += target.getX();
} }
else else
{ {
@@ -766,7 +766,7 @@ public class L2AttackableAI extends L2CharacterAI
int newY = combinedCollision + Rnd.get(40); int newY = combinedCollision + Rnd.get(40);
if (Rnd.nextBoolean()) if (Rnd.nextBoolean())
{ {
newY = target.getY() + newY; newY += target.getY();
} }
else else
{ {
@@ -799,20 +799,20 @@ public class L2AttackableAI extends L2CharacterAI
if (target.getX() < posX) if (target.getX() < posX)
{ {
posX = posX + 300; posX += 300;
} }
else else
{ {
posX = posX - 300; posX -= 300;
} }
if (target.getY() < posY) if (target.getY() < posY)
{ {
posY = posY + 300; posY += 300;
} }
else else
{ {
posY = posY - 300; posY -= 300;
} }
if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld())) if (GeoEngine.getInstance().canMoveToTarget(npc.getX(), npc.getY(), npc.getZ(), posX, posY, posZ, npc.getInstanceWorld()))
@@ -132,7 +132,7 @@ public class StackIDFactory extends IdFactory
else else
{ {
id = _curOID; id = _curOID;
_curOID = _curOID + 1; _curOID += 1;
} }
return id; return id;
} }
@@ -813,7 +813,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
int heading = Util.calculateHeadingFrom(this, target) - _heading; int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0) if (heading < 0)
{ {
heading = 65535 + heading; heading += 65535;
} }
return Util.convertHeadingToDegree(heading); return Util.convertHeadingToDegree(heading);
} }
@@ -102,7 +102,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public void onReceiveFood() public void onReceiveFood()
{ {
// Eating food extends the duration by 20secs, to a max of 20minutes // Eating food extends the duration by 20secs, to a max of 20minutes
_remainingTime = _remainingTime + DURATION_INCREASE_INTERVAL; _remainingTime += DURATION_INCREASE_INTERVAL;
if (_remainingTime > MAX_DURATION) if (_remainingTime > MAX_DURATION)
{ {
_remainingTime = MAX_DURATION; _remainingTime = MAX_DURATION;
@@ -199,7 +199,7 @@ public class Hero
private String calcFightTime(long FightTime) private String calcFightTime(long FightTime)
{ {
final String format = String.format("%%0%dd", 2); final String format = String.format("%%0%dd", 2);
FightTime = FightTime / 1000; FightTime /= 1000;
final String seconds = String.format(format, FightTime % 60); final String seconds = String.format(format, FightTime % 60);
final String minutes = String.format(format, (FightTime % 3600) / 60); final String minutes = String.format(format, (FightTime % 3600) / 60);
return minutes + ":" + seconds; return minutes + ":" + seconds;
@@ -256,7 +256,7 @@ public final class Formulas
// Autoattack critical depends on level difference at high levels as well. // Autoattack critical depends on level difference at high levels as well.
if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78)) if ((activeChar.getLevel() >= 78) || (target.getLevel() >= 78))
{ {
rate = rate + (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125); rate += (Math.sqrt(activeChar.getLevel()) * (activeChar.getLevel() - target.getLevel()) * 0.125);
} }
// Autoattack critical rate is limited between 3%-97%. // Autoattack critical rate is limited between 3%-97%.

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