Code style changes.

This commit is contained in:
MobiusDev
2016-04-26 19:21:19 +00:00
parent 6a13705766
commit fc070c9238
768 changed files with 3338 additions and 4252 deletions

View File

@ -256,7 +256,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
_lifeStones.put(45936, new LifeStone(GRADE_ACC, 15));
}
protected static final LifeStone getLifeStone(int itemId)
protected static LifeStone getLifeStone(int itemId)
{
return _lifeStones.get(itemId);
}
@ -269,7 +269,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param gemStones
* @return
*/
protected static final boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem, L2ItemInstance gemStones)
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem, L2ItemInstance gemStones)
{
if (!isValid(player, item, refinerItem))
{
@ -320,7 +320,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param refinerItem
* @return
*/
protected static final boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem)
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem)
{
if (!isValid(player, item))
{
@ -368,7 +368,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param item
* @return
*/
protected static final boolean isValid(L2PcInstance player, L2ItemInstance item)
protected static boolean isValid(L2PcInstance player, L2ItemInstance item)
{
if (!isValid(player))
{
@ -478,7 +478,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param player
* @return
*/
protected static final boolean isValid(L2PcInstance player)
protected static boolean isValid(L2PcInstance player)
{
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
{
@ -526,7 +526,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param itemGrade
* @return GemStone itemId based on item grade
*/
protected static final int[] getGemStoneId(CrystalType itemGrade)
protected static int[] getGemStoneId(CrystalType itemGrade)
{
switch (itemGrade)
{
@ -564,7 +564,7 @@ public abstract class AbstractRefinePacket extends L2GameClientPacket
* @param lifeStoneGrade
* @return GemStone count based on item grade and life stone grade
*/
protected static final int getGemStoneCount(CrystalType itemGrade, int lifeStoneGrade)
protected static int getGemStoneCount(CrystalType itemGrade, int lifeStoneGrade)
{
switch (lifeStoneGrade)
{

View File

@ -150,7 +150,7 @@ public final class Action extends L2GameClientPacket
}
case 1:
{
if (!activeChar.isGM() && !(obj.isNpc() && Config.ALT_GAME_VIEWNPC))
if (!activeChar.isGM() && (!obj.isNpc() || !Config.ALT_GAME_VIEWNPC))
{
obj.onAction(activeChar, false);
}

View File

@ -118,16 +118,13 @@ public final class Attack extends L2GameClientPacket
{
target.onAction(activeChar);
}
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}

View File

@ -108,16 +108,13 @@ public final class AttackRequest extends L2GameClientPacket
{
target.onAction(activeChar);
}
else if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
if ((target.getObjectId() != activeChar.getObjectId()) && (activeChar.getPrivateStoreType() == PrivateStoreType.NONE) && (activeChar.getActiveRequester() == null))
{
target.onForcedAttack(activeChar);
}
else
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
}
}

View File

@ -53,7 +53,7 @@ public final class CannotMoveAnymoreInVehicle extends L2GameClientPacket
}
player.setInVehiclePosition(new Location(_x, _y, _z));
player.setHeading(_heading);
player.broadcastPacket((new StopMoveInVehicle(player, _boatId)));
player.broadcastPacket(new StopMoveInVehicle(player, _boatId));
}
@Override

View File

@ -258,7 +258,7 @@ public final class CharacterCreate extends L2GameClientPacket
break;
}
}
newChar = L2PcInstance.create(template, getClient().getAccountName(), _name, (new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0)));
newChar = L2PcInstance.create(template, getClient().getAccountName(), _name, new PcAppearance(_face, _hairColor, _hairStyle, _sex != 0));
}
// HP and MP are at maximum and CP is zero by default.

View File

@ -123,7 +123,7 @@ public class CharacterSelect extends L2GameClientPacket
if (Config.FACTION_SYSTEM_ENABLED && Config.FACTION_BALANCE_ONLINE_PLAYERS)
{
if (info.isGood() && (L2World.getInstance().getAllGoodPlayersCount() >= ((L2World.getInstance().getAllEvilPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT))))
if (info.isGood() && (L2World.getInstance().getAllGoodPlayersCount() >= (L2World.getInstance().getAllEvilPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
{
final NpcHtmlMessage msg = new NpcHtmlMessage();
msg.setFile(info.getHtmlPrefix(), "html/mods/Faction/ExceededOnlineLimit.htm");
@ -132,7 +132,7 @@ public class CharacterSelect extends L2GameClientPacket
client.sendPacket(msg);
return;
}
if (info.isEvil() && (L2World.getInstance().getAllEvilPlayersCount() >= ((L2World.getInstance().getAllGoodPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT))))
if (info.isEvil() && (L2World.getInstance().getAllEvilPlayersCount() >= (L2World.getInstance().getAllGoodPlayersCount() + Config.FACTION_BALANCE_PLAYER_EXCEED_LIMIT)))
{
final NpcHtmlMessage msg = new NpcHtmlMessage();
msg.setFile(info.getHtmlPrefix(), "html/mods/Faction/ExceededOnlineLimit.htm");

View File

@ -84,7 +84,7 @@ public final class DlgAnswer extends L2GameClientPacket
{
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", cmd, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
}
AdminCommandHandler.getInstance().getHandler(command).useAdminCommand(cmd, activeChar);
}

View File

@ -110,12 +110,12 @@ import com.l2jmobius.gameserver.network.serverpackets.friend.L2FriendList;
*/
public class EnterWorld extends L2GameClientPacket
{
private final static String _C__11_ENTERWORLD = "[C] 11 EnterWorld";
private static final String _C__11_ENTERWORLD = "[C] 11 EnterWorld";
private final int[][] tracert = new int[5][4];
private final static double MIN_HP = 0.5;
private static final double MIN_HP = 0.5;
private static final int COMBAT_FLAG = 9819;
private final static int ERTHEIA_INTRO_FOR_ERTHEIA_USM_ID = 147;
private final static int ERTHEIA_INTRO_FOR_OTHERS_USM_ID = 148;
private static final int ERTHEIA_INTRO_FOR_ERTHEIA_USM_ID = 147;
private static final int ERTHEIA_INTRO_FOR_OTHERS_USM_ID = 148;
@Override
protected void readImpl()

View File

@ -209,7 +209,7 @@ public class MultiSellChoose extends L2GameClientPacket
{
// if this is not a list that maintains enchantment, check the count of all items that have the given id.
// otherwise, check only the count of items with exactly the needed enchantment level
final long required = ((Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient()) ? (e.getItemCount() * _amount) : e.getItemCount());
final long required = (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient()) ? (e.getItemCount() * _amount) : e.getItemCount();
if (inv.getInventoryItemCount(e.getItemId(), (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)) ? e.getEnchantLevel() : -1, false) < required)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_NEED_S2_S1_S);
@ -260,114 +260,107 @@ public class MultiSellChoose extends L2GameClientPacket
// if it's a stackable item, just reduce the amount from the first (only) instance that is found in the inventory
if (itemToTake.isStackable())
{
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), (e.getItemCount() * _amount), player.getTarget(), true))
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), e.getItemCount() * _amount, player.getTarget(), true))
{
player.setMultiSell(null);
return;
}
}
else
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
else if (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0))
{
// for non-stackable items, one of two scenarios are possible:
// a) list maintains enchantment: get the instances that exactly match the requested enchantment level
// b) list does not maintain enchantment: get the instances with the LOWEST enchantment level
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
if (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0))
// loop through this list and remove (one by one) each item until the required amount is taken.
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
for (int i = 0; i < (e.getItemCount() * _amount); i++)
{
// loop through this list and remove (one by one) each item until the required amount is taken.
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
for (int i = 0; i < (e.getItemCount() * _amount); i++)
if (inventoryContents[i].isAugmented())
{
if (inventoryContents[i].isAugmented())
{
augmentation.add(inventoryContents[i].getAugmentation());
}
if (inventoryContents[i].getElementals() != null)
{
elemental = inventoryContents[i].getElementals();
}
if (!player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1, player.getTarget(), true))
{
player.setMultiSell(null);
return;
}
if (inventoryContents[i].getCommonSoulCrystalOptions() != null)
{
commonSoulCrystalOptions = inventoryContents[i].getCommonSoulCrystalOptions();
}
if (inventoryContents[i].getSpecialSoulCrystalOption() != null)
{
specialSoulCrystalOption = inventoryContents[i].getSpecialSoulCrystalOption();
}
augmentation.add(inventoryContents[i].getAugmentation());
}
if (inventoryContents[i].getElementals() != null)
{
elemental = inventoryContents[i].getElementals();
}
if (!player.destroyItem("Multisell", inventoryContents[i].getObjectId(), 1, player.getTarget(), true))
{
player.setMultiSell(null);
return;
}
if (inventoryContents[i].getCommonSoulCrystalOptions() != null)
{
commonSoulCrystalOptions = inventoryContents[i].getCommonSoulCrystalOptions();
}
if (inventoryContents[i].getSpecialSoulCrystalOption() != null)
{
specialSoulCrystalOption = inventoryContents[i].getSpecialSoulCrystalOption();
}
}
else
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
}
else
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
{
// NOTE: There are 2 ways to achieve the above goal.
// 1) Get all items that have the correct itemId, loop through them until the lowest enchantment
// level is found. Repeat all this for the next item until proper count of items is reached.
// 2) Get all items that have the correct itemId, sort them once based on enchantment level,
// and get the range of items that is necessary.
// Method 1 is faster for a small number of items to be exchanged.
// Method 2 is faster for large amounts.
//
// EXPLANATION:
// Worst case scenario for algorithm 1 will make it run in a number of cycles given by:
// m*(2n-m+1)/2 where m is the number of items to be exchanged and n is the total
// number of inventory items that have a matching id.
// With algorithm 2 (sort), sorting takes n*log(n) time and the choice is done in a single cycle
// for case b (just grab the m first items) or in linear time for case a (find the beginning of items
// with correct enchantment, index x, and take all items from x to x+m).
// Basically, whenever m > log(n) we have: m*(2n-m+1)/2 = (2nm-m*m+m)/2 >
// (2nlogn-logn*logn+logn)/2 = nlog(n) - log(n*n) + log(n) = nlog(n) + log(n/n*n) =
// nlog(n) + log(1/n) = nlog(n) - log(n) = (n-1)log(n)
// So for m < log(n) then m*(2n-m+1)/2 > (n-1)log(n) and m*(2n-m+1)/2 > nlog(n)
//
// IDEALLY:
// In order to best optimize the performance, choose which algorithm to run, based on whether 2^m > n
// if ( (2<<(e.getItemCount()// _amount)) < inventoryContents.length )
// // do Algorithm 1, no sorting
// else
// // do Algorithm 2, sorting
//
// CURRENT IMPLEMENTATION:
// In general, it is going to be very rare for a person to do a massive exchange of non-stackable items
// For this reason, we assume that algorithm 1 will always suffice and we keep things simple.
// If, in the future, it becomes necessary that we optimize, the above discussion should make it clear
// what optimization exactly is necessary (based on the comments under "IDEALLY").
//
// choice 1. Small number of items exchanged. No sorting.
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
{
// NOTE: There are 2 ways to achieve the above goal.
// 1) Get all items that have the correct itemId, loop through them until the lowest enchantment
// level is found. Repeat all this for the next item until proper count of items is reached.
// 2) Get all items that have the correct itemId, sort them once based on enchantment level,
// and get the range of items that is necessary.
// Method 1 is faster for a small number of items to be exchanged.
// Method 2 is faster for large amounts.
//
// EXPLANATION:
// Worst case scenario for algorithm 1 will make it run in a number of cycles given by:
// m*(2n-m+1)/2 where m is the number of items to be exchanged and n is the total
// number of inventory items that have a matching id.
// With algorithm 2 (sort), sorting takes n*log(n) time and the choice is done in a single cycle
// for case b (just grab the m first items) or in linear time for case a (find the beginning of items
// with correct enchantment, index x, and take all items from x to x+m).
// Basically, whenever m > log(n) we have: m*(2n-m+1)/2 = (2nm-m*m+m)/2 >
// (2nlogn-logn*logn+logn)/2 = nlog(n) - log(n*n) + log(n) = nlog(n) + log(n/n*n) =
// nlog(n) + log(1/n) = nlog(n) - log(n) = (n-1)log(n)
// So for m < log(n) then m*(2n-m+1)/2 > (n-1)log(n) and m*(2n-m+1)/2 > nlog(n)
//
// IDEALLY:
// In order to best optimize the performance, choose which algorithm to run, based on whether 2^m > n
// if ( (2<<(e.getItemCount()// _amount)) < inventoryContents.length )
// // do Algorithm 1, no sorting
// else
// // do Algorithm 2, sorting
//
// CURRENT IMPLEMENTATION:
// In general, it is going to be very rare for a person to do a massive exchange of non-stackable items
// For this reason, we assume that algorithm 1 will always suffice and we keep things simple.
// If, in the future, it becomes necessary that we optimize, the above discussion should make it clear
// what optimization exactly is necessary (based on the comments under "IDEALLY").
//
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), false);
// choice 1. Small number of items exchanged. No sorting.
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
itemToTake = inventoryContents[0];
// get item with the LOWEST enchantment level from the inventory...
// +0 is lowest by default...
if (itemToTake.getEnchantLevel() > 0)
{
final L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), false);
itemToTake = inventoryContents[0];
// get item with the LOWEST enchantment level from the inventory...
// +0 is lowest by default...
if (itemToTake.getEnchantLevel() > 0)
for (L2ItemInstance item : inventoryContents)
{
for (L2ItemInstance item : inventoryContents)
if ((item.getEnchantLevel() < itemToTake.getEnchantLevel()) && (item.getEnchantLevel() >= e.getEnchantLevel()))
{
if ((item.getEnchantLevel() < itemToTake.getEnchantLevel()) && (item.getEnchantLevel() >= e.getEnchantLevel()))
itemToTake = item;
// nothing will have enchantment less than 0. If a zero-enchanted
// item is found, just take it
if (itemToTake.getEnchantLevel() == 0)
{
itemToTake = item;
// nothing will have enchantment less than 0. If a zero-enchanted
// item is found, just take it
if (itemToTake.getEnchantLevel() == 0)
{
break;
}
break;
}
}
}
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), 1, player.getTarget(), true))
{
player.setMultiSell(null);
return;
}
}
if (!player.destroyItem("Multisell", itemToTake.getObjectId(), 1, player.getTarget(), true))
{
player.setMultiSell(null);
return;
}
}
}
@ -391,7 +384,7 @@ public class MultiSellChoose extends L2GameClientPacket
}
// Calculate chance
matched = (itemRandom < (cumulativeChance += e.getChance()));
matched = itemRandom < (cumulativeChance += e.getChance());
if (!matched)
{
continue;

View File

@ -512,7 +512,7 @@ public final class RequestAcquireSkill extends L2GameClientPacket
}
}
public final static void showSubSkillList(L2PcInstance activeChar)
public static void showSubSkillList(L2PcInstance activeChar)
{
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableSubClassSkills(activeChar);
if (!skills.isEmpty())
@ -525,7 +525,7 @@ public final class RequestAcquireSkill extends L2GameClientPacket
}
}
public final static void showDualSkillList(L2PcInstance activeChar)
public static void showDualSkillList(L2PcInstance activeChar)
{
final List<L2SkillLearn> skills = SkillTreesData.getInstance().getAvailableDualClassSkills(activeChar);
if (!skills.isEmpty())

View File

@ -85,7 +85,7 @@ public final class RequestAcquireSkillInfo extends L2GameClientPacket
// Hack check. Doesn't apply to all Skill Types
final int prevSkillLevel = activeChar.getSkillLevel(_id);
if ((prevSkillLevel > 0) && !((_skillType == AcquireSkillType.TRANSFER) || (_skillType == AcquireSkillType.SUBPLEDGE)))
if ((prevSkillLevel > 0) && (_skillType != AcquireSkillType.TRANSFER) && (_skillType != AcquireSkillType.SUBPLEDGE))
{
if (prevSkillLevel == _level)
{

View File

@ -84,8 +84,8 @@ public final class RequestActionUse extends L2GameClientPacket
protected void readImpl()
{
_actionId = readD();
_ctrlPressed = (readD() == 1);
_shiftPressed = (readC() == 1);
_ctrlPressed = readD() == 1;
_shiftPressed = readC() == 1;
}
@Override
@ -124,7 +124,7 @@ public final class RequestActionUse extends L2GameClientPacket
}
// Don't allow to do some action if player is transformed
if (activeChar.isTransformed() && !(Arrays.binarySearch((activeChar.isTransformed() ? ExBasicActionList.ACTIONS_ON_TRANSFORM : ExBasicActionList.DEFAULT_ACTION_LIST), _actionId) >= 0))
if (activeChar.isTransformed() && (Arrays.binarySearch(activeChar.isTransformed() ? ExBasicActionList.ACTIONS_ON_TRANSFORM : ExBasicActionList.DEFAULT_ACTION_LIST, _actionId) < 0))
{
sendPacket(ActionFailed.STATIC_PACKET);
_log.warning("Player " + activeChar + " used action which he does not have! Id = " + _actionId + " transform: " + activeChar.getTransformation());
@ -144,7 +144,7 @@ public final class RequestActionUse extends L2GameClientPacket
}
else
{
activeChar.getAI().setNextAction((new NextAction(CtrlEvent.EVT_ARRIVED, CtrlIntention.AI_INTENTION_MOVE_TO, () -> useSit(activeChar, target))));
activeChar.getAI().setNextAction(new NextAction(CtrlEvent.EVT_ARRIVED, CtrlIntention.AI_INTENTION_MOVE_TO, () -> useSit(activeChar, target)));
}
break;
}
@ -463,7 +463,7 @@ public final class RequestActionUse extends L2GameClientPacket
case 80:
case 81:
{
if ((activeChar.getParty() != null) && (activeChar.getTarget() != null) && (activeChar.getTarget().isCharacter()))
if ((activeChar.getParty() != null) && (activeChar.getTarget() != null) && activeChar.getTarget().isCharacter())
{
activeChar.getParty().addTacticalSign(_actionId - 77, (L2Character) activeChar.getTarget());
}

View File

@ -104,7 +104,7 @@ public final class RequestBuyItem extends L2GameClientPacket
L2Character merchant = null;
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
{
if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
if (!(target instanceof L2MerchantInstance) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != target.getInstanceId()))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;

View File

@ -126,7 +126,7 @@ public class RequestBuySeed extends L2GameClientPacket
}
// Calculate price
totalPrice += (sp.getPrice() * ih.getCount());
totalPrice += sp.getPrice() * ih.getCount();
if (totalPrice > MAX_ADENA)
{
Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);

View File

@ -164,7 +164,7 @@ public final class RequestBypassToServer extends L2GameClientPacket
{
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
}
ach.useAdminCommand(_command, activeChar);

View File

@ -117,13 +117,13 @@ public class RequestChangeAttributeItem extends L2GameClientPacket
player.sendPacket(new ExStorageMaxCount(player));
final InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(item);
if (player.getInventory().getItemByObjectId(_attributeOID) == null)
if (player.getInventory().getItemByObjectId(_attributeOID) != null)
{
iu.addRemovedItem(attribute);
iu.addModifiedItem(attribute);
}
else
{
iu.addModifiedItem(attribute);
iu.addRemovedItem(attribute);
}
player.sendPacket(iu);

View File

@ -65,7 +65,7 @@ public final class RequestConfirmSiegeWaitingList extends L2GameClientPacket
}
// Check if leader of the clan who owns the castle?
if ((castle.getOwnerId() != activeChar.getClanId()) || (!activeChar.isClanLeader()))
if ((castle.getOwnerId() != activeChar.getClanId()) || !activeChar.isClanLeader())
{
return;
}
@ -89,12 +89,9 @@ public final class RequestConfirmSiegeWaitingList extends L2GameClientPacket
return;
}
}
else
else if (castle.getSiege().checkIsDefenderWaiting(clan) || castle.getSiege().checkIsDefender(clan))
{
if ((castle.getSiege().checkIsDefenderWaiting(clan)) || (castle.getSiege().checkIsDefender(clan)))
{
castle.getSiege().removeSiegeClan(_clanId);
}
castle.getSiege().removeSiegeClan(_clanId);
}
}

