瀏覽代碼

logging stuff

janiii 15 年之前
父節點
當前提交
a45b872b6c

+ 72 - 81
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestBuyItem.java

@@ -14,6 +14,9 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
+import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
+import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
+
 import java.util.List;
 import java.util.logging.Logger;
 
@@ -35,37 +38,29 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.item.L2Item;
 import com.l2jserver.gameserver.util.Util;
 
-
-import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
-import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
-
 /**
- * This class ...
- *
- * @version $Revision: 1.12.4.4 $ $Date: 2005/03/27 15:29:30 $
+ * RequestBuyItem client packet class.
  */
 public final class RequestBuyItem extends L2GameClientPacket
 {
 	private static final String _C__1F_REQUESTBUYITEM = "[C] 1F RequestBuyItem";
 	private static Logger _log = Logger.getLogger(RequestBuyItem.class.getName());
-
+	
 	private static final int BATCH_LENGTH = 12; // length of the one item
-
+	
 	private int _listId;
 	private Item[] _items = null;
-
+	
 	@Override
 	protected void readImpl()
 	{
 		_listId = readD();
 		int count = readD();
-		if(count <= 0
-				|| count > Config.MAX_ITEM_IN_PACKET
-				|| count * BATCH_LENGTH != _buf.remaining())
+		if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
 		{
 			return;
 		}
-
+		
 		_items = new Item[count];
 		for (int i = 0; i < count; i++)
 		{
@@ -79,79 +74,75 @@ public final class RequestBuyItem extends L2GameClientPacket
 			_items[i] = new Item(itemId, cnt);
 		}
 	}
-
+	
 	@Override
 	protected void runImpl()
 	{
 		L2PcInstance player = getClient().getActiveChar();
 		if (player == null)
 			return;
-
+		
 		if (!player.getFloodProtectors().getTransaction().tryPerformAction("buy"))
 		{
 			player.sendMessage("You buying too fast.");
 			return;
 		}
-
-		if(_items == null)
+		
+		if (_items == null)
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		// Alt game - Karma punishment
 		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Object target = player.getTarget();
 		if (!player.isGM() && (target == null // No target (ie GM Shop)
-				|| !(target instanceof L2MerchantInstance
-						|| target instanceof L2MerchantSummonInstance)
-				|| player.getInstanceId() != target.getInstanceId()
-				|| !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
+				|| !(target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance) || player.getInstanceId() != target.getInstanceId() || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Character merchant = null;
-		if (target instanceof L2MerchantInstance
-				|| target instanceof L2MerchantSummonInstance)
+		if (target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance)
 			merchant = (L2Character) target;
 		else if (!player.isGM())
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2TradeList list = null;
-
+		
 		double castleTaxRate = 0;
 		double baseTaxRate = 0;
-
+		
 		if (merchant != null)
 		{
 			List<L2TradeList> lists;
 			if (merchant instanceof L2MerchantInstance)
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance)merchant).getNpcId());
-				castleTaxRate = ((L2MerchantInstance)merchant).getMpc().getCastleTaxRate();
-				baseTaxRate = ((L2MerchantInstance)merchant).getMpc().getBaseTaxRate();
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance) merchant).getNpcId());
+				castleTaxRate = ((L2MerchantInstance) merchant).getMpc().getCastleTaxRate();
+				baseTaxRate = ((L2MerchantInstance) merchant).getMpc().getBaseTaxRate();
 			}
 			else
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance)merchant).getNpcId());
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance) merchant).getNpcId());
 				baseTaxRate = 50;
 			}
-
-			if(!player.isGM() )
+			
+			if (!player.isGM())
 			{
 				if (lists == null)
 				{
-					Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 					return;
 				}
 				for (L2TradeList tradeList : lists)
@@ -165,106 +156,106 @@ public final class RequestBuyItem extends L2GameClientPacket
 		}
 		else
 			list = TradeController.getInstance().getBuyList(_listId);
-
+		
 		if (list == null)
 		{
-			Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 			return;
 		}
-
+		
 		_listId = list.getListId();
