Jump to content

Question

Posted

Καλημερα, εχω ενα προβλημα με εναν κωδικα που εχω περασει στο Eclipse , εχω βαλει οταν κανει sub ο παιχτης να του βγαινουν armor,weapon αλλα το προβλημα ειναι οτι δεν κανει update το inventory...

 

Οριστε ο κωδικας :

 

					if(allowAddition)
				{
					String className = CharTemplateTable.getClassNameById(paramOne);

					if(!player.addSubClass(paramOne, player.getTotalSubClasses() + 1))
					{
						player.sendMessage("The sub class could not be added.");
						player.setLocked(false);
						return;
					}

					int[] armorType = { Inventory.PAPERDOLL_RHAND, Inventory.PAPERDOLL_LHAND, Inventory.PAPERDOLL_LRHAND, Inventory.PAPERDOLL_LRHAND,
						Inventory.PAPERDOLL_CHEST, Inventory.PAPERDOLL_HEAD,
						Inventory.PAPERDOLL_LEGS, Inventory.PAPERDOLL_GLOVES,
						Inventory.PAPERDOLL_FEET, Inventory.PAPERDOLL_BACK};
					for (int items : armorType)
					{
						L2ItemInstance parmorInstance = player.getInventory().getPaperdollItem(items);
						if (parmorInstance != null)
							player.getInventory().unEquipItemInSlot(items);
					}
					player.broadcastPacket(new InventoryUpdate());
					player.setActiveClass(player.getTotalSubClasses());

					if(Config.CHECK_SKILLS_ON_ENTER && !Config.ALT_GAME_SKILL_LEARN)
					{
						player.checkAllowedSkills();
					}

Recommended Posts

  • 0
Posted

kala tha eitane na rwtouses kai to error auto sto l2jfrozen Forum. mpas kai 3eroune auti kalitera. afou einai to code gia l2j frozen logika 3eroune.

  • 0
Posted

akiro telios auto p les , bump

Απλά δεν το κατάλαβες!

Τέσπα, στείλε μου σε ΠΜ τον κώδικα όπως ακριβώς τον έχεις.

Όχι μόνο αυτό που έχεις εδώ.

  • 0
Posted

   public synchronized boolean setActiveClass(int classIndex)
   {
+      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);
+         
+      }
+      
+      L2ItemInstance head = getInventory().getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+      if (head != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(head.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      
+      L2ItemInstance gloves = getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+      if (gloves != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(gloves.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      
+      L2ItemInstance feet = getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET);
+      if (feet != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(feet.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      
+      L2ItemInstance legs = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+      if (legs != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      
+      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);
+         
+      }
+      
+      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);
+         
+      }
+      L2ItemInstance lear = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEAR);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(lear.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      L2ItemInstance rear = getInventory().getPaperdollItem(Inventory.PAPERDOLL_REAR);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(rear.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      L2ItemInstance neck = getInventory().getPaperdollItem(Inventory.PAPERDOLL_NECK);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(neck.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      L2ItemInstance lfinger = getInventory().getPaperdollItem(Inventory.PAPERDOLL_LFINGER);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(lfinger.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      L2ItemInstance rfinger = getInventory().getPaperdollItem(Inventory.PAPERDOLL_RFINGER);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(rfinger.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }
+      L2ItemInstance under = getInventory().getPaperdollItem(Inventory.PAPERDOLL_UNDER);
+      if (lhand != null)
+      {
+         
+            L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(under.getItem().getBodyPart());
+            InventoryUpdate iu = new InventoryUpdate();
+            for (L2ItemInstance element : unequipped)
+               iu.addModifiedItem(element);
+            sendPacket(iu);
+         
+      }

 

vale afto egw to ekana kai test kai eianai ok..

 

ed: soz den eida to new reply :)

  • 0
Posted

αφού δεν το κάνει update λείπει λογικά το player.getInventory().update();

 

βάλτω κάτω από αυτό player.getInventory().unEquipItemInSlot(items);

  • 0
Posted

mia pio pro ekdosh tou parapanw kodika

public synchronized boolean setActiveClass(int classIndex)
{
+int[] armorType = 	
+{
+	Inventory.PAPERDOLL_RHAND, Inventory.PAPERDOLL_LHAND,
+	Inventory.PAPERDOLL_LRHAND, Inventory.PAPERDOLL_LRHAND,
+	Inventory.PAPERDOLL_CHEST, Inventory.PAPERDOLL_HEAD,
+	Inventory.PAPERDOLL_LEGS, Inventory.PAPERDOLL_GLOVES,
+	Inventory.PAPERDOLL_FEET, Inventory.PAPERDOLL_BACK,
+	Inventory.PAPERDOLL_DHAIR, Inventory.PAPERDOLL_HAIR,
+	Inventory.PAPERDOLL_LEAR, Inventory.PAPERDOLL_REAR,
+	Inventory.PAPERDOLL_RFINGER, Inventory.PAPERDOLL_LFINGER,
+	Inventory.PAPERDOLL_NECK, Inventory.PAPERDOLL_UNDER
+};
+
+for (int items : armorType)
+{
+	L2ItemInstance parmorInstance = getInventory().getPaperdollItem(items);
+	if (parmorInstance != null)
+	{
+		L2ItemInstance[] unequipped = getInventory().unEquipItemInBodySlotAndRecord(parmorInstance.getItem().getBodyPart());
+		InventoryUpdate iu = new InventoryUpdate();
+		for (L2ItemInstance element : unequipped)
+		iu.addModifiedItem(element);
+		sendPacket(iu);
+		}
+	}

Guest
This topic is now closed to further replies.


×
×
  • Create New...