View File

@ -216,13 +216,12 @@ public final class RequestCrystallizeItem extends L2GameClientPacket
{
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(itemToRemove.getEnchantLevel());
sm.addItemName(itemToRemove);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
sm.addItemName(itemToRemove);
}
sm.addItemName(itemToRemove);
activeChar.sendPacket(sm);
}

View File

@ -47,12 +47,7 @@ public class RequestCursedWeaponList extends L2GameClientPacket
}
// send a ExCursedWeaponList :p
final List<Integer> list = new ArrayList<>();
for (int id : CursedWeaponsManager.getInstance().getCursedWeaponsIds())
{
list.add(id);
}
final List<Integer> list = new ArrayList<>(CursedWeaponsManager.getInstance().getCursedWeaponsIds());
activeChar.sendPacket(new ExCursedWeaponList(list));
}

View File

@ -166,19 +166,18 @@ public final class RequestDestroyItem extends L2GameClientPacket
if (itemToRemove.isEquipped())
{
final SystemMessage sm;
if (itemToRemove.getEnchantLevel() > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(itemToRemove.getEnchantLevel());
sm.addItemName(itemToRemove);
activeChar.sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
sm.addItemName(itemToRemove);
activeChar.sendPacket(sm);
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
}
sm.addItemName(itemToRemove);
activeChar.sendPacket(sm);
final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(itemToRemove.getLocationSlot());

View File

@ -72,12 +72,12 @@ public final class RequestDropItem extends L2GameClientPacket
final L2ItemInstance item = activeChar.getInventory().getItemByObjectId(_objectId);
if ((item == null) || (_count == 0) || !activeChar.validateItemManipulation(_objectId, "drop") || (!Config.ALLOW_DISCARDITEM && !activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS)) || (!item.isDropable() && !(activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS) && Config.GM_TRADE_RESTRICTED_ITEMS)) || ((item.getItemType() == EtcItemType.PET_COLLAR) && activeChar.havePetInvItems()) || activeChar.isInsideZone(ZoneId.NO_ITEM_DROP))
if ((item == null) || (_count == 0) || !activeChar.validateItemManipulation(_objectId, "drop") || (!Config.ALLOW_DISCARDITEM && !activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS)) || (!item.isDropable() && (!activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS) || !Config.GM_TRADE_RESTRICTED_ITEMS)) || ((item.getItemType() == EtcItemType.PET_COLLAR) && activeChar.havePetInvItems()) || activeChar.isInsideZone(ZoneId.NO_ITEM_DROP))
{
activeChar.sendPacket(SystemMessageId.THIS_ITEM_CANNOT_BE_DESTROYED);
return;
}
if (item.isQuestItem() && !(activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS) && Config.GM_TRADE_RESTRICTED_ITEMS))
if (item.isQuestItem() && (!activeChar.canOverrideCond(PcCondOverride.DROP_ALL_ITEMS) || !Config.GM_TRADE_RESTRICTED_ITEMS))
{
return;
}
@ -192,7 +192,7 @@ public final class RequestDropItem extends L2GameClientPacket
activeChar.sendPacket(iu);
activeChar.broadcastUserInfo();
activeChar.sendPacket((new ItemList(activeChar, true)));
activeChar.sendPacket(new ItemList(activeChar, true));
}
final L2ItemInstance dropedItem = activeChar.dropItem("Drop", _objectId, _count, _x, _y, _z, null, false, false);
@ -206,7 +206,7 @@ public final class RequestDropItem extends L2GameClientPacket
if (activeChar.isGM())
{
final String target = (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
final String target = activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target";
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", "Drop", target, "(id: " + dropedItem.getId() + " name: " + dropedItem.getItemName() + " objId: " + dropedItem.getObjectId() + " x: " + activeChar.getX() + " y: " + activeChar.getY() + " z: " + activeChar.getZ() + ")");
}

View File

@ -78,7 +78,6 @@ public final class RequestDuelAnswerStart extends L2GameClientPacket
msg1.addString(requestor.getName());
msg2 = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_DUEL_AGAINST_THEIR_PARTY_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
msg2.addString(player.getName());
}
else
{
@ -86,13 +85,13 @@ public final class RequestDuelAnswerStart extends L2GameClientPacket
msg1.addString(requestor.getName());
msg2 = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_ACCEPTED_YOUR_CHALLENGE_TO_A_DUEL_THE_DUEL_WILL_BEGIN_IN_A_FEW_MOMENTS);
msg2.addString(player.getName());
}
msg2.addString(player.getName());
player.sendPacket(msg1);
requestor.sendPacket(msg2);
DuelManager.getInstance().addDuel(requestor, player, _partyDuel == 1 ? true : false);
DuelManager.getInstance().addDuel(requestor, player, _partyDuel == 1);
}
else if (_response == -1)
{

View File

@ -135,33 +135,29 @@ public final class RequestDuelStart extends L2GameClientPacket
}
}
}
else
// 1vs1 duel
else if (!targetChar.isProcessingRequest())
{
if (!targetChar.isProcessingRequest())
activeChar.onTransactionRequest(targetChar);
targetChar.sendPacket(new ExDuelAskStart(activeChar.getName(), _partyDuel));
if (Config.DEBUG)
{
activeChar.onTransactionRequest(targetChar);
targetChar.sendPacket(new ExDuelAskStart(activeChar.getName(), _partyDuel));
if (Config.DEBUG)
{
_log.fine(activeChar.getName() + " requested a duel with " + targetChar.getName());
}
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_CHALLENGED_TO_A_DUEL);
msg.addString(targetChar.getName());
activeChar.sendPacket(msg);
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_CHALLENGED_YOU_TO_A_DUEL);
msg.addString(activeChar.getName());
targetChar.sendPacket(msg);
}
else
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
msg.addString(targetChar.getName());
activeChar.sendPacket(msg);
_log.fine(activeChar.getName() + " requested a duel with " + targetChar.getName());
}
SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_BEEN_CHALLENGED_TO_A_DUEL);
msg.addString(targetChar.getName());
activeChar.sendPacket(msg);
msg = SystemMessage.getSystemMessage(SystemMessageId.C1_HAS_CHALLENGED_YOU_TO_A_DUEL);
msg.addString(activeChar.getName());
targetChar.sendPacket(msg);
}
else
{
final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_ON_ANOTHER_TASK_PLEASE_TRY_AGAIN_LATER);
msg.addString(targetChar.getName());
activeChar.sendPacket(msg);
}
}