-
+		
 		long subTotal = 0;
 		long castleTax = 0;
 		long baseTax = 0;
-
+		
 		// Check for buylist validity and calculates summary values
 		long slots = 0;
 		long weight = 0;
 		for (Item i : _items)
 		{
 			long price = -1;
-
-            L2TradeItem tradeItem = list.getItemById(i.getItemId());
+			
+			L2TradeItem tradeItem = list.getItemById(i.getItemId());
 			if (tradeItem == null)
 			{
-				Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
 				return;
 			}
-
+			
 			L2Item template = ItemTable.getInstance().getTemplate(i.getItemId());
 			if (template == null)
 				continue;
-
-            if (!template.isStackable() && i.getCount() > 1)
+			
+			if (!template.isStackable() && i.getCount() > 1)
 			{
-				Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase invalid quantity of items at the same time.",Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase invalid quantity of items at the same time.", Config.DEFAULT_PUNISH);
 				SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
 				sendPacket(sm);
 				sm = null;
 				return;
 			}
-
-            price = list.getPriceForItemId(i.getItemId());
-            if (i.getItemId() >= 3960 && i.getItemId() <= 4026) 
-            	price *= Config.RATE_SIEGE_GUARDS_PRICE;
-
-            if (price < 0)
-            {
+			
+			price = list.getPriceForItemId(i.getItemId());
+			if (i.getItemId() >= 3960 && i.getItemId() <= 4026)
+				price *= Config.RATE_SIEGE_GUARDS_PRICE;
+			
+			if (price < 0)
+			{
 				_log.warning("ERROR, no price found .. wrong buylist ??");
 				sendPacket(ActionFailed.STATIC_PACKET);
 				return;
 			}
-
+			
 			if (price == 0 && !player.isGM() && Config.ONLY_GM_ITEMS_FREE)
 			{
 				player.sendMessage("Ohh Cheat dont work? You have a problem now!");
-				Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried buy item for 0 adena.", Config.DEFAULT_PUNISH);
 				return;
 			}
-
+			
 			if (tradeItem.hasLimitedStock())
 			{
 				// trying to buy more then avaliable
 				if (i.getCount() > tradeItem.getCurrentCount())
 					return;
 			}
-
+			
 			if ((MAX_ADENA / i.getCount()) < price)
 			{
-				Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" tried to purchase over "+MAX_ADENA+" adena worth of goods.", Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
 				return;
 			}
-			subTotal += i.getCount() * price;	// Before tax
-			castleTax = (long)(subTotal * castleTaxRate);
-			baseTax = (long)(subTotal * baseTaxRate);
+			subTotal += i.getCount() * price; // Before tax
+			castleTax = (long) (subTotal * castleTaxRate);
+			baseTax = (long) (subTotal * baseTaxRate);
 			if (subTotal + castleTax + baseTax > 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);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
 				return;
 			}
-
+			
 			weight += i.getCount() * template.getWeight();
 			if (!template.isStackable())
 				slots += i.getCount();
 			else if (player.getInventory().getItemByItemId(i.getItemId()) == null)
 				slots++;
 		}
