From 9fb6fb32bd9f33490088033b39208a983a644197 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 7 Apr 2020 07:49:47 +0000 Subject: [PATCH] Proper fix for invisible equipped consumables. --- .../gameserver/engines/DocumentItem.java | 11 +- .../gameserver/model/items/Item.java | 129 +----------------- 2 files changed, 11 insertions(+), 129 deletions(-) diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/engines/DocumentItem.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/engines/DocumentItem.java index 266c6dd882..528a01c12e 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/engines/DocumentItem.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/engines/DocumentItem.java @@ -176,6 +176,7 @@ final class DocumentItem extends DocumentBase if (className.equals("Weapon")) { + int bodypart = _slots.get(_currentItem.set.getString("bodypart")); _currentItem.type = _weaponTypes.get(_currentItem.set.getString("weapon_type")); // lets see if this is a shield @@ -218,14 +219,16 @@ final class DocumentItem extends DocumentBase } } - _currentItem.set.set("bodypart", Item.SLOT_R_HAND); + bodypart = Item.SLOT_R_HAND; } + + _currentItem.set.set("bodypart", bodypart); } else if (className.equals("Armor")) { _currentItem.type = _armorTypes.get(_currentItem.set.getString("armor_type")); - final int bodypart = _slots.get(_currentItem.set.getString("bodypart")); + int bodypart = _slots.get(_currentItem.set.getString("bodypart")); if ((bodypart == Item.SLOT_NECK) || (bodypart == Item.SLOT_HAIR) || (bodypart == Item.SLOT_FACE) || (bodypart == Item.SLOT_DHAIR) || ((bodypart & Item.SLOT_L_EAR) != 0) || ((bodypart & Item.SLOT_L_FINGER) != 0)) { _currentItem.set.set("type1", Item.TYPE1_WEAPON_RING_EARRING_NECKLACE); @@ -265,8 +268,10 @@ final class DocumentItem extends DocumentBase } } - _currentItem.set.set("bodypart", Item.SLOT_CHEST); + bodypart = Item.SLOT_CHEST; } + + _currentItem.set.set("bodypart", bodypart); } else { diff --git a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/items/Item.java b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/items/Item.java index d0c52ea60f..bcd58d956d 100644 --- a/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/items/Item.java +++ b/L2J_Mobius_C6_Interlude/java/org/l2jmobius/gameserver/model/items/Item.java @@ -170,6 +170,7 @@ public abstract class Item _weight = set.getInt("weight", 0); _crystallizable = set.getBoolean("crystallizable", false); _stackable = set.getBoolean("stackable", false); + switch (set.getString("crystal_type", "")) { case "d": @@ -203,133 +204,9 @@ public abstract class Item break; } } - _duration = set.getInt("duration", -1); - switch (set.getString("bodypart", "")) - { - case "chest": - { - _bodyPart = SLOT_CHEST; - break; - } - case "fullarmor": - { - _bodyPart = SLOT_FULL_ARMOR; - break; - } - case "head": - { - _bodyPart = SLOT_HEAD; - break; - } - case "hair": - { - _bodyPart = SLOT_HAIR; - break; - } - case "face": - { - _bodyPart = SLOT_FACE; - break; - } - case "dhair": - { - _bodyPart = SLOT_DHAIR; - break; - } - case "underwear": - { - _bodyPart = SLOT_UNDERWEAR; - break; - } - case "back": - { - _bodyPart = SLOT_BACK; - break; - } - case "neck": - { - _bodyPart = SLOT_NECK; - break; - } - case "legs": - { - _bodyPart = SLOT_LEGS; - break; - } - case "feet": - { - _bodyPart = SLOT_FEET; - break; - } - case "gloves": - { - _bodyPart = SLOT_GLOVES; - break; - } - case "chest,legs": - { - _bodyPart = SLOT_CHEST | SLOT_LEGS; - break; - } - case "rhand": - { - _bodyPart = SLOT_R_HAND; - break; - } - case "lhand": - { - _bodyPart = SLOT_L_HAND; - break; - } - case "lrhand": - { - _bodyPart = SLOT_LR_HAND; - break; - } - case "rear,lear": - { - _bodyPart = SLOT_R_EAR | SLOT_L_EAR; - break; - } - case "rfinger,lfinger": - { - _bodyPart = SLOT_R_FINGER | SLOT_L_FINGER; - break; - } - case "wolf": - { - _bodyPart = SLOT_WOLF; - break; - } - case "hatchling": - { - _bodyPart = SLOT_HATCHLING; - break; - } - case "strider": - { - _bodyPart = SLOT_STRIDER; - break; - } - case "babypet": - { - _bodyPart = SLOT_BABYPET; - break; - } - default: // "none" - { - if (_name.contains(" Arrow") || _name.contains(" Lure")) // Tempfix for invisible equipped consumables. - { - _bodyPart = Item.SLOT_L_HAND; // TODO: Should be done on XML. - } - else - { - _bodyPart = SLOT_NONE; - } - break; - } - } + _duration = set.getInt("duration", -1); + _bodyPart = set.getInt("bodypart", SLOT_NONE); _referencePrice = set.getInt("price", 0); _crystalCount = set.getInt("crystal_count", 0); _sellable = set.getBoolean("sellable", true);