View File

@ -235,7 +235,7 @@ public final class RequestEnchantItem extends L2GameClientPacket
}
}
if ((item.isArmor()) && (item.getEnchantLevel() >= 4) && item.isEquipped())
if (item.isArmor() && (item.getEnchantLevel() >= 4) && item.isEquipped())
{
enchant4Skill = it.getEnchant4Skill();
if (enchant4Skill != null)
@ -274,19 +274,18 @@ public final class RequestEnchantItem extends L2GameClientPacket
// unequip item on enchant failure to avoid item skills stack
if (item.isEquipped())
{
final SystemMessage sm;
if (item.getEnchantLevel() > 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm = SystemMessage.getSystemMessage(SystemMessageId.THE_EQUIPMENT_S1_S2_HAS_BEEN_REMOVED);
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
activeChar.sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
sm.addItemName(item);
activeChar.sendPacket(sm);
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_BEEN_UNEQUIPPED);
}
sm.addItemName(item);
activeChar.sendPacket(sm);
final L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(item.getLocationSlot());
for (L2ItemInstance itm : unequiped)

View File

@ -72,7 +72,7 @@ public class RequestExAddEnchantScrollItem extends L2GameClientPacket
}
final EnchantScroll scrollTemplate = EnchantItemData.getInstance().getEnchantScroll(scroll);
if ((scrollTemplate == null))
if (scrollTemplate == null)
{
// message may be custom
activeChar.sendPacket(SystemMessageId.INAPPROPRIATE_ENCHANT_CONDITIONS);

View File

@ -97,30 +97,27 @@ public final class RequestExAskJoinMPCC extends L2GameClientPacket
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_DO_NOT_HAVE_AUTHORITY_TO_INVITE_SOMEONE_TO_THE_COMMAND_CHANNEL);
activeChar.sendPacket(sm);
}
else
// target in a party?
else if (player.isInParty())
{
// target in a party?
if (player.isInParty())
// targets party already in a CChannel?
if (player.getParty().isInCommandChannel())
{
// targets party already in a CChannel?
if (player.getParty().isInCommandChannel())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_IS_ALREADY_A_MEMBER_OF_THE_COMMAND_CHANNEL);
sm.addString(player.getName());
activeChar.sendPacket(sm);
}
else
{
// ready to open a new CC
// send request to targets Party's PartyLeader
askJoinMPCC(activeChar, player);
}
sm = SystemMessage.getSystemMessage(SystemMessageId.C1_S_PARTY_IS_ALREADY_A_MEMBER_OF_THE_COMMAND_CHANNEL);
sm.addString(player.getName());
activeChar.sendPacket(sm);
}
else
{
activeChar.sendMessage(player.getName() + " doesn't have party and cannot be invited to Command Channel.");
// ready to open a new CC
// send request to targets Party's PartyLeader
askJoinMPCC(activeChar, player);
}
}
else
{
activeChar.sendMessage(player.getName() + " doesn't have party and cannot be invited to Command Channel.");
}
}
else
{

View File

@ -25,7 +25,7 @@ import com.l2jmobius.gameserver.network.SystemMessageId;
*/
public class RequestExAutoFish extends L2GameClientPacket
{
private final static SkillHolder FISHING_SKILL = new SkillHolder(1312, 1);
private static final SkillHolder FISHING_SKILL = new SkillHolder(1312, 1);
public RequestExAutoFish()
{

View File

@ -219,12 +219,6 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S2_ELEMENTAL_POWER_HAS_BEEN_ADDED_SUCCESSFULLY_TO_S1);
}
sm.addItemName(item);
sm.addElemental(realElement);
if (item.isArmor())
{
sm.addElemental(Elementals.getOppositeElement(realElement));
}
}
else
{
@ -237,12 +231,12 @@ public class RequestExEnchantItemAttribute extends L2GameClientPacket
sm = SystemMessage.getSystemMessage(SystemMessageId.S3_ELEMENTAL_POWER_HAS_BEEN_ADDED_SUCCESSFULLY_TO_S1_S2);
}
sm.addInt(item.getEnchantLevel());
sm.addItemName(item);
sm.addElemental(realElement);
if (item.isArmor())
{
sm.addElemental(Elementals.getOppositeElement(realElement));
}
}
sm.addItemName(item);
sm.addElemental(realElement);
if (item.isArmor())
{
sm.addElemental(Elementals.getOppositeElement(realElement));
}
player.sendPacket(sm);
if (item.isEquipped())