-
-		if (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int)weight))
+		
+		if (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int) weight))
 		{
 			sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
-		if (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int)slots))
+		
+		if (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int) slots))
 		{
 			sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		// Charge buyer and add tax to castle treasury if not owned by npc clan
 		if ((subTotal < 0) || !player.reduceAdena("Buy", (subTotal + baseTax + castleTax), player.getLastFolkNPC(), false))
 		{
@@ -272,17 +263,17 @@ public final class RequestBuyItem extends L2GameClientPacket
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		// Proceed the purchase
 		for (Item i : _items)
 		{
 			L2TradeItem tradeItem = list.getItemById(i.getItemId());
 			if (tradeItem == null)
 			{
-				Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + i.getItemId(), Config.DEFAULT_PUNISH);
 				continue;
 			}
-
+			
 			if (tradeItem.hasLimitedStock())
 			{
 				if (tradeItem.decreaseCount(i.getCount()))
@@ -291,17 +282,17 @@ public final class RequestBuyItem extends L2GameClientPacket
 			else
 				player.getInventory().addItem("Buy", i.getItemId(), i.getCount(), player, merchant);
 		}
-
+		
 		// add to castle treasury
 		if (merchant instanceof L2MerchantInstance)
-			((L2MerchantInstance)merchant).getCastle().addToTreasury(castleTax);
-
+			((L2MerchantInstance) merchant).getCastle().addToTreasury(castleTax);
+		
 		StatusUpdate su = new StatusUpdate(player.getObjectId());
 		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
 		player.sendPacket(su);
 		player.sendPacket(new ExBuySellListPacket(player, list, castleTaxRate + baseTaxRate, true));
 	}
-
+	
 	private class Item
 	{
 		private final int _itemId;
@@ -312,18 +303,18 @@ public final class RequestBuyItem extends L2GameClientPacket
 			_itemId = id;
 			_count = num;
 		}
-
+		
 		public int getItemId()
 		{
 			return _itemId;
 		}
-
+		
 		public long getCount()
 		{
 			return _count;
 		}
 	}
-
+	
 	/* (non-Javadoc)
 	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
 	 */

+ 46 - 60
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestRefundItem.java

@@ -36,101 +36,96 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.item.L2Item;
 import com.l2jserver.gameserver.util.Util;
 
+/**
+ * RequestRefundItem client packet class.
+ */
 public final class RequestRefundItem extends L2GameClientPacket
 {
 	private static final String _C__D0_75_REQUESTREFUNDITEM = "[C] D0:75 RequestRefundItem";
 	private static final Logger _log = Logger.getLogger(RequestRefundItem.class.getName());
-
+	
 	private static final int BATCH_LENGTH = 4; // length of the one item
-
+	
 	private int _listId;
 	private int[] _items = null;
-
+	
 	@Override
 	protected void readImpl()
 	{
 		_listId = readD();
 		final int count = readD();
-		if (count <= 0
-				|| count > Config.MAX_ITEM_IN_PACKET
-				|| count * BATCH_LENGTH != _buf.remaining())
+		if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
 			return;
-
+		
 		_items = new int[count];
 		for (int i = 0; i < count; i++)
 			_items[i] = readD();
 	}
-
+	
 	@Override
 	protected void runImpl()
 	{
 		final L2PcInstance player = getClient().getActiveChar();
 		if (player == null)
 			return;
-
+		
 		if (!player.getFloodProtectors().getTransaction().tryPerformAction("refund"))
 		{
 			player.sendMessage("You using refund too fast.");
 			return;
 		}
-
+		
 		if (_items == null)
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		if (!player.hasRefund())
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Object target = player.getTarget();
 		if (!player.isGM() && (target == null // No target (ie GM Shop)
-				|| !(target instanceof L2MerchantInstance
-						|| target instanceof L2MerchantSummonInstance)
-				|| player.getInstanceId() != target.getInstanceId()
-				|| !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
+				|| !(target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance) || player.getInstanceId() != target.getInstanceId() || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Character merchant = null;
-		if (target instanceof L2MerchantInstance
-				|| target instanceof L2MerchantSummonInstance)
+		if (target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance)
 			merchant = (L2Character) target;
 		else if (!player.isGM())
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2TradeList list = null;
 		double taxRate = 0;
-
+		
 		if (merchant != null)
 		{
 			List<L2TradeList> lists;
 			if (merchant instanceof L2MerchantInstance)
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance)merchant).getNpcId());
-				taxRate = ((L2MerchantInstance)merchant).getMpc().getTotalTaxRate();
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance) merchant).getNpcId());
+				taxRate = ((L2MerchantInstance) merchant).getMpc().getTotalTaxRate();
 			}
 			else
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance)merchant).getNpcId());
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance) merchant).getNpcId());
 				taxRate = 50;
 			}
