Noticias:

No tienes permiso para ver los enlaces. Para poder verlos Registrate o Conectate.

Menú Principal

Restringir objetos durante la subclase

Iniciado por Swarlog, Ago 03, 2025, 12:38 AM

Tema anterior - Siguiente tema

Swarlog



Con este code evitas que un jugador puede equiparse determinados items/skills al estar con su subclase activa.

--- trunk/gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 910)
+++ trunk/gameserver/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 912)
@@ -12563,43 +12579,8 @@
	 */
	 public synchronized boolean addSubClass(int classId, int classIndex)
	 {
+		//Anti stuck Skills/Augments
+		//Remove Chest
+		L2ItemInstance chest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+		if (chest != null)
+		{
+	 			
+	 				L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
+	 				InventoryUpdate iu = new InventoryUpdate();
+	 				for (L2ItemInstance element : unequipped)
+	 				 iu.addModifiedItem(element);
+	 				sendPacket(iu);
+	 			
+		}
+		//Remove Item RHAND
+		L2ItemInstance rhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
+		if (rhand != null)
+		{
+	 			
+	 				L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
+	 				InventoryUpdate iu = new InventoryUpdate();
+	 				for (L2ItemInstance element : unequipped)
+	 				 iu.addModifiedItem(element);
+	 				sendPacket(iu);
+	 			
+		}
+		//Remove Item LHAND		
+		L2ItemInstance lhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
+		if (lhand != null)
+		{
+	 			
+	 				L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(lhand.getItem().getBodyPart());
+	 				InventoryUpdate iu = new InventoryUpdate();
+	 				for (L2ItemInstance element : unequipped)
+	 				 iu.addModifiedItem(element);
+	 				sendPacket(iu);
+	 			
+		}
-		// Reload skills from armors / jewels / weapons
-		getInventory().reloadEquippedItems();
			
		 if(getTotalSubClasses() == Config.ALLOWED_SUBCLASS || classIndex == 0)
			 return false;
@@ -12848,61 +12829,7 @@
			 sendPacket( ActionFailed.STATIC_PACKET );
			 return false;
		 }
+			
+		L2ItemInstance rhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);

+		if(rhand != null)
+		{
+			L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
+			InventoryUpdate iu = new InventoryUpdate();
+
+			for(L2ItemInstance element : unequipped)
+			{
+				iu.addModifiedItem(element);
+			}
+
+			sendPacket(iu);
+			rhand = null;
+			iu = null;
+			unequipped = null;
+		}
+
+		L2ItemInstance lhand = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND);
+
+		if(lhand != null)
+		{
+			L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(lhand.getItem().getBodyPart());
+			InventoryUpdate iu = new InventoryUpdate();
+
+			for(L2ItemInstance element : unequipped)
+			{
+				iu.addModifiedItem(element);
+			}
+
+			sendPacket(iu);
+			lhand = null;
+			iu = null;
+			unequipped = null;
+		}
+		
+		L2ItemInstance chest = getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+
+		if(chest != null)
+		{
+			L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
+			InventoryUpdate iu = new InventoryUpdate();
+
+			for(L2ItemInstance element : unequipped)
+			{
+				iu.addModifiedItem(element);
+			}
+
+			sendPacket(iu);
+			chest = null;
+			iu = null;
+			unequipped = null;
+		}
+
		 // Delete a force buff upon class change.
		 //thank l2j-arhid
		 if(_forceBuff != null)
@@ -13019,6 +12946,9 @@
			 restoreEffects();
		 }
		
-		// Reload skills from armors / jewels / weapons
-		getInventory().reloadEquippedItems();
-		
		 checkAllowedSkills();

		 sendPacket(new EtcStatusUpdate(this));