View File

@ -131,20 +131,17 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK_OLD;
}
else if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK_V2;
}
else
{
if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK_V2;
}
else
{
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK_V3;
}
reqItemId = EnchantSkillGroupsData.NORMAL_ENCHANT_BOOK_V3;
}
final L2ItemInstance spb = player.getInventory().getItemByItemId(reqItemId);
@ -154,7 +151,7 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
return;
}
final int requiredAdena = (esd.getAdenaCost() * costMultiplier);
final int requiredAdena = esd.getAdenaCost() * costMultiplier;
if (player.getInventory().getAdena() < requiredAdena)
{
player.sendPacket(SystemMessageId.YOU_DO_NOT_HAVE_ALL_OF_THE_ITEMS_NEEDED_TO_ENCHANT_THAT_SKILL);
@ -253,20 +250,17 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK_OLD;
}
else if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK_V2;
}
else
{
if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK_V2;
}
else
{
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK_V3;
}
reqItemId = EnchantSkillGroupsData.SAFE_ENCHANT_BOOK_V3;
}
final EnchantSkillHolder esd = s.getEnchantSkillHolder(_skillLvl);
final int beforeEnchantSkillLevel = player.getSkillLevel(_skillId);
@ -378,20 +372,17 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK_OLD;
}
else if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK_V2;
}
else
{
if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK_V2;
}
else
{
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK_V3;
}
reqItemId = EnchantSkillGroupsData.CHANGE_ENCHANT_BOOK_V3;
}
final int beforeEnchantSkillLevel = player.getSkillLevel(_skillId);
@ -469,15 +460,15 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
player.sendPacket(new UserInfo(player));
final SystemMessage sm;
if (levelPenalty == 0)
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ENCHANT_SKILL_ROUTE_CHANGE_WAS_SUCCESSFUL_LV_OF_ENCHANT_SKILL_S1_WILL_REMAIN);
sm = SystemMessage.getSystemMessage(SystemMessageId.ENCHANT_SKILL_ROUTE_CHANGE_WAS_SUCCESSFUL_LV_OF_ENCHANT_SKILL_S1_WILL_REMAIN);
sm.addSkillName(_skillId);
player.sendPacket(sm);
}
else
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.ENCHANT_SKILL_ROUTE_CHANGE_WAS_SUCCESSFUL_LV_OF_ENCHANT_SKILL_S1_HAS_BEEN_DECREASED_BY_S2);
sm = SystemMessage.getSystemMessage(SystemMessageId.ENCHANT_SKILL_ROUTE_CHANGE_WAS_SUCCESSFUL_LV_OF_ENCHANT_SKILL_S1_HAS_BEEN_DECREASED_BY_S2);
sm.addSkillName(_skillId);
if (_skillLvl > 1000)
@ -488,8 +479,8 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
{
sm.addInt(0);
}
player.sendPacket(sm);
}
player.sendPacket(sm);
player.sendSkillList();
final int afterEnchantSkillLevel = player.getSkillLevel(_skillId);
player.sendPacket(new ExEnchantSkillInfo(_skillId, afterEnchantSkillLevel));
@ -508,20 +499,17 @@ public final class RequestExEnchantSkill extends L2GameClientPacket
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL;
}
else if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL_V2;
}
else
{
if (_elvl == 0)
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL;
}
else if (_elvl == 1)
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL_V2;
}
else
{
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL_V3;
}
reqItemId = EnchantSkillGroupsData.IMMORTAL_SCROLL_V3;
}
final int beforeEnchantSkillLevel = player.getSkillLevel(_skillId);
if (beforeEnchantSkillLevel != s.getMinSkillLevel(_skillLvl))