-
-			if(!player.isGM() )
+			
+			if (!player.isGM())
 			{
 				if (lists == null)
 				{
-					Util.handleIllegalPlayerAction(player,"Warning!! Character " +
-							player.getName()+" of account "+player.getAccountName() +
-							" sent a false BuyList list_id",Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 					return;
 				}
 				for (L2TradeList tradeList : lists)
@@ -144,58 +139,49 @@ public final class RequestRefundItem extends L2GameClientPacket
 		}
 		else
 			list = TradeController.getInstance().getBuyList(_listId);
-
+		
 		if (list == null)
 		{
-			Util.handleIllegalPlayerAction(player,"Warning!! Character " +
-					player.getName()+" of account "+player.getAccountName() +
-					" sent a false BuyList list_id",Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 			return;
 		}
-
+		
 		long weight = 0;
 		long adena = 0;
 		long slots = 0;
-
+		
 		L2ItemInstance[] refund = player.getRefund().getItems();
 		int[] objectIds = new int[_items.length];
-
+		
 		for (int i = 0; i < _items.length; i++)
 		{
 			int idx = _items[i];
 			if (idx < 0 || idx >= refund.length)
 			{
-				Util.handleIllegalPlayerAction(player,"Warning!! Character " +
-						player.getName()+" of account "+player.getAccountName() +
-						" sent invalid refund index",Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent invalid refund index", Config.DEFAULT_PUNISH);
 				return;
 			}
-
+			
 			// check for duplicates - indexes
 			for (int j = i + 1; j < _items.length; j++)
 				if (idx == _items[j])
 				{
-					Util.handleIllegalPlayerAction(player,
-							"Warning!! Character "+player.getName() +
-							" of account "+player.getAccountName() +
-							" sent duplicate refund index",Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent duplicate refund index", Config.DEFAULT_PUNISH);
 					return;
 				}
-
+			
 			final L2ItemInstance item = refund[idx];
 			final L2Item template = item.getItem();
 			objectIds[i] = item.getObjectId();
-
+			
 			// second check for duplicates - object ids
 			for (int j = 0; j < i; j++)
 				if (objectIds[i] == objectIds[j])
 				{
-					Util.handleIllegalPlayerAction(player,"Warning!! Character " +
-							player.getName()+" of account "+player.getAccountName() +
-							" has duplicate items in refund list",Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " has duplicate items in refund list", Config.DEFAULT_PUNISH);
 					return;
 				}
-
+			
 			long count = item.getCount();
 			weight += count * template.getWeight();
 			adena += count * template.getReferencePrice() / 2;
@@ -204,45 +190,45 @@ public final class RequestRefundItem extends L2GameClientPacket
 			else if (player.getInventory().getItemByItemId(template.getItemId()) == null)
 				slots++;
 		}
-
-		if (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int)weight))
+		
+		if (weight > Integer.MAX_VALUE || weight < 0 || !player.getInventory().validateWeight((int) weight))
 		{
 			sendPacket(new SystemMessage(SystemMessageId.WEIGHT_LIMIT_EXCEEDED));
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
-		if (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int)slots))
+		
+		if (slots > Integer.MAX_VALUE || slots < 0 || !player.getInventory().validateCapacity((int) slots))
 		{
 			sendPacket(new SystemMessage(SystemMessageId.SLOTS_FULL));
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		if ((adena < 0) || !player.reduceAdena("Refund", adena, player.getLastFolkNPC(), false))
 		{
 			sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		for (int i = 0; i < _items.length; i++)
 		{
 			L2ItemInstance item = player.getRefund().transferItem("Refund", objectIds[i], Long.MAX_VALUE, player.getInventory(), player, player.getLastFolkNPC());
 			if (item == null)
 			{
-				_log.warning("Error refunding object for char "+player.getName()+" (newitem == null)");
+				_log.warning("Error refunding object for char " + player.getName() + " (newitem == null)");
 				continue;
 			}
 		}
-
+		
 		// Update current load status on player
 		StatusUpdate su = new StatusUpdate(player.getObjectId());
 		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
 		player.sendPacket(su);
 		player.sendPacket(new ExBuySellListPacket(player, list, taxRate, true));
 	}
-
+	
 	/* (non-Javadoc)
 	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
 	 */
@@ -251,4 +237,4 @@ public final class RequestRefundItem extends L2GameClientPacket
 	{
 		return _C__D0_75_REQUESTREFUNDITEM;
 	}
-}
+}

