Removal of assorted empty lines.

This commit is contained in:
MobiusDevelopment
2020-03-03 17:07:18 +00:00
parent ecaf8a1a66
commit 6d8addc784
14371 changed files with 304 additions and 44722 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1184,7 +1184,6 @@ public class BlowfishEngine
for (int s = 0; s < size; s += 2)
{
xl ^= P[0];
for (int i = 1; i < ROUNDS; i += 2)
{
xr ^= func(xl) ^ P[i];
@@ -1254,7 +1253,6 @@ public class BlowfishEngine
int xl = bytesTo32bits(src, srcIndex);
int xr = bytesTo32bits(src, srcIndex + 4);
xl ^= P[0];
for (int i = 1; i < ROUNDS; i += 2)
{
xr ^= func(xl) ^ P[i];
@@ -1278,7 +1276,6 @@ public class BlowfishEngine
int xl = bytesTo32bits(src, srcIndex);
int xr = bytesTo32bits(src, srcIndex + 4);
xl ^= P[ROUNDS + 1];
for (int i = ROUNDS; i > 0; i -= 2)
{
xr ^= func(xl) ^ P[i];

View File

@@ -66,7 +66,6 @@ public class MMOConnection<T extends MMOClient<?>>
_writableByteChannel = socket.getChannel();
_port = socket.getPort();
_selectionKey = key;
_sendQueue = new NioNetStackList<>();
}
@@ -83,7 +82,6 @@ public class MMOConnection<T extends MMOClient<?>>
public void sendPacket(SendablePacket<T> sp)
{
sp._client = _client;
if (_pendingClose)
{
return;
@@ -152,7 +150,6 @@ public class MMOConnection<T extends MMOClient<?>>
final int remaining = temp.remaining();
_primaryWriteBuffer.flip();
final int limit = _primaryWriteBuffer.limit();
if (remaining >= _primaryWriteBuffer.remaining())
{
temp.put(_primaryWriteBuffer);
@@ -257,7 +254,6 @@ public class MMOConnection<T extends MMOClient<?>>
{
_selectorThread.recycleBuffer(_primaryWriteBuffer);
_primaryWriteBuffer = null;
if (_secondaryWriteBuffer != null)
{
_selectorThread.recycleBuffer(_secondaryWriteBuffer);

View File

@@ -104,7 +104,6 @@ public class SelectorThread<T extends MMOClient<?>>extends Thread
selectable.configureBlocking(false);
final ServerSocket ss = selectable.socket();
if (address != null)
{
ss.bind(new InetSocketAddress(address, tcpPort));
@@ -141,10 +140,8 @@ public class SelectorThread<T extends MMOClient<?>>extends Thread
public void run()
{
int selectedKeysCount = 0;
SelectionKey key;
MMOConnection<T> con;
Iterator<SelectionKey> selectedKeys;
while (!_shutdown)
@@ -310,7 +307,6 @@ public class SelectorThread<T extends MMOClient<?>>extends Thread
buf.flip();
final T client = con.getClient();
for (int i = 0; i < MAX_READ_PER_PASS; i++)
{
if (!tryReadPacket(key, client, buf, con))
@@ -446,20 +442,17 @@ public class SelectorThread<T extends MMOClient<?>>extends Thread
private final void parseClientPacket(int pos, ByteBuffer buf, int dataSize, T client)
{
final boolean ret = client.decrypt(buf, dataSize);
if (ret && buf.hasRemaining())
{
// apply limit
final int limit = buf.limit();
buf.limit(pos + dataSize);
final ReceivablePacket<T> cp = _packetHandler.handlePacket(buf, client);
if (cp != null)
{
cp._buf = buf;
cp._sbuf = STRING_BUFFER;
cp._client = client;
if (cp.read())
{
_executor.execute(cp);

View File

@@ -40,7 +40,6 @@ public class DeadlockDetector implements Runnable
{
_instance = new DeadlockDetector();
}
return _instance;
}
@@ -53,14 +52,12 @@ public class DeadlockDetector implements Runnable
public void run()
{
final long[] ids = findDeadlockedThreadIDs();
if (ids == null)
{
return;
}
final List<Thread> deadlocked = new ArrayList<>();
for (long id : ids)
{
if (_logged.add(id))
@@ -72,7 +69,6 @@ public class DeadlockDetector implements Runnable
if (!deadlocked.isEmpty())
{
Util.printSection("Deadlocked Thread(s)");
for (Thread thread : deadlocked)
{
thread.getName();

View File

@@ -33,7 +33,6 @@ public class IPSubnet
_addr = InetAddress.getByName(input.substring(0, idx)).getAddress();
_mask = getMask(Integer.parseInt(input.substring(idx + 1)), _addr.length);
_isIPv4 = _addr.length == 4;
if (!applyMask(_addr))
{
throw new UnknownHostException(input);
@@ -88,7 +87,6 @@ public class IPSubnet
}
}
}
return true;
}

View File

@@ -68,7 +68,6 @@ public class IPv4Filter implements IAcceptFilter, Runnable
{
final InetAddress addr = sc.socket().getInetAddress();
final int h = hash(addr.getAddress());
final long current = System.currentTimeMillis();
Flood f;
synchronized (_ipFloodMap)
@@ -86,7 +85,6 @@ public class IPv4Filter implements IAcceptFilter, Runnable
if ((f.lastAccess + 1000) > current)
{
f.lastAccess = current;
if (f.trys >= 3)
{
f.trys = -1;

View File

@@ -323,7 +323,6 @@ public class PrimeFinder
// initializer
// The above prime numbers are formatted for human readability.
// To find numbers fast, we sort them once and for all.
Arrays.sort(PRIME_CAPACITIES);
}

View File

@@ -211,12 +211,10 @@ public class StringUtil
{
final int length = getLength(strings);
final StringBuilder sbString = new StringBuilder(sizeHint > length ? sizeHint : length);
for (String string : strings)
{
sbString.append(string);
}
return sbString;
}
@@ -229,7 +227,6 @@ public class StringUtil
public static void append(StringBuilder sbString, String... strings)
{
sbString.ensureCapacity(sbString.length() + getLength(strings));
for (String string : strings)
{
sbString.append(string);
@@ -257,7 +254,6 @@ public class StringUtil
private static int getLength(String[] strings)
{
int length = 0;
for (String string : strings)
{
if (string == null)
@@ -269,7 +265,6 @@ public class StringUtil
length += string.length();
}
}
return length;
}

View File

@@ -36,9 +36,7 @@ public class Util
public static String printData(byte[] data, int len)
{
final StringBuilder result = new StringBuilder();
int counter = 0;
for (int i = 0; i < len; i++)
{
if ((counter % 16) == 0)
@@ -51,7 +49,6 @@ public class Util
if (counter == 16)
{
result.append(" ");
int charpoint = i - 15;
for (int a = 0; a < 16; a++)
{
@@ -102,12 +99,10 @@ public class Util
public static String fillHex(int data, int digits)
{
String number = Integer.toHexString(data);
for (int i = number.length(); i < digits; i++)
{
number = "0" + number;
}
return number;
}

View File

@@ -52,7 +52,6 @@ public class ItemsAutoDestroy
}
final long curtime = System.currentTimeMillis();
for (ItemInstance item : _items)
{
if ((item == null) || (item.getDropTime() == 0) || (item.getItemLocation() != ItemInstance.ItemLocation.VOID))

View File

@@ -135,7 +135,6 @@ public class LoginServerThread extends Thread
LOGGER.info("Connecting to login on " + _hostname + ":" + _port);
_loginSocket = new Socket(_hostname, _port);
_in = _loginSocket.getInputStream();
if (_out != null)
{
synchronized (_out) // avoids tow threads writing in the mean time
@@ -156,7 +155,6 @@ public class LoginServerThread extends Thread
lengthLo = _in.read();
lengthHi = _in.read();
length = (lengthHi * 256) + lengthLo;
if (lengthHi < 0)
{
LOGGER.info("LoginServerThread: Login terminated the connection.");
@@ -166,7 +164,6 @@ public class LoginServerThread extends Thread
final byte[] incoming = new byte[length];
incoming[0] = (byte) lengthLo;
incoming[1] = (byte) lengthHi;
int receivedBytes = 0;
int newBytes = 0;
while ((newBytes != -1) && (receivedBytes < (length - 2)))
@@ -186,7 +183,6 @@ public class LoginServerThread extends Thread
// decrypt if we have a key
decrypt = _blowfish.decrypt(decrypt);
checksumOk = NewCrypt.verifyChecksum(decrypt);
if (!checksumOk)
{
LOGGER.warning("Incorrect packet checksum, ignoring packet (LS)");
@@ -442,7 +438,6 @@ public class LoginServerThread extends Thread
public boolean addGameServerLogin(String account, GameClient client)
{
final GameClient savedClient = _accountsInGameServer.get(account);
if (savedClient != null)
{
if (savedClient.isDetached())
@@ -509,7 +504,6 @@ public class LoginServerThread extends Thread
data = _blowfish.crypt(data);
final int len = data.length + 2;
if ((_out != null) && !_loginSocket.isClosed() && _loginSocket.isConnected())
{
synchronized (_out) // avoids tow threads writing in the mean time

View File

@@ -95,7 +95,6 @@ public class RecipeController
final List<RecipeList> dwarfRecipes = Arrays.asList(manufacturer.getDwarvenRecipeBook());
final List<RecipeList> commonRecipes = Arrays.asList(manufacturer.getCommonRecipeBook());
if (!dwarfRecipes.contains(recipeList) && !commonRecipes.contains(recipeList))
{
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false recipe id.", Config.DEFAULT_PUNISH);
@@ -103,7 +102,6 @@ public class RecipeController
}
RecipeItemMaker maker;
if (Config.ALT_GAME_CREATION && ((maker = _activeMakers.get(manufacturer)) != null)) // check if busy
{
player.sendMessage("Manufacturer is busy, please try later.");
@@ -134,7 +132,6 @@ public class RecipeController
}
final RecipeList recipeList = getValidRecipeList(player, recipeListId);
if (recipeList == null)
{
return;
@@ -142,7 +139,6 @@ public class RecipeController
final List<RecipeList> dwarfRecipes = Arrays.asList(player.getDwarvenRecipeBook());
final List<RecipeList> commonRecipes = Arrays.asList(player.getCommonRecipeBook());
if (!dwarfRecipes.contains(recipeList) && !commonRecipes.contains(recipeList))
{
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false recipe id.", Config.DEFAULT_PUNISH);
@@ -194,12 +190,10 @@ public class RecipeController
_player = pPlayer;
_target = pTarget;
_recipeList = pRecipeList;
_isValid = false;
_skillId = _recipeList.isDwarvenRecipe() ? Skill.SKILL_CREATE_DWARVEN : Skill.SKILL_CREATE_COMMON;
_skillLevel = _player.getSkillLevel(_skillId);
_skill = _player.getKnownSkill(_skillId);
_player.setCrafting(true);
if (_player.isAlikeDead())
@@ -300,7 +294,6 @@ public class RecipeController
// determine number of creation passes needed
// can "equip" skillLevel items each pass
_creationPasses = (_totalItems / _skillLevel) + ((_totalItems % _skillLevel) != 0 ? 1 : 0);
if (Config.ALT_GAME_CREATION && (_creationPasses != 0))
{
_manaRequired /= _creationPasses; // checks to validateMp() will only need portion of mp for one pass
@@ -377,7 +370,6 @@ public class RecipeController
// FIXME: please fix this packet to show crafting animation (somebody)
_player.broadcastPacket(new MagicSkillUse(_player, _skillId, _skillLevel, _delay, 0));
_player.sendPacket(new SetupGauge(0, _delay));
ThreadPool.schedule(this, 100 + _delay);
}
@@ -419,7 +411,6 @@ public class RecipeController
{
// attempt to pay for item
final ItemInstance adenatransfer = _target.transferItem("PayManufacture", _target.getInventory().getAdenaInstance().getObjectId(), _price, _player.getInventory(), _player);
if (adenatransfer == null)
{
_target.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ENOUGH_ADENA);
@@ -491,9 +482,7 @@ public class RecipeController
while ((numItems > 0) && !_items.isEmpty())
{
final TempItem item = _items.get(0);
int count = item.getQuantity();
if (count >= numItems)
{
count = numItems;
@@ -510,7 +499,6 @@ public class RecipeController
}
numItems -= count;
if (_target == _player)
{
// you equipped ...
@@ -552,11 +540,9 @@ public class RecipeController
final RecipeInstance[] recipes = _recipeList.getRecipes();
final Inventory inv = _target.getInventory();
final List<TempItem> materials = new ArrayList<>();
for (RecipeInstance recipe : recipes)
{
final int quantity = _recipeList.isConsumable() ? (int) (recipe.getQuantity() * Config.RATE_CONSUMABLE_COST) : recipe.getQuantity();
if (quantity > 0)
{
final ItemInstance item = inv.getItemByItemId(recipe.getItemId());
@@ -652,7 +638,6 @@ public class RecipeController
{
final int itemId = _recipeList.getItemId();
final int itemCount = _recipeList.getCount();
final ItemInstance createdItem = _target.getInventory().addItem("Manufacture", itemId, itemCount, _target, _player);
// inform customer of earned item
@@ -687,7 +672,6 @@ public class RecipeController
// exp -= materialsRefPrice;
// mat. ref. price is not accurate so other method is better
if (exp < 0)
{
exp = 0;
@@ -706,7 +690,6 @@ public class RecipeController
// slower crafting -> more XP, faster crafting -> less XP
// you can use ALT_GAME_CREATION_XP_RATE/SP to
// modify XP/SP gained (default = 1)
_player.addExpAndSp((int) _player.calcStat(Stat.EXPSP_RATE, exp * Config.ALT_GAME_CREATION_XP_RATE * Config.ALT_GAME_CREATION_SPEED, null, null), (int) _player.calcStat(Stat.EXPSP_RATE, sp * Config.ALT_GAME_CREATION_SP_RATE * Config.ALT_GAME_CREATION_SPEED, null, null));
}
updateMakeInfo(true); // success

View File

@@ -77,7 +77,6 @@ public class TradeController
_lists = new HashMap<>();
_listsTaskItem = new HashMap<>();
final File buylistData = new File(Config.DATAPACK_ROOT, "data/buylists.csv");
if (buylistData.exists())
{
LOGGER.warning("Do, please, remove buylists from data folder and use SQL buylist instead");
@@ -159,20 +158,17 @@ public class TradeController
try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement1 = con.prepareStatement("SELECT * FROM merchant_shopids");
final ResultSet rset1 = statement1.executeQuery();
while (rset1.next())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM merchant_buylists WHERE shop_id=? ORDER BY `order` ASC");
statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
final ResultSet rset = statement.executeQuery();
if (rset.next())
{
limitedItem = false;
final StoreTradeList buy1 = new StoreTradeList(rset1.getInt("shop_id"));
int itemId = rset.getInt("item_id");
int price = rset.getInt("price");
int count = rset.getInt("count");
@@ -180,7 +176,6 @@ public class TradeController
int time = rset.getInt("time");
final ItemInstance item = ItemTable.getInstance().createDummyItem(itemId);
if (item == null)
{
rset.close();
@@ -226,7 +221,6 @@ public class TradeController
time = rset.getInt("time");
currentCount = rset.getInt("currentCount");
final ItemInstance item2 = ItemTable.getInstance().createDummyItem(itemId);
if (item2 == null)
{
continue;
@@ -292,7 +286,6 @@ public class TradeController
int time = 0;
long savetimer = 0;
final long currentMillis = System.currentTimeMillis();
final PreparedStatement statement2 = con.prepareStatement("SELECT DISTINCT time, savetimer FROM merchant_buylists WHERE time <> 0 ORDER BY time");
final ResultSet rset2 = statement2.executeQuery();
@@ -331,18 +324,14 @@ public class TradeController
try (Connection con = DatabaseFactory.getConnection())
{
final int initialSize = _lists.size();
final PreparedStatement statement1 = con.prepareStatement("SELECT * FROM custom_merchant_shopids");
final ResultSet rset1 = statement1.executeQuery();
while (rset1.next())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM custom_merchant_buylists WHERE shop_id=? ORDER BY `order` ASC");
statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
final ResultSet rset = statement.executeQuery();
if (rset.next())
{
limitedItem = false;
@@ -459,7 +448,6 @@ public class TradeController
int time = 0;
long savetimer = 0;
final long currentMillis = System.currentTimeMillis();
final PreparedStatement statement2 = con.prepareStatement("SELECT DISTINCT time, savetimer FROM custom_merchant_buylists WHERE time <> 0 ORDER BY time");
final ResultSet rset2 = statement2.executeQuery();
@@ -499,14 +487,12 @@ public class TradeController
{
return _lists.get(listId);
}
return _listsTaskItem.get(listId);
}
public List<StoreTradeList> getBuyListByNpcId(int npcId)
{
final List<StoreTradeList> lists = new ArrayList<>();
for (StoreTradeList list : _lists.values())
{
if (list.getNpcId().startsWith("gm"))
@@ -567,7 +553,6 @@ public class TradeController
public void dataCountStore()
{
int listId;
if (_listsTaskItem == null)
{
return;
@@ -584,7 +569,6 @@ public class TradeController
}
listId = list.getListId();
for (ItemInstance Item : list.getItems())
{
if (Item.getCount() < Item.getInitCount()) // needed?

View File

@@ -83,7 +83,6 @@ abstract class AbstractAI implements Ctrl
}
final Creature follow = getFollowTarget();
if (follow == null)
{
stopFollow();
@@ -785,7 +784,6 @@ abstract class AbstractAI implements Ctrl
if (_clientMoving)
{
final Creature follow = getFollowTarget();
if ((_clientMovingToPawnOffset != 0) && (follow != null))
{
// Send a Server->Client packet MoveToPawn to the actor and all PlayerInstance in its _knownPlayers

View File

@@ -208,7 +208,6 @@ public class AttackableAI extends CreatureAI
{
final byte riftType = target.getParty().getDimensionalRift().getType();
final byte riftRoom = target.getParty().getDimensionalRift().getCurrentRoom();
if ((me instanceof RiftInvaderInstance) && !DimensionalRiftManager.getInstance().getRoom(riftType, riftRoom).checkIfInZone(me.getX(), me.getY(), me.getZ()))
{
return false;
@@ -448,7 +447,6 @@ public class AttackableAI extends CreatureAI
if (!target.isAlikeDead() && !npc.isInsideRadius(obj, npc.getAggroRange(), true, false))
{
final PlayerInstance targetPlayer = obj instanceof PlayerInstance ? (PlayerInstance) obj : ((Summon) obj).getOwner();
for (Quest quest : npc.getTemplate().getEventQuests(EventType.ON_AGGRO_RANGE_ENTER))
{
quest.notifyAggroRangeEnter(npc, targetPlayer, obj instanceof Summon);
@@ -553,7 +551,6 @@ public class AttackableAI extends CreatureAI
int x1;
int y1;
int z1;
x1 = (((MinionInstance) _actor).getLeader().getX() + Rnd.get((offset - 30) * 2)) - (offset - 30);
y1 = (((MinionInstance) _actor).getLeader().getY() + Rnd.get((offset - 30) * 2)) - (offset - 30);
z1 = ((MinionInstance) _actor).getLeader().getZ();
@@ -585,7 +582,6 @@ public class AttackableAI extends CreatureAI
// Calculate the distance between the current position of the Creature and the target (x,y)
final double distance2 = _actor.getPlanDistanceSq(x1, y1);
if (distance2 > (Config.MAX_DRIFT_RANGE * Config.MAX_DRIFT_RANGE))
{
npc.setReturningToSpawnPoint(true);
@@ -725,7 +721,6 @@ public class AttackableAI extends CreatureAI
{
final NpcInstance npc = (NpcInstance) obj;
final String factionId = ((NpcInstance) _actor).getFactionId();
if (!factionId.equalsIgnoreCase(npc.getFactionId()) || (npc.getFactionRange() == 0))
{
continue;
@@ -742,7 +737,6 @@ public class AttackableAI extends CreatureAI
{
final byte riftType = originalAttackTarget.getParty().getDimensionalRift().getType();
final byte riftRoom = originalAttackTarget.getParty().getDimensionalRift().getCurrentRoom();
if ((_actor instanceof RiftInvaderInstance) && !DimensionalRiftManager.getInstance().getRoom(riftType, riftRoom).checkIfInZone(npc.getX(), npc.getY(), npc.getZ()))
{
continue;
@@ -853,7 +847,6 @@ public class AttackableAI extends CreatureAI
int posY = _actor.getY();
final int posZ = _actor.getZ();
final double distance = Math.sqrt(distance2); // This way, we only do the sqrt if we need it
int signx = -1;
int signy = -1;
if (_actor.getX() > originalAttackTarget.getX())
@@ -896,7 +889,6 @@ public class AttackableAI extends CreatureAI
}
// We should calculate new distance cuz mob can have changed the target
dist2 = _actor.getPlanDistanceSq(hated.getX(), hated.getY());
if (hated.isMoving())
{
range += 50;
@@ -911,7 +903,6 @@ public class AttackableAI extends CreatureAI
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
boolean inRange = false;
if ((dist2 >= ((castRange * castRange) / 9.0)) && (dist2 <= (castRange * castRange)) && (castRange > 70))
{
@@ -923,7 +914,6 @@ public class AttackableAI extends CreatureAI
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
boolean useSkillSelf = true;
if ((sk.getSkillType() == Skill.SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
{
useSkillSelf = false;
@@ -933,11 +923,9 @@ public class AttackableAI extends CreatureAI
if (sk.getSkillType() == Skill.SkillType.BUFF)
{
final Effect[] effects = _actor.getAllEffects();
for (int i = 0; (effects != null) && (i < effects.length); i++)
{
final Effect effect = effects[i];
if (effect.getSkill() == sk)
{
useSkillSelf = false;
@@ -952,7 +940,6 @@ public class AttackableAI extends CreatureAI
}
final WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
@@ -973,7 +960,6 @@ public class AttackableAI extends CreatureAI
}
moveToPawn(originalAttackTarget, range);
return;
}
// Else, if this is close enough to attack
@@ -983,7 +969,6 @@ public class AttackableAI extends CreatureAI
if (!_actor.isMuted() /* && _rnd.nextInt(100) <= 5 */)
{
boolean useSkillSelf = true;
for (Skill sk : skills)
{
if (/* sk.getCastRange() >= dist && sk.getCastRange() <= 70 && */!sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk) && ((Rnd.get(100) <= 8) || ((_actor instanceof PenaltyMonsterInstance) && (Rnd.get(100) <= 20))))
@@ -991,7 +976,6 @@ public class AttackableAI extends CreatureAI
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
useSkillSelf = true;
if ((sk.getSkillType() == Skill.SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
{
useSkillSelf = false;
@@ -1001,11 +985,9 @@ public class AttackableAI extends CreatureAI
if (sk.getSkillType() == Skill.SkillType.BUFF)
{
final Effect[] effects = _actor.getAllEffects();
for (int i = 0; (effects != null) && (i < effects.length); i++)
{
final Effect effect = effects[i];
if (effect.getSkill() == sk)
{
useSkillSelf = false;
@@ -1025,7 +1007,6 @@ public class AttackableAI extends CreatureAI
}
final WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(oldTarget);

View File

@@ -60,14 +60,12 @@ public class ControllableMobAI extends AttackableAI
protected void thinkFollow()
{
final Attackable me = (Attackable) _actor;
if (!Util.checkIfInRange(MobGroupTable.FOLLOW_RANGE, me, getForcedTarget(), true))
{
final int signX = Rnd.nextBoolean() ? -1 : 1;
final int signY = Rnd.nextBoolean() ? -1 : 1;
final int randX = Rnd.get(MobGroupTable.FOLLOW_RANGE);
final int randY = Rnd.get(MobGroupTable.FOLLOW_RANGE);
moveTo(getForcedTarget().getX() + (signX * randX), getForcedTarget().getY() + (signY * randY), getForcedTarget().getZ());
}
}
@@ -148,7 +146,6 @@ public class ControllableMobAI extends AttackableAI
}
((Attackable) _actor).setTarget(getAttackTarget());
if (!_actor.isMuted())
{
// check distant skills
@@ -195,7 +192,6 @@ public class ControllableMobAI extends AttackableAI
final double dist2 = _actor.getPlanDistanceSq(target.getX(), target.getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + target.getTemplate().getCollisionRadius();
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
// check distant skills
@@ -233,14 +229,12 @@ public class ControllableMobAI extends AttackableAI
final double dist2 = _actor.getPlanDistanceSq(getForcedTarget().getX(), getForcedTarget().getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getForcedTarget().getTemplate().getCollisionRadius();
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
// check distant skills
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() > _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
@@ -285,7 +279,6 @@ public class ControllableMobAI extends AttackableAI
final NpcInstance npc = (NpcInstance) obj;
final String factionId = ((NpcInstance) _actor).getFactionId();
if (!factionId.equalsIgnoreCase(npc.getFactionId()))
{
continue;
@@ -303,7 +296,6 @@ public class ControllableMobAI extends AttackableAI
final double dist2 = _actor.getPlanDistanceSq(getAttackTarget().getX(), getAttackTarget().getY());
final int range = _actor.getPhysicalAttackRange() + _actor.getTemplate().getCollisionRadius() + getAttackTarget().getTemplate().getCollisionRadius();
int maxRange = range;
if (!_actor.isMuted() && (dist2 > ((range + 20) * (range + 20))))
{
// check distant skills
@@ -348,7 +340,6 @@ public class ControllableMobAI extends AttackableAI
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() < _actor.getStat().getMpConsume(sk)))
{
_accessor.doCast(sk);
@@ -364,7 +355,6 @@ public class ControllableMobAI extends AttackableAI
{
setAttackTarget(findNextRndTarget());
Creature hated;
if (_actor.isConfused())
{
hated = findNextRndTarget();
@@ -389,7 +379,6 @@ public class ControllableMobAI extends AttackableAI
}
final Attackable me = (Attackable) _actor;
if ((target instanceof FolkInstance) || (target instanceof DoorInstance))
{
return false;
@@ -423,9 +412,7 @@ public class ControllableMobAI extends AttackableAI
private Creature findNextRndTarget()
{
final int aggroRange = ((Attackable) _actor).getAggroRange();
final Attackable npc = (Attackable) _actor;
int npcX;
int npcY;
int targetX;
@@ -433,9 +420,7 @@ public class ControllableMobAI extends AttackableAI
double dy;
double dx;
final double dblAggroRange = aggroRange * aggroRange;
final List<Creature> potentialTarget = new ArrayList<>();
for (WorldObject obj : npc.getKnownList().getKnownObjects().values())
{
if (!(obj instanceof Creature))
@@ -447,17 +432,14 @@ public class ControllableMobAI extends AttackableAI
npcY = npc.getY();
targetX = obj.getX();
targetY = obj.getY();
dx = npcX - targetX;
dy = npcY - targetY;
if (((dx * dx) + (dy * dy)) > dblAggroRange)
{
continue;
}
final Creature target = (Creature) obj;
if (autoAttackCondition(target))
{
potentialTarget.add(target);
@@ -471,7 +453,6 @@ public class ControllableMobAI extends AttackableAI
// we choose a random target
final int choice = Rnd.get(potentialTarget.size());
return potentialTarget.get(choice);
}

View File

@@ -592,7 +592,6 @@ public class CreatureAI extends AbstractAI
{
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
{
AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
@@ -624,7 +623,6 @@ public class CreatureAI extends AbstractAI
{
// Stop the actor auto-attack client side by sending Server->Client packet AutoAttackStop (broadcast)
_actor.broadcastPacket(new AutoAttackStop(_actor.getObjectId()));
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(_actor))
{
AttackStanceTaskManager.getInstance().removeAttackStanceTask(_actor);
@@ -1145,7 +1143,6 @@ public class CreatureAI extends AbstractAI
if (target instanceof PlayerInstance)
{
final PlayerInstance target2 = (PlayerInstance) target; // convert object to chara
if (target2.isFakeDeath())
{
target2.stopFakeDeath(null);

View File

@@ -337,7 +337,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
{
// Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0)
{
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance
@@ -408,7 +407,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
// Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE, null, null);
_actor.setWalking();
return;
}
@@ -534,7 +532,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
}
final NpcInstance npc = (NpcInstance) creature;
if (!faction_id.equalsIgnoreCase(npc.getFactionId()))
{
continue;
@@ -650,7 +647,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if ((dist2 <= (castRange * castRange)) && (castRange > 70) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
final WorldObject oldTarget = _actor.getTarget();
@@ -789,7 +785,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
final WorldObject oldTarget = _actor.getTarget();
@@ -930,7 +925,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
return;
}
final Attackable me = (Attackable) _actor;
if (target != null)
{
// Add the target to the actor _aggroList or update hate if already present
@@ -938,7 +932,6 @@ public class FortSiegeGuardAI extends CreatureAI implements Runnable
// Get the hate of the actor against the target
aggro = me.getHating(target);
if (aggro <= 0)
{
if (me.getMostHated() == null)

View File

@@ -106,7 +106,6 @@ public class PlayerAI extends CreatureAI
{
// forget interupted actions after offensive skill
final Skill skill = getSkill();
if ((skill != null) && skill.isOffensive())
{
getInterruptedIntentions().clear();
@@ -171,7 +170,6 @@ public class PlayerAI extends CreatureAI
{
_clientMovingToPawnOffset = 0;
_clientMoving = false;
super.clientNotifyDead();
}
@@ -203,7 +201,6 @@ public class PlayerAI extends CreatureAI
final Creature target = getCastTarget();
final Skill skill = getSkill();
// if (Config.DEBUG) LOGGER.warning("PlayerAI: thinkCast -> Start");
if (checkTargetLost(target))
{
if (skill.isOffensive() && (getAttackTarget() != null))
@@ -225,7 +222,6 @@ public class PlayerAI extends CreatureAI
}
final WorldObject oldTarget = _actor.getTarget();
if (oldTarget != null)
{
// Replace the current target by the cast target

View File

@@ -75,7 +75,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
_attackTimeout = Integer.MAX_VALUE;
_globalAggro = -10; // 10 seconds timeout of ATTACK after respawn
_attackRange = ((Attackable) _actor).getPhysicalAttackRange();
}
@@ -163,7 +162,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
public void changeIntention(CtrlIntention intention, Object arg0, Object arg1)
{
((Attackable) _actor).setReturningToSpawnPoint(false);
if (intention == AI_INTENTION_IDLE /* || intention == AI_INTENTION_ACTIVE */) // active becomes idle if only a summon is present
{
// Check if actor is not dead
@@ -295,7 +293,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
// Get the hate level of the Attackable against this Creature target contained in _aggroList
final int aggro = npc.getHating(hated);
if ((aggro + _globalAggro) > 0)
{
// Set the Creature movement type to run and send Server->Client packet ChangeMoveType to all others PlayerInstance
@@ -323,7 +320,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
double dist2 = 0;
int range = 0;
final SiegeGuardInstance sGuard = (SiegeGuardInstance) _actor;
final Creature attackTarget = getAttackTarget();
try
@@ -369,13 +365,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist2 >= ((castRange * castRange) / 9)) && (dist2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
boolean useSkillSelf = true;
if (((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL) || ((dist2 >= ((castRange * castRange) / 9)) && (dist2 <= (castRange * castRange)) && (castRange > 70))) && !_actor.isSkillDisabled(sk) && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !sk.isPassive())
{
useSkillSelf = false;
@@ -384,11 +378,9 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
if (sk.getSkillType() == Skill.SkillType.BUFF)
{
final Effect[] effects = _actor.getAllEffects();
for (int i = 0; (effects != null) && (i < effects.length); i++)
{
final Effect effect = effects[i];
if (effect.getSkill() == sk)
{
useSkillSelf = false;
@@ -403,7 +395,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
final WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(oldTarget);
@@ -462,7 +453,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
{
// Force mobs to attak anybody if confused
Creature hated = null;
if (_actor.isConfused())
{
hated = attackTarget;
@@ -491,13 +481,11 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
for (Skill sk : skills)
{
final int castRange = sk.getCastRange();
if (((castRange * castRange) >= dist2) && (castRange <= 70) && !sk.isPassive() && (_actor.getCurrentMp() >= _actor.getStat().getMpConsume(sk)) && !_actor.isSkillDisabled(sk))
{
if ((sk.getSkillType() == Skill.SkillType.BUFF) || (sk.getSkillType() == Skill.SkillType.HEAL))
{
boolean useSkillSelf = true;
if ((sk.getSkillType() == Skill.SkillType.HEAL) && (_actor.getCurrentHp() > (int) (_actor.getMaxHp() / 1.5)))
{
useSkillSelf = false;
@@ -507,11 +495,9 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
if (sk.getSkillType() == Skill.SkillType.BUFF)
{
final Effect[] effects = _actor.getAllEffects();
for (int i = 0; (effects != null) && (i < effects.length); i++)
{
final Effect effect = effects[i];
if (effect.getSkill() == sk)
{
useSkillSelf = false;
@@ -526,7 +512,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
final WorldObject oldTarget = _actor.getTarget();
clientStopMoving(null);
_accessor.doCast(sk);
_actor.setTarget(oldTarget);
@@ -572,7 +557,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
if (attackTarget != null)
{
final Attackable npc = (Attackable) _actor;
npc.stopHating(attackTarget);
}
@@ -582,7 +566,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
// Set the AI Intention to AI_INTENTION_ACTIVE
setIntention(AI_INTENTION_ACTIVE, null, null);
_actor.setWalking();
return;
}
@@ -621,9 +604,7 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
final NpcInstance npc = (NpcInstance) creature;
final String factionId = ((NpcInstance) actor).getFactionId();
if (!factionId.equalsIgnoreCase(npc.getFactionId()))
{
continue;
@@ -753,7 +734,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
final Attackable me = (Attackable) _actor;
if (target != null)
{
// Add the target to the actor _aggroList or update hate if already present
@@ -761,7 +741,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
// Get the hate of the actor against the target
aggro = me.getHating(target);
if (aggro <= 0)
{
if (me.getMostHated() == null)
@@ -783,7 +762,6 @@ public class SiegeGuardAI extends CreatureAI implements Runnable
}
final SiegeGuardInstance sGuard = (SiegeGuardInstance) _actor;
final double homeX = target.getX() - sGuard.getHomeX();
final double homeY = target.getY() - sGuard.getHomeY();

View File

@@ -49,7 +49,6 @@ public class SummonAI extends CreatureAI
protected void onIntentionActive()
{
final Summon summon = (Summon) _actor;
if (summon.getFollowStatus())
{
setIntention(AI_INTENTION_FOLLOW, summon.getOwner());
@@ -63,7 +62,6 @@ public class SummonAI extends CreatureAI
private void thinkAttack()
{
final Summon summon = (Summon) _actor;
WorldObject target = null;
target = summon.getTarget();
@@ -91,7 +89,6 @@ public class SummonAI extends CreatureAI
private void thinkCast()
{
final Summon summon = (Summon) _actor;
final Creature target = getCastTarget();
if (checkTargetLost(target))
{
@@ -118,7 +115,6 @@ public class SummonAI extends CreatureAI
}
final WorldObject target = getTarget();
if (checkTargetLost(target))
{
return;
@@ -141,7 +137,6 @@ public class SummonAI extends CreatureAI
}
final WorldObject target = getTarget();
if (checkTargetLost(target))
{
return;
@@ -198,7 +193,6 @@ public class SummonAI extends CreatureAI
final Summon summon = (Summon) _actor;
WorldObject target = null;
target = summon.getTarget();
if (target == null)
{
return;

View File

@@ -56,16 +56,13 @@ public class CrestCache
public void reload()
{
final FileFilter filter = new BmpFilter();
final File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
final File[] files = dir.listFiles(filter);
byte[] content;
synchronized (this)
{
_loadedFiles = 0;
_bytesBuffLen = 0;
_cachePledge.clear();
_cachePledgeLarge.clear();
_cacheAlly.clear();
@@ -125,9 +122,7 @@ public class CrestCache
public void convertOldPedgeFiles()
{
final File dir = new File(Config.DATAPACK_ROOT, "data/crests/");
final File[] files = dir.listFiles(new OldPledgeFilter());
if (files == null)
{
LOGGER.info("No old crest files found in \"data/crests/\"!!! May be you deleted them?");
@@ -257,7 +252,6 @@ public class CrestCache
{
boolean output = false;
final File crestFile = new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp");
FileOutputStream out = null;
try
{
@@ -285,7 +279,6 @@ public class CrestCache
}
}
}
return output;
}
@@ -320,7 +313,6 @@ public class CrestCache
}
}
}
return output;
}
@@ -355,7 +347,6 @@ public class CrestCache
}
}
}
return output;
}

View File

@@ -100,7 +100,6 @@ public class HtmCache
{
final FileFilter filter = new HtmFilter();
final File[] files = dir.listFiles(filter);
for (File file : files)
{
if (!file.isDirectory())
@@ -117,9 +116,7 @@ public class HtmCache
public String loadFile(File file)
{
final HtmFilter filter = new HtmFilter();
String content = null;
if (file.exists() && filter.accept(file) && !file.isDirectory())
{
FileInputStream fis = null;
@@ -130,7 +127,6 @@ public class HtmCache
bis = new BufferedInputStream(fis);
final int bytes = bis.available();
final byte[] raw = new byte[bytes];
bis.read(raw);
content = new String(raw, StandardCharsets.UTF_8);
@@ -139,14 +135,12 @@ public class HtmCache
final String relpath = Util.getRelativePath(Config.DATAPACK_ROOT, file);
final int hashcode = relpath.hashCode();
if (Config.CHECK_HTML_ENCODING && !StandardCharsets.US_ASCII.newEncoder().canEncode(content))
{
LOGGER.warning("HTML encoding check: File " + relpath + " contains non ASCII content.");
}
final String oldContent = _cache.get(hashcode);
if (oldContent == null)
{
_bytesBuffLen += bytes;
@@ -197,25 +191,21 @@ public class HtmCache
public String getHtmForce(String path)
{
String content = getHtm(path);
if (content == null)
{
content = "<html><body>My text is missing:<br>" + path + "</body></html>";
LOGGER.warning("Cache[HTML]: Missing HTML page: " + path);
}
return content;
}
public String getHtm(String path)
{
String content = _cache.get(path.hashCode());
if (Config.LAZY_CACHE && (content == null))
{
content = loadFile(new File(Config.DATAPACK_ROOT, path));
}
return content;
}

View File

@@ -80,7 +80,6 @@ public class Forum
{
_forumName = name;
_forumId = ForumsBBSManager.getInstance().getANewID();
_forumType = type;
_forumPost = 0;
_forumPerm = perm;
@@ -100,15 +99,12 @@ public class Forum
final PreparedStatement statement = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?");
statement.setInt(1, _forumId);
final ResultSet result = statement.executeQuery();
if (result.next())
{
_forumName = result.getString("forum_name");
_forumPost = result.getInt("forum_post");
_forumType = result.getInt("forum_type");
_forumPerm = result.getInt("forum_perm");
_ownerID = result.getInt("forum_owner_id");
}
result.close();
@@ -128,7 +124,6 @@ public class Forum
while (result.next())
{
final Topic t = new Topic(Topic.ConstructorType.RESTORE, result.getInt("topic_id"), result.getInt("topic_forum_id"), result.getString("topic_name"), result.getLong("topic_date"), result.getString("topic_ownername"), result.getInt("topic_ownerid"), result.getInt("topic_type"), result.getInt("topic_reply"));
_topic.put(t.getID(), t);
if (t.getID() > TopicBBSManager.getInstance().getMaxID(this))
{

View File

@@ -137,7 +137,6 @@ public class ClanBBSManager extends BaseBBSManager
// Retrieve clans members, and store them under a String.
final StringBuilder membersList = new StringBuilder();
for (ClanMember player : clan.getMembers())
{
if (player != null)
@@ -236,7 +235,6 @@ public class ClanBBSManager extends BaseBBSManager
// Player got a clan, show the associated header.
final StringBuilder sb = new StringBuilder();
final Clan playerClan = activeChar.getClan();
if (playerClan != null)
{
@@ -244,7 +242,6 @@ public class ClanBBSManager extends BaseBBSManager
}
content = content.replace("%homebar%", sb.toString());
if (index < 1)
{
index = 1;

View File

@@ -66,7 +66,6 @@ public class FriendsBBSManager extends BaseBBSManager
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
final String action = st.nextToken();
if (action.equals("select"))
{
activeChar.selectFriend((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
@@ -107,7 +106,6 @@ public class FriendsBBSManager extends BaseBBSManager
activeChar.getFriendList().clear();
activeChar.getSelectedFriendList().clear();
showFriendsList(activeChar, false);
activeChar.sendMessage("You have cleared your friend list.");
activeChar.sendPacket(new FriendList(activeChar));
}
@@ -130,7 +128,6 @@ public class FriendsBBSManager extends BaseBBSManager
statement.close();
final String name = CharNameTable.getInstance().getPlayerName(friendId);
final PlayerInstance player = World.getInstance().getPlayer(friendId);
if (player != null)
{
@@ -151,7 +148,6 @@ public class FriendsBBSManager extends BaseBBSManager
activeChar.getSelectedFriendList().clear();
showFriendsList(activeChar, false);
activeChar.sendPacket(new FriendList(activeChar)); // update friendList *heavy method*
}
else if (action.equals("mail"))
@@ -167,7 +163,6 @@ public class FriendsBBSManager extends BaseBBSManager
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
final String action = st.nextToken();
if (action.equals("select"))
{
activeChar.selectBlock((st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 0);
@@ -237,7 +232,6 @@ public class FriendsBBSManager extends BaseBBSManager
// Retrieve activeChar's friendlist and selected
final List<Integer> list = activeChar.getFriendList();
final List<Integer> slist = activeChar.getSelectedFriendList();
final StringBuilder sb = new StringBuilder();
// Friendlist
@@ -278,7 +272,6 @@ public class FriendsBBSManager extends BaseBBSManager
// Delete button.
content = content.replace("%deleteMSG%", (delMsg) ? FRIENDLIST_DELETE_BUTTON : "");
separateAndSend(content, activeChar);
}
@@ -293,7 +286,6 @@ public class FriendsBBSManager extends BaseBBSManager
// Retrieve activeChar's blocklist and selected
final List<Integer> list = activeChar.getBlockList().getBlockList();
final List<Integer> slist = activeChar.getSelectedBlocksList();
final StringBuilder sb = new StringBuilder();
// Blocklist
@@ -334,7 +326,6 @@ public class FriendsBBSManager extends BaseBBSManager
// Delete button.
content = content.replace("%deleteMSG%", (delMsg) ? BLOCKLIST_DELETE_BUTTON : "");
separateAndSend(content, activeChar);
}
@@ -364,7 +355,6 @@ public class FriendsBBSManager extends BaseBBSManager
}
content = content.replace("%list%", sb.toString());
separateAndSend(content, activeChar);
}

View File

@@ -114,7 +114,6 @@ public class MailBBSManager extends BaseBBSManager
public void parseCmd(String command, PlayerInstance activeChar)
{
CommunityBoard.getInstance().addBypass(activeChar, "Mail Command", command);
if (command.equals("_bbsmail") || command.equals("_maillist_0_1_0_"))
{
showMailList(activeChar, 1, MailType.INBOX);
@@ -124,13 +123,11 @@ public class MailBBSManager extends BaseBBSManager
final StringTokenizer st = new StringTokenizer(command, ";");
st.nextToken();
final String action = st.nextToken();
if (action.equals("inbox") || action.equals("sentbox") || action.equals("archive") || action.equals("temparchive"))
{
final int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1;
final String sType = (st.hasMoreTokens()) ? st.nextToken() : "";
final String search = (st.hasMoreTokens()) ? st.nextToken() : "";
showMailList(activeChar, page, Enum.valueOf(MailType.class, action.toUpperCase()), sType, search);
}
else if (action.equals("crea"))
@@ -140,7 +137,6 @@ public class MailBBSManager extends BaseBBSManager
else if (action.equals("view"))
{
final int letterId = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : -1;
final Mail letter = getLetter(activeChar, letterId);
if (letter == null)
{
@@ -158,7 +154,6 @@ public class MailBBSManager extends BaseBBSManager
else if (action.equals("reply"))
{
final int letterId = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : -1;
final Mail letter = getLetter(activeChar, letterId);
if (letter == null)
{
@@ -172,7 +167,6 @@ public class MailBBSManager extends BaseBBSManager
else if (action.equals("del"))
{
final int letterId = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : -1;
final Mail letter = getLetter(activeChar, letterId);
if (letter != null)
{
@@ -184,7 +178,6 @@ public class MailBBSManager extends BaseBBSManager
else if (action.equals("store"))
{
final int letterId = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : -1;
final Mail letter = getLetter(activeChar, letterId);
if (letter != null)
{
@@ -330,7 +323,6 @@ public class MailBBSManager extends BaseBBSManager
letters = new ArrayList<>();
final boolean byTitle = sType.equalsIgnoreCase("title");
for (Mail letter : getPlayerMails(activeChar.getObjectId()))
{
if (byTitle && letter.subject.toLowerCase().contains(search.toLowerCase()))
@@ -354,7 +346,6 @@ public class MailBBSManager extends BaseBBSManager
final int countMails = getCountLetters(activeChar.getObjectId(), type, sType, search);
final int maxpage = getMaxPageId(countMails);
if (page > maxpage)
{
page = maxpage;
@@ -370,7 +361,6 @@ public class MailBBSManager extends BaseBBSManager
int maxIndex = 0;
maxIndex = (page == 1 ? page * 9 : (page * 10) - 1);
minIndex = maxIndex - 9;
String content = HtmCache.getInstance().getHtm(CB_PATH + "mail/mail.htm");
content = content.replace("%inbox%", Integer.toString(getCountLetters(activeChar.getObjectId(), MailType.INBOX, "", "")));
content = content.replace("%sentbox%", Integer.toString(getCountLetters(activeChar.getObjectId(), MailType.SENTBOX, "", "")));
@@ -396,14 +386,12 @@ public class MailBBSManager extends BaseBBSManager
}
StringUtil.append(sb, "<table width=610><tr><td width=5></td><td width=150>", getCharName(letter.senderId), "</td><td width=300><a action=\"bypass _bbsmail;view;", letter.letterId, "\">");
if (letter.unread)
{
sb.append("<font color=\"LEVEL\">");
}
sb.append(abbreviate(letter.subject, 51));
if (letter.unread)
{
sb.append("</font>");
@@ -419,9 +407,7 @@ public class MailBBSManager extends BaseBBSManager
sb.setLength(0);
final String fullSearch = (!sType.equals("") && !search.equals("")) ? ";" + sType + ";" + search : "";
StringUtil.append(sb, "<td><table><tr><td></td></tr><tr><td><button action=\"bypass _bbsmail;", type, ";", (page == 1 ? page : page - 1), fullSearch, "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16></td></tr></table></td>");
int i = 0;
if (maxpage > 21)
{
@@ -492,9 +478,7 @@ public class MailBBSManager extends BaseBBSManager
}
}
StringUtil.append(sb, "<td><table><tr><td></td></tr><tr><td><button action=\"bypass _bbsmail;", type, ";", (page == maxpage ? page : page + 1), fullSearch, "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td></tr></table></td>");
content = content.replace("%maillistlength%", sb.toString());
separateAndSend(content, activeChar);
}
@@ -510,7 +494,6 @@ public class MailBBSManager extends BaseBBSManager
final String link = letter.location.getBypass() + "&nbsp;&gt;&nbsp;" + letter.subject;
content = content.replace("%maillink%", link);
content = content.replace("%writer%", getCharName(letter.senderId));
content = content.replace("%sentDate%", letter.sentDateString);
content = content.replace("%receiver%", letter.recipientNames);
@@ -533,7 +516,6 @@ public class MailBBSManager extends BaseBBSManager
final String link = letter.location.getBypass() + "&nbsp;&gt;&nbsp;<a action=\"bypass _bbsmail;view;" + letter.letterId + "\">" + letter.subject + "</a>&nbsp;&gt;&nbsp;";
content = content.replace("%maillink%", link);
content = content.replace("%recipients%", letter.senderId == activeChar.getObjectId() ? letter.recipientNames : getCharName(letter.senderId));
content = content.replace("%letterId%", letter.letterId + "");
send1001(content, activeChar);
@@ -576,9 +558,7 @@ public class MailBBSManager extends BaseBBSManager
{
// Get the current time under timestamp format.
final Timestamp time = new Timestamp(currentDate);
PreparedStatement statement = null;
for (String recipientName : recipientNames)
{
// Recipient is an invalid player, or is the sender.
@@ -590,7 +570,6 @@ public class MailBBSManager extends BaseBBSManager
}
final PlayerInstance recipientPlayer = World.getInstance().getPlayer(recipientId);
if (!activeChar.isGM())
{
// Sender is a regular player, while recipient is a GM.
@@ -621,7 +600,6 @@ public class MailBBSManager extends BaseBBSManager
}
final int id = getNewMailId();
if (statement == null)
{
statement = con.prepareStatement(INSERT_NEW_MAIL);
@@ -649,7 +627,6 @@ public class MailBBSManager extends BaseBBSManager
letter.sentDateString = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(letter.sentDate);
letter.unread = true;
getPlayerMails(recipientId).add(0, letter);
if (recipientPlayer != null)
{
recipientPlayer.sendPacket(SystemMessageId.YOU_VE_GOT_MAIL);
@@ -662,7 +639,6 @@ public class MailBBSManager extends BaseBBSManager
if (statement != null)
{
final int id = getNewMailId();
statement.setInt(1, activeChar.getObjectId());
statement.setInt(2, id);
statement.setString(4, "sentbox");
@@ -682,7 +658,6 @@ public class MailBBSManager extends BaseBBSManager
letter.sentDateString = new SimpleDateFormat("yyyy-MM-dd HH:mm").format(letter.sentDate);
letter.unread = false;
getPlayerMails(activeChar.getObjectId()).add(0, letter);
activeChar.sendPacket(SystemMessageId.YOU_VE_SENT_MAIL);
}
}
@@ -839,7 +814,6 @@ public class MailBBSManager extends BaseBBSManager
{
final int page = activeChar.getMailPosition() % 1000;
final int type = activeChar.getMailPosition() / 1000;
showMailList(activeChar, page, MailType.VALUES[type]);
}

View File

@@ -56,7 +56,6 @@ public class PostBBSManager extends BaseBBSManager
final int idf = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
String index = null;
if (st.hasMoreTokens())
{
@@ -84,7 +83,6 @@ public class PostBBSManager extends BaseBBSManager
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
showEditPost((TopicBBSManager.getInstance().getTopicByID(idt)), ForumsBBSManager.getInstance().getForumByID(idf), player, idp);
}
else
@@ -100,7 +98,6 @@ public class PostBBSManager extends BaseBBSManager
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final int idp = Integer.parseInt(st.nextToken());
final Forum forum = ForumsBBSManager.getInstance().getForumByID(idf);
if (forum == null)
{
@@ -202,7 +199,6 @@ public class PostBBSManager extends BaseBBSManager
final Post p = getPostByTopic(topic);
final Locale locale = Locale.getDefault();
final DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.FULL, locale);
String mes = p.getCPost(0).postTxt.replace(">", "&gt;");
mes = mes.replace("<", "&lt;");
mes = mes.replace("\n", "<br1>");

View File

@@ -74,12 +74,10 @@ public class RegionBBSManager extends BaseBBSManager
private void showRegionsList(PlayerInstance player)
{
final String content = HtmCache.getInstance().getHtm(CB_PATH + "region/castlelist.htm");
final StringBuilder sb = new StringBuilder(500);
for (Castle castle : CastleManager.getInstance().getCastles())
{
final Clan owner = ClanTable.getInstance().getClan(castle.getOwnerId());
StringUtil.append(sb, "<table><tr><td width=5></td><td width=160><a action=\"bypass _bbsloc;", castle.getCastleId(), "\">", castle.getName(), "</a></td><td width=160>", ((owner != null) ? "<a action=\"bypass _bbsclan;home;" + owner.getClanId() + "\">" + owner.getName() + "</a>" : "None"), "</td><td width=160>", (((owner != null) && (owner.getAllyId() > 0)) ? owner.getAllyName() : "None"), "</td><td width=120>", ((owner != null) ? castle.getTaxPercent() : "0"), "</td><td width=5></td></tr></table><br1><img src=\"L2UI.Squaregray\" width=605 height=1><br1>");
}
separateAndSend(content.replace("%castleList%", sb.toString()), player);
@@ -89,9 +87,7 @@ public class RegionBBSManager extends BaseBBSManager
{
final Castle castle = CastleManager.getInstance().getCastleById(castleId);
final Clan owner = ClanTable.getInstance().getClan(castle.getOwnerId());
String content = HtmCache.getInstance().getHtm(CB_PATH + "region/castle.htm");
content = content.replace("%castleName%", castle.getName());
content = content.replace("%tax%", Integer.toString(castle.getTaxPercent()));
content = content.replace("%lord%", ((owner != null) ? owner.getLeaderName() : "None"));
@@ -100,16 +96,13 @@ public class RegionBBSManager extends BaseBBSManager
content = content.replace("%siegeDate%", new SimpleDateFormat("yyyy-MM-dd HH:mm").format(castle.getSiegeDate().getTimeInMillis()));
final StringBuilder sb = new StringBuilder(200);
final List<ClanHall> clanHalls = ClanHallManager.getInstance().getClanHallsByLocation(castle.getName());
if ((clanHalls != null) && !clanHalls.isEmpty())
{
sb.append("<br><br><table width=610 bgcolor=A7A19A><tr><td width=5></td><td width=200>Clan Hall Name</td><td width=200>Owning Clan</td><td width=200>Clan Leader Name</td><td width=5></td></tr></table><br1>");
for (ClanHall ch : clanHalls)
{
final Clan chOwner = ClanTable.getInstance().getClan(ch.getOwnerId());
StringUtil.append(sb, "<table><tr><td width=5></td><td width=200>", ch.getName(), "</td><td width=200>", ((chOwner != null) ? "<a action=\"bypass _bbsclan;home;" + chOwner.getClanId() + "\">" + chOwner.getName() + "</a>" : "None"), "</td><td width=200>", ((chOwner != null) ? chOwner.getLeaderName() : "None"), "</td><td width=5></td></tr></table><br1><img src=\"L2UI.Squaregray\" width=605 height=1><br1>");
}
}

View File

@@ -68,7 +68,6 @@ public class TopicBBSManager extends BaseBBSManager
final Post p = new Post(player.getName(), player.getObjectId(), Calendar.getInstance().getTimeInMillis(), t.getID(), f.getID(), ar4);
PostBBSManager.getInstance().addPostByTopic(p, t);
parseCmd("_bbsmemo", player);
}
else if (ar1.equals("del"))
@@ -108,7 +107,6 @@ public class TopicBBSManager extends BaseBBSManager
if (command.equals("_bbsmemo"))
{
CommunityBoard.getInstance().addBypass(player, "Memo Command", command);
showTopics(player.getMemo(), player, 1, player.getMemo().getID());
}
else if (command.startsWith("_bbstopics;read"))
@@ -120,7 +118,6 @@ public class TopicBBSManager extends BaseBBSManager
st.nextToken();
final int idf = Integer.parseInt(st.nextToken());
String index = null;
if (st.hasMoreTokens())
{
@@ -146,7 +143,6 @@ public class TopicBBSManager extends BaseBBSManager
st.nextToken();
final int idf = Integer.parseInt(st.nextToken());
showNewTopic(ForumsBBSManager.getInstance().getForumByID(idf), player, idf);
}
else if (command.startsWith("_bbstopics;del"))
@@ -157,7 +153,6 @@ public class TopicBBSManager extends BaseBBSManager
final int idf = Integer.parseInt(st.nextToken());
final int idt = Integer.parseInt(st.nextToken());
final Forum f = ForumsBBSManager.getInstance().getForumByID(idf);
if (f == null)
{
@@ -209,7 +204,6 @@ public class TopicBBSManager extends BaseBBSManager
{
return 0;
}
return i;
}
@@ -272,7 +266,6 @@ public class TopicBBSManager extends BaseBBSManager
{
forum.vload();
final StringBuilder sb = new StringBuilder("<html><body><br><br><table border=0 width=610><tr><td width=10></td><td width=600 align=left><a action=\"bypass _bbshome\">HOME</a>&nbsp;>&nbsp;<a action=\"bypass _bbsmemo\">Memo Form</a></td></tr></table><img src=\"L2UI.squareblank\" width=\"1\" height=\"10\"><center><table border=0 cellspacing=0 cellpadding=2 bgcolor=888888 width=610><tr><td FIXWIDTH=5></td><td FIXWIDTH=415 align=center>&$413;</td><td FIXWIDTH=120 align=center></td><td FIXWIDTH=70 align=center>&$418;</td></tr></table>");
final DateFormat dateFormat = DateFormat.getInstance();
for (int i = 0, j = getMaxID(forum) + 1; i < (12 * index); j--)
{
@@ -289,7 +282,6 @@ public class TopicBBSManager extends BaseBBSManager
}
sb.append("<br><table width=610 cellspace=0 cellpadding=0><tr><td width=50><button value=\"&$422;\" action=\"bypass _bbsmemo\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"></td><td width=510 align=center><table border=0><tr>");
if (index == 1)
{
sb.append("<td><button action=\"\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");

View File

@@ -42,7 +42,6 @@ public class CrownTable
_crownList.add(8182); // Rune
_crownList.add(8183); // Schuttgart
}
return _crownList;
}

View File

@@ -76,7 +76,6 @@ public class DesireTable
public Desires(DesireType... desireList)
{
_desireTable = new EnumMap<>(DesireType.class);
for (DesireType desire : desireList)
{
_desireTable.put(desire, new DesireValue());
@@ -91,7 +90,6 @@ public class DesireTable
public void addValue(DesireType type, float value)
{
final DesireValue temp = getDesireValue(type);
if (temp != null)
{
temp.addValue(value);
@@ -128,12 +126,10 @@ public class DesireTable
public float getDesireValue(WorldObject object, DesireType type)
{
final Desires desireList = _objectDesireTable.get(object);
if (desireList == null)
{
return 0f;
}
return desireList.getDesireValue(type).getValue();
}
@@ -145,7 +141,6 @@ public class DesireTable
public void addDesireValue(WorldObject object, DesireType type, float value)
{
final Desires desireList = _objectDesireTable.get(object);
if (desireList != null)
{
desireList.addValue(type, value);
@@ -165,7 +160,6 @@ public class DesireTable
public void createDesire(WorldObject object, DesireType type)
{
final Desires desireList = _objectDesireTable.get(object);
if (desireList != null)
{
desireList.createDesire(type);
@@ -175,7 +169,6 @@ public class DesireTable
public void deleteDesire(WorldObject object, DesireType type)
{
final Desires desireList = _objectDesireTable.get(object);
if (desireList != null)
{
desireList.deleteDesire(type);

View File

@@ -250,7 +250,6 @@ public class ItemTable
public ItemInstance createDummyItem(int itemId)
{
final Item item = getTemplate(itemId);
if (item == null)
{
return null;

View File

@@ -61,7 +61,6 @@ public class MobGroupTable
return mobGroup;
}
}
return null;
}

View File

@@ -68,7 +68,6 @@ public class OfflineTradeTable
con.setAutoCommit(false); // avoid halfway done
stm = con.prepareStatement(SAVE_OFFLINE_STATUS);
final PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS);
for (PlayerInstance pc : World.getInstance().getAllPlayers())
{
try
@@ -321,7 +320,6 @@ public class OfflineTradeTable
con.setAutoCommit(false); // avoid halfway done
stm = con.prepareStatement(SAVE_OFFLINE_STATUS);
final PreparedStatement stmItems = con.prepareStatement(SAVE_ITEMS);
boolean save = true;
try

View File

@@ -66,12 +66,9 @@ public class SchemeBufferTable
while (rs.next())
{
final int objectId = rs.getInt("object_id");
final String schemeName = rs.getString("scheme_name");
final String[] skills = rs.getString("skills").split(",");
final ArrayList<Integer> schemeList = new ArrayList<>();
for (String skill : skills)
{
// Don't feed the skills list if the list is empty.
@@ -100,9 +97,7 @@ public class SchemeBufferTable
final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
final DocumentBuilder db = dbf.newDocumentBuilder();
final Document doc = db.parse(new File("./data/SchemeBufferSkills.xml"));
final Node n = doc.getFirstChild();
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
if (!d.getNodeName().equalsIgnoreCase("category"))
@@ -111,7 +106,6 @@ public class SchemeBufferTable
}
final String category = d.getAttributes().getNamedItem("type").getNodeValue();
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
{
if (!c.getNodeName().equalsIgnoreCase("buff"))
@@ -121,7 +115,6 @@ public class SchemeBufferTable
final NamedNodeMap attrs = c.getAttributes();
final int skillId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
_availableBuffs.put(skillId, new BuffSkillHolder(skillId, Integer.parseInt(attrs.getNamedItem("price").getNodeValue()), category, attrs.getNamedItem("desc").getNodeValue()));
}
}
@@ -212,7 +205,6 @@ public class SchemeBufferTable
{
return Collections.emptyList();
}
return _schemesTable.get(playerId).get(schemeName);
}

View File

@@ -73,18 +73,15 @@ public class SkillTable
public int getMaxLevel(int magicId, int level)
{
Skill temp;
while (level < 100)
{
level++;
temp = _skills.get(getSkillHashCode(magicId, level));
if (temp == null)
{
return level - 1;
}
}
return level;
}
@@ -111,7 +108,6 @@ public class SkillTable
}
int weaponsAllowed = 0;
for (int i = 0; i < weaponDbMasks.length; i++)
{
if ((mask & (1 << i)) != 0)

View File

@@ -149,7 +149,6 @@ public class ClanTable
return clan;
}
}
return null;
}
@@ -167,7 +166,6 @@ public class ClanTable
}
LOGGER.info("{" + player.getObjectId() + "}({" + player.getName() + "}) requested a clan creation.");
if (10 > player.getLevel())
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_CRITERIA_IR_ORDER_TO_CREATE_A_CLAN);
@@ -262,7 +260,6 @@ public class ClanTable
public synchronized void destroyClan(int clanId)
{
final Clan clan = getClan(clanId);
if (clan == null)
{
return;
@@ -290,7 +287,6 @@ public class ClanTable
clan.broadcastToOnlineMembers(new SystemMessage(SystemMessageId.CLAN_HAS_DISPERSED));
final int castleId = clan.getHasCastle();
if (castleId == 0)
{
for (Siege siege : SiegeManager.getInstance().getSieges())
@@ -300,7 +296,6 @@ public class ClanTable
}
final int fortId = clan.getHasFort();
if (fortId == 0)
{
for (FortSiege siege : FortSiegeManager.getInstance().getSieges())
@@ -310,7 +305,6 @@ public class ClanTable
}
final ClanMember leaderMember = clan.getLeader();
if (leaderMember == null)
{
clan.getWarehouse().destroyAllItems("ClanRemove", null, null);
@@ -432,7 +426,6 @@ public class ClanTable
{
final Clan clan1 = getInstance().getClan(clanId1);
final Clan clan2 = getInstance().getClan(clanId2);
clan1.setEnemyClan(clan2);
clan2.setAttackerClan(clan1);
clan1.broadcastClanStatus();
@@ -466,7 +459,6 @@ public class ClanTable
{
final Clan clan1 = getInstance().getClan(clanId1);
final Clan clan2 = getInstance().getClan(clanId2);
clan1.deleteEnemyClan(clan2);
clan2.deleteAttackerClan(clan1);
clan1.broadcastClanStatus();
@@ -497,7 +489,6 @@ public class ClanTable
public void checkSurrender(Clan clan1, Clan clan2)
{
int count = 0;
for (ClanMember player : clan1.getMembers())
{
if ((player != null) && (player.getPlayerInstance().getWantsPeace() == 1))

View File

@@ -64,7 +64,6 @@ public class HelperBuffTable
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM helper_buff_list");
final ResultSet helperbuffdata = statement.executeQuery();
fillHelperBuffTable(helperbuffdata);
helperbuffdata.close();
statement.close();
@@ -86,7 +85,6 @@ public class HelperBuffTable
{
final StatSet helperBuffDat = new StatSet();
final int id = helperBuffData.getInt("id");
helperBuffDat.set("id", id);
helperBuffDat.set("skillID", helperBuffData.getInt("skill_id"));
helperBuffDat.set("skillLevel", helperBuffData.getInt("skill_level"));

View File

@@ -98,7 +98,6 @@ public class NpcTable
{
final int mobId = npcskills.getInt("npcid");
npcDat = _npcs.get(mobId);
if (npcDat == null)
{
continue;
@@ -106,7 +105,6 @@ public class NpcTable
final int skillId = npcskills.getInt("skillid");
final int level = npcskills.getInt("level");
if ((npcDat.getRace() == null) && (skillId == 4416))
{
npcDat.setRace(level);
@@ -114,7 +112,6 @@ public class NpcTable
}
npcSkill = SkillTable.getInstance().getInfo(skillId, level);
if (npcSkill == null)
{
continue;
@@ -137,15 +134,12 @@ public class NpcTable
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM custom_droplist ORDER BY mobId, chance DESC");
final ResultSet dropData = statement.executeQuery();
int cCount = 0;
while (dropData.next())
{
final int mobId = dropData.getInt("mobId");
final NpcTemplate npcDat = _npcs.get(mobId);
if (npcDat == null)
{
LOGGER.warning("NPCTable: CUSTOM DROPLIST No npc correlating with id: " + mobId);
@@ -159,7 +153,6 @@ public class NpcTable
dropDat.setChance(dropData.getInt("chance"));
final int category = dropData.getInt("category");
npcDat.addDropData(dropDat, category);
cCount++;
}
@@ -183,9 +176,7 @@ public class NpcTable
while (dropData.next())
{
final int mobId = dropData.getInt("mobId");
npcDat = _npcs.get(mobId);
if (npcDat == null)
{
LOGGER.info("NPCTable: No npc correlating with id: " + mobId);
@@ -193,14 +184,12 @@ public class NpcTable
}
dropDat = new DropData();
dropDat.setItemId(dropData.getInt("itemId"));
dropDat.setMinDrop(dropData.getInt("min"));
dropDat.setMaxDrop(dropData.getInt("max"));
dropDat.setChance(dropData.getInt("chance"));
final int category = dropData.getInt("category");
npcDat.addDropData(dropDat, category);
}
@@ -221,7 +210,6 @@ public class NpcTable
{
final int npcId = learndata.getInt("npc_id");
final int cId = learndata.getInt("class_id");
final NpcTemplate npc = getTemplate(npcId);
if (npc == null)
{
@@ -258,7 +246,6 @@ public class NpcTable
while (minionData.next())
{
final int raidId = minionData.getInt("boss_id");
npcDat = _npcs.get(raidId);
minionDat = new MinionData();
minionDat.setMinionId(minionData.getInt("minion_id"));
@@ -285,9 +272,7 @@ public class NpcTable
while (npcData.next())
{
final StatSet npcDat = new StatSet();
final int id = npcData.getInt("id");
npcDat.set("npcId", id);
npcDat.set("idTemplate", npcData.getInt("idTemplate"));
@@ -381,11 +366,9 @@ public class NpcTable
npcDat.set("level", level);
npcDat.set("jClass", npcData.getString("class"));
npcDat.set("baseShldDef", 0);
npcDat.set("baseShldRate", 0);
npcDat.set("baseCritRate", 4);
npcDat.set("name", npcData.getString("name"));
npcDat.set("serverSideName", npcData.getBoolean("serverSideName"));
npcDat.set("title", npcData.getString("title"));
@@ -398,7 +381,6 @@ public class NpcTable
// BOSS POWER CHANGES
double multiValue = 1;
if (diff >= 15) // means that there is level customization
{
multiValue = multiValue * (diff / 10);
@@ -495,7 +477,6 @@ public class NpcTable
npcDat.set("basePDef", npcData.getInt("pdef") * multiValue);
npcDat.set("baseMAtk", npcData.getInt("matk") * multiValue);
npcDat.set("baseMDef", npcData.getInt("mdef") * multiValue);
npcDat.set("aggroRange", npcData.getInt("aggro"));
npcDat.set("rhand", npcData.getInt("rhand"));
npcDat.set("lhand", npcData.getInt("lhand"));
@@ -510,14 +491,10 @@ public class NpcTable
npcDat.safeSet("baseINT", npcData.getInt("int"), 0, BaseStat.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseWIT", npcData.getInt("wit"), 0, BaseStat.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.safeSet("baseMEN", npcData.getInt("men"), 0, BaseStat.MAX_STAT_VALUE, "Loading npc template id: " + npcData.getInt("idTemplate"));
npcDat.set("baseCpMax", 0);
npcDat.set("factionId", npcData.getString("faction_id"));
npcDat.set("factionRange", npcData.getInt("faction_range"));
npcDat.set("isUndead", npcData.getString("isUndead"));
npcDat.set("absorb_level", npcData.getString("absorb_level"));
npcDat.set("absorb_type", npcData.getString("absorb_type"));
@@ -525,7 +502,6 @@ public class NpcTable
template.addVulnerability(Stat.BOW_WPN_VULN, 1);
template.addVulnerability(Stat.BLUNT_WPN_VULN, 1);
template.addVulnerability(Stat.DAGGER_WPN_VULN, 1);
_npcs.put(id, template);
}
@@ -539,20 +515,16 @@ public class NpcTable
// save a copy of the old data
final NpcTemplate old = getTemplate(id);
final Map<Integer, Skill> skills = new HashMap<>();
skills.putAll(old.getSkills());
final List<DropCategory> categories = new ArrayList<>();
if (old.getDropData() != null)
{
categories.addAll(old.getDropData());
}
final List<ClassId> classIds = old.getTeachInfo();
final List<MinionData> minions = new ArrayList<>();
if (old.getMinionData() != null)
{
minions.addAll(old.getMinionData());
@@ -579,7 +551,6 @@ public class NpcTable
// restore additional data from saved copy
final NpcTemplate created = getTemplate(id);
for (Skill skill : skills.values())
{
created.addSkill(skill);
@@ -611,16 +582,13 @@ public class NpcTable
try (Connection con = DatabaseFactory.getConnection())
{
final Map<String, Object> set = npc.getSet();
String name = "";
String values = "";
final NpcTemplate old = getTemplate(npc.getInt("npcId"));
for (Object obj : set.keySet())
{
name = (String) obj;
if (!name.equalsIgnoreCase("npcId"))
{
if (values != "")
@@ -675,14 +643,12 @@ public class NpcTable
return npcTemplate;
}
}
return null;
}
public NpcTemplate[] getAllOfLevel(int lvl)
{
final List<NpcTemplate> list = new ArrayList<>();
for (NpcTemplate t : _npcs.values())
{
if (t.getLevel() == lvl)
@@ -690,14 +656,12 @@ public class NpcTable
list.add(t);
}
}
return list.toArray(new NpcTemplate[list.size()]);
}
public NpcTemplate[] getAllMonstersOfLevel(int lvl)
{
final List<NpcTemplate> list = new ArrayList<>();
for (NpcTemplate t : _npcs.values())
{
if ((t.getLevel() == lvl) && "Monster".equals(t.getType()))
@@ -705,14 +669,12 @@ public class NpcTable
list.add(t);
}
}
return list.toArray(new NpcTemplate[list.size()]);
}
public NpcTemplate[] getAllNpcStartingWith(String letter)
{
final List<NpcTemplate> list = new ArrayList<>();
for (NpcTemplate t : _npcs.values())
{
if (t.getName().startsWith(letter) && "Npc".equals(t.getType()))
@@ -720,7 +682,6 @@ public class NpcTable
list.add(t);
}
}
return list.toArray(new NpcTemplate[list.size()]);
}

View File

@@ -45,7 +45,6 @@ public class PetDataTable
{
final PreparedStatement statement = con.prepareStatement("SELECT typeID, level, expMax, hpMax, mpMax, patk, pdef, matk, mdef, acc, evasion, crit, speed, atk_speed, cast_speed, feedMax, feedbattle, feednormal, loadMax, hpregen, mpregen, owner_exp_taken FROM pets_stats");
final ResultSet rset = statement.executeQuery();
int petId;
int petLevel;
@@ -56,7 +55,6 @@ public class PetDataTable
// build the petdata for this level
final PetData petData = new PetData();
petData.setPetID(petId);
petData.setPetLevel(petLevel);
petData.setPetMaxExp(rset.getInt("expMax"));
@@ -102,7 +100,6 @@ public class PetDataTable
public void addPetData(PetData petData)
{
final Map<Integer, PetData> h = _petTable.get(petData.getPetID());
if (h == null)
{
final Map<Integer, PetData> statTable = new HashMap<>();

View File

@@ -39,7 +39,6 @@ public class PetNameTable
{
final PreparedStatement statement = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)");
statement.setString(1, name);
String cond = "";
for (int it : PetDataTable.getPetItemsAsNpc(petNpcId))
{
@@ -66,7 +65,6 @@ public class PetNameTable
public boolean isValidPetName(String name)
{
boolean result = true;
if (!isAlphaNumeric(name))
{
return result;
@@ -84,7 +82,6 @@ public class PetNameTable
}
final Matcher regexp = pattern.matcher(name);
if (!regexp.matches())
{
result = false;
@@ -105,7 +102,6 @@ public class PetNameTable
break;
}
}
return result;
}

View File

@@ -69,7 +69,6 @@ public class SkillTreeTable
ClassId classId = null;
ClassId parentClassId;
int count = 0;
try (Connection con = DatabaseFactory.getConnection())
{
@@ -82,7 +81,6 @@ public class SkillTreeTable
final PreparedStatement statement = con.prepareStatement("SELECT * FROM skill_trees where class_id=? ORDER BY skill_id, level");
statement.setInt(1, classId.getId());
final ResultSet skilltree = statement.executeQuery();
if (parentClassId != null)
{
map.putAll(_skillTrees.get(parentClassId));
@@ -97,7 +95,6 @@ public class SkillTreeTable
final String name = skilltree.getString("name");
final int minLvl = skilltree.getInt("min_level");
final int cost = skilltree.getInt("sp");
if (prevSkillId != id)
{
prevSkillId = id;
@@ -108,7 +105,6 @@ public class SkillTreeTable
_skillTrees.put(classId, map);
count += map.size();
skilltree.close();
statement.close();
}
@@ -126,7 +122,6 @@ public class SkillTreeTable
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM fishing_skill_trees ORDER BY skill_id, level");
final ResultSet skilltree = statement.executeQuery();
int prevSkillId = -1;
while (skilltree.next())
@@ -139,14 +134,12 @@ public class SkillTreeTable
final int costId = skilltree.getInt("costid");
final int costCount = skilltree.getInt("cost");
final int isDwarven = skilltree.getInt("isfordwarf");
if (prevSkillId != id)
{
prevSkillId = id;
}
final SkillLearn skill = new SkillLearn(id, lvl, minLvl, name, cost, costId, costCount);
if (isDwarven == 0)
{
_fishingSkillTrees.add(skill);
@@ -169,7 +162,6 @@ public class SkillTreeTable
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM enchant_skill_trees ORDER BY skill_id, level");
final ResultSet skilltree = statement.executeQuery();
int prevSkillId = -1;
while (skilltree.next())
@@ -186,7 +178,6 @@ public class SkillTreeTable
final byte rate78 = skilltree.getByte("success_rate78");
final byte rate79 = skilltree.getByte("success_rate79");
final byte rate80 = skilltree.getByte("success_rate80");
if (prevSkillId != id)
{
prevSkillId = id;
@@ -207,7 +198,6 @@ public class SkillTreeTable
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM pledge_skill_trees ORDER BY skill_id, level");
final ResultSet skilltree = statement.executeQuery();
int prevSkillId = -1;
while (skilltree.next())
@@ -218,7 +208,6 @@ public class SkillTreeTable
final int baseLvl = skilltree.getInt("clan_lvl");
final int sp = skilltree.getInt("repCost");
final int itemId = skilltree.getInt("itemId");
if (prevSkillId != id)
{
prevSkillId = id;
@@ -256,9 +245,7 @@ public class SkillTreeTable
// since expertise comes at same level for all classes we use paladin for now
final Map<Integer, SkillLearn> learnMap = _skillTrees.get(ClassId.PALADIN);
final int skillHashCode = SkillTable.getSkillHashCode(239, grade);
if (learnMap.containsKey(skillHashCode))
{
return learnMap.get(skillHashCode).getMinLevel();
@@ -277,14 +264,11 @@ public class SkillTreeTable
public int getMinSkillLevel(int skillId, ClassId classId, int skillLvl)
{
final Map<Integer, SkillLearn> map = _skillTrees.get(classId);
final int skillHashCode = SkillTable.getSkillHashCode(skillId, skillLvl);
if (map.containsKey(skillHashCode))
{
return map.get(skillHashCode).getMinLevel();
}
return 0;
}
@@ -301,7 +285,6 @@ public class SkillTreeTable
return map.get(skillHashCode).getMinLevel();
}
}
return 0;
}
@@ -322,7 +305,6 @@ public class SkillTreeTable
{
final List<SkillLearn> result = new ArrayList<>();
final Collection<SkillLearn> skills = _skillTrees.get(classId).values();
if (skills.isEmpty())
{
LOGGER.warning(getClass().getSimpleName() + ": Skilltree for class " + classId + " is not defined!");
@@ -354,7 +336,6 @@ public class SkillTreeTable
{
final List<SkillLearn> result = new ArrayList<>();
final List<SkillLearn> skills = new ArrayList<>();
skills.addAll(_fishingSkillTrees);
if (player.hasDwarvenCraft() && (_expandDwarfCraftSkillTrees != null))
@@ -363,19 +344,16 @@ public class SkillTreeTable
}
final Skill[] oldSkills = player.getAllSkills();
for (SkillLearn temp : skills)
{
if (temp.getMinLevel() <= player.getLevel())
{
boolean knownSkill = false;
for (int j = 0; (j < oldSkills.length) && !knownSkill; j++)
{
if (oldSkills[j].getId() == temp.getId())
{
knownSkill = true;
if (oldSkills[j].getLevel() == (temp.getLevel() - 1))
{
// this is the next level of a skill that we know
@@ -399,11 +377,9 @@ public class SkillTreeTable
{
final List<EnchantSkillLearn> result = new ArrayList<>();
final List<EnchantSkillLearn> skills = new ArrayList<>();
skills.addAll(_enchantSkillTrees);
final Skill[] oldSkills = player.getAllSkills();
if (player.getLevel() < 76)
{
return result.toArray(new EnchantSkillLearn[result.size()]);
@@ -412,7 +388,6 @@ public class SkillTreeTable
for (EnchantSkillLearn skillLearn : skills)
{
boolean isKnownSkill = false;
for (Skill skill : oldSkills)
{
if (isKnownSkill)
@@ -437,7 +412,6 @@ public class SkillTreeTable
{
final List<PledgeSkillLearn> result = new ArrayList<>();
final List<PledgeSkillLearn> skills = _pledgeSkillTrees;
if (skills == null)
{
LOGGER.warning("No clan skills defined!");
@@ -445,19 +419,16 @@ public class SkillTreeTable
}
final Skill[] oldSkills = player.getClan().getAllSkills();
for (PledgeSkillLearn temp : skills)
{
if (temp.getBaseLevel() <= player.getClan().getLevel())
{
boolean knownSkill = false;
for (int j = 0; (j < oldSkills.length) && !knownSkill; j++)
{
if (oldSkills[j].getId() == temp.getId())
{
knownSkill = true;
if (oldSkills[j].getLevel() == (temp.getLevel() - 1))
{
// this is the next level of a skill that we know
@@ -491,7 +462,6 @@ public class SkillTreeTable
{
int minLevel = 0;
final Collection<SkillLearn> skills = _skillTrees.get(classId).values();
for (SkillLearn temp : skills)
{
if ((temp.getMinLevel() > player.getLevel()) && (temp.getSpCost() != 0) && ((minLevel == 0) || (temp.getMinLevel() < minLevel)))
@@ -499,7 +469,6 @@ public class SkillTreeTable
minLevel = temp.getMinLevel();
}
}
return minLevel;
}
@@ -507,7 +476,6 @@ public class SkillTreeTable
{
int minLevel = 0;
final List<SkillLearn> skills = new ArrayList<>();
skills.addAll(_fishingSkillTrees);
if (player.hasDwarvenCraft() && (_expandDwarfCraftSkillTrees != null))
@@ -531,7 +499,6 @@ public class SkillTreeTable
int skillCost = 100000000;
final ClassId classId = player.getSkillLearningClassId();
final int skillHashCode = SkillTable.getSkillHashCode(skill);
if (_skillTrees.get(classId).containsKey(skillHashCode))
{
final SkillLearn skillLearn = _skillTrees.get(classId).get(skillHashCode);
@@ -568,7 +535,6 @@ public class SkillTreeTable
{
int skillCost = 100000000;
final EnchantSkillLearn[] enchantSkillLearnList = getAvailableEnchantSkills(player);
for (EnchantSkillLearn enchantSkillLearn : enchantSkillLearnList)
{
if (enchantSkillLearn.getId() != skill.getId())
@@ -595,7 +561,6 @@ public class SkillTreeTable
{
int skillCost = 100000000;
final EnchantSkillLearn[] enchantSkillLearnList = getAvailableEnchantSkills(player);
for (EnchantSkillLearn enchantSkillLearn : enchantSkillLearnList)
{
if (enchantSkillLearn.getId() != skill.getId())
@@ -622,7 +587,6 @@ public class SkillTreeTable
public byte getSkillRate(PlayerInstance player, Skill skill)
{
final EnchantSkillLearn[] enchantSkillLearnList = getAvailableEnchantSkills(player);
for (EnchantSkillLearn enchantSkillLearn : enchantSkillLearnList)
{
if (enchantSkillLearn.getId() != skill.getId())

View File

@@ -62,7 +62,6 @@ public class SpawnTable
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
if (Config.DELETE_GMSPAWN_ON_CUSTOM)
{
statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM spawnlist where id NOT in ( select id from custom_notspawned where isCustom = false ) ORDER BY id");
@@ -73,7 +72,6 @@ public class SpawnTable
}
final ResultSet rset = statement.executeQuery();
Spawn spawnDat;
NpcTemplate template1;
@@ -110,7 +108,6 @@ public class SpawnTable
spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
final int loc_id = rset.getInt("loc_id");
spawnDat.setLocation(loc_id);
switch (rset.getInt("periodOfDay"))
@@ -167,7 +164,6 @@ public class SpawnTable
try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement;
if (Config.DELETE_GMSPAWN_ON_CUSTOM)
{
statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, loc_id, periodOfDay FROM custom_spawnlist where id NOT in ( select id from custom_notspawned where isCustom = false ) ORDER BY id");
@@ -178,14 +174,12 @@ public class SpawnTable
}
final ResultSet rset = statement.executeQuery();
Spawn spawnDat;
NpcTemplate template1;
while (rset.next())
{
template1 = NpcTable.getInstance().getTemplate(rset.getInt("npc_templateid"));
if (template1 != null)
{
if (template1.getType().equalsIgnoreCase("SiegeGuard"))
@@ -212,7 +206,6 @@ public class SpawnTable
spawnDat.setRespawnDelay(rset.getInt("respawn_delay"));
final int loc_id = rset.getInt("loc_id");
spawnDat.setLocation(loc_id);
switch (rset.getInt("periodOfDay"))

View File

@@ -54,14 +54,12 @@ public class TeleportLocationTable
while (rset.next())
{
teleport = new TeleportLocation();
teleport.setTeleId(rset.getInt("id"));
teleport.setX(rset.getInt("loc_x"));
teleport.setY(rset.getInt("loc_y"));
teleport.setZ(rset.getInt("loc_z"));
teleport.setPrice(rset.getInt("price"));
teleport.setForNoble(rset.getInt("fornoble") == 1);
_teleports.put(teleport.getTeleId(), teleport);
}
@@ -82,7 +80,6 @@ public class TeleportLocationTable
final PreparedStatement statement = con.prepareStatement("SELECT Description, id, loc_x, loc_y, loc_z, price, fornoble FROM custom_teleport");
final ResultSet rset = statement.executeQuery();
TeleportLocation teleport;
int cTeleCount = _teleports.size();
while (rset.next())
@@ -101,7 +98,6 @@ public class TeleportLocationTable
rset.close();
cTeleCount = _teleports.size() - cTeleCount;
if (cTeleCount > 0)
{
LOGGER.info("TeleportLocationTable: Loaded " + cTeleCount + " Custom Teleport Location Templates.");

View File

@@ -58,7 +58,6 @@ public class TerritoryTable
while (rset.next())
{
final int terr = rset.getInt("loc_id");
if (_territory.get(terr) == null)
{
final Territory t = new Territory();

View File

@@ -78,14 +78,11 @@ public class TradeListTable
final PreparedStatement statement = con.prepareStatement("SELECT item_id, price, shop_id, order, count, time, currentCount FROM " + (custom ? "custom_merchant_buylists" : "merchant_buylists") + " WHERE shop_id=? ORDER BY order ASC");
statement.setString(1, String.valueOf(rset1.getInt("shop_id")));
final ResultSet rset = statement.executeQuery();
final StoreTradeList buylist = new StoreTradeList(rset1.getInt("shop_id"));
buylist.setNpcId(rset1.getString("npc_id"));
int itemId = 0;
int itemCount = 0;
int price = 0;
if (!buylist.isGm() && (NpcTable.getInstance().getTemplate(rset1.getInt("npc_id")) == null))
{
LOGGER.warning("TradeListTable: Merchant id " + rset1.getString("npc_id") + " with buylist " + buylist.getListId() + " does not exist.");
@@ -100,9 +97,7 @@ public class TradeListTable
final int count = rset.getInt("count");
final int currentCount = rset.getInt("currentCount");
final int time = rset.getInt("time");
final ItemInstance buyItem = ItemTable.getInstance().createDummyItem(itemId);
if (buyItem == null)
{
continue;
@@ -214,7 +209,6 @@ public class TradeListTable
{
return _lists.get(listId);
}
return null;
}
@@ -250,7 +244,6 @@ public class TradeListTable
try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
for (StoreTradeList list : _lists.values())
{
if (list == null)
@@ -259,7 +252,6 @@ public class TradeListTable
}
listId = list.getListId();
for (ItemInstance Item : list.getItems())
{
if (Item.getCount() < Item.getInitCount()) // needed?

View File

@@ -59,7 +59,6 @@ public class AdminData implements IXmlReader
_accessLevels.clear();
parseDatapackFile("config/AccessLevels.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _accessLevels.size() + " access levels.");
_adminCommandAccessRights.clear();
parseDatapackFile("config/AdminCommands.xml");
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _adminCommandAccessRights.size() + " access commands.");
@@ -85,7 +84,6 @@ public class AdminData implements IXmlReader
boolean useNameColor = true;
boolean useTitleColor = false;
boolean canDisableGmStatus = true;
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -95,10 +93,8 @@ public class AdminData implements IXmlReader
if ("access".equals(d.getNodeName()))
{
set = new StatSet(parseAttributes(d));
accessLevel = set.getInt("level");
name = set.getString("name");
if (accessLevel < 0)
{
LOGGER.info(getClass().getSimpleName() + ": Access level with name " + name + " is using banned access level state(below 0). Ignoring it...");
@@ -149,17 +145,14 @@ public class AdminData implements IXmlReader
giveDamage = set.getBoolean("giveDamage");
takeAggro = set.getBoolean("takeAggro");
gainExp = set.getBoolean("gainExp");
useNameColor = set.getBoolean("useNameColor");
useTitleColor = set.getBoolean("useTitleColor");
canDisableGmStatus = set.getBoolean("canDisableGmStatus");
_accessLevels.put(accessLevel, new AccessLevel(accessLevel, name, nameColor, titleColor, isGm, allowPeaceAttack, allowFixedRes, allowTransaction, allowAltG, giveDamage, takeAggro, gainExp, useNameColor, useTitleColor, canDisableGmStatus));
}
else if ("admin".equals(d.getNodeName()))
{
set = new StatSet(parseAttributes(d));
command = set.getString("command");
accessLevel = set.getInt("accessLevel");
_adminCommandAccessRights.put(command, accessLevel);
@@ -322,7 +315,6 @@ public class AdminData implements IXmlReader
if (isGmOnline(player.isGM()))
{
player.sendPacket(new SystemMessage(SystemMessageId.GM_LIST));
for (String name : getAllGmNames(player.isGM()))
{
final SystemMessage sm = new SystemMessage(SystemMessageId.GM_S1);

View File

@@ -58,7 +58,6 @@ public class ArmorSetData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"armorset".equalsIgnoreCase(node.getNodeName()))

View File

@@ -76,13 +76,11 @@ public class AugmentationData
public void load()
{
LOGGER.info("Initializing AugmentationData.");
_augmentationStats = new ArrayList[4];
_augmentationStats[0] = new ArrayList<>();
_augmentationStats[1] = new ArrayList<>();
_augmentationStats[2] = new ArrayList<>();
_augmentationStats[3] = new ArrayList<>();
_blueSkills = new HashMap<>();
_purpleSkills = new HashMap<>();
_redSkills = new HashMap<>();
@@ -110,7 +108,6 @@ public class AugmentationData
}
final Document doc = factory.newDocumentBuilder().parse(file);
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -124,7 +121,6 @@ public class AugmentationData
final int augmentationId = Integer.parseInt(attrs.getNamedItem("id").getNodeValue());
String type = "blue";
int skillLvL = 0;
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
if ("skillId".equalsIgnoreCase(cd.getNodeName()))
@@ -199,14 +195,12 @@ public class AugmentationData
factory.setIgnoringComments(true);
final File file = new File(Config.DATAPACK_ROOT + "/data/stats/augmentation/augmentation_stats" + i + ".xml");
if (!file.exists())
{
return;
}
final Document doc = factory.newDocumentBuilder().parse(file);
for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
{
if ("list".equalsIgnoreCase(n.getNodeName()))
@@ -217,17 +211,14 @@ public class AugmentationData
{
NamedNodeMap attrs = d.getAttributes();
final String statName = attrs.getNamedItem("name").getNodeValue();
float[] soloValues = null;
float[] combinedValues = null;
for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
{
if ("table".equalsIgnoreCase(cd.getNodeName()))
{
attrs = cd.getAttributes();
final String tableName = attrs.getNamedItem("name").getNodeValue();
final StringTokenizer data = new StringTokenizer(cd.getFirstChild().getNodeValue());
final List<Float> array = new ArrayList<>();
@@ -240,7 +231,6 @@ public class AugmentationData
{
soloValues = new float[array.size()];
int x = 0;
for (float value : array)
{
soloValues[x++] = value;
@@ -250,7 +240,6 @@ public class AugmentationData
{
combinedValues = new float[array.size()];
int x = 0;
for (float value : array)
{
combinedValues[x++] = value;
@@ -352,7 +341,6 @@ public class AugmentationData
if ((stat34 == 0) && !generateSkill)
{
resultColor = Rnd.get(0, 100);
if (resultColor <= ((15 * lifeStoneGrade) + 40))
{
resultColor = 1;
@@ -365,7 +353,6 @@ public class AugmentationData
else
{
resultColor = Rnd.get(0, 100);
if ((resultColor <= ((10 * lifeStoneGrade) + 5)) || (stat34 != 0))
{
resultColor = 3;
@@ -382,15 +369,12 @@ public class AugmentationData
// is neither a skill nor basestat used for stat34? then generate a normal stat
int stat12 = 0;
if ((stat34 == 0) && !generateSkill)
{
final int temp = Rnd.get(2, 3);
final int colorOffset = (resultColor * 10 * STAT_SUBBLOCKSIZE) + (temp * STAT_BLOCKSIZE) + 1;
int offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + colorOffset;
stat34 = Rnd.get(offset, (offset + STAT_SUBBLOCKSIZE) - 1);
if (generateGlow && (lifeStoneGrade >= 2))
{
offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + ((temp - 2) * STAT_BLOCKSIZE) + (lifeStoneGrade * 10 * STAT_SUBBLOCKSIZE) + 1;
@@ -404,7 +388,6 @@ public class AugmentationData
else
{
int offset;
if (!generateGlow)
{
offset = ((lifeStoneLevel - 1) * STAT_SUBBLOCKSIZE) + (Rnd.get(0, 1) * STAT_BLOCKSIZE) + 1;
@@ -492,7 +475,6 @@ public class AugmentationData
final int[] stats = new int[2];
stats[0] = 0x0000FFFF & augmentationId;
stats[1] = augmentationId >> 16;
for (int i = 0; i < 2; i++)
{
// its a stat
@@ -522,7 +504,6 @@ public class AugmentationData
else // twin stat
{
stats[i] -= 13; // rescale to 0 (if first of first combined block)
int x = 12; // next combi block has 12 stats
int rescales = 0; // number of rescales done
@@ -607,7 +588,6 @@ public class AugmentationData
{
return SkillTable.getInstance().getInfo(_skillId, _maxSkillLevel);
}
return SkillTable.getInstance().getInfo(_skillId, level);
}
@@ -650,7 +630,6 @@ public class AugmentationData
{
return _singleValues[_singleSize - 1];
}
return _singleValues[i];
}
@@ -660,7 +639,6 @@ public class AugmentationData
{
return _combinedValues[_combinedSize - 1];
}
return _combinedValues[i];
}

View File

@@ -68,7 +68,6 @@ public class BoatData implements IXmlReader
{
final StatSet set = new StatSet();
final Map<Integer, List<BoatPoint>> paths = new HashMap<>();
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
@@ -156,7 +155,6 @@ public class BoatData implements IXmlReader
point.y = set.getInt("y");
point.z = set.getInt("z");
point.time = set.getInt("time");
points.add(point);
}
paths.put(Integer.parseInt(node.getAttributes().getNamedItem("id").getNodeValue()), points);

View File

@@ -57,7 +57,6 @@ public class DoorData implements IXmlReader
try
{
final StatSet set = new StatSet();
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
@@ -108,7 +107,6 @@ public class DoorData implements IXmlReader
final int mDef = set.getInt("mDef");
final boolean unlockable = set.getBoolean("unlockable", false);
final boolean isOpen = set.getBoolean("isOpen", false);
if (xMin > xMax)
{
LOGGER.warning("Error in door data, ID:" + id);
@@ -138,14 +136,12 @@ public class DoorData implements IXmlReader
npcDat.set("npcId", id);
npcDat.set("level", 0);
npcDat.set("jClass", "door");
npcDat.set("baseSTR", 0);
npcDat.set("baseCON", 0);
npcDat.set("baseDEX", 0);
npcDat.set("baseINT", 0);
npcDat.set("baseWIT", 0);
npcDat.set("baseMEN", 0);
npcDat.set("baseShldDef", 0);
npcDat.set("baseShldRate", 0);
npcDat.set("baseAccCombat", 38);
@@ -193,7 +189,6 @@ public class DoorData implements IXmlReader
door.setCurrentHpMp(door.getMaxHp(), door.getMaxMp());
door.setOpen(isOpen);
door.setXYZInvisible(x, y, z);
return door;
}
@@ -285,24 +280,19 @@ public class DoorData implements IXmlReader
final int px2 = doorInst.getXMax();
final int py2 = doorInst.getYMax();
final int pz2 = doorInst.getZMax();
final int l = tx - x;
final int m = ty - y;
final int n = tz - z;
final int dk = ((doorInst.getA() * l) + (doorInst.getB() * m) + (doorInst.getC() * n));
if (dk == 0)
{
continue; // Parallel
}
final float p = (float) ((doorInst.getA() * x) + (doorInst.getB() * y) + (doorInst.getC() * z) + doorInst.getD()) / dk;
final int fx = (int) (x - (l * p));
final int fy = (int) (y - (m * p));
final int fz = (int) (z - (n * p));
if (((Math.min(x, tx) <= fx) && (fx <= Math.max(x, tx))) && ((Math.min(y, ty) <= fy) && (fy <= Math.max(y, ty))) && ((Math.min(z, tz) <= fz) && (fz <= Math.max(z, tz))))
{
if ((((fx >= px1) && (fx <= px2)) || ((fx >= px2) && (fx <= px1))) && (((fy >= py1) && (fy <= py2)) || ((fy >= py2) && (fy <= py1))) && (((fz >= pz1) && (fz <= pz2)) || ((fz >= pz2) && (fz <= pz1))))

View File

@@ -72,10 +72,8 @@ public class ExperienceData
final Node table = doc.getFirstChild();
final NamedNodeMap tableAttr = table.getAttributes();
MAX_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxLevel").getNodeValue()) + 1);
MAX_PET_LEVEL = (byte) (Byte.parseByte(tableAttr.getNamedItem("maxPetLevel").getNodeValue()) + 1);
_expTable.clear();
NamedNodeMap attrs;

View File

@@ -61,7 +61,6 @@ public class ExtractableItemData implements IXmlReader
float totalChance;
float chance;
final StatSet set = new StatSet();
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
@@ -84,7 +83,6 @@ public class ExtractableItemData implements IXmlReader
amount = set.getInt("quantity");
chance = set.getFloat("chance");
extractables.add(new ExtractableProductItem(production, amount, chance));
totalChance = 0;
for (ExtractableProductItem extractable : extractables)
{

View File

@@ -112,7 +112,6 @@ public class FenceData
final int length = Integer.parseInt(attrs.getNamedItem("length").getNodeValue());
final int height = Integer.parseInt(attrs.getNamedItem("height").getNodeValue());
final FenceState state = FenceState.valueOf(attrs.getNamedItem("state").getNodeValue());
spawnFence(x, y, z, name, width, length, height, state);
}
@@ -238,7 +237,6 @@ public class FenceData
final double xi = (((x3 - x4) * ((x1 * y2) - (y1 * x2))) - ((x1 - x2) * ((x3 * y4) - (y3 * x4)))) / d;
final double yi = (((y3 - y4) * ((x1 * y2) - (y1 * x2))) - ((y1 - y2) * ((x3 * y4) - (y3 * x4)))) / d;
return new double[]
{
xi,

View File

@@ -57,7 +57,6 @@ public class FishData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"fish".equalsIgnoreCase(node.getNodeName()))

View File

@@ -59,7 +59,6 @@ public class HennaData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"henna".equalsIgnoreCase(node.getNodeName()))

View File

@@ -64,7 +64,6 @@ public class ManorSeedData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if ("seed".equalsIgnoreCase(node.getNodeName()))

View File

@@ -73,7 +73,6 @@ public class MapRegionData implements IXmlReader
{
int id = 0;
final StatSet set = new StatSet();
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
@@ -142,7 +141,6 @@ public class MapRegionData implements IXmlReader
Castle castle = null;
Fort fort = null;
ClanHall clanhall = null;
if (player.getClan() != null)
{
// If teleport to clan hall

View File

@@ -58,7 +58,6 @@ public class PlayerTemplateData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"class".equalsIgnoreCase(node.getNodeName()))

View File

@@ -58,7 +58,6 @@ public class RecipeData extends RecipeController implements IXmlReader
try
{
List<RecipeInstance> recipePartList = new ArrayList<>();
Node n = doc.getFirstChild();
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
{
@@ -66,7 +65,6 @@ public class RecipeData extends RecipeController implements IXmlReader
{
recipePartList.clear();
NamedNodeMap attrs = d.getAttributes();
Node att = attrs.getNamedItem("id");
if (att == null)
{
@@ -74,7 +72,6 @@ public class RecipeData extends RecipeController implements IXmlReader
continue;
}
int id = Integer.parseInt(att.getNodeValue());
att = attrs.getNamedItem("name");
if (att == null)
{
@@ -82,7 +79,6 @@ public class RecipeData extends RecipeController implements IXmlReader
continue;
}
String recipeName = att.getNodeValue();
int recipeId = -1;
int level = -1;
boolean isDwarvenRecipe = true;
@@ -90,7 +86,6 @@ public class RecipeData extends RecipeController implements IXmlReader
int successRate = -1;
int prodId = -1;
int count = -1;
for (Node c = d.getFirstChild(); c != null; c = c.getNextSibling())
{
if ("recipe".equalsIgnoreCase(c.getNodeName()))

View File

@@ -58,7 +58,6 @@ public class StaticObjectData implements IXmlReader
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"object".equalsIgnoreCase(node.getNodeName()))

View File

@@ -51,7 +51,6 @@ public class SummonItemData implements IXmlReader
{
// First element is never read.
final Node n = doc.getFirstChild();
for (Node node = n.getFirstChild(); node != null; node = node.getNextSibling())
{
if (!"item".equalsIgnoreCase(node.getNodeName()))
@@ -60,11 +59,9 @@ public class SummonItemData implements IXmlReader
}
final NamedNodeMap attrs = node.getAttributes();
final int itemId = Integer.valueOf(attrs.getNamedItem("id").getNodeValue());
final int npcId = Integer.valueOf(attrs.getNamedItem("npcId").getNodeValue());
final byte summonType = Byte.valueOf(attrs.getNamedItem("summonType").getNodeValue());
_items.put(itemId, new SummonItem(itemId, npcId, summonType));
}
}

View File

@@ -85,7 +85,6 @@ public class WalkerRouteData implements IXmlReader
route.setDelay(set.getInt("delay"));
route.setRunning(set.getBoolean("run"));
route.setChatText(set.getString("chat", null));
points.add(route);
}
_routes.put(Integer.parseInt(node.getAttributes().getNamedItem("npcId").getNodeValue()), points);

View File

@@ -83,7 +83,6 @@ public class ZoneData
protected ZoneData()
{
LOGGER.info(getClass().getSimpleName() + ": Loading zones...");
load();
}
@@ -367,7 +366,6 @@ public class ZoneData
}
int[][] coords = rs.toArray(new int[rs.size()][]);
if ((coords == null) || (coords.length == 0))
{
LOGGER.warning(getClass().getSimpleName() + ": missing data for zone: " + zoneId + " on file: " + f.getName());
@@ -442,7 +440,6 @@ public class ZoneData
attrs = cd.getAttributes();
String name = attrs.getNamedItem("name").getNodeValue();
String val = attrs.getNamedItem("val").getNodeValue();
temp.setParameter(name, val);
}
else if ("spawn".equalsIgnoreCase(cd.getNodeName()) && (temp instanceof ZoneRespawn))
@@ -451,7 +448,6 @@ public class ZoneData
int spawnX = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
int spawnY = Integer.parseInt(attrs.getNamedItem("Y").getNodeValue());
int spawnZ = Integer.parseInt(attrs.getNamedItem("Z").getNodeValue());
Node val = attrs.getNamedItem("isChaotic");
if ((val != null) && Boolean.parseBoolean(val.getNodeValue()))
{
@@ -586,7 +582,6 @@ public class ZoneData
{
return null;
}
return getZone(object.getX(), object.getY(), object.getZ(), type);
}

View File

@@ -257,7 +257,6 @@ public abstract class DocumentBase
if (attrs.getNamedItem("time") != null)
{
time = Integer.decode(getValue(attrs.getNamedItem("time").getNodeValue(), template));
if (Config.ENABLE_MODIFY_SKILL_DURATION && Config.SKILL_DURATION_LIST.containsKey(((Skill) template).getId()))
{
if (((Skill) template).getLevel() < 100)
@@ -280,7 +279,6 @@ public abstract class DocumentBase
}
boolean self = false;
if ((attrs.getNamedItem("self") != null) && (Integer.decode(getValue(attrs.getNamedItem("self").getNodeValue(), template)) == 1))
{
self = true;
@@ -288,13 +286,10 @@ public abstract class DocumentBase
final Lambda lambda = getLambda(n, template);
final Condition applayCond = parseCondition(n.getFirstChild(), template);
int abnormal = 0;
if (attrs.getNamedItem("abnormal") != null)
{
final String abn = attrs.getNamedItem("abnormal").getNodeValue();
if (abn.equals("poison"))
{
abnormal = Creature.ABNORMAL_EFFECT_POISON;
@@ -322,7 +317,6 @@ public abstract class DocumentBase
}
float stackOrder = 0;
String stackType = "none";
if (attrs.getNamedItem("stackType") != null)
{
@@ -357,7 +351,6 @@ public abstract class DocumentBase
final EffectTemplate lt = new EffectTemplate(attachCond, applayCond, name, lambda, count, time, abnormal, stackType, stackOrder, showIcon, type, effectPower);
parseTemplate(n, lt);
if (template instanceof Item)
{
((Item) template).attach(lt);
@@ -375,10 +368,8 @@ public abstract class DocumentBase
protected void attachSkill(Node n, Object template, Condition attachCond)
{
final NamedNodeMap attrs = n.getAttributes();
int id = 0;
int lvl = 1;
if (attrs.getNamedItem("id") != null)
{
id = Integer.decode(getValue(attrs.getNamedItem("id").getNodeValue(), template));
@@ -390,7 +381,6 @@ public abstract class DocumentBase
}
final Skill skill = SkillTable.getInstance().getInfo(id, lvl);
if (attrs.getNamedItem("chance") != null)
{
if ((template instanceof Weapon) || (template instanceof Item))

View File

@@ -41,7 +41,6 @@ final class GeoEnginePathfinding extends GeoEngine
final String[] array = Config.PATHFIND_BUFFERS.split(";");
_buffers = new BufferHolder[array.length];
int count = 0;
for (int i = 0; i < array.length; i++)
{
@@ -98,7 +97,6 @@ final class GeoEnginePathfinding extends GeoEngine
try
{
final Node result = buffer.findPath(gox, goy, goz, gtx, gty, gtz);
if (result == null)
{
return null;
@@ -258,7 +256,6 @@ final class GeoEnginePathfinding extends GeoEngine
{
_size = size;
_buffer = new ArrayList<>(count);
for (int i = 0; i < count; i++)
{
_buffer.add(new NodeBuffer(size));

View File

@@ -37,7 +37,6 @@ public class BlockFlat extends ABlock
{
_height = bb.getShort();
_nswe = format != GeoFormat.L2D ? 0x0F : (byte) (0xFF);
if (format == GeoFormat.L2OFF)
{
bb.getShort();

View File

@@ -71,7 +71,6 @@ public class BlockMultilayer extends ABlock
{
// get layer count for this cell
final byte layers = format != GeoFormat.L2OFF ? bb.get() : (byte) bb.getShort();
if ((layers <= 0) || (layers > MAX_LAYERS))
{
throw new RuntimeException("Invalid layer count for MultilayerBlock");

View File

@@ -101,7 +101,6 @@ public class AdminCommandHandler
private AdminCommandHandler()
{
_datatable = new HashMap<>();
registerAdminCommandHandler(new AdminAdmin());
registerAdminCommandHandler(new AdminAio());
registerAdminCommandHandler(new AdminAnnouncements());
@@ -193,12 +192,10 @@ public class AdminCommandHandler
public IAdminCommandHandler getAdminCommandHandler(String adminCommand)
{
String command = adminCommand;
if (adminCommand.indexOf(' ') != -1)
{
command = adminCommand.substring(0, adminCommand.indexOf(' '));
}
return _datatable.get(command);
}

View File

@@ -82,12 +82,10 @@ public class AutoAnnouncementHandler
public void listAutoAnnouncements(PlayerInstance player)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<table width=260><tr>");
replyMSG.append("<td width=40></td>");
replyMSG.append("<button value=\"Main\" action=\"bypass -h admin_admin\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br>");
replyMSG.append("<td width=180><center>Auto Announcement Menu</center></td>");
replyMSG.append("<td width=40></td>");
replyMSG.append("</tr></table>");
@@ -160,7 +158,6 @@ public class AutoAnnouncementHandler
statement.setInt(1, nextId);
statement.setString(2, announcementTexts);
statement.setLong(3, announcementDelay);
statement.executeUpdate();
statement.close();
@@ -169,14 +166,12 @@ public class AutoAnnouncementHandler
{
LOGGER.warning("System: Could Not Insert Auto Announcment into DataBase: Reason: Duplicate Id");
}
return registerAnnouncement(nextId, announcementTexts, announcementDelay);
}
public int nextAutoAnnouncmentId()
{
int nextId = 0;
PreparedStatement statement = null;
ResultSet rs = null;
@@ -214,7 +209,6 @@ public class AutoAnnouncementHandler
private final AutoAnnouncementInstance registerAnnouncement(int id, String announcementTexts, long chatDelay)
{
AutoAnnouncementInstance announcementInst = null;
if (chatDelay < 0)
{
chatDelay = DEFAULT_ANNOUNCEMENT_DELAY;
@@ -262,7 +256,6 @@ public class AutoAnnouncementHandler
{
LOGGER.warning("Could not Delete Auto Announcement in Database, Reason: " + e);
}
return removeAnnouncement(announcementInst);
}
@@ -330,7 +323,6 @@ public class AutoAnnouncementHandler
_defaultId = id;
_defaultTexts = announcementTexts;
_defaultDelay = announcementDelay * 1000;
setActive(true);
}
@@ -409,7 +401,6 @@ public class AutoAnnouncementHandler
}
_isActive = activeValue;
if (_isActive)
{
final AutoAnnouncementRunner acr = new AutoAnnouncementRunner(_defaultId);
@@ -440,11 +431,8 @@ public class AutoAnnouncementHandler
public synchronized void run()
{
final AutoAnnouncementInstance announcementInst = _registeredAnnouncements.get(id);
String text;
text = announcementInst.getDefaultTexts();
if (text == null)
{
return;

View File

@@ -70,7 +70,6 @@ public class AutoChatHandler implements SpawnListener
final PreparedStatement statement2 = con.prepareStatement("SELECT * FROM auto_chat_text WHERE groupId=?");
statement2.setInt(1, rs.getInt("groupId"));
final ResultSet rs2 = statement2.executeQuery();
rs2.last();
final String[] chatTexts = new String[rs2.getRow()];
int i = 0;
@@ -80,7 +79,6 @@ public class AutoChatHandler implements SpawnListener
chatTexts[i++] = rs2.getString("chatText");
}
registerGlobalChat(rs.getInt("npcId"), chatTexts, rs.getLong("chatDelay"));
statement2.close();
rs2.close();
}
@@ -128,7 +126,6 @@ public class AutoChatHandler implements SpawnListener
private final AutoChatInstance registerChat(int npcId, NpcInstance npcInst, String[] chatTexts, long chatDelay)
{
AutoChatInstance chatInst = null;
if (chatDelay < 0)
{
chatDelay = DEFAULT_CHAT_DELAY;
@@ -161,7 +158,6 @@ public class AutoChatHandler implements SpawnListener
public boolean removeChat(int npcId)
{
final AutoChatInstance chatInst = _registeredChats.get(npcId);
return removeChat(chatInst);
}
@@ -234,11 +230,9 @@ public class AutoChatHandler implements SpawnListener
}
final int npcId = npc.getNpcId();
if (_registeredChats.containsKey(npcId))
{
final AutoChatInstance chatInst = _registeredChats.get(npcId);
if ((chatInst != null) && chatInst.isGlobal())
{
chatInst.addChatDefinition(npc);
@@ -283,7 +277,6 @@ public class AutoChatHandler implements SpawnListener
protected AutoChatDefinition[] getChatDefinitions()
{
final Collection<AutoChatDefinition> values = _chatDefinitions.values();
return values.toArray(new AutoChatDefinition[values.size()]);
}
@@ -310,9 +303,7 @@ public class AutoChatHandler implements SpawnListener
public int addChatDefinition(NpcInstance npcInst, String[] chatTexts, long chatDelay)
{
final int objectId = npcInst.getObjectId();
final AutoChatDefinition chatDef = new AutoChatDefinition(this, npcInst, chatTexts, chatDelay);
if (npcInst instanceof SiegeGuardInstance)
{
chatDef.setRandomChat(true);
@@ -381,7 +372,6 @@ public class AutoChatHandler implements SpawnListener
{
return false;
}
return _chatDefinitions.get(objectId).isRandomChat();
}
@@ -410,12 +400,10 @@ public class AutoChatHandler implements SpawnListener
public NpcInstance[] getNPCInstanceList()
{
final List<NpcInstance> npcInsts = new ArrayList<>();
for (AutoChatDefinition chatDefinition : _chatDefinitions.values())
{
npcInsts.add(chatDefinition._npcInstance);
}
return npcInsts.toArray(new NpcInstance[npcInsts.size()]);
}
@@ -456,7 +444,6 @@ public class AutoChatHandler implements SpawnListener
public void setChatDelay(int objectId, long delayValue)
{
final AutoChatDefinition chatDef = getChatDefinition(objectId);
if (chatDef != null)
{
chatDef.setChatDelay(delayValue);
@@ -471,7 +458,6 @@ public class AutoChatHandler implements SpawnListener
public void setChatTexts(int objectId, String[] textsValue)
{
final AutoChatDefinition chatDef = getChatDefinition(objectId);
if (chatDef != null)
{
chatDef.setChatTexts(textsValue);
@@ -486,7 +472,6 @@ public class AutoChatHandler implements SpawnListener
public void setRandomChat(int objectId, boolean randValue)
{
final AutoChatDefinition chatDef = getChatDefinition(objectId);
if (chatDef != null)
{
chatDef.setRandomChat(randValue);
@@ -505,7 +490,6 @@ public class AutoChatHandler implements SpawnListener
}
_isActive = activeValue;
if (!_globalChat)
{
for (AutoChatDefinition chatDefinition : _chatDefinitions.values())
@@ -549,10 +533,8 @@ public class AutoChatHandler implements SpawnListener
protected AutoChatDefinition(AutoChatInstance chatInst, NpcInstance npcInst, String[] chatTexts, long chatDelay)
{
_npcInstance = npcInst;
_chatInstance = chatInst;
_randomChat = chatInst.isDefaultRandom();
_chatDelay = chatDelay;
_chatTexts = chatTexts;
@@ -616,7 +598,6 @@ public class AutoChatHandler implements SpawnListener
if (activeValue)
{
final AutoChatRunner acr = new AutoChatRunner(_npcId, _npcInstance.getObjectId());
if (getChatDelay() == 0)
{
// Schedule it set to 5Ms, isn't error, if use 0 sometimes chatDefinition return null in AutoChatRunner
@@ -658,7 +639,6 @@ public class AutoChatHandler implements SpawnListener
{
final AutoChatInstance chatInst = _registeredChats.get(_runnerNpcId);
AutoChatDefinition[] chatDefinitions;
if (chatInst.isGlobal())
{
chatDefinitions = chatInst.getChatDefinitions();
@@ -666,7 +646,6 @@ public class AutoChatHandler implements SpawnListener
else
{
final AutoChatDefinition chatDef = chatInst.getChatDefinition(_objectId);
if (chatDef == null)
{
LOGGER.warning("AutoChatHandler: Auto chat definition is NULL for NPC ID " + _npcId + ".");
@@ -686,7 +665,6 @@ public class AutoChatHandler implements SpawnListener
final NpcInstance chatNpc = chatDef._npcInstance;
final List<PlayerInstance> nearbyPlayers = new ArrayList<>();
final List<PlayerInstance> nearbyGMs = new ArrayList<>();
for (Creature creature : chatNpc.getKnownList().getKnownCharactersInRadius(1500))
{
if (!(creature instanceof PlayerInstance))
@@ -709,7 +687,6 @@ public class AutoChatHandler implements SpawnListener
final String creatureName = chatNpc.getName();
String text;
if (!chatDef.isRandomChat())
{
lastIndex = chatDef._chatIndex;
@@ -724,7 +701,6 @@ public class AutoChatHandler implements SpawnListener
}
text = chatDef.getChatTexts()[lastIndex];
if (text == null)
{
return;
@@ -733,12 +709,9 @@ public class AutoChatHandler implements SpawnListener
if (!nearbyPlayers.isEmpty())
{
final int randomPlayerIndex = Rnd.get(nearbyPlayers.size());
final PlayerInstance randomPlayer = nearbyPlayers.get(randomPlayerIndex);
final int winningCabal = SevenSigns.getInstance().getCabalHighestScore();
int losingCabal = SevenSigns.CABAL_NULL;
if (winningCabal == SevenSigns.CABAL_DAWN)
{
losingCabal = SevenSigns.CABAL_DUSK;

View File

@@ -1,3 +1,4 @@
/*
* This file is part of the L2J Mobius project.
*
@@ -81,7 +82,6 @@ public class ItemHandler
private ItemHandler()
{
_datatable = new HashMap<>();
registerItemHandler(new BeastSoulShot());
registerItemHandler(new BeastSpice());
registerItemHandler(new BeastSpiritShot());

View File

@@ -1,3 +1,4 @@
/*
* This file is part of the L2J Mobius project.
*
@@ -65,7 +66,6 @@ public class SkillHandler
private SkillHandler()
{
_datatable = new HashMap<>();
registerSkillHandler(new BalanceLife());
registerSkillHandler(new BeastFeed());
registerSkillHandler(new Blow());
@@ -107,7 +107,6 @@ public class SkillHandler
public void registerSkillHandler(ISkillHandler handler)
{
final SkillType[] types = handler.getSkillIds();
for (SkillType t : types)
{
_datatable.put(t, handler);

View File

@@ -45,7 +45,6 @@ public class UserCommandHandler
private UserCommandHandler()
{
_datatable = new HashMap<>();
registerUserCommandHandler(new ChannelDelete());
registerUserCommandHandler(new ChannelLeave());
registerUserCommandHandler(new ChannelListUpdate());
@@ -59,7 +58,6 @@ public class UserCommandHandler
registerUserCommandHandler(new PartyInfo());
registerUserCommandHandler(new SiegeStatus());
registerUserCommandHandler(new Time());
if (Config.OFFLINE_TRADE_ENABLE && Config.OFFLINE_COMMAND1)
{
registerUserCommandHandler(new OfflineShop());

View File

@@ -40,7 +40,6 @@ public class VoicedCommandHandler
private VoicedCommandHandler()
{
_datatable = new HashMap<>();
if (Config.BANKING_SYSTEM_ENABLED)
{
registerVoicedCommandHandler(new BankingCmd());

View File

@@ -242,7 +242,6 @@ public class AdminAdmin implements IAdminCommandHandler
{
int mode = 0;
String filename = null;
if ((command != null) && (command.length() > 11))
{
final String mode_s = command.substring(11);

View File

@@ -63,12 +63,10 @@ public class AdminBan implements IAdminCommandHandler
String player = "";
int duration = -1;
PlayerInstance targetPlayer = null;
if (st.hasMoreTokens())
{
player = st.nextToken();
targetPlayer = World.getInstance().getPlayer(player);
if (st.hasMoreTokens())
{
try
@@ -101,7 +99,6 @@ public class AdminBan implements IAdminCommandHandler
else if (command.startsWith("admin_ban_acc"))
{
// May need to check usage in admin_ban_menu as well.
if ((targetPlayer == null) && player.equals(""))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //ban_acc <account_name> (if none, target char's account gets banned)");
@@ -145,7 +142,6 @@ public class AdminBan implements IAdminCommandHandler
return false;
}
String banLengthStr = "";
targetPlayer.setPunishLevel(PlayerInstance.PunishLevel.CHAT, duration);
if (duration > 0)
{
@@ -194,7 +190,6 @@ public class AdminBan implements IAdminCommandHandler
else if (command.startsWith("admin_unban_acc"))
{
// Need to check admin_unban_menu command as well in AdminMenu.java handler.
if (targetPlayer != null)
{
activeChar.sendMessage(targetPlayer.getName() + " is currently online so must not be banned.");
@@ -242,7 +237,6 @@ public class AdminBan implements IAdminCommandHandler
targetPlayer.setPunishLevel(PlayerInstance.PunishLevel.JAIL, duration);
BuilderUtil.sendSysMessage(activeChar, "Character " + targetPlayer.getName() + " jailed for " + (duration > 0 ? duration + " minutes." : "ever!"));
auditAction(command, activeChar, targetPlayer.getName());
if (targetPlayer.getParty() != null)
{
targetPlayer.getParty().removePartyMember(targetPlayer);
@@ -284,7 +278,6 @@ public class AdminBan implements IAdminCommandHandler
}
final String[] command = fullCommand.split(" ");
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", command[0], (target.equals("") ? "no-target" : target), (command.length > 2 ? command[2] : ""));
}
@@ -309,7 +302,6 @@ public class AdminBan implements IAdminCommandHandler
statement.setInt(1, level);
statement.setLong(2, value);
statement.setString(3, name);
statement.execute();
final int count = statement.getUpdateCount();
statement.close();
@@ -344,7 +336,6 @@ public class AdminBan implements IAdminCommandHandler
statement.setInt(4, PlayerInstance.PunishLevel.JAIL.value());
statement.setLong(5, (delay > 0 ? delay * 60000 : 0));
statement.setString(6, name);
statement.execute();
final int count = statement.getUpdateCount();
statement.close();
@@ -396,7 +387,6 @@ public class AdminBan implements IAdminCommandHandler
private boolean changeCharAccessLevel(PlayerInstance targetPlayer, String player, PlayerInstance activeChar, int lvl)
{
boolean output = false;
if (targetPlayer != null)
{
targetPlayer.setAccessLevel(lvl);
@@ -422,7 +412,6 @@ public class AdminBan implements IAdminCommandHandler
targetPlayer.deleteMe();
BuilderUtil.sendSysMessage(activeChar, "The character " + targetPlayer.getName() + " has now been banned.");
output = true;
}
else

View File

@@ -174,13 +174,11 @@ public class AdminBuffs implements IAdminCommandHandler
public void showBuffs(PlayerInstance player, PlayerInstance activeChar)
{
final StringBuilder html = new StringBuilder();
html.append("<html><center><font color=\"LEVEL\">Effects of " + player.getName() + "</font><center><br>");
html.append("<table>");
html.append("<tr><td width=200>Skill</td><td width=70>Action</td></tr>");
final Effect[] effects = player.getAllEffects();
for (Effect e : effects)
{
if (e != null)
@@ -202,11 +200,9 @@ public class AdminBuffs implements IAdminCommandHandler
private void removeBuff(PlayerInstance remover, String playername, int SkillId)
{
final PlayerInstance player = World.getInstance().getPlayer(playername);
if ((player != null) && (SkillId > 0))
{
final Effect[] effects = player.getAllEffects();
for (Effect e : effects)
{
if ((e != null) && (e.getSkill().getId() == SkillId))
@@ -222,7 +218,6 @@ public class AdminBuffs implements IAdminCommandHandler
private void removeAllBuffs(PlayerInstance remover, String playername)
{
final PlayerInstance player = World.getInstance().getPlayer(playername);
if (player != null)
{
player.stopAllEffects();

View File

@@ -623,7 +623,6 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine]</font></center><br><br><br>");
replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
replyMSG.append("<table border=\"0\"><tr>");
@@ -663,7 +662,6 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine]</font></center><br><br><br>");
replyMSG.append("<table border=\"0\"><tr>");
replyMSG.append("<td width=\"100\"><button value=\"Join\" action=\"bypass -h admin_ctf_join\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
@@ -692,9 +690,7 @@ public class AdminCTFEngine implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[CTF Engine]</font></center><br><br><br>");
replyMSG.append("<table><tr>");
if (!CTF.isInProgress())
{
@@ -709,7 +705,6 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + CTF.getJoiningLocationName() + "</font><br1>");
final Location npcLoc = CTF.getNpcLocation();
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + CTF.getNpcId() + " on pos " + npcLoc.getX() + "," + npcLoc.getY() + "," + npcLoc.getZ() + "</font><br1>");
replyMSG.append("<button value=\"Tele->NPC\" action=\"bypass -h admin_ctf_tele_npc\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br>");
replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + CTF.getRewardId() + "</font><br1>");
@@ -733,11 +728,9 @@ public class AdminCTFEngine implements IAdminCommandHandler
replyMSG.append("<font color=\"LEVEL\">Current teams:</font><br1>");
}
replyMSG.append("<center><table border=\"0\">");
for (String team : CTF._teams)
{
replyMSG.append("<tr><td width=\"100\">Name: <font color=\"FF0000\">" + team + "</font>");
if (Config.CTF_EVEN_TEAMS.equals("NO") || Config.CTF_EVEN_TEAMS.equals("BALANCE"))
{
replyMSG.append("&nbsp;(" + CTF.teamPlayersCount(team) + " joined)");
@@ -757,7 +750,6 @@ public class AdminCTFEngine implements IAdminCommandHandler
c = "0" + c;
}
replyMSG.append("Color: <font color=\"00FF00\">0x" + c.toUpperCase() + "</font><font color=\"" + c + "\"> =) </font>");
replyMSG.append("</td></tr><tr><td>");
replyMSG.append("<button value=\"Tele->Team\" action=\"bypass -h admin_ctf_tele_team " + team + "\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("</td></tr><tr><td>");

View File

@@ -51,11 +51,9 @@ public class AdminChangeAccessLevel implements IAdminCommandHandler
}
final String[] parts = command.split(" ");
if (parts.length == 2)
{
final int lvl = Integer.parseInt(parts[1]);
if (activeChar.getTarget() instanceof PlayerInstance)
{
((PlayerInstance) activeChar.getTarget()).setAccessLevel(lvl);
@@ -65,9 +63,7 @@ public class AdminChangeAccessLevel implements IAdminCommandHandler
else if (parts.length == 3)
{
final int lvl = Integer.parseInt(parts[2]);
final PlayerInstance player = World.getInstance().getPlayer(parts[1]);
if (player != null)
{
player.setAccessLevel(lvl);

View File

@@ -224,7 +224,6 @@ public class AdminCreateItem implements IAdminCommandHandler
if (num > 20)
{
final Item template = ItemTable.getInstance().getTemplate(id);
if ((template != null) && !template.isStackable())
{
BuilderUtil.sendSysMessage(activeChar, "This item does not stack - Creation aborted.");

View File

@@ -59,11 +59,9 @@ public class AdminCursedWeapons implements IAdminCommandHandler
if (command.equalsIgnoreCase("admin_cw_info"))
{
BuilderUtil.sendSysMessage(activeChar, "====== Cursed Weapons: ======");
for (CursedWeapon cw : cursedWeaponsManager.getCursedWeapons())
{
BuilderUtil.sendSysMessage(activeChar, "> " + cw.getName() + " (" + cw.getItemId() + ")");
if (cw.isActivated())
{
final PlayerInstance pl = cw.getPlayer();
@@ -96,7 +94,6 @@ public class AdminCursedWeapons implements IAdminCommandHandler
{
final int itemId = cw.getItemId();
replyMSG.append("<table width=270><tr><td>Name:</td><td>" + cw.getName() + "</td></tr>");
if (cw.isActivated())
{
final PlayerInstance pl = cw.getPlayer();
@@ -221,7 +218,6 @@ public class AdminCursedWeapons implements IAdminCommandHandler
else
{
parameter = parameter.replace('_', ' ');
for (CursedWeapon cwp : cursedWeaponsManager.getCursedWeapons())
{
if (cwp.getName().toLowerCase().contains(parameter.toLowerCase()))

View File

@@ -254,7 +254,6 @@ public class AdminDMEngine implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[DeathMatch Engine]</font></center><br><br><br>");
replyMSG.append("<table><tr><td><edit var=\"input1\" width=\"125\"></td><td><edit var=\"input2\" width=\"125\"></td></tr></table>");
replyMSG.append("<table border=\"0\"><tr>");
@@ -297,7 +296,6 @@ public class AdminDMEngine implements IAdminCommandHandler
replyMSG.append("Joining location name:&nbsp;<font color=\"00FF00\">" + DM.getJoiningLocationName() + "</font><br1>");
final Location npcLoc = DM.getNpcLocation();
replyMSG.append("Joining NPC ID:&nbsp;<font color=\"00FF00\">" + DM.getNpcId() + " on pos " + npcLoc.getX() + "," + npcLoc.getY() + "," + npcLoc.getZ() + "</font><br1>");
replyMSG.append("Reward ID:&nbsp;<font color=\"00FF00\">" + DM.getRewardId() + "</font><br1>");
replyMSG.append("Reward Amount:&nbsp;<font color=\"00FF00\">" + DM.getRewardAmount() + "</font><br><br>");
@@ -306,10 +304,8 @@ public class AdminDMEngine implements IAdminCommandHandler
replyMSG.append("Death Match Color:&nbsp;<font color=\"00FF00\">" + DM.getPlayerColors() + "</font><br>");
final Location playerLoc = DM.getPlayersSpawnLocation();
replyMSG.append("Death Match Spawn Pos:&nbsp;<font color=\"00FF00\">" + playerLoc.getX() + "," + playerLoc.getY() + "," + playerLoc.getZ() + "</font><br><br>");
replyMSG.append("Current players:<br1>");
if (!DM.hasStarted())
{
replyMSG.append("<br1>");

View File

@@ -53,7 +53,6 @@ public class AdminDisconnect implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -73,7 +72,6 @@ public class AdminDisconnect implements IAdminCommandHandler
// Logout Character
player.sendPacket(new LeaveWorld());
player.closeNetConnection();
}
}

View File

@@ -49,12 +49,10 @@ public class AdminDonator implements IAdminCommandHandler
if (command.startsWith("admin_setdonator"))
{
final WorldObject target = activeChar.getTarget();
if (target instanceof PlayerInstance)
{
final PlayerInstance targetPlayer = (PlayerInstance) target;
final boolean newDonator = !targetPlayer.isDonator();
if (newDonator)
{
targetPlayer.setDonator(true);
@@ -77,7 +75,6 @@ public class AdminDonator implements IAdminCommandHandler
{
BuilderUtil.sendSysMessage(activeChar, "Impossible to set a non Player Target as Donator.");
LOGGER.info("GM: " + activeChar.getName() + " is trying to set a non Player Target as Donator.");
return false;
}
}
@@ -90,7 +87,6 @@ public class AdminDonator implements IAdminCommandHandler
{
player.sendMessage(gm.getName() + " has granted Donator Status for you!");
gm.sendMessage("You've granted Donator Status for " + player.getName());
if (announce)
{
Announcements.getInstance().announceToAll(player.getName() + " has received Donator Status!");
@@ -105,7 +101,6 @@ public class AdminDonator implements IAdminCommandHandler
{
player.sendMessage(gm.getName() + " has revoked Donator Status from you!");
gm.sendMessage("You've revoked Donator Status from " + player.getName());
if (announce)
{
Announcements.getInstance().announceToAll(player.getName() + " has lost Donator Status!");

View File

@@ -56,15 +56,12 @@ public class AdminDoorControl implements IAdminCommandHandler
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
final DoorData doorTable = DoorData.getInstance();
WorldObject target2 = null;
if (command.startsWith("admin_close "))
{
try
{
final int doorId = Integer.parseInt(command.substring(12));
if (doorTable.getDoor(doorId) != null)
{
doorTable.getDoor(doorId).closeMe();
@@ -89,7 +86,6 @@ public class AdminDoorControl implements IAdminCommandHandler
else if (command.equals("admin_close"))
{
target2 = activeChar.getTarget();
if (target2 instanceof DoorInstance)
{
((DoorInstance) target2).closeMe();
@@ -104,7 +100,6 @@ public class AdminDoorControl implements IAdminCommandHandler
try
{
final int doorId = Integer.parseInt(command.substring(11));
if (doorTable.getDoor(doorId) != null)
{
doorTable.getDoor(doorId).openMe();
@@ -129,7 +124,6 @@ public class AdminDoorControl implements IAdminCommandHandler
else if (command.equals("admin_open"))
{
target2 = activeChar.getTarget();
if (target2 instanceof DoorInstance)
{
((DoorInstance) target2).openMe();

View File

@@ -906,7 +906,6 @@ public class AdminEditChar implements IAdminCommandHandler
private void listCharacters(PlayerInstance activeChar, int page)
{
final List<PlayerInstance> onlinePlayersList = new ArrayList<>();
for (PlayerInstance actualPlayer : World.getInstance().getAllPlayers())
{
if ((actualPlayer != null) && actualPlayer.isOnline() && !actualPlayer.isInOfflineMode())
@@ -920,10 +919,8 @@ public class AdminEditChar implements IAdminCommandHandler
}
final PlayerInstance[] players = onlinePlayersList.toArray(new PlayerInstance[onlinePlayersList.size()]);
final int MaxCharactersPerPage = 20;
int maxPages = players.length / MaxCharactersPerPage;
if (players.length > (MaxCharactersPerPage * maxPages))
{
maxPages++;
@@ -937,7 +934,6 @@ public class AdminEditChar implements IAdminCommandHandler
final int CharactersStart = MaxCharactersPerPage * page;
int charactersEnd = players.length;
if ((charactersEnd - CharactersStart) > MaxCharactersPerPage)
{
charactersEnd = CharactersStart + MaxCharactersPerPage;
@@ -946,7 +942,6 @@ public class AdminEditChar implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setFile("data/html/admin/charlist.htm");
StringBuilder replyMSG = new StringBuilder();
for (int x = 0; x < maxPages; x++)
{
final int pagenr = x + 1;
@@ -955,7 +950,6 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%pages%", replyMSG.toString());
replyMSG = new StringBuilder();
for (int i = CharactersStart; i < charactersEnd; i++)
{
replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info " + players[i].getName() + "\">" + players[i].getName() + "</a></td><td width=110>" + players[i].getTemplate().getClassName() + "</td><td width=40>" + players[i].getLevel() + "</td></tr>");
@@ -969,7 +963,6 @@ public class AdminEditChar implements IAdminCommandHandler
{
String ip = "N/A";
String account = "N/A";
if (player.getClient() != null)
{
account = player.getClient().getAccountName();
@@ -1032,7 +1025,6 @@ public class AdminEditChar implements IAdminCommandHandler
// function to change karma of selected char
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -1075,7 +1067,6 @@ public class AdminEditChar implements IAdminCommandHandler
private void adminModifyCharacter(PlayerInstance activeChar, String modifications)
{
final WorldObject target = activeChar.getTarget();
if (!(target instanceof PlayerInstance))
{
return;
@@ -1083,7 +1074,6 @@ public class AdminEditChar implements IAdminCommandHandler
final PlayerInstance player = (PlayerInstance) target;
final StringTokenizer st = new StringTokenizer(modifications);
if (st.countTokens() != 6)
{
editCharacter(player);
@@ -1096,7 +1086,6 @@ public class AdminEditChar implements IAdminCommandHandler
final String pvpflag = st.nextToken();
final String pvpkills = st.nextToken();
final String pkkills = st.nextToken();
final int hpval = Integer.parseInt(hp);
final int mpval = Integer.parseInt(mp);
final int cpval = Integer.parseInt(cp);
@@ -1127,9 +1116,7 @@ public class AdminEditChar implements IAdminCommandHandler
// Admin information
player.sendMessage("Changed stats of " + player.getName() + ". HP: " + hpval + " MP: " + mpval + " CP: " + cpval + " PvP: " + pvpflagval + " / " + pvpkillsval);
showCharacterInfo(activeChar, null); // Back to start
player.broadcastUserInfo();
player.getAI().setIntention(CtrlIntention.AI_INTENTION_IDLE);
player.decayMe();
@@ -1139,7 +1126,6 @@ public class AdminEditChar implements IAdminCommandHandler
private void editCharacter(PlayerInstance activeChar)
{
final WorldObject target = activeChar.getTarget();
if (!(target instanceof PlayerInstance))
{
return;
@@ -1152,19 +1138,15 @@ public class AdminEditChar implements IAdminCommandHandler
private void findCharacter(PlayerInstance activeChar, String characterToFind)
{
int charactersFound = 0;
String name;
final Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
final PlayerInstance[] players = allPlayers.toArray(new PlayerInstance[allPlayers.size()]);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setFile("data/html/admin/charfind.htm");
StringBuilder replyMSG = new StringBuilder();
for (PlayerInstance player : players)
{
name = player.getName();
if (name.toLowerCase().contains(characterToFind.toLowerCase()))
{
charactersFound = charactersFound + 1;
@@ -1179,7 +1161,6 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
replyMSG = new StringBuilder();
if (charactersFound == 0)
{
replyMSG.append("s. Please try again.");
@@ -1208,11 +1189,9 @@ public class AdminEditChar implements IAdminCommandHandler
final Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
final PlayerInstance[] players = allPlayers.toArray(new PlayerInstance[allPlayers.size()]);
final Map<String, List<PlayerInstance>> ipMap = new HashMap<>();
String ip = "0.0.0.0";
final Map<String, Integer> dualboxIPs = new HashMap<>();
for (PlayerInstance player : players)
{
if ((player.getClient() == null) || (player.getClient().getConnection() == null) || (player.getClient().getConnection().getInetAddress() == null) || (player.getClient().getConnection().getInetAddress().getHostAddress() == null))
@@ -1221,7 +1200,6 @@ public class AdminEditChar implements IAdminCommandHandler
}
ip = player.getClient().getConnection().getInetAddress().getHostAddress();
if (ipMap.get(ip) == null)
{
ipMap.put(ip, new ArrayList<PlayerInstance>());
@@ -1272,9 +1250,7 @@ public class AdminEditChar implements IAdminCommandHandler
final Collection<PlayerInstance> allPlayers = World.getInstance().getAllPlayers();
final PlayerInstance[] players = allPlayers.toArray(new PlayerInstance[allPlayers.size()]);
int charactersFound = 0;
String name;
String ip = "0.0.0.0";
StringBuilder replyMSG = new StringBuilder();
@@ -1289,7 +1265,6 @@ public class AdminEditChar implements IAdminCommandHandler
}
ip = player.getClient().getConnection().getInetAddress().getHostAddress();
if (ip.equals(ipAdress))
{
name = player.getName();
@@ -1305,7 +1280,6 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%results%", replyMSG.toString());
replyMSG = new StringBuilder();
if (charactersFound == 0)
{
replyMSG.append("s. Maybe they got d/c? :)");
@@ -1341,7 +1315,6 @@ public class AdminEditChar implements IAdminCommandHandler
String account = null;
Map<Integer, String> chars;
final PlayerInstance player = World.getInstance().getPlayer(characterName);
if (player == null)
{
throw new IllegalArgumentException("Player doesn't exist");
@@ -1375,7 +1348,6 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
final WorldObject target = activeChar.getTarget();
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;

View File

@@ -83,7 +83,6 @@ public class AdminEditNpc implements IAdminCommandHandler
if (command.startsWith("admin_showShop "))
{
final String[] args = command.split(" ");
if (args.length > 1)
{
showShop(activeChar, Integer.parseInt(command.split(" ")[1]));
@@ -104,9 +103,7 @@ public class AdminEditNpc implements IAdminCommandHandler
try
{
final String[] commandSplit = command.split(" ");
final int npcId = Integer.parseInt(commandSplit[1]);
final NpcTemplate npc = NpcTable.getInstance().getTemplate(npcId);
Show_Npc_Property(activeChar, npc);
}
@@ -118,7 +115,6 @@ public class AdminEditNpc implements IAdminCommandHandler
else if (activeChar.getTarget() instanceof NpcInstance)
{
final int npcId = ((NpcInstance) activeChar.getTarget()).getNpcId();
final NpcTemplate npc = NpcTable.getInstance().getTemplate(npcId);
Show_Npc_Property(activeChar, npc);
}
@@ -165,7 +161,6 @@ public class AdminEditNpc implements IAdminCommandHandler
else if (command.startsWith("admin_addShopItem "))
{
final String[] args = command.split(" ");
if (args.length > 1)
{
addShopItem(activeChar, args);
@@ -174,7 +169,6 @@ public class AdminEditNpc implements IAdminCommandHandler
else if (command.startsWith("admin_delShopItem "))
{
final String[] args = command.split(" ");
if (args.length > 2)
{
delShopItem(activeChar, args);
@@ -183,7 +177,6 @@ public class AdminEditNpc implements IAdminCommandHandler
else if (command.startsWith("admin_editShopItem "))
{
final String[] args = command.split(" ");
if (args.length > 2)
{
editShopItem(activeChar, args);
@@ -260,7 +253,6 @@ public class AdminEditNpc implements IAdminCommandHandler
npcId = Integer.parseInt(st.nextToken());
skillId = Integer.parseInt(st.nextToken());
final int level = Integer.parseInt(st.nextToken());
updateNpcSkillData(activeChar, npcId, skillId, level);
}
catch (Exception e)
@@ -313,7 +305,6 @@ public class AdminEditNpc implements IAdminCommandHandler
npcId = Integer.parseInt(st.nextToken());
skillId = Integer.parseInt(st.nextToken());
final int level = Integer.parseInt(st.nextToken());
addNpcSkillData(activeChar, npcId, skillId, level);
}
catch (Exception e)
@@ -388,7 +379,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final int min = Integer.parseInt(st.nextToken());
final int max = Integer.parseInt(st.nextToken());
final int chance = Integer.parseInt(st.nextToken());
updateDropData(activeChar, npcId, itemId, min, max, category, chance);
}
catch (Exception e)
@@ -417,7 +407,6 @@ public class AdminEditNpc implements IAdminCommandHandler
try
{
final String[] input = command.substring(15).split(" ");
if (input.length < 1)
{
return true;
@@ -445,7 +434,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final int min = Integer.parseInt(st.nextToken());
final int max = Integer.parseInt(st.nextToken());
final int chance = Integer.parseInt(st.nextToken());
addDropData(activeChar, npcId, itemId, min, max, category, chance);
}
catch (Exception e)
@@ -500,10 +488,8 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final int tradeListID = Integer.parseInt(args[1]);
final int itemId = Integer.parseInt(args[2]);
final StoreTradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);
final Item item = ItemTable.getInstance().getTemplate(itemId);
if (tradeList.getPriceForItemId(itemId) < 0)
{
return;
@@ -513,17 +499,14 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final int price = Integer.parseInt(args[3]);
final int order = findOrderTradeList(itemId, tradeList.getPriceForItemId(itemId), tradeListID);
tradeList.replaceItem(itemId, Integer.parseInt(args[3]));
updateTradeList(itemId, price, tradeListID, order);
BuilderUtil.sendSysMessage(activeChar, "Updated price for " + item.getName() + " in Trade List " + tradeListID);
showShopList(activeChar, tradeListID, 1);
return;
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>Merchant Shop Item Edit</title>");
replyMSG.append("<body>");
@@ -548,9 +531,7 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final int tradeListID = Integer.parseInt(args[1]);
final int itemID = Integer.parseInt(args[2]);
final StoreTradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);
if (tradeList.getPriceForItemId(itemID) < 0)
{
return;
@@ -559,17 +540,14 @@ public class AdminEditNpc implements IAdminCommandHandler
if (args.length > 3)
{
final int order = findOrderTradeList(itemID, tradeList.getPriceForItemId(itemID), tradeListID);
tradeList.removeItem(itemID);
deleteTradeList(tradeListID, order);
BuilderUtil.sendSysMessage(activeChar, "Deleted " + ItemTable.getInstance().getTemplate(itemID).getName() + " from Trade List " + tradeListID);
showShopList(activeChar, tradeListID, 1);
return;
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>Merchant Shop Item Delete</title>");
replyMSG.append("<body>");
@@ -593,9 +571,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void addShopItem(PlayerInstance activeChar, String[] args)
{
final int tradeListID = Integer.parseInt(args[1]);
final StoreTradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);
if (tradeList == null)
{
BuilderUtil.sendSysMessage(activeChar, "TradeList not found!");
@@ -609,7 +585,6 @@ public class AdminEditNpc implements IAdminCommandHandler
int price = Integer.parseInt(args[3]);
final ItemInstance newItem = ItemTable.getInstance().createDummyItem(itemID);
if (price < newItem.getReferencePrice())
{
LOGGER.warning("TradeList " + tradeList.getListId() + " itemId " + itemID + " has an ADENA sell price lower then reference price.. Automatically Updating it..");
@@ -619,15 +594,12 @@ public class AdminEditNpc implements IAdminCommandHandler
newItem.setCount(-1);
tradeList.addItem(newItem);
storeTradeList(itemID, price, tradeListID, order);
BuilderUtil.sendSysMessage(activeChar, "Added " + newItem.getItem().getName() + " to Trade List " + tradeList.getListId());
showShopList(activeChar, tradeListID, 1);
return;
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>Merchant Shop Item Add</title>");
replyMSG.append("<body>");
@@ -651,7 +623,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showShopList(PlayerInstance activeChar, int tradeListID, int page)
{
final StoreTradeList tradeList = TradeController.getInstance().getBuyList(tradeListID);
if ((page > ((tradeList.getItems().size() / PAGE_LIMIT) + 1)) || (page < 1))
{
return;
@@ -659,7 +630,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder html = itemListHtml(tradeList, page);
adminReply.setHtml(html.toString());
activeChar.sendPacket(adminReply);
}
@@ -667,7 +637,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private StringBuilder itemListHtml(StoreTradeList tradeList, int page)
{
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>Merchant Shop List Page: " + page + "</title>");
replyMSG.append("<body>");
replyMSG.append("<br>Edit, add or delete entries in a merchantList.");
@@ -676,7 +645,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final int start = (page - 1) * PAGE_LIMIT;
final int end = Math.min((((page - 1) * PAGE_LIMIT) + PAGE_LIMIT) - 1, tradeList.getItems().size() - 1);
for (ItemInstance item : tradeList.getItems(start, end + 1))
{
replyMSG.append("<tr><td><a action=\"bypass -h admin_editShopItem " + tradeList.getListId() + " " + item.getItemId() + "\">" + item.getItem().getName() + "</a></td>");
@@ -689,7 +657,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final int min = 1;
final int max = (tradeList.getItems().size() / PAGE_LIMIT) + 1;
if (page > 1)
{
replyMSG.append("<td><button value=\"Page" + (page - 1) + "\" action=\"bypass -h admin_showShopList " + tradeList.getListId() + " " + (page - 1) + "\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
@@ -718,7 +685,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showShop(PlayerInstance activeChar, int merchantID)
{
final List<StoreTradeList> tradeLists = getTradeLists(merchantID);
if (tradeLists == null)
{
BuilderUtil.sendSysMessage(activeChar, "Unknown npc template ID" + merchantID);
@@ -726,13 +692,11 @@ public class AdminEditNpc implements IAdminCommandHandler
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>Merchant Shop Lists</title>");
replyMSG.append("<body>");
replyMSG.append("<br>Select a list to view");
replyMSG.append("<table>");
replyMSG.append("<tr><td>Mecrchant List ID</td></tr>");
for (StoreTradeList tradeList : tradeLists)
{
if (tradeList != null)
@@ -802,7 +766,6 @@ public class AdminEditNpc implements IAdminCommandHandler
rs.first();
order = rs.getInt("order");
stmt.close();
rs.close();
}
@@ -816,13 +779,10 @@ public class AdminEditNpc implements IAdminCommandHandler
private List<StoreTradeList> getTradeLists(int merchantId)
{
final String target = "npc_%objectId%_Buy";
String content = HtmCache.getInstance().getHtm("data/html/merchant/" + merchantId + ".htm");
if (content == null)
{
content = HtmCache.getInstance().getHtm("data/html/merchant/30001.htm");
if (content == null)
{
return null;
@@ -831,17 +791,13 @@ public class AdminEditNpc implements IAdminCommandHandler
final List<StoreTradeList> tradeLists = new ArrayList<>();
final String[] lines = content.split("\n");
int pos = 0;
for (String line : lines)
{
pos = line.indexOf(target);
if (pos >= 0)
{
final int tradeListID = Integer.decode(line.substring(pos + target.length() + 1).split("\"")[0]);
tradeLists.add(TradeController.getInstance().getBuyList(tradeListID));
}
}
@@ -864,7 +820,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final String content = HtmCache.getInstance().getHtm("data/html/admin/editnpc.htm");
if (content != null)
{
adminReply.setHtml(content);
@@ -926,7 +881,6 @@ public class AdminEditNpc implements IAdminCommandHandler
newNpcData.set("npcId", commandSplit[1]);
final String statToSet = commandSplit[2];
String value = "";
for (int i = 3; i < commandSplit.length; i++)
{
if (i == 3)
@@ -1143,7 +1097,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final int npcId = newNpcData.getInt("npcId");
final NpcTemplate old = NpcTable.getInstance().getTemplate(npcId);
if (old.isCustom())
{
BuilderUtil.sendSysMessage(activeChar, "You are going to save Custom NPC");
@@ -1159,7 +1112,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showNpcDropList(PlayerInstance activeChar, int npcId)
{
final NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
if (npcData == null)
{
BuilderUtil.sendSysMessage(activeChar, "unknown npc template id" + npcId);
@@ -1167,7 +1119,6 @@ public class AdminEditNpc implements IAdminCommandHandler
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>NPC: " + npcData.getName() + "(" + npcData.getNpcId() + ") 's drop manage</title>");
replyMSG.append("<body>");
replyMSG.append("<br>Notes: click[drop_id]to show the detail of drop data,click[del] to delete the drop data!");
@@ -1204,9 +1155,7 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
final ResultSet dropData = statement.executeQuery();
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>the detail of dropdata: (" + npcId + " " + itemId + " " + category + ")</title>");
replyMSG.append("<body>");
@@ -1242,7 +1191,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showAddDropData(PlayerInstance activeChar, NpcTemplate npcData)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>Add dropdata to " + npcData.getName() + "(" + npcData.getNpcId() + ")</title>");
replyMSG.append("<body>");
replyMSG.append("<table>");
@@ -1273,7 +1221,6 @@ public class AdminEditNpc implements IAdminCommandHandler
statement.setInt(4, npcId);
statement.setInt(5, itemId);
statement.setInt(6, category);
statement.execute();
statement.close();
@@ -1283,7 +1230,6 @@ public class AdminEditNpc implements IAdminCommandHandler
statement2.setInt(3, category);
final ResultSet npcIdRs = statement2.executeQuery();
if (npcIdRs.next())
{
npcId = npcIdRs.getInt("mobId");
@@ -1380,7 +1326,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void reLoadNpcDropList(int npcId)
{
final NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
if (npcData == null)
{
return;
@@ -1393,7 +1338,6 @@ public class AdminEditNpc implements IAdminCommandHandler
try (Connection con = DatabaseFactory.getConnection())
{
DropData dropData = null;
npcData.getDropData().clear();
final PreparedStatement statement = con.prepareStatement("SELECT mobId,itemId,min,max,category,chance FROM droplist WHERE mobId=?");
@@ -1403,14 +1347,12 @@ public class AdminEditNpc implements IAdminCommandHandler
while (dropDataList.next())
{
dropData = new DropData();
dropData.setItemId(dropDataList.getInt("itemId"));
dropData.setMinDrop(dropDataList.getInt("min"));
dropData.setMaxDrop(dropDataList.getInt("max"));
dropData.setChance(dropDataList.getInt("chance"));
final int category = dropDataList.getInt("category");
npcData.addDropData(dropData, category);
}
dropDataList.close();
@@ -1431,9 +1373,7 @@ public class AdminEditNpc implements IAdminCommandHandler
}
final Map<Integer, Skill> skills = npcData.getSkills();
final int skillSize = skills.size();
final int maxSkillsPerPage = 10;
int maxPages = skillSize / maxSkillsPerPage;
if (skillSize > (maxSkillsPerPage * maxPages))
@@ -1454,7 +1394,6 @@ public class AdminEditNpc implements IAdminCommandHandler
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>" + npcData.getName() + " Skillist");
replyMSG.append(" (ID:" + npcData.getNpcId() + "Skills " + skillSize + ")</title>");
@@ -1480,7 +1419,6 @@ public class AdminEditNpc implements IAdminCommandHandler
final Set<Integer> skillset = skills.keySet();
final Iterator<Integer> skillite = skillset.iterator();
Object skillobj = null;
for (int i = 0; i < SkillsStart; i++)
{
if (skillite.hasNext())
@@ -1517,16 +1455,13 @@ public class AdminEditNpc implements IAdminCommandHandler
{
final PreparedStatement statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills WHERE npcid=" + npcId + " AND skillid=" + skillId);
final ResultSet skillData = statement.executeQuery();
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>(NPC:" + npcId + " SKILL:" + skillId + ")</title>");
replyMSG.append("<body>");
if (skillData.next())
{
final Skill skill = SkillTable.getInstance().getInfo(skillData.getInt("skillid"), skillData.getInt("level"));
replyMSG.append("<table>");
replyMSG.append("<tr><td>NPC</td><td>" + NpcTable.getInstance().getTemplate(skillData.getInt("npcid")).getName() + "</td></tr>");
replyMSG.append("<tr><td>SKILL</td><td>" + skill.getName() + "(" + skillData.getInt("skillid") + ")</td></tr>");
@@ -1574,7 +1509,6 @@ public class AdminEditNpc implements IAdminCommandHandler
statement.setInt(1, level);
statement.setInt(2, npcId);
statement.setInt(3, skillId);
statement.execute();
statement.close();
@@ -1604,7 +1538,6 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showNpcSkillAdd(PlayerInstance activeChar, NpcTemplate npcData)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><title>Add Skill to " + npcData.getName() + "(ID:" + npcData.getNpcId() + ")</title>");
replyMSG.append("<body>");
replyMSG.append("<table>");
@@ -1705,7 +1638,6 @@ public class AdminEditNpc implements IAdminCommandHandler
// with out race
final String _sql = "SELECT npcid, skillid, level FROM npcskills WHERE npcid=? AND (skillid NOT BETWEEN 4290 AND 4302)";
final PreparedStatement statement = con.prepareStatement(_sql);
statement.setInt(1, npcId);
final ResultSet skillDataList = statement.executeQuery();

View File

@@ -170,7 +170,6 @@ public class AdminEffects implements IAdminCommandHandler
try
{
final WorldObject target = activeChar.getTarget();
if (activeChar.getSayMode() != null)
{
activeChar.setSayMode(null);
@@ -308,7 +307,6 @@ public class AdminEffects implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
Creature creature = null;
if (target instanceof Creature)
{
creature = (Creature) target;
@@ -325,7 +323,6 @@ public class AdminEffects implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
Creature creature = null;
if (target instanceof Creature)
{
creature = (Creature) target;
@@ -341,10 +338,8 @@ public class AdminEffects implements IAdminCommandHandler
try
{
final String id = st.nextToken();
activeChar.getPoly().setPolyInfo("npc", id);
activeChar.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), false);
activeChar.broadcastPacket(new CharInfo(activeChar));
activeChar.sendPacket(new UserInfo(activeChar));
}
@@ -359,7 +354,6 @@ public class AdminEffects implements IAdminCommandHandler
activeChar.getPoly().setPolyInfo(null, "1");
activeChar.decayMe();
activeChar.spawnMe(activeChar.getX(), activeChar.getY(), activeChar.getZ());
activeChar.broadcastPacket(new CharInfo(activeChar));
activeChar.sendPacket(new UserInfo(activeChar));
}
@@ -386,9 +380,7 @@ public class AdminEffects implements IAdminCommandHandler
try
{
final String val = st.nextToken();
final int teamVal = Integer.parseInt(val);
for (PlayerInstance player : activeChar.getKnownList().getKnownPlayers().values())
{
if (activeChar.isInsideRadius(player, 400, false, true))
@@ -411,12 +403,9 @@ public class AdminEffects implements IAdminCommandHandler
else if (command.startsWith("admin_setteam"))
{
final String val = command.substring(14);
final int teamVal = Integer.parseInt(val);
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -441,17 +430,13 @@ public class AdminEffects implements IAdminCommandHandler
{
String target = null;
WorldObject obj = activeChar.getTarget();
if (st.countTokens() == 2)
{
final int social = Integer.parseInt(st.nextToken());
target = st.nextToken();
if (target != null)
{
final PlayerInstance player = World.getInstance().getPlayer(target);
if (player != null)
{
if (performSocial(social, player, activeChar))
@@ -464,7 +449,6 @@ public class AdminEffects implements IAdminCommandHandler
try
{
final int radius = Integer.parseInt(target);
for (WorldObject object : activeChar.getKnownList().getKnownObjects().values())
{
if (activeChar.isInsideRadius(object, radius, false, false))
@@ -485,7 +469,6 @@ public class AdminEffects implements IAdminCommandHandler
else if (st.countTokens() == 1)
{
final int social = Integer.parseInt(st.nextToken());
if (obj == null)
{
obj = activeChar;
@@ -515,7 +498,6 @@ public class AdminEffects implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
Creature creature = null;
if (target instanceof Creature)
{
creature = (Creature) target;
@@ -533,19 +515,14 @@ public class AdminEffects implements IAdminCommandHandler
{
String target = null;
WorldObject obj = activeChar.getTarget();
if (st.countTokens() == 2)
{
final String parm = st.nextToken();
final int abnormal = Integer.decode("0x" + parm);
target = st.nextToken();
if (target != null)
{
final PlayerInstance player = World.getInstance().getPlayer(target);
if (player != null)
{
if (performAbnormal(abnormal, player))
@@ -562,7 +539,6 @@ public class AdminEffects implements IAdminCommandHandler
try
{
final int radius = Integer.parseInt(target);
for (WorldObject object : activeChar.getKnownList().getKnownObjects().values())
{
if (activeChar.isInsideRadius(object, radius, false, false))
@@ -583,7 +559,6 @@ public class AdminEffects implements IAdminCommandHandler
else if (st.countTokens() == 1)
{
final int abnormal = Integer.decode("0x" + st.nextToken());
if (obj == null)
{
obj = activeChar;
@@ -612,11 +587,9 @@ public class AdminEffects implements IAdminCommandHandler
try
{
WorldObject obj = activeChar.getTarget();
int level = 1;
int hittime = 1;
final int skill = Integer.parseInt(st.nextToken());
if (st.hasMoreTokens())
{
level = Integer.parseInt(st.nextToken());
@@ -639,10 +612,8 @@ public class AdminEffects implements IAdminCommandHandler
else
{
final Creature target = (Creature) obj;
target.broadcastPacket(new MagicSkillUse(target, activeChar, skill, level, hittime, 0));
BuilderUtil.sendSysMessage(activeChar, obj.getName() + " performs MSU " + skill + "/" + level + " by your request.");
}
}
catch (Exception e)
@@ -669,7 +640,6 @@ public class AdminEffects implements IAdminCommandHandler
if (target instanceof Creature)
{
final Creature creature = (Creature) target;
if ((creature.getAbnormalEffect() & action) == action)
{
creature.stopAbnormalEffect(action);
@@ -678,7 +648,6 @@ public class AdminEffects implements IAdminCommandHandler
{
creature.startAbnormalEffect(action);
}
return true;
}
return false;
@@ -797,7 +766,6 @@ public class AdminEffects implements IAdminCommandHandler
private void showMainPage(PlayerInstance activeChar, String command)
{
String filename = "effects_menu";
if (command.contains("menu_main"))
{
filename = "main_menu";

View File

@@ -65,7 +65,6 @@ public class AdminEnchant implements IAdminCommandHandler
else
{
int armorType = -1;
if (command.startsWith("admin_seteh"))
{
armorType = Inventory.PAPERDOLL_HEAD;
@@ -166,7 +165,6 @@ public class AdminEnchant implements IAdminCommandHandler
}
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -179,12 +177,10 @@ public class AdminEnchant implements IAdminCommandHandler
// now we need to find the equipped weapon of the targeted character...
int curEnchant = 0; // display purposes only
ItemInstance itemInstance = null;
// only attempt to enchant if there is a weapon equipped
ItemInstance parmorInstance = player.getInventory().getPaperdollItem(armorType);
if ((parmorInstance != null) && (parmorInstance.getEquipSlot() == armorType))
{
itemInstance = parmorInstance;
@@ -193,7 +189,6 @@ public class AdminEnchant implements IAdminCommandHandler
{
// for bows and double handed weapons
parmorInstance = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LRHAND);
if ((parmorInstance != null) && (parmorInstance.getEquipSlot() == Inventory.PAPERDOLL_LRHAND))
{
itemInstance = parmorInstance;
@@ -206,7 +201,6 @@ public class AdminEnchant implements IAdminCommandHandler
* Protection against Corrupt GMs This protection will ban both GM and Edited char if a GM tries to enchant a NON GM player above the value specified in the file: other.ini (GMOverEnchant = XX)
*/
curEnchant = itemInstance.getEnchantLevel();
if ((Config.GM_OVER_ENCHANT != 0) && (ench >= Config.GM_OVER_ENCHANT) && !player.isGM())
{
player.sendMessage("A GM tried to overenchant you. You will both be banned.");

View File

@@ -101,7 +101,6 @@ public class AdminEventEngine implements IAdminCommandHandler
else if (command.startsWith("admin_event_see"))
{
final String eventName = command.substring(16);
FileInputStream fis = null;
BufferedInputStream buff = null;
DataInputStream in = null;
@@ -110,7 +109,6 @@ public class AdminEventEngine implements IAdminCommandHandler
try
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
fis = new FileInputStream("data/events/" + eventName);
buff = new BufferedInputStream(fis);
in = new DataInputStream(buff);
@@ -119,7 +117,6 @@ public class AdminEventEngine implements IAdminCommandHandler
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">" + eventName + "</font><font color=\"FF0000\"> bY " + inbr.readLine() + "</font></center><br>");
replyMSG.append("<br>" + inbr.readLine());
replyMSG.append("</body></html>");
adminReply.setHtml(replyMSG.toString());
@@ -282,7 +279,6 @@ public class AdminEventEngine implements IAdminCommandHandler
while (!GameEvent.participatingPlayers.isEmpty())
{
final String target = getMaxLeveledPlayer();
if (!target.equals(""))
{
GameEvent.players.get(i + 1).add(target);
@@ -377,7 +373,6 @@ public class AdminEventEngine implements IAdminCommandHandler
final StringTokenizer st1 = new StringTokenizer(n, "*");
n = st1.nextToken();
String type = "";
if (st1.hasMoreElements())
{
type = st1.nextToken();
@@ -412,10 +407,8 @@ public class AdminEventEngine implements IAdminCommandHandler
else if (command.startsWith("admin_event_announce"))
{
StringTokenizer st = new StringTokenizer(command.substring(21));
GameEvent.id = Integer.parseInt(st.nextToken());
GameEvent.teamsNumber = Integer.parseInt(st.nextToken());
String temp = " ";
String temp2 = "";
@@ -425,13 +418,11 @@ public class AdminEventEngine implements IAdminCommandHandler
}
st = new StringTokenizer(temp, "-");
Integer i = 1;
while (st.hasMoreElements())
{
temp2 = st.nextToken();
if (!temp2.equals(" "))
{
GameEvent.names.put(i, temp2.substring(1, temp2.length() - 1));
@@ -448,9 +439,7 @@ public class AdminEventEngine implements IAdminCommandHandler
activeChar.broadcastPacket(snd);
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE</font></center><br>");
replyMSG.append("<center>The event <font color=\"LEVEL\">" + GameEvent.eventName + "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>");
replyMSG.append("</body></html>");
@@ -472,18 +461,15 @@ public class AdminEventEngine implements IAdminCommandHandler
final File dir = new File("data/events");
final String[] files = dir.list();
String result = "";
if (files == null)
{
result = "No 'data/events' directory!";
return result;
}
for (String file2 : files)
{
final File file = new File("data/events/" + file2);
result += "<font color=\"LEVEL\">" + file.getName() + " </font><br><button value=\"select\" action=\"bypass -h admin_event_set " + file.getName() + "\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><button value=\"ver\" action=\"bypass -h admin_event_see " + file.getName() + "\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><button value=\"delete\" action=\"bypass -h admin_event_del " + file.getName() + "\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"><br><br>";
}
@@ -493,9 +479,7 @@ public class AdminEventEngine implements IAdminCommandHandler
public void showMainPage(PlayerInstance activeChar)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
replyMSG.append("<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
replyMSG.append("<center><br>Stored Events<br></center>");
@@ -509,12 +493,9 @@ public class AdminEventEngine implements IAdminCommandHandler
public void showNewEventPage(PlayerInstance activeChar)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
replyMSG.append("<br><center>Event's Title <br><font color=\"LEVEL\">");
if (tempName.equals(""))
{
replyMSG.append("Use //event_name text to insert a new title");
@@ -525,7 +506,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
replyMSG.append("</font></center><br><br>Event's description<br>");
if (tempBuffer.equals(""))
{
replyMSG.append("Use //add text o //delete_buffer to modify this text field");
@@ -550,20 +530,16 @@ public class AdminEventEngine implements IAdminCommandHandler
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
replyMSG.append("<center><font color=\"LEVEL\">" + GameEvent.eventName + "</font></center><br>");
replyMSG.append("<br><center><button value=\"Change number of teams to\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"> <edit var=\"event_teams_number\" width=100 height=20><br><br>");
replyMSG.append("<font color=\"LEVEL\">Team's Names</font><br>");
for (int i = 0; i < teamnumbers; i++)
{
replyMSG.append((i + 1) + ".- <edit var=\"event_teams_name" + (i + 1) + "\" width=100 height=20><br>");
}
replyMSG.append("<br><br>Announcer NPC id<edit var=\"event_npcid\" width=100 height=20><br><br><button value=\"Announce Event!!\" action=\"bypass -h admin_event_announce $event_npcid " + teamnumbers + " ");
for (int i = 0; i < teamnumbers; i++)
{
replyMSG.append("$event_teams_name" + (i + 1) + " - ");
@@ -587,7 +563,6 @@ public class AdminEventEngine implements IAdminCommandHandler
if (!temp.contains(player))
{
GameEvent.spawn(player, id);
temp.add(player);
}
for (PlayerInstance playertemp : player.getKnownList().getKnownPlayers().values())
@@ -605,9 +580,7 @@ public class AdminEventEngine implements IAdminCommandHandler
void showEventControl(PlayerInstance activeChar)
{
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><font color=\"LEVEL\">" + GameEvent.eventName + "</font><br><br><table width=200>");
replyMSG.append("<tr><td>Apply this command to teams number </td><td><edit var=\"team_number\" width=100 height=15></td></tr>");
replyMSG.append("<tr><td>&nbsp;</td></tr>");
@@ -644,9 +617,7 @@ public class AdminEventEngine implements IAdminCommandHandler
{
final Iterator<String> it = GameEvent.participatingPlayers.iterator();
PlayerInstance pc = null;
int max = 0;
String name = "";
while (it.hasNext())
@@ -655,7 +626,6 @@ public class AdminEventEngine implements IAdminCommandHandler
{
tempName2 = it.next();
pc = World.getInstance().getPlayer(tempName2);
if (max < pc.getLevel())
{
max = pc.getLevel();
@@ -688,7 +658,6 @@ public class AdminEventEngine implements IAdminCommandHandler
{
npc = (NpcInstance) World.getInstance().findObject(Integer.parseInt(GameEvent.npcs.get(0)));
final Spawn spawn = npc.getSpawn();
if (spawn != null)
{
spawn.stopRespawn();
@@ -735,7 +704,6 @@ public class AdminEventEngine implements IAdminCommandHandler
{
final PlayerInstance pc = World.getInstance().getPlayer(it.next());
pc.eventSitForced = !pc.eventSitForced;
if (pc.eventSitForced)
{
pc.sitDown();
@@ -807,7 +775,6 @@ public class AdminEventEngine implements IAdminCommandHandler
final PlayerInstance target = World.getInstance().getPlayer(it.next());
target.getPoly().setPolyInfo("npc", id);
target.teleToLocation(target.getX(), target.getY(), target.getZ(), true);
target.broadcastPacket(new CharInfo(target));
target.sendPacket(new UserInfo(target));
}
@@ -827,11 +794,9 @@ public class AdminEventEngine implements IAdminCommandHandler
try
{
final PlayerInstance target = World.getInstance().getPlayer(it.next());
target.getPoly().setPolyInfo(null, "1");
target.decayMe();
target.spawnMe(target.getX(), target.getY(), target.getZ());
target.broadcastPacket(new CharInfo(target));
target.sendPacket(new UserInfo(target));
}
@@ -844,12 +809,10 @@ public class AdminEventEngine implements IAdminCommandHandler
private void createItem(PlayerInstance activeChar, PlayerInstance player, int id, int num)
{
player.getInventory().addItem("Event", id, num, player, activeChar);
player.sendPacket(new ItemList(player, true));
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder("<html><body>");
replyMSG.append("CONGRATULATIONS, you should have a present in your inventory");
replyMSG.append("</body></html>");
@@ -860,7 +823,6 @@ public class AdminEventEngine implements IAdminCommandHandler
void regardTeam(PlayerInstance activeChar, int team, int n, int id, String type)
{
final LinkedList<String> linked = GameEvent.players.get(team);
int temp = n;
final Iterator<String> it = linked.iterator();
@@ -870,7 +832,6 @@ public class AdminEventEngine implements IAdminCommandHandler
try
{
final PlayerInstance target = World.getInstance().getPlayer(it.next());
if (type.equalsIgnoreCase("level"))
{
temp = n * target.getLevel();
@@ -904,7 +865,6 @@ public class AdminEventEngine implements IAdminCommandHandler
try
{
final PlayerInstance target = World.getInstance().getPlayer(it.next());
target.setTitle(target.eventTitle);
target.setKarma(target.eventKarma);
target.setPvpKills(target.eventPvpKills);

View File

@@ -49,7 +49,6 @@ public class AdminExpSp implements IAdminCommandHandler
try
{
final String val = command.substring(16);
if (!adminAddExpSp(activeChar, val))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //add_exp_sp exp sp");
@@ -66,7 +65,6 @@ public class AdminExpSp implements IAdminCommandHandler
try
{
final String val = command.substring(19);
if (!adminRemoveExpSP(activeChar, val))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //remove_exp_sp exp sp");
@@ -94,7 +92,6 @@ public class AdminExpSp implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -119,7 +116,6 @@ public class AdminExpSp implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -131,7 +127,6 @@ public class AdminExpSp implements IAdminCommandHandler
}
final StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{
return false;
@@ -139,7 +134,6 @@ public class AdminExpSp implements IAdminCommandHandler
final String exp = st.nextToken();
final String sp = st.nextToken();
long expval = 0;
int spval = 0;
@@ -169,7 +163,6 @@ public class AdminExpSp implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -181,7 +174,6 @@ public class AdminExpSp implements IAdminCommandHandler
}
final StringTokenizer st = new StringTokenizer(expSp);
if (st.countTokens() != 2)
{
return false;
@@ -189,7 +181,6 @@ public class AdminExpSp implements IAdminCommandHandler
final String exp = st.nextToken();
final String sp = st.nextToken();
long expval = 0;
int spval = 0;

View File

@@ -85,7 +85,6 @@ public class AdminFence implements IAdminCommandHandler
{
final int objId = Integer.parseInt(st.nextToken());
final int fenceTypeOrdinal = Integer.parseInt(st.nextToken());
if ((fenceTypeOrdinal < 0) || (fenceTypeOrdinal >= FenceState.values().length))
{
BuilderUtil.sendSysMessage(activeChar, "Specified FenceType is out of range. Only 0-" + (FenceState.values().length - 1) + " are permitted.");
@@ -214,7 +213,6 @@ public class AdminFence implements IAdminCommandHandler
html.setFile("data/html/admin/fences.htm");
html.replace("%pages%", result.getPagerTemplate().toString());
html.replace("%announcements%", result.getBodyTemplate().toString());
if (result.getPages() > 0)
{
html.replace("%pages%", "<table width=280 cellspacing=0><tr>" + result.getPagerTemplate() + "</tr></table>");

View File

@@ -76,7 +76,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
private void handleStart(String params, PlayerInstance activeChar)
{
final StringTokenizer st = new StringTokenizer(params);
int lvl1 = 0;
int lvl2 = 0;
int mid1 = 0;
@@ -85,7 +84,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
while (st.hasMoreTokens())
{
final String s = st.nextToken();
if (s.equals("lvl1"))
{
lvl1 = Integer.parseInt(st.nextToken());
@@ -112,23 +110,19 @@ public class AdminFightCalculator implements IAdminCommandHandler
}
NpcTemplate npc1 = null;
if (mid1 != 0)
{
npc1 = NpcTable.getInstance().getTemplate(mid1);
}
NpcTemplate npc2 = null;
if (mid2 != 0)
{
npc2 = NpcTable.getInstance().getTemplate(mid2);
}
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
if ((npc1 != null) && (npc2 != null))
{
replyMSG.append("<html><title>Selected mobs to fight</title>");
@@ -150,7 +144,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
replyMSG.append("<body><table>");
final NpcTemplate[] npcs = NpcTable.getInstance().getAllOfLevel(lvl1);
for (NpcTemplate n : npcs)
{
replyMSG.append("<tr><td><a action=\"bypass -h admin_fight_calculator lvl1 " + lvl1 + " lvl2 " + lvl2 + " mid1 " + n.getNpcId() + " mid2 " + mid2 + "\">" + n.getName() + "</a></td></tr>");
@@ -164,7 +157,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
replyMSG.append("<body><table>");
final NpcTemplate[] npcs = NpcTable.getInstance().getAllOfLevel(lvl2);
for (NpcTemplate n : npcs)
{
replyMSG.append("<tr><td><a action=\"bypass -h admin_fight_calculator lvl1 " + lvl1 + " lvl2 " + lvl2 + " mid1 " + mid1 + " mid2 " + n.getNpcId() + "\">" + n.getName() + "</a></td></tr>");
@@ -193,10 +185,8 @@ public class AdminFightCalculator implements IAdminCommandHandler
private void handleShow(String params, PlayerInstance activeChar)
{
params = params.trim();
Creature npc1 = null;
Creature npc2 = null;
if (params.length() == 0)
{
npc1 = activeChar;
@@ -215,9 +205,7 @@ public class AdminFightCalculator implements IAdminCommandHandler
final StringTokenizer st = new StringTokenizer(params);
mid1 = Integer.parseInt(st.nextToken());
mid2 = Integer.parseInt(st.nextToken());
npc1 = new MonsterInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(mid1));
npc2 = new MonsterInstance(IdFactory.getNextId(), NpcTable.getInstance().getTemplate(mid2));
}
@@ -243,7 +231,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
// number of ATTACK per 100 seconds
sAtk1 = 100000 / sAtk1;
sAtk2 = 100000 / sAtk2;
for (int i = 0; i < 10000; i++)
{
final boolean calcMiss1 = Formulas.calcHitMiss(npc1, npc2);
@@ -276,7 +263,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
final double npcPdef1 = npc1.getPDef(npc2);
pdef1 += npcPdef1;
if (!calcMiss1)
{
npc1.setAttackingBodypart();
@@ -319,7 +305,6 @@ public class AdminFightCalculator implements IAdminCommandHandler
final double npcPdef2 = npc2.getPDef(npc1);
pdef2 += npcPdef2;
if (!calcMiss2)
{
npc2.setAttackingBodypart();
@@ -352,12 +337,9 @@ public class AdminFightCalculator implements IAdminCommandHandler
// HP restored per 100 seconds
final double maxHp1 = npc1.getMaxHp();
final int hp1 = (int) ((Formulas.calcHpRegen(npc1) * 100000) / Formulas.getRegeneratePeriod(npc1));
final double maxHp2 = npc2.getMaxHp();
final int hp2 = (int) ((Formulas.calcHpRegen(npc2) * 100000) / Formulas.getRegeneratePeriod(npc2));
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
final StringBuilder replyMSG = new StringBuilder();
replyMSG.append("<html><title>Selected mobs to fight</title>");
replyMSG.append("<body>");

View File

@@ -59,7 +59,6 @@ public class AdminFortSiege implements IAdminCommandHandler
// Get fort
Fort fort = null;
if (st.hasMoreTokens())
{
fort = FortManager.getInstance().getFort(st.nextToken());
@@ -74,7 +73,6 @@ public class AdminFortSiege implements IAdminCommandHandler
{
final WorldObject target = activeChar.getTarget();
PlayerInstance player = null;
if (target instanceof PlayerInstance)
{
player = (PlayerInstance) target;
@@ -134,7 +132,6 @@ public class AdminFortSiege implements IAdminCommandHandler
else if (command.equalsIgnoreCase("admin_removefort"))
{
final Clan clan = ClanTable.getInstance().getClan(fort.getOwnerId());
if (clan != null)
{
fort.removeOwner(clan);
@@ -166,7 +163,6 @@ public class AdminFortSiege implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
adminReply.setFile("data/html/admin/forts.htm");
final StringBuilder cList = new StringBuilder();
for (Fort fort : FortManager.getInstance().getForts())
{
if (fort != null)

View File

@@ -49,7 +49,6 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldZ = activeChar.getZ();
final int geoX = GeoEngine.getGeoX(worldX);
final int geoY = GeoEngine.getGeoY(worldY);
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
BuilderUtil.sendSysMessage(activeChar, "WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoEngine.getInstance().getHeightNearest(geoX, geoY, worldZ));
@@ -66,7 +65,6 @@ public class AdminGeodata implements IAdminCommandHandler
final int worldZ = activeChar.getZ();
final int geoX = GeoEngine.getGeoX(worldX);
final int geoY = GeoEngine.getGeoY(worldY);
if (GeoEngine.getInstance().hasGeoPos(geoX, geoY))
{
BuilderUtil.sendSysMessage(activeChar, "WorldX: " + worldX + ", WorldY: " + worldY + ", WorldZ: " + worldZ + ", GeoX: " + geoX + ", GeoY: " + geoY + ", GeoZ: " + GeoEngine.getInstance().getHeightNearest(worldX, worldY, worldZ));
@@ -128,7 +126,6 @@ public class AdminGeodata implements IAdminCommandHandler
{
return false;
}
return true;
}

View File

@@ -39,7 +39,6 @@ public class AdminGm implements IAdminCommandHandler
{
handleGm(activeChar);
}
return true;
}

View File

@@ -47,7 +47,6 @@ public class AdminGmSpeed implements IAdminCommandHandler
{
final StringTokenizer st = new StringTokenizer(command);
final String cmd = st.nextToken();
if (cmd.equals("admin_gmspeed"))
{
if (!st.hasMoreTokens())
@@ -64,7 +63,6 @@ public class AdminGmSpeed implements IAdminCommandHandler
{
final int val = Integer.parseInt(token);
final boolean sendMessage = player.getFirstEffect(SUPER_HASTE_ID) != null;
player.stopSkillEffects(SUPER_HASTE_ID);
if ((val == 0) && sendMessage)

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