View File

@ -49,13 +49,13 @@ public final class RequestExPledgeCrestLarge extends L2GameClientPacket
if (i < 4)
{
final byte[] fullChunk = new byte[14336];
System.arraycopy(data, (14336 * i), fullChunk, 0, 14336);
System.arraycopy(data, 14336 * i, fullChunk, 0, 14336);
sendPacket(new ExPledgeEmblem(_crestId, fullChunk, _clanId, i));
}
else
{
final byte[] lastChunk = new byte[8320];
System.arraycopy(data, (14336 * i), lastChunk, 0, 8320);
System.arraycopy(data, 14336 * i, lastChunk, 0, 8320);
sendPacket(new ExPledgeEmblem(_crestId, lastChunk, _clanId, i));
}
}

View File

@ -85,29 +85,20 @@ public class RequestExRemoveItemAttribute extends L2GameClientPacket
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S2_S_S3_ATTRIBUTE_HAS_BEEN_REMOVED);
}
sm.addInt(targetItem.getEnchantLevel());
sm.addItemName(targetItem);
if (targetItem.isArmor())
{
sm.addElemental(realElement);
sm.addElemental(Elementals.getOppositeElement(realElement));
}
}
else if (targetItem.isArmor())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S_S2_ATTRIBUTE_WAS_REMOVED_AND_RESISTANCE_TO_S3_WAS_DECREASED);
}
else
{
if (targetItem.isArmor())
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S_S2_ATTRIBUTE_WAS_REMOVED_AND_RESISTANCE_TO_S3_WAS_DECREASED);
}
else
{
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S_S2_ATTRIBUTE_HAS_BEEN_REMOVED);
}
sm.addItemName(targetItem);
if (targetItem.isArmor())
{
sm.addElemental(realElement);
sm.addElemental(Elementals.getOppositeElement(realElement));
}
sm = SystemMessage.getSystemMessage(SystemMessageId.S1_S_S2_ATTRIBUTE_HAS_BEEN_REMOVED);
}
sm.addItemName(targetItem);
if (targetItem.isArmor())
{
sm.addElemental(realElement);
sm.addElemental(Elementals.getOppositeElement(realElement));
}
activeChar.sendPacket(sm);
activeChar.sendPacket(new ExBaseAttributeCancelResult(targetItem.getObjectId(), _element));

View File

@ -53,12 +53,9 @@ public class RequestExRqItemLink extends L2GameClientPacket
{
client.sendPacket(new ExRpItemLink((L2ItemInstance) object));
}
else
else if (Config.DEBUG)
{
if (Config.DEBUG)
{
_log.info(getClient() + " requested item link for item which wasnt published! ID:" + _objectId);
}
_log.info(getClient() + " requested item link for item which wasnt published! ID:" + _objectId);
}
}
}

View File

@ -37,7 +37,7 @@ public final class RequestItemList extends L2GameClientPacket
{
if ((getClient() != null) && (getClient().getActiveChar() != null) && !getClient().getActiveChar().isInventoryDisabled())
{
sendPacket((new ItemList(getClient().getActiveChar(), true)));
sendPacket(new ItemList(getClient().getActiveChar(), true));
}
}

View File

@ -68,7 +68,7 @@ public final class RequestJoinPledge extends L2GameClientPacket
}
final String pledgeName = activeChar.getClan().getName();
final String subPledgeName = (activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null);
final String subPledgeName = activeChar.getClan().getSubPledge(_pledgeType) != null ? activeChar.getClan().getSubPledge(_pledgeType).getName() : null;
final String askjoinName = activeChar.getName();
target.sendPacket(new AskJoinPledge(activeChar.getObjectId(), subPledgeName, _pledgeType, pledgeName, askjoinName));
}

View File

@ -119,7 +119,7 @@ public final class RequestMagicSkillUse extends L2GameClientPacket
}
// Stop if use self-buff (except if on AirShip or Boat).
if ((skill.isContinuous() && !skill.isDebuff() && (skill.getTargetType() == L2TargetType.SELF)) && (!activeChar.isInAirShip() || !activeChar.isInBoat()))
if (skill.isContinuous() && !skill.isDebuff() && (skill.getTargetType() == L2TargetType.SELF) && (!activeChar.isInAirShip() || !activeChar.isInBoat()))
{
activeChar.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, activeChar.getLocation());
}

View File