+ 50 - 57
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestSellItem.java

@@ -14,6 +14,9 @@
  */
 package com.l2jserver.gameserver.network.clientpackets;
 
+import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
+import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
+
 import java.util.List;
 
 import com.l2jserver.Config;
@@ -30,24 +33,19 @@ import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
 import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
 import com.l2jserver.gameserver.util.Util;
 
-import static com.l2jserver.gameserver.model.actor.L2Npc.INTERACTION_DISTANCE;
-import static com.l2jserver.gameserver.model.itemcontainer.PcInventory.MAX_ADENA;
-
 /**
- * This class ...
- *
- * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/03/27 15:29:30 $
+ * RequestSellItem client packet class.
  */
 public final class RequestSellItem extends L2GameClientPacket
 {
 	private static final String _C__1E_REQUESTSELLITEM = "[C] 1E RequestSellItem";
-    //private static Logger _log = Logger.getLogger(RequestSellItem.class.getName());
-
+	//private static Logger _log = Logger.getLogger(RequestSellItem.class.getName());
+	
 	private static final int BATCH_LENGTH = 16; // length of the one item
-
+	
 	private int _listId;
 	private Item[] _items = null;
-
+	
 	/**
 	 * packet type id 0x1e
 	 *
@@ -68,19 +66,17 @@ public final class RequestSellItem extends L2GameClientPacket
 	 * format:		cdd (ddd)
 	 * @param decrypt
 	 */
-
+	
 	@Override
 	protected void readImpl()
 	{
 		_listId = readD();
 		int count = readD();
-		if (count <= 0
-				|| count > Config.MAX_ITEM_IN_PACKET
-				|| count * BATCH_LENGTH != _buf.remaining())
+		if (count <= 0 || count > Config.MAX_ITEM_IN_PACKET || count * BATCH_LENGTH != _buf.remaining())
 		{
-		    return;
+			return;
 		}
-
+		
 		_items = new Item[count];
 		for (int i = 0; i < count; i++)
 		{
@@ -95,81 +91,78 @@ public final class RequestSellItem extends L2GameClientPacket
 			_items[i] = new Item(objectId, itemId, cnt);
 		}
 	}
-
+	
 	@Override
-    protected void runImpl()
-    {
-	    this.processSell();
-    }
-    
+	protected void runImpl()
+	{
+		this.processSell();
+	}
+	
 	protected void processSell()
 	{
 		L2PcInstance player = getClient().getActiveChar();
-        
+		
 		if (player == null)
 			return;
-
+		
 		if (!player.getFloodProtectors().getTransaction().tryPerformAction("buy"))
 		{
 			player.sendMessage("You buying too fast.");
 			return;
 		}
-
-		if(_items == null)
+		
+		if (_items == null)
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		// Alt game - Karma punishment
 		if (!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Object target = player.getTarget();
-		if (!player.isGM() && (target == null								// No target (ie GM Shop)
-				|| !(target instanceof L2MerchantInstance
-						|| target instanceof L2MerchantSummonInstance)	// Target not a merchant
-						|| target.getInstanceId() != player.getInstanceId()
-						|| !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
+		if (!player.isGM() && (target == null // No target (ie GM Shop)
+				|| !(target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance) // Target not a merchant
+				|| target.getInstanceId() != player.getInstanceId() || !player.isInsideRadius(target, INTERACTION_DISTANCE, true, false))) // Distance is too far
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2Character merchant = null;
 		double taxRate = 0;
-		if (target instanceof L2MerchantInstance
-				|| target instanceof L2MerchantSummonInstance)
-			merchant = (L2Character)target;
+		if (target instanceof L2MerchantInstance || target instanceof L2MerchantSummonInstance)
+			merchant = (L2Character) target;
 		else if (!player.isGM())
 		{
 			sendPacket(ActionFailed.STATIC_PACKET);
 			return;
 		}
-
+		
 		L2TradeList list = null;
 		if (merchant != null)
 		{
 			List<L2TradeList> lists;
 			if (merchant instanceof L2MerchantInstance)
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance)merchant).getNpcId());
-				taxRate = ((L2MerchantInstance)merchant).getMpc().getTotalTaxRate();
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantInstance) merchant).getNpcId());
+				taxRate = ((L2MerchantInstance) merchant).getMpc().getTotalTaxRate();
 			}
 			else
 			{
-				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance)merchant).getNpcId());
+				lists = TradeController.getInstance().getBuyListByNpcId(((L2MerchantSummonInstance) merchant).getNpcId());
 				taxRate = 50;
 			}
