Sync with L2jServer HighFive Mar 25th 2015.
This commit is contained in:
@ -101,7 +101,7 @@ public class Debug
|
||||
|
||||
private static String getBodyPart(int bodyPart)
|
||||
{
|
||||
for (Entry<String, Integer> entry : ItemTable._slots.entrySet())
|
||||
for (Entry<String, Integer> entry : ItemTable.SLOTS.entrySet())
|
||||
{
|
||||
if ((entry.getValue() & bodyPart) == bodyPart)
|
||||
{
|
||||
|
@ -24,6 +24,7 @@ import java.nio.ByteBuffer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.RejectedExecutionException;
|
||||
@ -97,7 +98,7 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
|
||||
private boolean _isAuthedGG;
|
||||
private final long _connectionStartTime;
|
||||
private CharSelectInfoPackage[] _charSlotMapping = null;
|
||||
private List<CharSelectInfoPackage> _charSlotMapping = null;
|
||||
|
||||
// flood protectors
|
||||
private final FloodProtectors _floodProtectors = new FloodProtectors(this);
|
||||
@ -626,20 +627,20 @@ public final class L2GameClient extends MMOClient<MMOConnection<L2GameClient>> i
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chars
|
||||
* @param list
|
||||
*/
|
||||
public void setCharSelection(CharSelectInfoPackage[] chars)
|
||||
public void setCharSelection(List<CharSelectInfoPackage> list)
|
||||
{
|
||||
_charSlotMapping = chars;
|
||||
_charSlotMapping = list;
|
||||
}
|
||||
|
||||
public CharSelectInfoPackage getCharSelection(int charslot)
|
||||
{
|
||||
if ((_charSlotMapping == null) || (charslot < 0) || (charslot >= _charSlotMapping.length))
|
||||
if ((_charSlotMapping == null) || (charslot < 0) || (charslot >= _charSlotMapping.size()))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _charSlotMapping[charslot];
|
||||
return _charSlotMapping.get(charslot);
|
||||
}
|
||||
|
||||
public SecondaryPasswordAuth getSecondaryAuth()
|
||||
|
@ -228,244 +228,236 @@ public class MultiSellChoose extends L2GameClientPacket
|
||||
ArrayList<L2Augmentation> augmentation = new ArrayList<>();
|
||||
Elementals[] elemental = null;
|
||||
/** All ok, remove items and add final product */
|
||||
|
||||
try
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
{
|
||||
for (Ingredient e : entry.getIngredients())
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
if (e.getItemId() < 0)
|
||||
if (!MultisellData.takeSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
if (!MultisellData.takeSpecialIngredient(e.getItemId(), e.getItemCount() * _amount, player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
L2ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); // initialize and initial guess for the item to take.
|
||||
if (itemToTake == null)
|
||||
{ // this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
_log.severe("Character: " + player.getName() + " is trying to cheat in multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (itemToTake.isEquipped())
|
||||
// {
|
||||
// this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
// _log.severe("Character: " + player.getName() + " is trying to cheat in multisell, exchanging equipped item, merchatnt id:" + merchant.getNpcId());
|
||||
// player.setMultiSell(null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient())
|
||||
{
|
||||
L2ItemInstance itemToTake = inv.getItemByItemId(e.getItemId()); // initialize and initial guess for the item to take.
|
||||
if (itemToTake == null)
|
||||
{ // this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
_log.severe("Character: " + player.getName() + " is trying to cheat in multisell, id:" + _listId + ":" + _entryId);
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// if (itemToTake.isEquipped())
|
||||
// {
|
||||
// this is a cheat, transaction will be aborted and if any items already taken will not be returned back to inventory!
|
||||
// _log.severe("Character: " + player.getName() + " is trying to cheat in multisell, exchanging equipped item, merchatnt id:" + merchant.getNpcId());
|
||||
// player.setMultiSell(null);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (Config.ALT_BLACKSMITH_USE_RECIPES || !e.getMaintainIngredient())
|
||||
// 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 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
|
||||
{
|
||||
// for non-stackable items, one of two scenaria 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.
|
||||
L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
player.setMultiSell(null);
|
||||
return;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
// b) enchantment is not maintained. Get the instances with the LOWEST enchantment level
|
||||
{
|
||||
// for non-stackable items, one of two scenaria 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
|
||||
// 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").
|
||||
//
|
||||
|
||||
// a) if enchantment is maintained, then get a list of items that exactly match this enchantment
|
||||
if (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0))
|
||||
// choice 1. Small number of items exchanged. No sorting.
|
||||
for (int i = 1; i <= (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
// loop through this list and remove (one by one) each item until the required amount is taken.
|
||||
L2ItemInstance[] inventoryContents = inv.getAllItemsByItemId(e.getItemId(), e.getEnchantLevel(), false);
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
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").
|
||||
//
|
||||
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)
|
||||
{
|
||||
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())
|
||||
{
|
||||
if (item.getEnchantLevel() < itemToTake.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final double itemRandom = 100 * Rnd.nextDouble();
|
||||
float cumulativeChance = 0;
|
||||
|
||||
boolean matched = false;
|
||||
// Generate the appropriate items
|
||||
for (Ingredient e : entry.getProducts())
|
||||
}
|
||||
|
||||
final double itemRandom = 100 * Rnd.nextDouble();
|
||||
float cumulativeChance = 0;
|
||||
|
||||
boolean matched = false;
|
||||
// Generate the appropriate items
|
||||
for (Ingredient e : entry.getProducts())
|
||||
{
|
||||
if (list.isNewMultisell())
|
||||
{
|
||||
if (list.isNewMultisell())
|
||||
// Skip first entry.
|
||||
if (e.getChance() < 1)
|
||||
{
|
||||
// Skip first entry.
|
||||
if (e.getChance() < 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Calculate chance
|
||||
matched = (itemRandom < (cumulativeChance += e.getChance()));
|
||||
if (!matched)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (e.getItemId() < 0)
|
||||
// Calculate chance
|
||||
matched = (itemRandom < (cumulativeChance += e.getChance()));
|
||||
if (!matched)
|
||||
{
|
||||
MultisellData.giveSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.getItemId() < 0)
|
||||
{
|
||||
MultisellData.giveSpecialProduct(e.getItemId(), e.getItemCount() * _amount, player);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.isStackable())
|
||||
{
|
||||
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.isStackable())
|
||||
L2ItemInstance product = null;
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
{
|
||||
inv.addItem("Multisell", e.getItemId(), e.getItemCount() * _amount, player, player.getTarget());
|
||||
}
|
||||
else
|
||||
{
|
||||
L2ItemInstance product = null;
|
||||
for (int i = 0; i < (e.getItemCount() * _amount); i++)
|
||||
product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
||||
if ((product != null) && (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)))
|
||||
{
|
||||
product = inv.addItem("Multisell", e.getItemId(), 1, player, player.getTarget());
|
||||
if ((product != null) && (list.getMaintainEnchantment() || (e.getEnchantLevel() > 0)))
|
||||
if (i < augmentation.size())
|
||||
{
|
||||
if (i < augmentation.size())
|
||||
{
|
||||
product.setAugmentation(new L2Augmentation(augmentation.get(i).getAugmentationId()));
|
||||
}
|
||||
if (elemental != null)
|
||||
{
|
||||
for (Elementals elm : elemental)
|
||||
{
|
||||
product.setElementAttr(elm.getElement(), elm.getValue());
|
||||
}
|
||||
}
|
||||
product.setEnchantLevel(e.getEnchantLevel());
|
||||
product.updateDatabase();
|
||||
product.setAugmentation(new L2Augmentation(augmentation.get(i).getAugmentationId()));
|
||||
}
|
||||
if (elemental != null)
|
||||
{
|
||||
for (Elementals elm : elemental)
|
||||
{
|
||||
product.setElementAttr(elm.getElement(), elm.getValue());
|
||||
}
|
||||
}
|
||||
product.setEnchantLevel(e.getEnchantLevel());
|
||||
product.updateDatabase();
|
||||
}
|
||||
}
|
||||
// msg part
|
||||
SystemMessage sm;
|
||||
|
||||
if ((e.getItemCount() * _amount) > 1)
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
sm.addItemName(e.getItemId());
|
||||
sm.addLong(e.getItemCount() * _amount);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (list.getMaintainEnchantment() && (e.getEnchantLevel() > 0))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
|
||||
sm.addLong(e.getEnchantLevel());
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
// msg part
|
||||
SystemMessage sm;
|
||||
|
||||
if (matched)
|
||||
if ((e.getItemCount() * _amount) > 1)
|
||||
{
|
||||
break;
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S);
|
||||
sm.addItemName(e.getItemId());
|
||||
sm.addLong(e.getItemCount() * _amount);
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (list.getMaintainEnchantment() && (e.getEnchantLevel() > 0))
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.ACQUIRED_S1_S2);
|
||||
sm.addLong(e.getEnchantLevel());
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
else
|
||||
{
|
||||
sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1);
|
||||
sm.addItemName(e.getItemId());
|
||||
}
|
||||
player.sendPacket(sm);
|
||||
}
|
||||
}
|
||||
player.sendPacket(new ItemList(player, false));
|
||||
player.sendPacket(new ExUserInfoInvenWeight(player));
|
||||
}
|
||||
finally
|
||||
{
|
||||
augmentation.clear();
|
||||
|
||||
if (matched)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
player.sendPacket(new ItemList(player, false));
|
||||
player.sendPacket(new ExUserInfoInvenWeight(player));
|
||||
|
||||
// finally, give the tax to the castle...
|
||||
if ((npc != null) && (entry.getTaxAmount() > 0))
|
||||
|
@ -21,6 +21,7 @@ package com.l2jserver.gameserver.network.clientpackets;
|
||||
import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.data.sql.impl.OfflineTradersTable;
|
||||
@ -33,10 +34,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
||||
import com.l2jserver.gameserver.util.Util;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.2.2.1.2.5 $ $Date: 2005/03/27 15:29:30 $
|
||||
*/
|
||||
public final class RequestPrivateStoreBuy extends L2GameClientPacket
|
||||
{
|
||||
private static final String _C__83_REQUESTPRIVATESTOREBUY = "[C] 83 RequestPrivateStoreBuy";
|
||||
@ -44,7 +41,7 @@ public final class RequestPrivateStoreBuy extends L2GameClientPacket
|
||||
private static final int BATCH_LENGTH = 20; // length of the one item
|
||||
|
||||
private int _storePlayerId;
|
||||
private HashSet<ItemRequest> _items = null;
|
||||
private Set<ItemRequest> _items = null;
|
||||
|
||||
@Override
|
||||
protected void readImpl()
|
||||
|
@ -42,7 +42,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
private final String _loginName;
|
||||
private final int _sessionId;
|
||||
private int _activeId;
|
||||
private final CharSelectInfoPackage[] _characterPackages;
|
||||
private final List<CharSelectInfoPackage> _characterPackages;
|
||||
|
||||
/**
|
||||
* Constructor for CharSelectionInfo.
|
||||
@ -65,7 +65,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
_activeId = activeId;
|
||||
}
|
||||
|
||||
public CharSelectInfoPackage[] getCharInfo()
|
||||
public List<CharSelectInfoPackage> getCharInfo()
|
||||
{
|
||||
return _characterPackages;
|
||||
}
|
||||
@ -74,7 +74,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
protected final void writeImpl()
|
||||
{
|
||||
writeC(0x09); // packet id
|
||||
int size = _characterPackages.length;
|
||||
int size = (_characterPackages.size());
|
||||
writeD(size); // How many char there is on this account
|
||||
|
||||
// Can prevent players from creating new characters (if 0); (if 1, the client will ask if chars may be created (0x13) Response: (0x0D) )
|
||||
@ -89,9 +89,10 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
{
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
if (lastAccess < _characterPackages[i].getLastAccess())
|
||||
final CharSelectInfoPackage charInfoPackage = _characterPackages.get(i);
|
||||
if (lastAccess < charInfoPackage.getLastAccess())
|
||||
{
|
||||
lastAccess = _characterPackages[i].getLastAccess();
|
||||
lastAccess = charInfoPackage.getLastAccess();
|
||||
_activeId = i;
|
||||
}
|
||||
}
|
||||
@ -99,7 +100,7 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
|
||||
for (int i = 0; i < size; i++)
|
||||
{
|
||||
CharSelectInfoPackage charInfoPackage = _characterPackages[i];
|
||||
final CharSelectInfoPackage charInfoPackage = _characterPackages.get(i);
|
||||
|
||||
writeS(charInfoPackage.getName()); // char name
|
||||
writeD(charInfoPackage.getObjectId()); // char id
|
||||
@ -197,11 +198,9 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
}
|
||||
}
|
||||
|
||||
private static CharSelectInfoPackage[] loadCharacterSelectInfo(String loginName)
|
||||
private static List<CharSelectInfoPackage> loadCharacterSelectInfo(String loginName)
|
||||
{
|
||||
CharSelectInfoPackage charInfopackage;
|
||||
List<CharSelectInfoPackage> characterList = new ArrayList<>();
|
||||
|
||||
final List<CharSelectInfoPackage> characterList = new ArrayList<>();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
|
||||
{
|
||||
@ -210,20 +209,19 @@ public class CharSelectionInfo extends L2GameServerPacket
|
||||
{
|
||||
while (charList.next())// fills the package
|
||||
{
|
||||
charInfopackage = restoreChar(charList);
|
||||
CharSelectInfoPackage charInfopackage = restoreChar(charList);
|
||||
if (charInfopackage != null)
|
||||
{
|
||||
characterList.add(charInfopackage);
|
||||
}
|
||||
}
|
||||
}
|
||||
return characterList.toArray(new CharSelectInfoPackage[characterList.size()]);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, "Could not restore char info: " + e.getMessage(), e);
|
||||
}
|
||||
return new CharSelectInfoPackage[0];
|
||||
return characterList;
|
||||
}
|
||||
|
||||
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
|
||||
|
@ -19,6 +19,7 @@
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.impl.EnchantSkillGroupsData;
|
||||
import com.l2jserver.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder;
|
||||
@ -26,7 +27,7 @@ import com.l2jserver.gameserver.model.L2EnchantSkillLearn;
|
||||
|
||||
public final class ExEnchantSkillInfo extends L2GameServerPacket
|
||||
{
|
||||
private final ArrayList<Integer> _routes; // skill lvls for each route
|
||||
private final List<Integer> _routes = new ArrayList<>(); // skill lvls for each route
|
||||
|
||||
private final int _id;
|
||||
private final int _lvl;
|
||||
@ -34,7 +35,6 @@ public final class ExEnchantSkillInfo extends L2GameServerPacket
|
||||
|
||||
public ExEnchantSkillInfo(int id, int lvl)
|
||||
{
|
||||
_routes = new ArrayList<>();
|
||||
_id = id;
|
||||
_lvl = lvl;
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2PremiumItem;
|
||||
@ -31,12 +30,9 @@ public class ExGetPremiumItemList extends L2GameServerPacket
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
|
||||
private final Map<Integer, L2PremiumItem> _map;
|
||||
|
||||
public ExGetPremiumItemList(L2PcInstance activeChar)
|
||||
{
|
||||
_activeChar = activeChar;
|
||||
_map = _activeChar.getPremiumItemList();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -44,8 +40,8 @@ public class ExGetPremiumItemList extends L2GameServerPacket
|
||||
{
|
||||
writeC(0xFE);
|
||||
writeH(0x87);
|
||||
writeD(_map.size());
|
||||
for (Entry<Integer, L2PremiumItem> entry : _map.entrySet())
|
||||
writeD(_activeChar.getPremiumItemList().size());
|
||||
for (Entry<Integer, L2PremiumItem> entry : _activeChar.getPremiumItemList().entrySet())
|
||||
{
|
||||
L2PremiumItem item = entry.getValue();
|
||||
writeQ(entry.getKey());
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.FortSiegeManager;
|
||||
import com.l2jserver.gameserver.model.FortSiegeSpawn;
|
||||
@ -47,7 +47,7 @@ public class ExShowFortressMapInfo extends L2GameServerPacket
|
||||
writeD(_fortress.getSiege().isInProgress() ? 1 : 0); // fortress siege status
|
||||
writeD(_fortress.getFortSize()); // barracks count
|
||||
|
||||
ArrayList<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(_fortress.getResidenceId());
|
||||
List<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(_fortress.getResidenceId());
|
||||
if ((commanders != null) && (commanders.size() != 0) && _fortress.getSiege().isInProgress())
|
||||
{
|
||||
switch (commanders.size())
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.instancemanager.FortSiegeManager;
|
||||
import com.l2jserver.gameserver.model.FortSiegeSpawn;
|
||||
@ -41,7 +41,7 @@ public class ExShowFortressSiegeInfo extends L2GameServerPacket
|
||||
{
|
||||
_fortId = fort.getResidenceId();
|
||||
_size = fort.getFortSize();
|
||||
ArrayList<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(_fortId);
|
||||
List<FortSiegeSpawn> commanders = FortSiegeManager.getInstance().getCommanderSpawnList(_fortId);
|
||||
_csize = ((commanders == null) ? 0 : commanders.size());
|
||||
_csize2 = fort.getSiege().getCommanders().size();
|
||||
}
|
||||
|
@ -18,6 +18,8 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
|
||||
@ -27,7 +29,7 @@ import com.l2jserver.gameserver.model.skills.Skill;
|
||||
public class PledgeSkillList extends L2GameServerPacket
|
||||
{
|
||||
private final Skill[] _skills;
|
||||
private final SubPledgeSkill[] _subSkills;
|
||||
private final List<SubPledgeSkill> _subSkills;
|
||||
|
||||
public static class SubPledgeSkill
|
||||
{
|
||||
@ -56,7 +58,7 @@ public class PledgeSkillList extends L2GameServerPacket
|
||||
writeC(0xfE);
|
||||
writeH(0x3A);
|
||||
writeD(_skills.length);
|
||||
writeD(_subSkills.length); // Squad skill length
|
||||
writeD(_subSkills.size()); // Squad skill length
|
||||
for (Skill sk : _skills)
|
||||
{
|
||||
writeD(sk.getDisplayId());
|
||||
|
@ -18,18 +18,16 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.l2jserver.gameserver.model.TradeItem;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.7.2.2.2.3 $ $Date: 2005/03/27 15:29:39 $
|
||||
*/
|
||||
public class PrivateStoreListBuy extends AbstractItemPacket
|
||||
{
|
||||
private final int _objId;
|
||||
private final long _playerAdena;
|
||||
private final TradeItem[] _items;
|
||||
private final List<TradeItem> _items;
|
||||
|
||||
public PrivateStoreListBuy(L2PcInstance player, L2PcInstance storePlayer)
|
||||
{
|
||||
@ -46,7 +44,7 @@ public class PrivateStoreListBuy extends AbstractItemPacket
|
||||
writeD(_objId);
|
||||
writeQ(_playerAdena);
|
||||
writeD(0x00); // unk
|
||||
writeD(_items.length);
|
||||
writeD(_items.size());
|
||||
|
||||
for (TradeItem item : _items)
|
||||
{
|
||||
|
@ -112,7 +112,6 @@ public final class RelationChanged extends L2GameServerPacket
|
||||
{
|
||||
writeRelation(r);
|
||||
}
|
||||
// _multi.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,10 +26,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
|
||||
/**
|
||||
* This class ...
|
||||
* @version $Revision: 1.4.2.3.2.4 $ $Date: 2005/03/27 15:29:39 $
|
||||
*/
|
||||
public class SellList extends L2GameServerPacket
|
||||
{
|
||||
private final L2PcInstance _activeChar;
|
||||
|
Reference in New Issue
Block a user