@ -86,7 +86,7 @@ public class RequestPackageSend extends L2GameClientPacket
}
final L2Npc manager = player.getLastFolkNPC();
if (((manager == null) || !player.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, false, false)))
if ((manager == null) || !player.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, false, false))
{
return;
}

View File

@ -89,7 +89,7 @@ public final class RequestPartyMatchConfig extends L2GameClientPacket
PartyMatchWaitingList.getInstance().addPlayer(_activeChar);
// Send Room list
_activeChar.sendPacket((new ListPartyWating(_activeChar, _auto, _loc, _lvl)));
_activeChar.sendPacket(new ListPartyWating(_activeChar, _auto, _loc, _lvl));
}
}

View File

@ -66,31 +66,28 @@ public final class RequestPetitionCancel extends L2GameClientPacket
activeChar.sendPacket(SystemMessageId.YOUR_PETITION_IS_BEING_PROCESSED);
}
}
else
else if (PetitionManager.getInstance().isPlayerPetitionPending(activeChar))
{
if (PetitionManager.getInstance().isPlayerPetitionPending(activeChar))
if (PetitionManager.getInstance().cancelActivePetition(activeChar))
{
if (PetitionManager.getInstance().cancelActivePetition(activeChar))
{
final int numRemaining = Config.MAX_PETITIONS_PER_PLAYER - PetitionManager.getInstance().getPlayerTotalPetitionCount(activeChar);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PETITION_WAS_CANCELED_YOU_MAY_SUBMIT_S1_MORE_PETITION_S_TODAY);
sm.addString(String.valueOf(numRemaining));
activeChar.sendPacket(sm);
// Notify all GMs that the player's pending petition has been cancelled.
AdminData.getInstance().broadcastToGMs(new CreatureSay(activeChar.getObjectId(), ChatType.HERO_VOICE, "Petition System", (activeChar.getName() + " has canceled a pending petition.")));
}
else
{
activeChar.sendPacket(SystemMessageId.FAILED_TO_CANCEL_PETITION_PLEASE_TRY_AGAIN_LATER);
}
final int numRemaining = Config.MAX_PETITIONS_PER_PLAYER - PetitionManager.getInstance().getPlayerTotalPetitionCount(activeChar);
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PETITION_WAS_CANCELED_YOU_MAY_SUBMIT_S1_MORE_PETITION_S_TODAY);
sm.addString(String.valueOf(numRemaining));
activeChar.sendPacket(sm);
// Notify all GMs that the player's pending petition has been cancelled.
AdminData.getInstance().broadcastToGMs(new CreatureSay(activeChar.getObjectId(), ChatType.HERO_VOICE, "Petition System", (activeChar.getName() + " has canceled a pending petition.")));
}
else
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_NOT_SUBMITTED_A_PETITION);
activeChar.sendPacket(SystemMessageId.FAILED_TO_CANCEL_PETITION_PLEASE_TRY_AGAIN_LATER);
}
}
else
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_NOT_SUBMITTED_A_PETITION);
}
}
@Override

View File

@ -48,7 +48,7 @@ public class RequestPledgeRecruitApplyInfo extends L2GameClientPacket
{
status = ClanEntryStatus.ORDERED;
}
else if ((activeChar.getClan() == null) && (ClanEntryManager.getInstance().isPlayerRegistred(activeChar.getObjectId())))
else if ((activeChar.getClan() == null) && ClanEntryManager.getInstance().isPlayerRegistred(activeChar.getObjectId()))
{
status = ClanEntryStatus.WAITING;
}

View File

@ -64,7 +64,7 @@ public class RequestPledgeWaitingApply extends L2GameClientPacket
return;
}
if (ClanEntryManager.getInstance().addPlayerApplicationToClan(_clanId, (new PledgeApplicantInfo(activeChar.getObjectId(), activeChar.getName(), activeChar.getLevel(), _karma, _clanId, _message))))
if (ClanEntryManager.getInstance().addPlayerApplicationToClan(_clanId, new PledgeApplicantInfo(activeChar.getObjectId(), activeChar.getName(), activeChar.getLevel(), _karma, _clanId, _message)))
{
activeChar.sendPacket(new ExPledgeRecruitApplyInfo(ClanEntryStatus.WAITING));

View File

@ -51,13 +51,13 @@ public class RequestPledgeWaitingUser extends L2GameClientPacket
final PledgeApplicantInfo infos = ClanEntryManager.getInstance().getPlayerApplication(_clanId, _playerId);
if (infos == null)
if (infos != null)
{
activeChar.sendPacket(new ExPledgeWaitingList(_clanId));
activeChar.sendPacket(new ExPledgeWaitingUser(infos));
}
else
{
activeChar.sendPacket(new ExPledgeWaitingUser(infos));
activeChar.sendPacket(new ExPledgeWaitingList(_clanId));
}
}

View File

@ -111,7 +111,7 @@ public final class RequestPrivateStoreBuy extends L2GameClientPacket
return;
}
if (!((storePlayer.getPrivateStoreType() == PrivateStoreType.SELL) || (storePlayer.getPrivateStoreType() == PrivateStoreType.PACKAGE_SELL)))
if ((storePlayer.getPrivateStoreType() != PrivateStoreType.SELL) && (storePlayer.getPrivateStoreType() != PrivateStoreType.PACKAGE_SELL))
{
return;
}

View File

@ -119,7 +119,7 @@ public class RequestProcureCropList extends L2GameClientPacket
}
final L2Item template = ItemTable.getInstance().getTemplate(i.getRewardId());
weight += (i.getCount() * template.getWeight());
weight += i.getCount() * template.getWeight();
if (!template.isStackable())
{
@ -166,7 +166,7 @@ public class RequestProcureCropList extends L2GameClientPacket
}
// Fee for selling to other manors
final long fee = (castleId == i.getManorId()) ? 0 : ((long) (i.getPrice() * 0.05));
final long fee = (castleId == i.getManorId()) ? 0 : (long) (i.getPrice() * 0.05);
if ((fee != 0) && (player.getAdena() < fee))
{
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.FAILED_IN_TRADING_S2_OF_S1_CROPS);

View File

@ -57,20 +57,14 @@ public final class RequestQuestAbort extends L2GameClientPacket
qs.exitQuest(true);
activeChar.sendPacket(new QuestList());
}
else
else if (Config.DEBUG)
{
if (Config.DEBUG)
{
_log.info("Player '" + activeChar.getName() + "' try to abort quest " + qe.getName() + " but he didn't have it started.");
}
_log.info("Player '" + activeChar.getName() + "' try to abort quest " + qe.getName() + " but he didn't have it started.");
}
}
else
else if (Config.DEBUG)
{
if (Config.DEBUG)
{
_log.warning("Quest (id='" + _questId + "') not found.");
}
_log.warning("Quest (id='" + _questId + "') not found.");
}
}

View File

@ -30,7 +30,7 @@ public final class RequestRecipeBookOpen extends L2GameClientPacket
@Override
protected void readImpl()
{
_isDwarvenCraft = (readD() == 0);
_isDwarvenCraft = readD() == 0;
if (Config.DEBUG)
{
_log.info("RequestRecipeBookOpen : " + (_isDwarvenCraft ? "dwarvenCraft" : "commonCraft"));

View File

@ -40,7 +40,7 @@ public final class RequestRecipeItemMakeInfo extends L2GameClientPacket
return;
}
sendPacket((new RecipeItemMakeInfo(_id, player)));
sendPacket(new RecipeItemMakeInfo(_id, player));
}
@Override

View File