-
-			if(!player.isGM() )
+			
+			if (!player.isGM())
 			{
 				if (lists == null)
 				{
-					Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+					Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 					return;
 				}
 				for (L2TradeList tradeList : lists)
@@ -183,13 +176,13 @@ public final class RequestSellItem extends L2GameClientPacket
 		}
 		else
 			list = TradeController.getInstance().getBuyList(_listId);
-
+		
 		if (list == null)
 		{
-			Util.handleIllegalPlayerAction(player,"Warning!! Character "+player.getName()+" of account "+player.getAccountName()+" sent a false BuyList list_id.",Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 			return;
 		}
-
+		
 		long totalPrice = 0;
 		// Proceed the sell
 		for (Item i : _items)
@@ -197,29 +190,29 @@ public final class RequestSellItem extends L2GameClientPacket
 			L2ItemInstance item = player.checkItemManipulation(i.getObjectId(), i.getCount(), "sell");
 			if (item == null || (!item.isSellable()))
 				continue;
-
+			
 			long price = item.getReferencePrice() / 2;
 			totalPrice += price * i.getCount();
 			if ((MAX_ADENA / i.getCount()) < price || 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);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " tried to purchase over " + MAX_ADENA + " adena worth of goods.", Config.DEFAULT_PUNISH);
 				return;
 			}
-
+			
 			if (Config.ALLOW_REFUND)
 				item = player.getInventory().transferItem("Sell", i.getObjectId(), i.getCount(), player.getRefund(), player, merchant);
 			else
 				item = player.getInventory().destroyItem("Sell", i.getObjectId(), i.getCount(), player, merchant);
 		}
 		player.addAdena("Sell", totalPrice, merchant, false);
-
+		
 		// Update current load as well
 		StatusUpdate su = new StatusUpdate(player.getObjectId());
 		su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
 		player.sendPacket(su);
 		player.sendPacket(new ExBuySellListPacket(player, list, taxRate, true));
 	}
-
+	
 	private class Item
 	{
 		private final int _objectId;
@@ -232,23 +225,23 @@ public final class RequestSellItem extends L2GameClientPacket
 			_itemId = id;
 			_count = num;
 		}
-
+		
 		public int getObjectId()
 		{
 			return _objectId;
 		}
-
+		
 		public int getItemId()
 		{
 			return _itemId;
 		}
-
+		
 		public long getCount()
 		{
 			return _count;
 		}
 	}
-
+	
 	/* (non-Javadoc)
 	 * @see com.l2jserver.gameserver.clientpackets.ClientBasePacket#getType()
 	 */
@@ -257,4 +250,4 @@ public final class RequestSellItem extends L2GameClientPacket
 	{
 		return _C__1E_REQUESTSELLITEM;
 	}
-}
+}

+ 6 - 9
L2_GameServer/java/com/l2jserver/gameserver/network/clientpackets/RequestWearItem.java

@@ -39,11 +39,8 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.item.L2Item;
 import com.l2jserver.gameserver.util.Util;
 
