Bladeren bron

Retail system message if no free slots for henna (thanks Evilius) and little cleanup.

_DS_ 16 jaren geleden
bovenliggende
commit
5ff96c0783

+ 5 - 13
L2_GameServer/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java

@@ -7897,12 +7897,12 @@ public final class L2PcInstance extends L2Playable
 	 */
 	public boolean removeHenna(int slot)
 	{
-		if (slot<1 || slot>3)
+		if (slot < 1 || slot > 3)
 			return false;
 
 		slot--;
 
-		if (_henna[slot]==null)
+		if (_henna[slot] == null)
 			return false;
 
 		L2HennaInstance henna = _henna[slot];
@@ -7956,18 +7956,11 @@ public final class L2PcInstance extends L2Playable
 	 */
 	public boolean addHenna(L2HennaInstance henna)
 	{
-		if (getHennaEmptySlots()==0)
-		{
-			sendMessage("You may not have more than three equipped symbols at a time.");
-			return false;
-		}
-
-		// int slot = 0;
-		for (int i=0;i<3;i++)
+		for (int i = 0; i < 3; i++)
 		{
-			if (_henna[i]==null)
+			if (_henna[i] == null)
 			{
-				_henna[i]=henna;
+				_henna[i] = henna;
 
 				// Calculate Henna modifiers of this L2PcInstance
 				recalcHennaStats();
@@ -8006,7 +7999,6 @@ public final class L2PcInstance extends L2Playable
 				return true;
 			}
 		}
-
 		return false;
 	}
 

+ 34 - 22
L2_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/RequestHennaEquip.java

@@ -55,36 +55,47 @@ public final class RequestHennaEquip extends L2GameClientPacket
 		L2PcInstance activeChar = getClient().getActiveChar();
 
 		if (activeChar == null)
-		    return;
+			return;
 
 		L2Henna template = HennaTable.getInstance().getTemplate(_symbolId);
 
-        if (template == null)
-            return;
+		if (template == null)
+			return;
 
-    	L2HennaInstance temp = new L2HennaInstance(template);
-    	long _count = 0;
-    	
-    	/* Prevents henna drawing exploit: 
-    	   1) talk to L2SymbolMakerInstance 
+		L2HennaInstance temp = new L2HennaInstance(template);
+		long _count = 0;
+
+		/* Prevents henna drawing exploit: 
+           1) talk to L2SymbolMakerInstance 
     	   2) RequestHennaList
     	   3) Don't close the window and go to a GrandMaster and change your subclass
     	   4) Get SymbolMaker range again and press draw
     	   You could draw any kind of henna just having the required subclass...
     	 */
-    	boolean cheater = true;
-    	for (L2HennaInstance h : HennaTreeTable.getInstance().getAvailableHenna(activeChar.getClassId()))
-    	{
-    	    if (h.getSymbolId() == temp.getSymbolId()) 
-    	    {
-    	        cheater = false;
-    	        break;
-    	    }
-    	}    	
-		try{
+
+		boolean cheater = true;
+		for (L2HennaInstance h : HennaTreeTable.getInstance().getAvailableHenna(activeChar.getClassId()))
+		{
+			if (h.getSymbolId() == temp.getSymbolId()) 
+			{
+				cheater = false;
+				break;
+			}
+		}
+		try
+		{
 			_count = activeChar.getInventory().getItemByItemId(temp.getItemIdDye()).getCount();
 		}
-		catch(Exception e){}
+		catch(Exception e)
+		{
+			//
+		}
+
+		if (activeChar.getHennaEmptySlots() == 0)
+		{
+			activeChar.sendPacket(new SystemMessage(SystemMessageId.SYMBOLS_FULL));
+			return;
+		}
 
 		if (!cheater && (_count >= temp.getAmountDyeRequire())&& (activeChar.getAdena()>= temp.getPrice()) && activeChar.addHenna(temp))
 		{
@@ -103,14 +114,15 @@ public final class RequestHennaEquip extends L2GameClientPacket
 
 			//update inventory
 			InventoryUpdate iu = new InventoryUpdate();
-            iu.addModifiedItem(activeChar.getInventory().getAdenaInstance());
+			iu.addModifiedItem(activeChar.getInventory().getAdenaInstance());
 			iu.addModifiedItem(dyeToUpdate);
 			activeChar.sendPacket(iu);
 		}
 		else
-        {
+		{
 			activeChar.sendPacket(new SystemMessage(SystemMessageId.CANT_DRAW_SYMBOL));
-			if ((!activeChar.isGM()) && (cheater)) Util.handleIllegalPlayerAction(activeChar,"Exploit attempt: Character "+activeChar.getName()+" of account "+activeChar.getAccountName()+" tryed to add a forbidden henna.",Config.DEFAULT_PUNISH);
+			if ((!activeChar.isGM()) && (cheater))
+				Util.handleIllegalPlayerAction(activeChar,"Exploit attempt: Character "+activeChar.getName()+" of account "+activeChar.getAccountName()+" tryed to add a forbidden henna.",Config.DEFAULT_PUNISH);
 		}
 	}