@ -38,7 +38,7 @@ public final class RequestRecipeShopManagePrev extends L2GameClientPacket
protected void runImpl()
{
final L2PcInstance player = getActiveChar();
if ((player == null))
if (player == null)
{
return;
}

View File

@ -49,15 +49,12 @@ public class RequestRecordInfo extends L2GameClientPacket
{
activeChar.sendPacket(new SpawnItem(object));
}
else
else if (!object.isVisibleFor(activeChar))
{
if (!object.isVisibleFor(activeChar))
object.sendInfo(activeChar);
if ((object instanceof L2Character) && (((L2Character) object).getAI() != null))
{
object.sendInfo(activeChar);
if ((object instanceof L2Character) && (((L2Character) object).getAI() != null))
{
((L2Character) object).getAI().describeStateToPlayer(activeChar);
}
((L2Character) object).getAI().describeStateToPlayer(activeChar);
}
}
}

View File

@ -87,7 +87,7 @@ public final class RequestRefundItem extends L2GameClientPacket
L2Character merchant = null;
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
{
if (!(target instanceof L2MerchantInstance) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
if (!(target instanceof L2MerchantInstance) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != target.getInstanceId()))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;

View File

@ -100,7 +100,7 @@ public class RequestRegistBeauty extends L2GameClientPacket
requiredBeautyShopTicket += face.getBeautyShopTicket();
}
if ((player.getAdena() < requiredAdena) || ((player.getBeautyTickets() < requiredBeautyShopTicket)))
if ((player.getAdena() < requiredAdena) || (player.getBeautyTickets() < requiredBeautyShopTicket))
{
player.sendPacket(new ExResponseBeautyRegistReset(player, ExResponseBeautyRegistReset.CHANGE, ExResponseBeautyRegistReset.FAILURE));
player.sendPacket(new ExResponseBeautyList(player, ExResponseBeautyList.SHOW_FACESHAPE));

View File

@ -75,7 +75,7 @@ public final class RequestRestart extends L2GameClientPacket
return;
}
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) && !(player.isGM() && Config.GM_RESTART_FIGHTING))
if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player) && (!player.isGM() || !Config.GM_RESTART_FIGHTING))
{
if (Config.DEBUG)
{

View File

@ -198,7 +198,7 @@ public final class RequestRestartPoint extends L2GameClientPacket
{
siegeClan = hall.getSiege().getAttackerClan(activeChar.getClan());
}
if (((siegeClan == null) || siegeClan.getFlag().isEmpty()))
if ((siegeClan == null) || siegeClan.getFlag().isEmpty())
{
// Check if clan hall has inner spawns loc
if (hall != null)

View File

@ -112,7 +112,7 @@ public final class RequestSellItem extends L2GameClientPacket
L2Character merchant = null;
if (!player.isGM() && (_listId != CUSTOM_CB_SELL_LIST))
{
if ((target == null) || (!player.isInsideRadius(target, INTERACTION_DISTANCE, true, false)) || (player.getInstanceId() != target.getInstanceId()))
if ((target == null) || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false) || (player.getInstanceId() != target.getInstanceId()))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@ -152,7 +152,7 @@ public final class RequestSellItem extends L2GameClientPacket
for (UniqueItemHolder i : _items)
{
L2ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
if ((item == null) || (!item.isSellable()))
if ((item == null) || !item.isSellable())
{
continue;
}

View File

@ -56,7 +56,7 @@ public final class RequestSetPledgeCrest extends L2GameClientPacket
return;
}
if ((_length < 0))
if (_length < 0)
{
activeChar.sendPacket(SystemMessageId.THE_SIZE_OF_THE_UPLOADED_SYMBOL_DOES_NOT_MEET_THE_STANDARD_REQUIREMENTS);
return;

View File

@ -48,13 +48,13 @@ public final class RequestVoteNew extends L2GameClientPacket
if (!(object instanceof L2PcInstance))
{
if (object == null)
if (object != null)
{
activeChar.sendPacket(SystemMessageId.SELECT_TARGET);
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
}
else
{
activeChar.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
activeChar.sendPacket(SystemMessageId.SELECT_TARGET);
}
return;
}

View File

@ -73,7 +73,7 @@ public final class RequestWithDrawPremiumItem extends L2GameClientPacket
return;
}
final long itemsLeft = (_item.getCount() - _itemCount);
final long itemsLeft = _item.getCount() - _itemCount;
activeChar.addItem("PremiumItem", _item.getItemId(), _itemCount, activeChar.getTarget(), true);

View File

@ -56,7 +56,7 @@ public final class RequestWithdrawPartyRoom extends L2GameClientPacket
return;
}
if ((_activeChar.isInParty() && _room.getOwner().isInParty()) && (_activeChar.getParty().getLeaderObjectId() == _room.getOwner().getParty().getLeaderObjectId()))
if (_activeChar.isInParty() && _room.getOwner().isInParty() && (_activeChar.getParty().getLeaderObjectId() == _room.getOwner().getParty().getLeaderObjectId()))
{
// If user is in party with Room Owner
// is not removed from Room

View File

@ -154,12 +154,9 @@ public final class Say2 extends L2GameClientPacket
{
activeChar.sendPacket(SystemMessageId.YOU_HAVE_BEEN_REPORTED_AS_AN_ILLEGAL_PROGRAM_USER_SO_CHATTING_IS_NOT_ALLOWED);
}
else
else if (Config.BAN_CHAT_CHANNELS.contains(chatType))
{
if (Config.BAN_CHAT_CHANNELS.contains(chatType))
{
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
}
activeChar.sendPacket(SystemMessageId.CHATTING_IS_CURRENTLY_PROHIBITED_IF_YOU_TRY_TO_CHAT_BEFORE_THE_PROHIBITION_IS_REMOVED_THE_PROHIBITION_TIME_WILL_INCREASE_EVEN_FURTHER);
}
return;
}

View File

@ -79,7 +79,7 @@ public final class SendBypassBuildCmd extends L2GameClientPacket
if (Config.GMAUDIT)
{
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"));
GMAudit.auditGMAction(activeChar.getName() + " [" + activeChar.getObjectId() + "]", _command, activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target");
}
ach.useAdminCommand("admin_" + _command, activeChar);

View File

@ -117,13 +117,10 @@ public final class SendWareHouseWithDrawList extends L2GameClientPacket
return;
}
}
else
else if ((warehouse instanceof ClanWarehouse) && !player.isClanLeader())
{
if ((warehouse instanceof ClanWarehouse) && !player.isClanLeader())
{
player.sendPacket(SystemMessageId.ITEMS_LEFT_AT_THE_CLAN_HALL_WAREHOUSE_CAN_ONLY_BE_RETRIEVED_BY_THE_CLAN_LEADER_DO_YOU_WANT_TO_CONTINUE);
return;
}
player.sendPacket(SystemMessageId.ITEMS_LEFT_AT_THE_CLAN_HALL_WAREHOUSE_CAN_ONLY_BE_RETRIEVED_BY_THE_CLAN_LEADER_DO_YOU_WANT_TO_CONTINUE);
return;
}
int weight = 0;

View File

@ -47,7 +47,7 @@ public class SetPrivateStoreListSell extends L2GameClientPacket
@Override
protected void readImpl()
{
_packageSale = (readD() == 1);
_packageSale = readD() == 1;
final int count = readD();
if ((count < 1) || (count > Config.MAX_ITEM_IN_PACKET) || ((count * BATCH_LENGTH) != _buf.remaining()))
{

View File

@ -75,7 +75,7 @@ public final class TradeDone extends L2GameClientPacket
return;
}
if ((trade.getOwner().hasItemRequest()) || (trade.getPartner().hasItemRequest()))
if (trade.getOwner().hasItemRequest() || trade.getPartner().hasItemRequest())
{
return;
}

View File

@ -251,7 +251,7 @@ public final class UseItem extends L2GameClientPacket
case L2Item.SLOT_FULL_ARMOR:
case L2Item.SLOT_LEGS:
{
if ((activeChar.getRace() == Race.ERTHEIA) && (activeChar.isMageClass()) && ((item.getItem().getItemType() == ArmorType.SHIELD) || (item.getItem().getItemType() == ArmorType.SIGIL)))
if ((activeChar.getRace() == Race.ERTHEIA) && activeChar.isMageClass() && ((item.getItem().getItemType() == ArmorType.SHIELD) || (item.getItem().getItemType() == ArmorType.SIGIL)))
{
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
return;
@ -296,7 +296,7 @@ public final class UseItem extends L2GameClientPacket
else
{
final L2Weapon weaponItem = activeChar.getActiveWeaponItem();
if (((weaponItem != null) && (weaponItem.getItemType() == WeaponType.FISHINGROD)) && (((_itemId >= 6519) && (_itemId <= 6527)) || ((_itemId >= 7610) && (_itemId <= 7613)) || ((_itemId >= 7807) && (_itemId <= 7809)) || ((_itemId >= 8484) && (_itemId <= 8486)) || ((_itemId >= 8505) && (_itemId <= 8513))))
if ((weaponItem != null) && (weaponItem.getItemType() == WeaponType.FISHINGROD) && (((_itemId >= 6519) && (_itemId <= 6527)) || ((_itemId >= 7610) && (_itemId <= 7613)) || ((_itemId >= 7807) && (_itemId <= 7809)) || ((_itemId >= 8484) && (_itemId <= 8486)) || ((_itemId >= 8505) && (_itemId <= 8513))))
{
activeChar.getInventory().setPaperdollItem(Inventory.PAPERDOLL_LHAND, item);
activeChar.broadcastUserInfo();

View File

@ -81,7 +81,7 @@ public class ValidatePosition extends L2GameClientPacket
dx = _x - activeChar.getInVehiclePosition().getX();
dy = _y - activeChar.getInVehiclePosition().getY();
// dz = _z - activeChar.getInVehiclePosition().getZ();
diffSq = ((dx * dx) + (dy * dy));
diffSq = (dx * dx) + (dy * dy);
if (diffSq > 250000)
{
sendPacket(new GetOnVehicle(activeChar.getObjectId(), _data, activeChar.getInVehiclePosition()));
@ -98,7 +98,7 @@ public class ValidatePosition extends L2GameClientPacket
dx = _x - realX;
dy = _y - realY;
dz = _z - realZ;
diffSq = ((dx * dx) + (dy * dy));
diffSq = (dx * dx) + (dy * dy);
// Zoey76: TODO: Implement or cleanup.
// L2Party party = activeChar.getParty();

View File

@ -125,7 +125,7 @@ public class RequestDivideAdena extends L2GameClientPacket
{
for (L2PcInstance target : targets)
{
if ((target == null))
if (target == null)
{
// TODO : handle that case here + regive adena OR filter with Objects::nonNull on memberCount ?
// those sys msg exists and bother me ADENA_WAS_NOT_DISTRIBUTED_TO_S1 / YOU_DID_NOT_RECEIVE_ADENA_DISTRIBUTION

View File

@ -28,8 +28,8 @@ import com.l2jmobius.gameserver.network.serverpackets.alchemy.ExTryMixCube;
public class RequestAlchemyTryMixCube extends L2GameClientPacket
{
private final static int AIR_STONE = 39461;
private final static int ELCYUM_CRYSTAL = 36514;
private static final int AIR_STONE = 39461;
private static final int ELCYUM_CRYSTAL = 36514;
private final Map<Integer, Long> _items = new HashMap<>();
public RequestAlchemyTryMixCube()

View File

@ -262,24 +262,24 @@ public class RequestShapeShiftingItem extends L2GameClientPacket
final InventoryUpdate iu = new InventoryUpdate();
iu.addModifiedItem(targetItem);
if (inventory.getItemByObjectId(stone.getObjectId()) == null)
if (inventory.getItemByObjectId(stone.getObjectId()) != null)
{
iu.addRemovedItem(stone);
iu.addModifiedItem(stone);
}
else
{
iu.addModifiedItem(stone);
iu.addRemovedItem(stone);
}
if (appearanceStone.getType() == AppearanceType.NORMAL)
{
if (inventory.getItemByObjectId(extracItem.getObjectId()) == null)
if (inventory.getItemByObjectId(extracItem.getObjectId()) != null)
{
iu.addRemovedItem(extracItem);
iu.addModifiedItem(extracItem);
}
else
{
iu.addModifiedItem(extracItem);
iu.addRemovedItem(extracItem);
}
}

View File

@ -132,7 +132,7 @@ public class RequestItemEnsoul extends L2GameClientPacket
activeChar.sendPacket(new ExUserInfoInvenWeight(activeChar));
}
private static final boolean checkAndConsume(L2PcInstance activeChar, L2ItemInstance soulcrystal, L2ItemInstance targetItem, boolean changing, boolean special)
private static boolean checkAndConsume(L2PcInstance activeChar, L2ItemInstance soulcrystal, L2ItemInstance targetItem, boolean changing, boolean special)
{
final CrystalType targetItemGrade = targetItem.getItem().getCrystalType();
final int gemstoneId = getGemStoneId(targetItemGrade);
@ -166,7 +166,7 @@ public class RequestItemEnsoul extends L2GameClientPacket
return true;
}
private static final long getGemstoneCount(CrystalType itemGrade, boolean price2x, boolean changing, boolean special)
private static long getGemstoneCount(CrystalType itemGrade, boolean price2x, boolean changing, boolean special)
{
switch (itemGrade)
{
@ -210,7 +210,7 @@ public class RequestItemEnsoul extends L2GameClientPacket
}
}
private static final int getGemStoneId(CrystalType itemGrade)
private static int getGemStoneId(CrystalType itemGrade)
{
switch (itemGrade)
{

View File

@ -69,32 +69,29 @@ public class ConfirmMenteeAdd extends L2GameClientPacket
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_DECLINED_S1_S_MENTORING_OFFER).addCharName(mentor));
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.S1_HAS_DECLINED_BECOMING_YOUR_MENTEE).addCharName(mentee));
}
else
else if (validate(mentor, mentee))
{
if (validate(mentor, mentee))
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
try (Connection con = DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
statement.setInt(2, mentor.getObjectId());
statement.execute();
MentorManager.getInstance().addMentor(mentor.getObjectId(), mentee.getObjectId());
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerMenteeAdd(mentor, mentee), mentor);
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTEE).addCharName(mentee));
mentor.sendPacket(new ExMentorList(mentor));
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTOR).addCharName(mentor));
mentee.sendPacket(new ExMentorList(mentee));
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
statement.setInt(1, mentee.getObjectId());
statement.setInt(2, mentor.getObjectId());
statement.execute();
MentorManager.getInstance().addMentor(mentor.getObjectId(), mentee.getObjectId());
// Notify to scripts
EventDispatcher.getInstance().notifyEventAsync(new OnPlayerMenteeAdd(mentor, mentee), mentor);
mentor.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTEE).addCharName(mentee));
mentor.sendPacket(new ExMentorList(mentor));
mentee.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.FROM_NOW_ON_S1_WILL_BE_YOUR_MENTOR).addCharName(mentor));
mentee.sendPacket(new ExMentorList(mentee));
}
catch (Exception e)
{
_log.log(Level.WARNING, e.getMessage(), e);
}
}
}

View File

@ -68,7 +68,7 @@ public final class RequestBRBuyProduct extends L2GameClientPacket
final PrimeShopGroup item = PrimeShopData.getInstance().getItem(_brId);
if (validatePlayer(item, _count, activeChar))
{
final int price = (item.getPrice() * _count);
final int price = item.getPrice() * _count;
final int paymentId = validatePaymentId(activeChar, item, price);
if (paymentId < 0)

View File

@ -53,7 +53,7 @@ public class RequestShuttleGetOn extends L2GameClientPacket
// TODO: better way?
for (L2Object obj : activeChar.getKnownList().getKnownObjects().values())
{
if ((obj instanceof L2ShuttleInstance))
if (obj instanceof L2ShuttleInstance)
{
final L2ShuttleInstance shuttle = (L2ShuttleInstance) obj;
if (shuttle.calculateDistance(activeChar, false, false) < 1000)