-
 /**
- * This class ...
- *
- * @version $Revision: 1.12.4.4 $ $Date: 2005/03/27 15:29:30 $
+ * RequestWearItem client packet class.
  */
 public final class RequestWearItem extends L2GameClientPacket
 {
@@ -133,7 +130,7 @@ public final class RequestWearItem extends L2GameClientPacket
 		if (!player.isGM() && (target == null // No target (ie GM Shop)
 				|| !(target instanceof L2MerchantInstance || target instanceof L2MercManagerInstance) // Target not a merchant and not mercmanager
 		|| !player.isInsideRadius(target, L2Npc.INTERACTION_DISTANCE, false, false) // Distance is too far
-				))
+		))
 			return;
 		
 		L2TradeList list = null;
@@ -145,7 +142,7 @@ public final class RequestWearItem extends L2GameClientPacket
 		
 		if (lists == null)
 		{
-			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id.", Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 			return;
 		}
 		
@@ -159,7 +156,7 @@ public final class RequestWearItem extends L2GameClientPacket
 		
 		if (list == null)
 		{
-			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id.", Config.DEFAULT_PUNISH);
+			Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId, Config.DEFAULT_PUNISH);
 			return;
 		}
 		
@@ -185,7 +182,7 @@ public final class RequestWearItem extends L2GameClientPacket
 			
 			if (!list.containsItemId(itemId))
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id.", Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + itemId, Config.DEFAULT_PUNISH);
 				return;
 			}
 			
@@ -230,7 +227,7 @@ public final class RequestWearItem extends L2GameClientPacket
 			
 			if (!list.containsItemId(itemId))
 			{
-				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id.", Config.DEFAULT_PUNISH);
+				Util.handleIllegalPlayerAction(player, "Warning!! Character " + player.getName() + " of account " + player.getAccountName() + " sent a false BuyList list_id " + _listId + " and item_id " + itemId, Config.DEFAULT_PUNISH);
 				return;
 			}
 			

+ 2 - 5
L2_GameServer/java/com/l2jserver/gameserver/network/communityserver/readpackets/RequestPlayerShowBoard.java

@@ -16,12 +16,12 @@ package com.l2jserver.gameserver.network.communityserver.readpackets;
 
 import java.util.logging.Logger;
 
+import org.netcon.BaseReadPacket;
+
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.serverpackets.CSShowComBoard;
 
-import org.netcon.BaseReadPacket;
-
 /**
  * @authors  Forsaiken, Gigiikun
  */
@@ -43,10 +43,7 @@ public final class RequestPlayerShowBoard extends BaseReadPacket
 		
 		L2PcInstance player = L2World.getInstance().getPlayer(playerObjId);
 		if (player == null)
-		{
-			_log.info("error: player not found!!!");
 			return;
-		}
 		
 		player.sendPacket(new CSShowComBoard(html));
 	}

+ 3 - 6
L2_GameServer/java/com/l2jserver/gameserver/network/communityserver/readpackets/RequestPlayerShowMessage.java

@@ -16,14 +16,14 @@ package com.l2jserver.gameserver.network.communityserver.readpackets;
 
 import java.util.logging.Logger;
 
+import org.netcon.BaseReadPacket;
+
 import com.l2jserver.gameserver.model.L2World;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.ExMailArrived;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 
-import org.netcon.BaseReadPacket;
-
 /**
  * @authors  Forsaiken, Gigiikun
  */
@@ -44,14 +44,11 @@ public final class RequestPlayerShowMessage extends BaseReadPacket
 		
 		L2PcInstance player = L2World.getInstance().getPlayer(playerObjId);
 		if (player == null)
-		{
-			_log.info("error: player not found!!!");
 			return;
-		}
 		
 		switch(type)
 		{
-			case -1: // mail arraived
+			case -1: // mail arrived
 				player.sendPacket(ExMailArrived.STATIC_PACKET);
 				break;
 			case 0: // text message

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/skills/AbnormalEffect.java

@@ -67,6 +67,7 @@ public enum AbnormalEffect
 	S_BLACK_AFFRO("blackafro", 0x000040),
 	S_UNKNOWN8("unknown8", 0x000080),
 	STIGMA_SHILIEN("stigmashilien", 0x000100),
+	S_UNKNOWN9("unknown9", 0x000200),
 	
 	// event effects
 	E_AFRO_1("afrobaguette1", 0x000001),