diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java index 61b368b2db..74fee9bc0b 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java @@ -38,14 +38,14 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public final class Disarmor extends AbstractEffect { private final Map _unequippedItems; // PlayerObjId, ItemObjId - private final int _slot; + private final long _slot; public Disarmor(StatsSet params) { _unequippedItems = new ConcurrentHashMap<>(); final String slot = params.getString("slot", "chest"); - _slot = ItemTable.SLOTS.getOrDefault(slot, L2Item.SLOT_NONE); + _slot = ItemTable.SLOTS.getOrDefault(slot, (long) L2Item.SLOT_NONE); if (_slot == L2Item.SLOT_NONE) { LOGGER.severe("Unknown bodypart slot for effect: " + slot); diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java index 363a9d65fe..1b7446e991 100644 --- a/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java +++ b/L2J_Mobius_5.0_Salvation/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java @@ -73,7 +73,7 @@ public class EquipArmorSkillCondition implements ISkillCondition // So from here, chest armor matches conditions - final int chestBodyPart = chest.getItem().getBodyPart(); + final long chestBodyPart = chest.getItem().getBodyPart(); // return True if chest armor is a Full Armor if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java index dd15efb7ce..7eb3e8c960 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java @@ -102,7 +102,7 @@ public class AppearanceItemData implements IGameXmlReader } case "bodyPart": { - final int part = ItemTable.SLOTS.get(c.getTextContent()); + final long part = ItemTable.SLOTS.get(c.getTextContent()); stone.addBodyPart(part); break; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/datatables/ItemTable.java index 69ba816691..a4b27841b8 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/datatables/ItemTable.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/datatables/ItemTable.java @@ -58,7 +58,7 @@ public class ItemTable private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName()); private static Logger LOGGER_ITEMS = Logger.getLogger("item"); - public static final Map SLOTS = new HashMap<>(); + public static final Map SLOTS = new HashMap<>(); private L2Item[] _allTemplates; private final Map _etcItems = new HashMap<>(); @@ -66,45 +66,45 @@ public class ItemTable private final Map _weapons = new HashMap<>(); static { - SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR); - SLOTS.put("lbracelet", L2Item.SLOT_L_BRACELET); - SLOTS.put("rbracelet", L2Item.SLOT_R_BRACELET); - SLOTS.put("talisman", L2Item.SLOT_DECO); - SLOTS.put("chest", L2Item.SLOT_CHEST); - SLOTS.put("fullarmor", L2Item.SLOT_FULL_ARMOR); - SLOTS.put("head", L2Item.SLOT_HEAD); - SLOTS.put("hair", L2Item.SLOT_HAIR); - SLOTS.put("hairall", L2Item.SLOT_HAIRALL); - SLOTS.put("underwear", L2Item.SLOT_UNDERWEAR); - SLOTS.put("back", L2Item.SLOT_BACK); - SLOTS.put("neck", L2Item.SLOT_NECK); - SLOTS.put("legs", L2Item.SLOT_LEGS); - SLOTS.put("feet", L2Item.SLOT_FEET); - SLOTS.put("gloves", L2Item.SLOT_GLOVES); - SLOTS.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); - SLOTS.put("belt", L2Item.SLOT_BELT); - SLOTS.put("rhand", L2Item.SLOT_R_HAND); - SLOTS.put("lhand", L2Item.SLOT_L_HAND); - SLOTS.put("lrhand", L2Item.SLOT_LR_HAND); - SLOTS.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); - SLOTS.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); - SLOTS.put("wolf", L2Item.SLOT_WOLF); - SLOTS.put("greatwolf", L2Item.SLOT_GREATWOLF); - SLOTS.put("hatchling", L2Item.SLOT_HATCHLING); - SLOTS.put("strider", L2Item.SLOT_STRIDER); - SLOTS.put("babypet", L2Item.SLOT_BABYPET); - SLOTS.put("brooch", L2Item.SLOT_BROOCH); - SLOTS.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL); + SLOTS.put("shirt", (long) L2Item.SLOT_UNDERWEAR); + SLOTS.put("lbracelet", (long) L2Item.SLOT_L_BRACELET); + SLOTS.put("rbracelet", (long) L2Item.SLOT_R_BRACELET); + SLOTS.put("talisman", (long) L2Item.SLOT_DECO); + SLOTS.put("chest", (long) L2Item.SLOT_CHEST); + SLOTS.put("fullarmor", (long) L2Item.SLOT_FULL_ARMOR); + SLOTS.put("head", (long) L2Item.SLOT_HEAD); + SLOTS.put("hair", (long) L2Item.SLOT_HAIR); + SLOTS.put("hairall", (long) L2Item.SLOT_HAIRALL); + SLOTS.put("underwear", (long) L2Item.SLOT_UNDERWEAR); + SLOTS.put("back", (long) L2Item.SLOT_BACK); + SLOTS.put("neck", (long) L2Item.SLOT_NECK); + SLOTS.put("legs", (long) L2Item.SLOT_LEGS); + SLOTS.put("feet", (long) L2Item.SLOT_FEET); + SLOTS.put("gloves", (long) L2Item.SLOT_GLOVES); + SLOTS.put("chest,legs", (long) L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); + SLOTS.put("belt", (long) L2Item.SLOT_BELT); + SLOTS.put("rhand", (long) L2Item.SLOT_R_HAND); + SLOTS.put("lhand", (long) L2Item.SLOT_L_HAND); + SLOTS.put("lrhand", (long) L2Item.SLOT_LR_HAND); + SLOTS.put("rear;lear", (long) L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); + SLOTS.put("rfinger;lfinger", (long) L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); + SLOTS.put("wolf", (long) L2Item.SLOT_WOLF); + SLOTS.put("greatwolf", (long) L2Item.SLOT_GREATWOLF); + SLOTS.put("hatchling", (long) L2Item.SLOT_HATCHLING); + SLOTS.put("strider", (long) L2Item.SLOT_STRIDER); + SLOTS.put("babypet", (long) L2Item.SLOT_BABYPET); + SLOTS.put("brooch", (long) L2Item.SLOT_BROOCH); + SLOTS.put("brooch_jewel", (long) L2Item.SLOT_BROOCH_JEWEL); SLOTS.put("agathion", L2Item.SLOT_AGATHION); - SLOTS.put("none", L2Item.SLOT_NONE); + SLOTS.put("none", (long) L2Item.SLOT_NONE); // retail compatibility - SLOTS.put("onepiece", L2Item.SLOT_FULL_ARMOR); - SLOTS.put("hair2", L2Item.SLOT_HAIR2); - SLOTS.put("dhair", L2Item.SLOT_HAIRALL); - SLOTS.put("alldress", L2Item.SLOT_ALLDRESS); - SLOTS.put("deco1", L2Item.SLOT_DECO); - SLOTS.put("waist", L2Item.SLOT_BELT); + SLOTS.put("onepiece", (long) L2Item.SLOT_FULL_ARMOR); + SLOTS.put("hair2", (long) L2Item.SLOT_HAIR2); + SLOTS.put("dhair", (long) L2Item.SLOT_HAIRALL); + SLOTS.put("alldress", (long) L2Item.SLOT_ALLDRESS); + SLOTS.put("deco1", (long) L2Item.SLOT_DECO); + SLOTS.put("waist", (long) L2Item.SLOT_BELT); } /** diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/enums/CrystallizationType.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/enums/CrystallizationType.java index 7a7abafdf1..c1c30115d6 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/enums/CrystallizationType.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/enums/CrystallizationType.java @@ -40,19 +40,16 @@ public enum CrystallizationType { return ARMOR; } - switch (item.getBodyPart()) + if ((item.getBodyPart() == L2Item.SLOT_R_EAR) // + || (item.getBodyPart() == L2Item.SLOT_L_EAR) // + || (item.getBodyPart() == L2Item.SLOT_R_FINGER) // + || (item.getBodyPart() == L2Item.SLOT_L_FINGER) // + || (item.getBodyPart() == L2Item.SLOT_NECK) // + || (item.getBodyPart() == L2Item.SLOT_HAIR) // + || (item.getBodyPart() == L2Item.SLOT_HAIR2) // + || (item.getBodyPart() == L2Item.SLOT_HAIRALL)) { - case L2Item.SLOT_R_EAR: - case L2Item.SLOT_L_EAR: - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_L_FINGER: - case L2Item.SLOT_NECK: - case L2Item.SLOT_HAIR: - case L2Item.SLOT_HAIR2: - case L2Item.SLOT_HAIRALL: - { - return ACCESORY; - } + return ACCESORY; } return NONE; diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/CombatFlag.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/CombatFlag.java index 89abcb268d..76a96b3ed0 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/CombatFlag.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/CombatFlag.java @@ -104,7 +104,7 @@ public class CombatFlag { // Reset player stats _player.setCombatFlagEquipped(false); - final int slot = _player.getInventory().getSlotFromItem(_item); + final long slot = _player.getInventory().getSlotFromItem(_item); _player.getInventory().unEquipItemInBodySlot(slot); _player.destroyItem("CombatFlag", _item, null, true); _item = null; diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index 36a6c98065..183e951d26 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -2197,7 +2197,7 @@ public final class L2PcInstance extends L2Playable } sendPacket(sm); - final int slot = _inventory.getSlotFromItem(item); + final long slot = _inventory.getSlotFromItem(item); // we can't unequip talisman by body slot if ((slot == L2Item.SLOT_DECO) || (slot == L2Item.SLOT_BROOCH_JEWEL) || (slot == L2Item.SLOT_AGATHION)) { @@ -4990,7 +4990,7 @@ public final class L2PcInstance extends L2Playable } else { - final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); + final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); _inventory.unEquipItemInBodySlot(slot); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); } @@ -10887,7 +10887,7 @@ public final class L2PcInstance extends L2Playable } else { - final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); + final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); _inventory.unEquipItemInBodySlot(slot); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java index ee85aeabd0..9a8fb90a18 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java @@ -70,7 +70,7 @@ public final class ConditionUsingItemType extends Condition // So from here, chest armor matches conditions - final int chestBodyPart = chest.getItem().getBodyPart(); + final long chestBodyPart = chest.getItem().getBodyPart(); // return True if chest armor is a Full Armor if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) { diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java index 7f4dc2a68d..bf1631f6ac 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java @@ -35,7 +35,7 @@ public class AppearanceHolder private final AppearanceHandType _handType; private final AppearanceMagicType _magicType; private final AppearanceTargetType _targetType; - private final Integer _bodyPart; + private final long _bodyPart; public AppearanceHolder(StatsSet set) { @@ -73,7 +73,7 @@ public class AppearanceHolder return _targetType; } - public int getBodyPart() + public long getBodyPart() { return _bodyPart; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 5f63b95faa..509e5fc622 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -902,108 +902,104 @@ public abstract class Inventory extends ItemContainer return _paperdoll[slot] == null; } - public static int getPaperdollIndex(int slot) + public boolean isPaperdollSlotNotEmpty(int slot) { - switch (slot) + return _paperdoll[slot] != null; + } + + public static int getPaperdollIndex(long slot) + { + if (slot == L2Item.SLOT_UNDERWEAR) { - case L2Item.SLOT_UNDERWEAR: - { - return PAPERDOLL_UNDER; - } - case L2Item.SLOT_R_EAR: - { - return PAPERDOLL_REAR; - } - case L2Item.SLOT_LR_EAR: - case L2Item.SLOT_L_EAR: - { - return PAPERDOLL_LEAR; - } - case L2Item.SLOT_NECK: - { - return PAPERDOLL_NECK; - } - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_LR_FINGER: - { - return PAPERDOLL_RFINGER; - } - case L2Item.SLOT_L_FINGER: - { - return PAPERDOLL_LFINGER; - } - case L2Item.SLOT_HEAD: - { - return PAPERDOLL_HEAD; - } - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LR_HAND: - { - return PAPERDOLL_RHAND; - } - case L2Item.SLOT_L_HAND: - { - return PAPERDOLL_LHAND; - } - case L2Item.SLOT_GLOVES: - { - return PAPERDOLL_GLOVES; - } - case L2Item.SLOT_CHEST: - case L2Item.SLOT_FULL_ARMOR: - case L2Item.SLOT_ALLDRESS: - { - return PAPERDOLL_CHEST; - } - case L2Item.SLOT_LEGS: - { - return PAPERDOLL_LEGS; - } - case L2Item.SLOT_FEET: - { - return PAPERDOLL_FEET; - } - case L2Item.SLOT_BACK: - { - return PAPERDOLL_CLOAK; - } - case L2Item.SLOT_HAIR: - case L2Item.SLOT_HAIRALL: - { - return PAPERDOLL_HAIR; - } - case L2Item.SLOT_HAIR2: - { - return PAPERDOLL_HAIR2; - } - case L2Item.SLOT_R_BRACELET: - { - return PAPERDOLL_RBRACELET; - } - case L2Item.SLOT_L_BRACELET: - { - return PAPERDOLL_LBRACELET; - } - case L2Item.SLOT_DECO: - { - return PAPERDOLL_DECO1; // return first we deal with it later - } - case L2Item.SLOT_BELT: - { - return PAPERDOLL_BELT; - } - case L2Item.SLOT_BROOCH: - { - return PAPERDOLL_BROOCH; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - return PAPERDOLL_BROOCH_JEWEL1; - } - case L2Item.SLOT_AGATHION: - { - return PAPERDOLL_AGATHION1; - } + return PAPERDOLL_UNDER; + } + else if (slot == L2Item.SLOT_R_EAR) + { + return PAPERDOLL_REAR; + } + else if ((slot == L2Item.SLOT_LR_EAR) || (slot == L2Item.SLOT_L_EAR)) + { + return PAPERDOLL_LEAR; + } + else if (slot == L2Item.SLOT_NECK) + { + return PAPERDOLL_NECK; + } + else if ((slot == L2Item.SLOT_R_FINGER) || (slot == L2Item.SLOT_LR_FINGER)) + { + return PAPERDOLL_RFINGER; + } + else if (slot == L2Item.SLOT_L_FINGER) + { + return PAPERDOLL_LFINGER; + } + else if (slot == L2Item.SLOT_HEAD) + { + return PAPERDOLL_HEAD; + } + else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND)) + { + return PAPERDOLL_RHAND; + } + else if (slot == L2Item.SLOT_L_HAND) + { + return PAPERDOLL_LHAND; + } + else if (slot == L2Item.SLOT_GLOVES) + { + return PAPERDOLL_GLOVES; + } + else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_FULL_ARMOR) || (slot == L2Item.SLOT_ALLDRESS)) + { + return PAPERDOLL_CHEST; + } + else if (slot == L2Item.SLOT_LEGS) + { + return PAPERDOLL_LEGS; + } + else if (slot == L2Item.SLOT_FEET) + { + return PAPERDOLL_FEET; + } + else if (slot == L2Item.SLOT_BACK) + { + return PAPERDOLL_CLOAK; + } + else if ((slot == L2Item.SLOT_HAIR) || (slot == L2Item.SLOT_HAIRALL)) + { + return PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HAIR2) + { + return PAPERDOLL_HAIR2; + } + else if (slot == L2Item.SLOT_R_BRACELET) + { + return PAPERDOLL_RBRACELET; + } + else if (slot == L2Item.SLOT_L_BRACELET) + { + return PAPERDOLL_LBRACELET; + } + else if (slot == L2Item.SLOT_DECO) + { + return PAPERDOLL_DECO1; // return first we deal with it later + } + else if (slot == L2Item.SLOT_BELT) + { + return PAPERDOLL_BELT; + } + else if (slot == L2Item.SLOT_BROOCH) + { + return PAPERDOLL_BROOCH; + } + else if (slot == L2Item.SLOT_BROOCH_JEWEL) + { + return PAPERDOLL_BROOCH_JEWEL1; + } + else if (slot == L2Item.SLOT_AGATHION) + { + return PAPERDOLL_AGATHION1; } return -1; } @@ -1174,9 +1170,9 @@ public abstract class Inventory extends ItemContainer return _wearedMask; } - public int getSlotFromItem(L2ItemInstance item) + public long getSlotFromItem(L2ItemInstance item) { - int slot = -1; + long slot = -1; final int location = item.getLocationSlot(); switch (location) { @@ -1315,11 +1311,11 @@ public abstract class Inventory extends ItemContainer /** * Unequips item in body slot and returns alterations.
- * If you dont need return value use {@link Inventory#unEquipItemInBodySlot(int)} instead + * If you dont need return value use {@link Inventory#unEquipItemInBodySlot(long)} instead * @param slot : int designating the slot of the paperdoll * @return L2ItemInstance[] : list of changes */ - public L2ItemInstance[] unEquipItemInBodySlotAndRecord(int slot) + public L2ItemInstance[] unEquipItemInBodySlotAndRecord(long slot) { final ChangeRecorder recorder = newRecorder(); @@ -1374,141 +1370,111 @@ public abstract class Inventory extends ItemContainer * @param slot : int designating the slot * @return {@link L2ItemInstance} designating the item placed in the slot */ - public L2ItemInstance unEquipItemInBodySlot(int slot) + public L2ItemInstance unEquipItemInBodySlot(long slot) { int pdollSlot = -1; - switch (slot) + if (slot == L2Item.SLOT_L_EAR) { - case L2Item.SLOT_L_EAR: - { - pdollSlot = PAPERDOLL_LEAR; - break; - } - case L2Item.SLOT_R_EAR: - { - pdollSlot = PAPERDOLL_REAR; - break; - } - case L2Item.SLOT_NECK: - { - pdollSlot = PAPERDOLL_NECK; - break; - } - case L2Item.SLOT_R_FINGER: - { - pdollSlot = PAPERDOLL_RFINGER; - break; - } - case L2Item.SLOT_L_FINGER: - { - pdollSlot = PAPERDOLL_LFINGER; - break; - } - case L2Item.SLOT_HAIR: - { - pdollSlot = PAPERDOLL_HAIR; - break; - } - case L2Item.SLOT_HAIR2: - { - pdollSlot = PAPERDOLL_HAIR2; - break; - } - case L2Item.SLOT_HAIRALL: - { - setPaperdollItem(PAPERDOLL_HAIR, null); - pdollSlot = PAPERDOLL_HAIR; - break; - } - case L2Item.SLOT_HEAD: - { - pdollSlot = PAPERDOLL_HEAD; - break; - } - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LR_HAND: - { - pdollSlot = PAPERDOLL_RHAND; - break; - } - case L2Item.SLOT_L_HAND: - { - pdollSlot = PAPERDOLL_LHAND; - break; - } - case L2Item.SLOT_GLOVES: - { - pdollSlot = PAPERDOLL_GLOVES; - break; - } - case L2Item.SLOT_CHEST: - case L2Item.SLOT_ALLDRESS: - case L2Item.SLOT_FULL_ARMOR: - { - pdollSlot = PAPERDOLL_CHEST; - break; - } - case L2Item.SLOT_LEGS: - { - pdollSlot = PAPERDOLL_LEGS; - break; - } - case L2Item.SLOT_BACK: - { - pdollSlot = PAPERDOLL_CLOAK; - break; - } - case L2Item.SLOT_FEET: - { - pdollSlot = PAPERDOLL_FEET; - break; - } - case L2Item.SLOT_UNDERWEAR: - { - pdollSlot = PAPERDOLL_UNDER; - break; - } - case L2Item.SLOT_L_BRACELET: - { - pdollSlot = PAPERDOLL_LBRACELET; - break; - } - case L2Item.SLOT_R_BRACELET: - { - pdollSlot = PAPERDOLL_RBRACELET; - break; - } - case L2Item.SLOT_DECO: - { - pdollSlot = PAPERDOLL_DECO1; - break; - } - case L2Item.SLOT_BELT: - { - pdollSlot = PAPERDOLL_BELT; - break; - } - case L2Item.SLOT_BROOCH: - { - pdollSlot = PAPERDOLL_BROOCH; - break; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - pdollSlot = PAPERDOLL_BROOCH_JEWEL1; - break; - } - case L2Item.SLOT_AGATHION: - { - pdollSlot = PAPERDOLL_AGATHION1; - break; - } - default: - { - LOGGER.info("Unhandled slot type: " + slot); - LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace())); - } + pdollSlot = PAPERDOLL_LEAR; + } + else if (slot == L2Item.SLOT_R_EAR) + { + pdollSlot = PAPERDOLL_REAR; + } + else if (slot == L2Item.SLOT_NECK) + { + pdollSlot = PAPERDOLL_NECK; + } + else if (slot == L2Item.SLOT_R_FINGER) + { + pdollSlot = PAPERDOLL_RFINGER; + } + else if (slot == L2Item.SLOT_L_FINGER) + { + pdollSlot = PAPERDOLL_LFINGER; + } + else if (slot == L2Item.SLOT_HAIR) + { + pdollSlot = PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HAIR2) + { + pdollSlot = PAPERDOLL_HAIR2; + } + else if (slot == L2Item.SLOT_HAIRALL) + { + setPaperdollItem(PAPERDOLL_HAIR, null); + pdollSlot = PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HEAD) + { + pdollSlot = PAPERDOLL_HEAD; + } + else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND)) + { + pdollSlot = PAPERDOLL_RHAND; + } + else if (slot == L2Item.SLOT_L_HAND) + { + pdollSlot = PAPERDOLL_LHAND; + } + else if (slot == L2Item.SLOT_GLOVES) + { + pdollSlot = PAPERDOLL_GLOVES; + } + else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_ALLDRESS) || (slot == L2Item.SLOT_FULL_ARMOR)) + { + pdollSlot = PAPERDOLL_CHEST; + } + else if (slot == L2Item.SLOT_LEGS) + { + pdollSlot = PAPERDOLL_LEGS; + } + else if (slot == L2Item.SLOT_BACK) + { + pdollSlot = PAPERDOLL_CLOAK; + } + else if (slot == L2Item.SLOT_FEET) + { + pdollSlot = PAPERDOLL_FEET; + } + else if (slot == L2Item.SLOT_UNDERWEAR) + { + pdollSlot = PAPERDOLL_UNDER; + } + else if (slot == L2Item.SLOT_L_BRACELET) + { + pdollSlot = PAPERDOLL_LBRACELET; + } + else if (slot == L2Item.SLOT_R_BRACELET) + { + pdollSlot = PAPERDOLL_RBRACELET; + } + else if (slot == L2Item.SLOT_DECO) + { + pdollSlot = PAPERDOLL_DECO1; + } + else if (slot == L2Item.SLOT_BELT) + { + pdollSlot = PAPERDOLL_BELT; + } + else if (slot == L2Item.SLOT_BROOCH) + { + pdollSlot = PAPERDOLL_BROOCH; + } + else if (slot == L2Item.SLOT_BROOCH_JEWEL) + { + pdollSlot = PAPERDOLL_BROOCH_JEWEL1; + } + else if (slot == L2Item.SLOT_AGATHION) + { + pdollSlot = PAPERDOLL_AGATHION1; + } + else + { + LOGGER.info("Unhandled slot type: " + slot); + LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace())); } if (pdollSlot >= 0) { @@ -1567,225 +1533,184 @@ public abstract class Inventory extends ItemContainer } } - final int targetSlot = item.getItem().getBodyPart(); + final long targetSlot = item.getItem().getBodyPart(); // Check if player is using Formal Wear and item isn't Wedding Bouquet. final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST); if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS)) { // only chest target can pass this - switch (targetSlot) + if ((targetSlot == L2Item.SLOT_LR_HAND) || (targetSlot == L2Item.SLOT_L_HAND) || (targetSlot == L2Item.SLOT_R_HAND) || (targetSlot == L2Item.SLOT_LEGS) || (targetSlot == L2Item.SLOT_FEET) || (targetSlot == L2Item.SLOT_GLOVES) || (targetSlot == L2Item.SLOT_HEAD)) { - case L2Item.SLOT_LR_HAND: - case L2Item.SLOT_L_HAND: - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LEGS: - case L2Item.SLOT_FEET: - case L2Item.SLOT_GLOVES: - case L2Item.SLOT_HEAD: - { - return; - } + return; } } - switch (targetSlot) + // don't care about arrows, listener will unequip them (hopefully) + // handle full armor + // formal dress + if (targetSlot == L2Item.SLOT_LR_HAND) { - case L2Item.SLOT_LR_HAND: + setPaperdollItem(PAPERDOLL_LHAND, null); + setPaperdollItem(PAPERDOLL_RHAND, item); + } + else if (targetSlot == L2Item.SLOT_L_HAND) + { + final L2ItemInstance rh = getPaperdollItem(PAPERDOLL_RHAND); + if ((rh != null) && (rh.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) && !(((rh.getItemType() == WeaponType.BOW) && (item.getItemType() == EtcItemType.ARROW)) || (((rh.getItemType() == WeaponType.CROSSBOW) || (rh.getItemType() == WeaponType.TWOHANDCROSSBOW)) && (item.getItemType() == EtcItemType.BOLT)) || ((rh.getItemType() == WeaponType.FISHINGROD) && (item.getItemType() == EtcItemType.LURE)))) { - setPaperdollItem(PAPERDOLL_LHAND, null); - setPaperdollItem(PAPERDOLL_RHAND, item); - break; + setPaperdollItem(PAPERDOLL_RHAND, null); } - case L2Item.SLOT_L_HAND: + setPaperdollItem(PAPERDOLL_LHAND, item); + } + else if (targetSlot == L2Item.SLOT_R_HAND) + { + setPaperdollItem(PAPERDOLL_RHAND, item); + } + else if ((targetSlot == L2Item.SLOT_L_EAR) || (targetSlot == L2Item.SLOT_R_EAR) || (targetSlot == L2Item.SLOT_LR_EAR)) + { + if (_paperdoll[PAPERDOLL_LEAR] == null) { - final L2ItemInstance rh = getPaperdollItem(PAPERDOLL_RHAND); - if ((rh != null) && (rh.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) && !(((rh.getItemType() == WeaponType.BOW) && (item.getItemType() == EtcItemType.ARROW)) || (((rh.getItemType() == WeaponType.CROSSBOW) || (rh.getItemType() == WeaponType.TWOHANDCROSSBOW)) && (item.getItemType() == EtcItemType.BOLT)) || ((rh.getItemType() == WeaponType.FISHINGROD) && (item.getItemType() == EtcItemType.LURE)))) - { - setPaperdollItem(PAPERDOLL_RHAND, null); - } - setPaperdollItem(PAPERDOLL_LHAND, item); - break; + setPaperdollItem(PAPERDOLL_LEAR, item); } - case L2Item.SLOT_R_HAND: + else if (_paperdoll[PAPERDOLL_REAR] == null) { - // don't care about arrows, listener will unequip them (hopefully) - setPaperdollItem(PAPERDOLL_RHAND, item); - break; + setPaperdollItem(PAPERDOLL_REAR, item); } - case L2Item.SLOT_L_EAR: - case L2Item.SLOT_R_EAR: - case L2Item.SLOT_LR_EAR: + else { - if (_paperdoll[PAPERDOLL_LEAR] == null) - { - setPaperdollItem(PAPERDOLL_LEAR, item); - } - else if (_paperdoll[PAPERDOLL_REAR] == null) - { - setPaperdollItem(PAPERDOLL_REAR, item); - } - else - { - setPaperdollItem(PAPERDOLL_LEAR, item); - } - break; + setPaperdollItem(PAPERDOLL_LEAR, item); } - case L2Item.SLOT_L_FINGER: - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_LR_FINGER: + } + else if ((targetSlot == L2Item.SLOT_L_FINGER) || (targetSlot == L2Item.SLOT_R_FINGER) || (targetSlot == L2Item.SLOT_LR_FINGER)) + { + if (_paperdoll[PAPERDOLL_LFINGER] == null) { - if (_paperdoll[PAPERDOLL_LFINGER] == null) - { - setPaperdollItem(PAPERDOLL_LFINGER, item); - } - else if (_paperdoll[PAPERDOLL_RFINGER] == null) - { - setPaperdollItem(PAPERDOLL_RFINGER, item); - } - else - { - setPaperdollItem(PAPERDOLL_LFINGER, item); - } - break; + setPaperdollItem(PAPERDOLL_LFINGER, item); } - case L2Item.SLOT_NECK: + else if (_paperdoll[PAPERDOLL_RFINGER] == null) { - setPaperdollItem(PAPERDOLL_NECK, item); - break; + setPaperdollItem(PAPERDOLL_RFINGER, item); } - case L2Item.SLOT_FULL_ARMOR: + else { - setPaperdollItem(PAPERDOLL_LEGS, null); - setPaperdollItem(PAPERDOLL_CHEST, item); - break; + setPaperdollItem(PAPERDOLL_LFINGER, item); } - case L2Item.SLOT_CHEST: + } + else if (targetSlot == L2Item.SLOT_NECK) + { + setPaperdollItem(PAPERDOLL_NECK, item); + } + else if (targetSlot == L2Item.SLOT_FULL_ARMOR) + { + setPaperdollItem(PAPERDOLL_LEGS, null); + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_CHEST) + { + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_LEGS) + { + final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); + if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) { - setPaperdollItem(PAPERDOLL_CHEST, item); - break; + setPaperdollItem(PAPERDOLL_CHEST, null); } - case L2Item.SLOT_LEGS: - { - // handle full armor - final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); - if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) - { - setPaperdollItem(PAPERDOLL_CHEST, null); - } - setPaperdollItem(PAPERDOLL_LEGS, item); - break; - } - case L2Item.SLOT_FEET: - { - setPaperdollItem(PAPERDOLL_FEET, item); - break; - } - case L2Item.SLOT_GLOVES: - { - setPaperdollItem(PAPERDOLL_GLOVES, item); - break; - } - case L2Item.SLOT_HEAD: - { - setPaperdollItem(PAPERDOLL_HEAD, item); - break; - } - case L2Item.SLOT_HAIR: - { - final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR); - if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) - { - setPaperdollItem(PAPERDOLL_HAIR2, null); - } - else - { - setPaperdollItem(PAPERDOLL_HAIR, null); - } - setPaperdollItem(PAPERDOLL_HAIR, item); - break; - } - case L2Item.SLOT_HAIR2: - { - final L2ItemInstance hair2 = getPaperdollItem(PAPERDOLL_HAIR); - if ((hair2 != null) && (hair2.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) - { - setPaperdollItem(PAPERDOLL_HAIR, null); - } - else - { - setPaperdollItem(PAPERDOLL_HAIR2, null); - } - setPaperdollItem(PAPERDOLL_HAIR2, item); - break; - } - case L2Item.SLOT_HAIRALL: + setPaperdollItem(PAPERDOLL_LEGS, item); + } + else if (targetSlot == L2Item.SLOT_FEET) + { + setPaperdollItem(PAPERDOLL_FEET, item); + } + else if (targetSlot == L2Item.SLOT_GLOVES) + { + setPaperdollItem(PAPERDOLL_GLOVES, item); + } + else if (targetSlot == L2Item.SLOT_HEAD) + { + setPaperdollItem(PAPERDOLL_HEAD, item); + } + else if (targetSlot == L2Item.SLOT_HAIR) + { + final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR); + if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) { setPaperdollItem(PAPERDOLL_HAIR2, null); - setPaperdollItem(PAPERDOLL_HAIR, item); - break; } - case L2Item.SLOT_UNDERWEAR: + else { - setPaperdollItem(PAPERDOLL_UNDER, item); - break; + setPaperdollItem(PAPERDOLL_HAIR, null); } - case L2Item.SLOT_BACK: + setPaperdollItem(PAPERDOLL_HAIR, item); + } + else if (targetSlot == L2Item.SLOT_HAIR2) + { + final L2ItemInstance hair2 = getPaperdollItem(PAPERDOLL_HAIR); + if ((hair2 != null) && (hair2.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) { - setPaperdollItem(PAPERDOLL_CLOAK, item); - break; + setPaperdollItem(PAPERDOLL_HAIR, null); } - case L2Item.SLOT_L_BRACELET: + else { - setPaperdollItem(PAPERDOLL_LBRACELET, item); - break; - } - case L2Item.SLOT_R_BRACELET: - { - setPaperdollItem(PAPERDOLL_RBRACELET, item); - break; - } - case L2Item.SLOT_DECO: - { - equipTalisman(item); - break; - } - case L2Item.SLOT_BELT: - { - setPaperdollItem(PAPERDOLL_BELT, item); - break; - } - case L2Item.SLOT_ALLDRESS: - { - // formal dress - setPaperdollItem(PAPERDOLL_LEGS, null); - setPaperdollItem(PAPERDOLL_LHAND, null); - setPaperdollItem(PAPERDOLL_RHAND, null); - setPaperdollItem(PAPERDOLL_HEAD, null); - setPaperdollItem(PAPERDOLL_FEET, null); - setPaperdollItem(PAPERDOLL_GLOVES, null); - setPaperdollItem(PAPERDOLL_CHEST, item); - break; - } - case L2Item.SLOT_BROOCH: - { - setPaperdollItem(PAPERDOLL_BROOCH, item); - break; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - equipBroochJewel(item); - break; - } - case L2Item.SLOT_AGATHION: - { - equipAgathion(item); - break; - } - default: - { - LOGGER.warning("Unknown body slot " + targetSlot + " for Item ID: " + item.getId()); + setPaperdollItem(PAPERDOLL_HAIR2, null); } + setPaperdollItem(PAPERDOLL_HAIR2, item); + } + else if (targetSlot == L2Item.SLOT_HAIRALL) + { + setPaperdollItem(PAPERDOLL_HAIR2, null); + setPaperdollItem(PAPERDOLL_HAIR, item); + } + else if (targetSlot == L2Item.SLOT_UNDERWEAR) + { + setPaperdollItem(PAPERDOLL_UNDER, item); + } + else if (targetSlot == L2Item.SLOT_BACK) + { + setPaperdollItem(PAPERDOLL_CLOAK, item); + } + else if (targetSlot == L2Item.SLOT_L_BRACELET) + { + setPaperdollItem(PAPERDOLL_LBRACELET, item); + } + else if (targetSlot == L2Item.SLOT_R_BRACELET) + { + setPaperdollItem(PAPERDOLL_RBRACELET, item); + } + else if (targetSlot == L2Item.SLOT_DECO) + { + equipTalisman(item); + } + else if (targetSlot == L2Item.SLOT_BELT) + { + setPaperdollItem(PAPERDOLL_BELT, item); + } + else if (targetSlot == L2Item.SLOT_ALLDRESS) + { + setPaperdollItem(PAPERDOLL_LEGS, null); + setPaperdollItem(PAPERDOLL_LHAND, null); + setPaperdollItem(PAPERDOLL_RHAND, null); + setPaperdollItem(PAPERDOLL_HEAD, null); + setPaperdollItem(PAPERDOLL_FEET, null); + setPaperdollItem(PAPERDOLL_GLOVES, null); + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_BROOCH) + { + setPaperdollItem(PAPERDOLL_BROOCH, item); + } + else if (targetSlot == L2Item.SLOT_BROOCH_JEWEL) + { + equipBroochJewel(item); + } + else if (targetSlot == L2Item.SLOT_AGATHION) + { + equipAgathion(item); + } + else + { + LOGGER.warning("Unknown body slot " + targetSlot + " for Item ID: " + item.getId()); } } @@ -2097,7 +2022,7 @@ public abstract class Inventory extends ItemContainer * Blocks the given item slot from being equipped. * @param itemSlot mask from L2Item */ - public void blockItemSlot(int itemSlot) + public void blockItemSlot(long itemSlot) { _blockedItemSlotsMask |= itemSlot; } @@ -2106,7 +2031,7 @@ public abstract class Inventory extends ItemContainer * Unblocks the given item slot so it can be equipped. * @param itemSlot mask from L2Item */ - public void unblockItemSlot(int itemSlot) + public void unblockItemSlot(long itemSlot) { _blockedItemSlotsMask &= ~itemSlot; } @@ -2115,7 +2040,7 @@ public abstract class Inventory extends ItemContainer * @param itemSlot mask from L2Item * @return if the given item slot is blocked or not. */ - public boolean isItemSlotBlocked(int itemSlot) + public boolean isItemSlotBlocked(long itemSlot) { return (_blockedItemSlotsMask & itemSlot) == itemSlot; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Armor.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Armor.java index dbba43acd0..a492657b7d 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Armor.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Armor.java @@ -41,7 +41,7 @@ public final class L2Armor extends L2Item super.set(set); _type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE); - final int _bodyPart = getBodyPart(); + final long _bodyPart = getBodyPart(); if ((_bodyPart == L2Item.SLOT_NECK) || ((_bodyPart & L2Item.SLOT_L_EAR) != 0) || ((_bodyPart & L2Item.SLOT_L_FINGER) != 0) || ((_bodyPart & L2Item.SLOT_R_BRACELET) != 0) || ((_bodyPart & L2Item.SLOT_L_BRACELET) != 0)) { _type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE; diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Item.java index b7877d1e99..106c84a03a 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -111,7 +111,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable public static final int SLOT_BELT = 0x10000000; public static final int SLOT_BROOCH = 0x20000000; public static final int SLOT_BROOCH_JEWEL = 0x40000000; - public static final int SLOT_AGATHION = 0x80000000; + public static final long SLOT_AGATHION = 0x3000000000L; public static final int SLOT_WOLF = -100; public static final int SLOT_HATCHLING = -101; @@ -134,7 +134,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable private int _duration; private long _time; private int _autoDestroyTime; - private int _bodyPart; + private long _bodyPart; private long _referencePrice; private int _crystalCount; private boolean _sellable; @@ -503,7 +503,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable /** * @return the part of the body used with the item. */ - public final int getBodyPart() + public final long getBodyPart() { return _bodyPart; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java index a2d2ca1f5e..e265dad855 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java @@ -171,7 +171,7 @@ public class L2WarehouseItem /** * @return the part of body used with this item. */ - public final int getBodyPart() + public final long getBodyPart() { return _item.getBodyPart(); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java index d9baca8329..c95df4e66f 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java @@ -49,7 +49,7 @@ public class AppearanceStone private final AppearanceMagicType _magicType; private List _crystalTypes; private List _targetTypes; - private List _bodyParts; + private List _bodyParts; private List _races; private List _racesNot; private List _allVisualIds; @@ -103,7 +103,7 @@ public class AppearanceStone addCrystalType(crystalType); } - final int bodyPart = ItemTable.SLOTS.get(set.getString("bodyPart", "none")); + final long bodyPart = ItemTable.SLOTS.get(set.getString("bodyPart", "none")); if (bodyPart != L2Item.SLOT_NONE) { addBodyPart(bodyPart); @@ -195,7 +195,7 @@ public class AppearanceStone return _targetTypes != null ? _targetTypes : Collections.emptyList(); } - public void addBodyPart(Integer part) + public void addBodyPart(long part) { if (_bodyParts == null) { @@ -218,7 +218,7 @@ public class AppearanceStone return _allVisualIds != null ? _allVisualIds : Collections.emptyList(); } - public List getBodyParts() + public List getBodyParts() { return _bodyParts != null ? _bodyParts : Collections.emptyList(); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java index 241af23261..c105a03b76 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java @@ -54,7 +54,7 @@ public final class EnchantRateItem * Adds body slot verification. * @param slot */ - public void addSlot(int slot) + public void addSlot(long slot) { _slot |= slot; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 10a153adb4..44bc9e5d8a 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -112,13 +112,13 @@ public interface IStatsFunction for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted)) { final L2Item item = equippedItem.getItem(); - final int bodypart = item.getBodyPart(); + final long bodypart = item.getBodyPart(); if ((bodypart == L2Item.SLOT_HAIR) || // (bodypart == L2Item.SLOT_HAIR2) || // (bodypart == L2Item.SLOT_HAIRALL)) { // TODO: Item after enchant shows pDef, but scroll says mDef increase. - if (stat != Stats.PHYSICAL_DEFENCE && stat != Stats.MAGICAL_DEFENCE) + if ((stat != Stats.PHYSICAL_DEFENCE) && (stat != Stats.MAGICAL_DEFENCE)) { continue; } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java index 1a84fae4b6..5711875d56 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java @@ -214,7 +214,7 @@ public class L2SiegeZone extends L2ZoneType } else { - final int slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); + final long slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); activeChar.getInventory().unEquipItemInBodySlot(slot); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index a77a3a8174..3dc650d07c 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -563,7 +563,7 @@ public class EnterWorld implements IClientIncomingPacket } else { - final int slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); + final long slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); activeChar.getInventory().unEquipItemInBodySlot(slot); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 11ae75bb99..c6cf9ececd 100644 --- a/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_5.0_Salvation/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -192,61 +192,49 @@ public final class UseItem implements IClientIncomingPacket activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); return; } - - switch (item.getItem().getBodyPart()) + // Prevent players to equip weapon while wearing combat flag + // Don't allow weapon/shield equipment if a cursed weapon is equipped. + if ((item.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) || (item.getItem().getBodyPart() == L2Item.SLOT_L_HAND) || (item.getItem().getBodyPart() == L2Item.SLOT_R_HAND)) { - case L2Item.SLOT_LR_HAND: - case L2Item.SLOT_L_HAND: - case L2Item.SLOT_R_HAND: + if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) { - // Prevent players to equip weapon while wearing combat flag - if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - - if (activeChar.isMounted() || activeChar.isDisarmed()) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - - // Don't allow weapon/shield equipment if a cursed weapon is equipped. - if (activeChar.isCursedWeaponEquipped()) - { - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } - case L2Item.SLOT_DECO: + if (activeChar.isMounted() || activeChar.isDisarmed()) { - if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } - case L2Item.SLOT_BROOCH_JEWEL: + if (activeChar.isCursedWeaponEquipped()) { - if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) - { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH); - sm.addItemName(item); - activeChar.sendPacket(sm); - return; - } - break; + return; } - case L2Item.SLOT_AGATHION: + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_DECO) + { + if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0)) { - if (!item.isEquipped() && (activeChar.getInventory().getAgathionSlots() == 0)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; + } + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL) + { + if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) + { + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH); + sm.addItemName(item); + activeChar.sendPacket(sm); + return; + } + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_AGATHION) + { + if (!item.isEquipped() && (activeChar.getInventory().getAgathionSlots() == 0)) + { + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } } diff --git a/L2J_Mobius_5.0_Salvation/readme.txt b/L2J_Mobius_5.0_Salvation/readme.txt index 7bfd6a7c8d..2bb11b99ad 100644 --- a/L2J_Mobius_5.0_Salvation/readme.txt +++ b/L2J_Mobius_5.0_Salvation/readme.txt @@ -85,6 +85,7 @@ Salvation: -Parsed new items from client -TODO: Skills -TODO: Skill trees +-New Agathion item support Events: -Birth of Draco diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java index 8fb26ea974..db85c5b687 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/effecthandlers/Disarmor.java @@ -38,14 +38,14 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage; public final class Disarmor extends AbstractEffect { private final Map _unequippedItems; // PlayerObjId, ItemObjId - private final int _slot; + private final long _slot; public Disarmor(StatsSet params) { _unequippedItems = new ConcurrentHashMap<>(); final String slot = params.getString("slot", "chest"); - _slot = ItemTable.SLOTS.getOrDefault(slot, L2Item.SLOT_NONE); + _slot = ItemTable.SLOTS.getOrDefault(slot, (long) L2Item.SLOT_NONE); if (_slot == L2Item.SLOT_NONE) { LOGGER.severe("Unknown bodypart slot for effect: " + slot); diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java index 363a9d65fe..1b7446e991 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/skillconditionhandlers/EquipArmorSkillCondition.java @@ -73,7 +73,7 @@ public class EquipArmorSkillCondition implements ISkillCondition // So from here, chest armor matches conditions - final int chestBodyPart = chest.getItem().getBodyPart(); + final long chestBodyPart = chest.getItem().getBodyPart(); // return True if chest armor is a Full Armor if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java index dd15efb7ce..7eb3e8c960 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/AppearanceItemData.java @@ -102,7 +102,7 @@ public class AppearanceItemData implements IGameXmlReader } case "bodyPart": { - final int part = ItemTable.SLOTS.get(c.getTextContent()); + final long part = ItemTable.SLOTS.get(c.getTextContent()); stone.addBodyPart(part); break; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java index 69ba816691..a4b27841b8 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java @@ -58,7 +58,7 @@ public class ItemTable private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName()); private static Logger LOGGER_ITEMS = Logger.getLogger("item"); - public static final Map SLOTS = new HashMap<>(); + public static final Map SLOTS = new HashMap<>(); private L2Item[] _allTemplates; private final Map _etcItems = new HashMap<>(); @@ -66,45 +66,45 @@ public class ItemTable private final Map _weapons = new HashMap<>(); static { - SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR); - SLOTS.put("lbracelet", L2Item.SLOT_L_BRACELET); - SLOTS.put("rbracelet", L2Item.SLOT_R_BRACELET); - SLOTS.put("talisman", L2Item.SLOT_DECO); - SLOTS.put("chest", L2Item.SLOT_CHEST); - SLOTS.put("fullarmor", L2Item.SLOT_FULL_ARMOR); - SLOTS.put("head", L2Item.SLOT_HEAD); - SLOTS.put("hair", L2Item.SLOT_HAIR); - SLOTS.put("hairall", L2Item.SLOT_HAIRALL); - SLOTS.put("underwear", L2Item.SLOT_UNDERWEAR); - SLOTS.put("back", L2Item.SLOT_BACK); - SLOTS.put("neck", L2Item.SLOT_NECK); - SLOTS.put("legs", L2Item.SLOT_LEGS); - SLOTS.put("feet", L2Item.SLOT_FEET); - SLOTS.put("gloves", L2Item.SLOT_GLOVES); - SLOTS.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); - SLOTS.put("belt", L2Item.SLOT_BELT); - SLOTS.put("rhand", L2Item.SLOT_R_HAND); - SLOTS.put("lhand", L2Item.SLOT_L_HAND); - SLOTS.put("lrhand", L2Item.SLOT_LR_HAND); - SLOTS.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); - SLOTS.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); - SLOTS.put("wolf", L2Item.SLOT_WOLF); - SLOTS.put("greatwolf", L2Item.SLOT_GREATWOLF); - SLOTS.put("hatchling", L2Item.SLOT_HATCHLING); - SLOTS.put("strider", L2Item.SLOT_STRIDER); - SLOTS.put("babypet", L2Item.SLOT_BABYPET); - SLOTS.put("brooch", L2Item.SLOT_BROOCH); - SLOTS.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL); + SLOTS.put("shirt", (long) L2Item.SLOT_UNDERWEAR); + SLOTS.put("lbracelet", (long) L2Item.SLOT_L_BRACELET); + SLOTS.put("rbracelet", (long) L2Item.SLOT_R_BRACELET); + SLOTS.put("talisman", (long) L2Item.SLOT_DECO); + SLOTS.put("chest", (long) L2Item.SLOT_CHEST); + SLOTS.put("fullarmor", (long) L2Item.SLOT_FULL_ARMOR); + SLOTS.put("head", (long) L2Item.SLOT_HEAD); + SLOTS.put("hair", (long) L2Item.SLOT_HAIR); + SLOTS.put("hairall", (long) L2Item.SLOT_HAIRALL); + SLOTS.put("underwear", (long) L2Item.SLOT_UNDERWEAR); + SLOTS.put("back", (long) L2Item.SLOT_BACK); + SLOTS.put("neck", (long) L2Item.SLOT_NECK); + SLOTS.put("legs", (long) L2Item.SLOT_LEGS); + SLOTS.put("feet", (long) L2Item.SLOT_FEET); + SLOTS.put("gloves", (long) L2Item.SLOT_GLOVES); + SLOTS.put("chest,legs", (long) L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); + SLOTS.put("belt", (long) L2Item.SLOT_BELT); + SLOTS.put("rhand", (long) L2Item.SLOT_R_HAND); + SLOTS.put("lhand", (long) L2Item.SLOT_L_HAND); + SLOTS.put("lrhand", (long) L2Item.SLOT_LR_HAND); + SLOTS.put("rear;lear", (long) L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); + SLOTS.put("rfinger;lfinger", (long) L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); + SLOTS.put("wolf", (long) L2Item.SLOT_WOLF); + SLOTS.put("greatwolf", (long) L2Item.SLOT_GREATWOLF); + SLOTS.put("hatchling", (long) L2Item.SLOT_HATCHLING); + SLOTS.put("strider", (long) L2Item.SLOT_STRIDER); + SLOTS.put("babypet", (long) L2Item.SLOT_BABYPET); + SLOTS.put("brooch", (long) L2Item.SLOT_BROOCH); + SLOTS.put("brooch_jewel", (long) L2Item.SLOT_BROOCH_JEWEL); SLOTS.put("agathion", L2Item.SLOT_AGATHION); - SLOTS.put("none", L2Item.SLOT_NONE); + SLOTS.put("none", (long) L2Item.SLOT_NONE); // retail compatibility - SLOTS.put("onepiece", L2Item.SLOT_FULL_ARMOR); - SLOTS.put("hair2", L2Item.SLOT_HAIR2); - SLOTS.put("dhair", L2Item.SLOT_HAIRALL); - SLOTS.put("alldress", L2Item.SLOT_ALLDRESS); - SLOTS.put("deco1", L2Item.SLOT_DECO); - SLOTS.put("waist", L2Item.SLOT_BELT); + SLOTS.put("onepiece", (long) L2Item.SLOT_FULL_ARMOR); + SLOTS.put("hair2", (long) L2Item.SLOT_HAIR2); + SLOTS.put("dhair", (long) L2Item.SLOT_HAIRALL); + SLOTS.put("alldress", (long) L2Item.SLOT_ALLDRESS); + SLOTS.put("deco1", (long) L2Item.SLOT_DECO); + SLOTS.put("waist", (long) L2Item.SLOT_BELT); } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/enums/CrystallizationType.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/enums/CrystallizationType.java index 7a7abafdf1..c1c30115d6 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/enums/CrystallizationType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/enums/CrystallizationType.java @@ -40,19 +40,16 @@ public enum CrystallizationType { return ARMOR; } - switch (item.getBodyPart()) + if ((item.getBodyPart() == L2Item.SLOT_R_EAR) // + || (item.getBodyPart() == L2Item.SLOT_L_EAR) // + || (item.getBodyPart() == L2Item.SLOT_R_FINGER) // + || (item.getBodyPart() == L2Item.SLOT_L_FINGER) // + || (item.getBodyPart() == L2Item.SLOT_NECK) // + || (item.getBodyPart() == L2Item.SLOT_HAIR) // + || (item.getBodyPart() == L2Item.SLOT_HAIR2) // + || (item.getBodyPart() == L2Item.SLOT_HAIRALL)) { - case L2Item.SLOT_R_EAR: - case L2Item.SLOT_L_EAR: - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_L_FINGER: - case L2Item.SLOT_NECK: - case L2Item.SLOT_HAIR: - case L2Item.SLOT_HAIR2: - case L2Item.SLOT_HAIRALL: - { - return ACCESORY; - } + return ACCESORY; } return NONE; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CombatFlag.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CombatFlag.java index 6bb59c8fba..8576c15fab 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CombatFlag.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CombatFlag.java @@ -104,7 +104,7 @@ public class CombatFlag { // Reset player stats _player.setCombatFlagEquipped(false); - final int slot = _player.getInventory().getSlotFromItem(_item); + final long slot = _player.getInventory().getSlotFromItem(_item); _player.getInventory().unEquipItemInBodySlot(slot); _player.destroyItem("CombatFlag", _item, null, true); _item = null; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java index bc4c93871a..0a16b9171c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java @@ -2168,7 +2168,7 @@ public final class L2PcInstance extends L2Playable } sendPacket(sm); - final int slot = _inventory.getSlotFromItem(item); + final long slot = _inventory.getSlotFromItem(item); // we can't unequip talisman by body slot if ((slot == L2Item.SLOT_DECO) || (slot == L2Item.SLOT_BROOCH_JEWEL) || (slot == L2Item.SLOT_AGATHION)) { @@ -4957,7 +4957,7 @@ public final class L2PcInstance extends L2Playable } else { - final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); + final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); _inventory.unEquipItemInBodySlot(slot); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); } @@ -10813,7 +10813,7 @@ public final class L2PcInstance extends L2Playable } else { - final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); + final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); _inventory.unEquipItemInBodySlot(slot); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java index ee85aeabd0..9a8fb90a18 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/conditions/ConditionUsingItemType.java @@ -70,7 +70,7 @@ public final class ConditionUsingItemType extends Condition // So from here, chest armor matches conditions - final int chestBodyPart = chest.getItem().getBodyPart(); + final long chestBodyPart = chest.getItem().getBodyPart(); // return True if chest armor is a Full Armor if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) { diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java index cb609618fd..b4ba43d7ba 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/holders/AppearanceHolder.java @@ -35,7 +35,7 @@ public class AppearanceHolder private final AppearanceHandType _handType; private final AppearanceMagicType _magicType; private final AppearanceTargetType _targetType; - private final Integer _bodyPart; + private final long _bodyPart; public AppearanceHolder(StatsSet set) { @@ -73,7 +73,7 @@ public class AppearanceHolder return _targetType; } - public int getBodyPart() + public long getBodyPart() { return _bodyPart; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java index 8652a23a71..f6e59673e5 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java @@ -902,108 +902,104 @@ public abstract class Inventory extends ItemContainer return _paperdoll[slot] == null; } - public static int getPaperdollIndex(int slot) + public boolean isPaperdollSlotNotEmpty(int slot) { - switch (slot) + return _paperdoll[slot] != null; + } + + public static int getPaperdollIndex(long slot) + { + if (slot == L2Item.SLOT_UNDERWEAR) { - case L2Item.SLOT_UNDERWEAR: - { - return PAPERDOLL_UNDER; - } - case L2Item.SLOT_R_EAR: - { - return PAPERDOLL_REAR; - } - case L2Item.SLOT_LR_EAR: - case L2Item.SLOT_L_EAR: - { - return PAPERDOLL_LEAR; - } - case L2Item.SLOT_NECK: - { - return PAPERDOLL_NECK; - } - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_LR_FINGER: - { - return PAPERDOLL_RFINGER; - } - case L2Item.SLOT_L_FINGER: - { - return PAPERDOLL_LFINGER; - } - case L2Item.SLOT_HEAD: - { - return PAPERDOLL_HEAD; - } - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LR_HAND: - { - return PAPERDOLL_RHAND; - } - case L2Item.SLOT_L_HAND: - { - return PAPERDOLL_LHAND; - } - case L2Item.SLOT_GLOVES: - { - return PAPERDOLL_GLOVES; - } - case L2Item.SLOT_CHEST: - case L2Item.SLOT_FULL_ARMOR: - case L2Item.SLOT_ALLDRESS: - { - return PAPERDOLL_CHEST; - } - case L2Item.SLOT_LEGS: - { - return PAPERDOLL_LEGS; - } - case L2Item.SLOT_FEET: - { - return PAPERDOLL_FEET; - } - case L2Item.SLOT_BACK: - { - return PAPERDOLL_CLOAK; - } - case L2Item.SLOT_HAIR: - case L2Item.SLOT_HAIRALL: - { - return PAPERDOLL_HAIR; - } - case L2Item.SLOT_HAIR2: - { - return PAPERDOLL_HAIR2; - } - case L2Item.SLOT_R_BRACELET: - { - return PAPERDOLL_RBRACELET; - } - case L2Item.SLOT_L_BRACELET: - { - return PAPERDOLL_LBRACELET; - } - case L2Item.SLOT_DECO: - { - return PAPERDOLL_DECO1; // return first we deal with it later - } - case L2Item.SLOT_BELT: - { - return PAPERDOLL_BELT; - } - case L2Item.SLOT_BROOCH: - { - return PAPERDOLL_BROOCH; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - return PAPERDOLL_BROOCH_JEWEL1; - } - case L2Item.SLOT_AGATHION: - { - return PAPERDOLL_AGATHION1; - } + return PAPERDOLL_UNDER; + } + else if (slot == L2Item.SLOT_R_EAR) + { + return PAPERDOLL_REAR; + } + else if ((slot == L2Item.SLOT_LR_EAR) || (slot == L2Item.SLOT_L_EAR)) + { + return PAPERDOLL_LEAR; + } + else if (slot == L2Item.SLOT_NECK) + { + return PAPERDOLL_NECK; + } + else if ((slot == L2Item.SLOT_R_FINGER) || (slot == L2Item.SLOT_LR_FINGER)) + { + return PAPERDOLL_RFINGER; + } + else if (slot == L2Item.SLOT_L_FINGER) + { + return PAPERDOLL_LFINGER; + } + else if (slot == L2Item.SLOT_HEAD) + { + return PAPERDOLL_HEAD; + } + else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND)) + { + return PAPERDOLL_RHAND; + } + else if (slot == L2Item.SLOT_L_HAND) + { + return PAPERDOLL_LHAND; + } + else if (slot == L2Item.SLOT_GLOVES) + { + return PAPERDOLL_GLOVES; + } + else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_FULL_ARMOR) || (slot == L2Item.SLOT_ALLDRESS)) + { + return PAPERDOLL_CHEST; + } + else if (slot == L2Item.SLOT_LEGS) + { + return PAPERDOLL_LEGS; + } + else if (slot == L2Item.SLOT_FEET) + { + return PAPERDOLL_FEET; + } + else if (slot == L2Item.SLOT_BACK) + { + return PAPERDOLL_CLOAK; + } + else if ((slot == L2Item.SLOT_HAIR) || (slot == L2Item.SLOT_HAIRALL)) + { + return PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HAIR2) + { + return PAPERDOLL_HAIR2; + } + else if (slot == L2Item.SLOT_R_BRACELET) + { + return PAPERDOLL_RBRACELET; + } + else if (slot == L2Item.SLOT_L_BRACELET) + { + return PAPERDOLL_LBRACELET; + } + else if (slot == L2Item.SLOT_DECO) + { + return PAPERDOLL_DECO1; // return first we deal with it later + } + else if (slot == L2Item.SLOT_BELT) + { + return PAPERDOLL_BELT; + } + else if (slot == L2Item.SLOT_BROOCH) + { + return PAPERDOLL_BROOCH; + } + else if (slot == L2Item.SLOT_BROOCH_JEWEL) + { + return PAPERDOLL_BROOCH_JEWEL1; + } + else if (slot == L2Item.SLOT_AGATHION) + { + return PAPERDOLL_AGATHION1; } return -1; } @@ -1174,9 +1170,9 @@ public abstract class Inventory extends ItemContainer return _wearedMask; } - public int getSlotFromItem(L2ItemInstance item) + public long getSlotFromItem(L2ItemInstance item) { - int slot = -1; + long slot = -1; final int location = item.getLocationSlot(); switch (location) { @@ -1315,11 +1311,11 @@ public abstract class Inventory extends ItemContainer /** * Unequips item in body slot and returns alterations.
- * If you dont need return value use {@link Inventory#unEquipItemInBodySlot(int)} instead + * If you dont need return value use {@link Inventory#unEquipItemInBodySlot(long)} instead * @param slot : int designating the slot of the paperdoll * @return L2ItemInstance[] : list of changes */ - public L2ItemInstance[] unEquipItemInBodySlotAndRecord(int slot) + public L2ItemInstance[] unEquipItemInBodySlotAndRecord(long slot) { final ChangeRecorder recorder = newRecorder(); @@ -1374,141 +1370,111 @@ public abstract class Inventory extends ItemContainer * @param slot : int designating the slot * @return {@link L2ItemInstance} designating the item placed in the slot */ - public L2ItemInstance unEquipItemInBodySlot(int slot) + public L2ItemInstance unEquipItemInBodySlot(long slot) { int pdollSlot = -1; - switch (slot) + if (slot == L2Item.SLOT_L_EAR) { - case L2Item.SLOT_L_EAR: - { - pdollSlot = PAPERDOLL_LEAR; - break; - } - case L2Item.SLOT_R_EAR: - { - pdollSlot = PAPERDOLL_REAR; - break; - } - case L2Item.SLOT_NECK: - { - pdollSlot = PAPERDOLL_NECK; - break; - } - case L2Item.SLOT_R_FINGER: - { - pdollSlot = PAPERDOLL_RFINGER; - break; - } - case L2Item.SLOT_L_FINGER: - { - pdollSlot = PAPERDOLL_LFINGER; - break; - } - case L2Item.SLOT_HAIR: - { - pdollSlot = PAPERDOLL_HAIR; - break; - } - case L2Item.SLOT_HAIR2: - { - pdollSlot = PAPERDOLL_HAIR2; - break; - } - case L2Item.SLOT_HAIRALL: - { - setPaperdollItem(PAPERDOLL_HAIR, null); - pdollSlot = PAPERDOLL_HAIR; - break; - } - case L2Item.SLOT_HEAD: - { - pdollSlot = PAPERDOLL_HEAD; - break; - } - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LR_HAND: - { - pdollSlot = PAPERDOLL_RHAND; - break; - } - case L2Item.SLOT_L_HAND: - { - pdollSlot = PAPERDOLL_LHAND; - break; - } - case L2Item.SLOT_GLOVES: - { - pdollSlot = PAPERDOLL_GLOVES; - break; - } - case L2Item.SLOT_CHEST: - case L2Item.SLOT_ALLDRESS: - case L2Item.SLOT_FULL_ARMOR: - { - pdollSlot = PAPERDOLL_CHEST; - break; - } - case L2Item.SLOT_LEGS: - { - pdollSlot = PAPERDOLL_LEGS; - break; - } - case L2Item.SLOT_BACK: - { - pdollSlot = PAPERDOLL_CLOAK; - break; - } - case L2Item.SLOT_FEET: - { - pdollSlot = PAPERDOLL_FEET; - break; - } - case L2Item.SLOT_UNDERWEAR: - { - pdollSlot = PAPERDOLL_UNDER; - break; - } - case L2Item.SLOT_L_BRACELET: - { - pdollSlot = PAPERDOLL_LBRACELET; - break; - } - case L2Item.SLOT_R_BRACELET: - { - pdollSlot = PAPERDOLL_RBRACELET; - break; - } - case L2Item.SLOT_DECO: - { - pdollSlot = PAPERDOLL_DECO1; - break; - } - case L2Item.SLOT_BELT: - { - pdollSlot = PAPERDOLL_BELT; - break; - } - case L2Item.SLOT_BROOCH: - { - pdollSlot = PAPERDOLL_BROOCH; - break; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - pdollSlot = PAPERDOLL_BROOCH_JEWEL1; - break; - } - case L2Item.SLOT_AGATHION: - { - pdollSlot = PAPERDOLL_AGATHION1; - break; - } - default: - { - LOGGER.info("Unhandled slot type: " + slot); - LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace())); - } + pdollSlot = PAPERDOLL_LEAR; + } + else if (slot == L2Item.SLOT_R_EAR) + { + pdollSlot = PAPERDOLL_REAR; + } + else if (slot == L2Item.SLOT_NECK) + { + pdollSlot = PAPERDOLL_NECK; + } + else if (slot == L2Item.SLOT_R_FINGER) + { + pdollSlot = PAPERDOLL_RFINGER; + } + else if (slot == L2Item.SLOT_L_FINGER) + { + pdollSlot = PAPERDOLL_LFINGER; + } + else if (slot == L2Item.SLOT_HAIR) + { + pdollSlot = PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HAIR2) + { + pdollSlot = PAPERDOLL_HAIR2; + } + else if (slot == L2Item.SLOT_HAIRALL) + { + setPaperdollItem(PAPERDOLL_HAIR, null); + pdollSlot = PAPERDOLL_HAIR; + } + else if (slot == L2Item.SLOT_HEAD) + { + pdollSlot = PAPERDOLL_HEAD; + } + else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND)) + { + pdollSlot = PAPERDOLL_RHAND; + } + else if (slot == L2Item.SLOT_L_HAND) + { + pdollSlot = PAPERDOLL_LHAND; + } + else if (slot == L2Item.SLOT_GLOVES) + { + pdollSlot = PAPERDOLL_GLOVES; + } + else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_ALLDRESS) || (slot == L2Item.SLOT_FULL_ARMOR)) + { + pdollSlot = PAPERDOLL_CHEST; + } + else if (slot == L2Item.SLOT_LEGS) + { + pdollSlot = PAPERDOLL_LEGS; + } + else if (slot == L2Item.SLOT_BACK) + { + pdollSlot = PAPERDOLL_CLOAK; + } + else if (slot == L2Item.SLOT_FEET) + { + pdollSlot = PAPERDOLL_FEET; + } + else if (slot == L2Item.SLOT_UNDERWEAR) + { + pdollSlot = PAPERDOLL_UNDER; + } + else if (slot == L2Item.SLOT_L_BRACELET) + { + pdollSlot = PAPERDOLL_LBRACELET; + } + else if (slot == L2Item.SLOT_R_BRACELET) + { + pdollSlot = PAPERDOLL_RBRACELET; + } + else if (slot == L2Item.SLOT_DECO) + { + pdollSlot = PAPERDOLL_DECO1; + } + else if (slot == L2Item.SLOT_BELT) + { + pdollSlot = PAPERDOLL_BELT; + } + else if (slot == L2Item.SLOT_BROOCH) + { + pdollSlot = PAPERDOLL_BROOCH; + } + else if (slot == L2Item.SLOT_BROOCH_JEWEL) + { + pdollSlot = PAPERDOLL_BROOCH_JEWEL1; + } + else if (slot == L2Item.SLOT_AGATHION) + { + pdollSlot = PAPERDOLL_AGATHION1; + } + else + { + LOGGER.info("Unhandled slot type: " + slot); + LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace())); } if (pdollSlot >= 0) { @@ -1567,225 +1533,184 @@ public abstract class Inventory extends ItemContainer } } - final int targetSlot = item.getItem().getBodyPart(); + final long targetSlot = item.getItem().getBodyPart(); // Check if player is using Formal Wear and item isn't Wedding Bouquet. final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST); if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS)) { // only chest target can pass this - switch (targetSlot) + if ((targetSlot == L2Item.SLOT_LR_HAND) || (targetSlot == L2Item.SLOT_L_HAND) || (targetSlot == L2Item.SLOT_R_HAND) || (targetSlot == L2Item.SLOT_LEGS) || (targetSlot == L2Item.SLOT_FEET) || (targetSlot == L2Item.SLOT_GLOVES) || (targetSlot == L2Item.SLOT_HEAD)) { - case L2Item.SLOT_LR_HAND: - case L2Item.SLOT_L_HAND: - case L2Item.SLOT_R_HAND: - case L2Item.SLOT_LEGS: - case L2Item.SLOT_FEET: - case L2Item.SLOT_GLOVES: - case L2Item.SLOT_HEAD: - { - return; - } + return; } } - switch (targetSlot) + // don't care about arrows, listener will unequip them (hopefully) + // handle full armor + // formal dress + if (targetSlot == L2Item.SLOT_LR_HAND) { - case L2Item.SLOT_LR_HAND: + setPaperdollItem(PAPERDOLL_LHAND, null); + setPaperdollItem(PAPERDOLL_RHAND, item); + } + else if (targetSlot == L2Item.SLOT_L_HAND) + { + final L2ItemInstance rh = getPaperdollItem(PAPERDOLL_RHAND); + if ((rh != null) && (rh.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) && !(((rh.getItemType() == WeaponType.BOW) && (item.getItemType() == EtcItemType.ARROW)) || (((rh.getItemType() == WeaponType.CROSSBOW) || (rh.getItemType() == WeaponType.TWOHANDCROSSBOW)) && (item.getItemType() == EtcItemType.BOLT)) || ((rh.getItemType() == WeaponType.FISHINGROD) && (item.getItemType() == EtcItemType.LURE)))) { - setPaperdollItem(PAPERDOLL_LHAND, null); - setPaperdollItem(PAPERDOLL_RHAND, item); - break; + setPaperdollItem(PAPERDOLL_RHAND, null); } - case L2Item.SLOT_L_HAND: + setPaperdollItem(PAPERDOLL_LHAND, item); + } + else if (targetSlot == L2Item.SLOT_R_HAND) + { + setPaperdollItem(PAPERDOLL_RHAND, item); + } + else if ((targetSlot == L2Item.SLOT_L_EAR) || (targetSlot == L2Item.SLOT_R_EAR) || (targetSlot == L2Item.SLOT_LR_EAR)) + { + if (_paperdoll[PAPERDOLL_LEAR] == null) { - final L2ItemInstance rh = getPaperdollItem(PAPERDOLL_RHAND); - if ((rh != null) && (rh.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) && !(((rh.getItemType() == WeaponType.BOW) && (item.getItemType() == EtcItemType.ARROW)) || (((rh.getItemType() == WeaponType.CROSSBOW) || (rh.getItemType() == WeaponType.TWOHANDCROSSBOW)) && (item.getItemType() == EtcItemType.BOLT)) || ((rh.getItemType() == WeaponType.FISHINGROD) && (item.getItemType() == EtcItemType.LURE)))) - { - setPaperdollItem(PAPERDOLL_RHAND, null); - } - setPaperdollItem(PAPERDOLL_LHAND, item); - break; + setPaperdollItem(PAPERDOLL_LEAR, item); } - case L2Item.SLOT_R_HAND: + else if (_paperdoll[PAPERDOLL_REAR] == null) { - // don't care about arrows, listener will unequip them (hopefully) - setPaperdollItem(PAPERDOLL_RHAND, item); - break; + setPaperdollItem(PAPERDOLL_REAR, item); } - case L2Item.SLOT_L_EAR: - case L2Item.SLOT_R_EAR: - case L2Item.SLOT_LR_EAR: + else { - if (_paperdoll[PAPERDOLL_LEAR] == null) - { - setPaperdollItem(PAPERDOLL_LEAR, item); - } - else if (_paperdoll[PAPERDOLL_REAR] == null) - { - setPaperdollItem(PAPERDOLL_REAR, item); - } - else - { - setPaperdollItem(PAPERDOLL_LEAR, item); - } - break; + setPaperdollItem(PAPERDOLL_LEAR, item); } - case L2Item.SLOT_L_FINGER: - case L2Item.SLOT_R_FINGER: - case L2Item.SLOT_LR_FINGER: + } + else if ((targetSlot == L2Item.SLOT_L_FINGER) || (targetSlot == L2Item.SLOT_R_FINGER) || (targetSlot == L2Item.SLOT_LR_FINGER)) + { + if (_paperdoll[PAPERDOLL_LFINGER] == null) { - if (_paperdoll[PAPERDOLL_LFINGER] == null) - { - setPaperdollItem(PAPERDOLL_LFINGER, item); - } - else if (_paperdoll[PAPERDOLL_RFINGER] == null) - { - setPaperdollItem(PAPERDOLL_RFINGER, item); - } - else - { - setPaperdollItem(PAPERDOLL_LFINGER, item); - } - break; + setPaperdollItem(PAPERDOLL_LFINGER, item); } - case L2Item.SLOT_NECK: + else if (_paperdoll[PAPERDOLL_RFINGER] == null) { - setPaperdollItem(PAPERDOLL_NECK, item); - break; + setPaperdollItem(PAPERDOLL_RFINGER, item); } - case L2Item.SLOT_FULL_ARMOR: + else { - setPaperdollItem(PAPERDOLL_LEGS, null); - setPaperdollItem(PAPERDOLL_CHEST, item); - break; + setPaperdollItem(PAPERDOLL_LFINGER, item); } - case L2Item.SLOT_CHEST: + } + else if (targetSlot == L2Item.SLOT_NECK) + { + setPaperdollItem(PAPERDOLL_NECK, item); + } + else if (targetSlot == L2Item.SLOT_FULL_ARMOR) + { + setPaperdollItem(PAPERDOLL_LEGS, null); + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_CHEST) + { + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_LEGS) + { + final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); + if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) { - setPaperdollItem(PAPERDOLL_CHEST, item); - break; + setPaperdollItem(PAPERDOLL_CHEST, null); } - case L2Item.SLOT_LEGS: - { - // handle full armor - final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); - if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) - { - setPaperdollItem(PAPERDOLL_CHEST, null); - } - setPaperdollItem(PAPERDOLL_LEGS, item); - break; - } - case L2Item.SLOT_FEET: - { - setPaperdollItem(PAPERDOLL_FEET, item); - break; - } - case L2Item.SLOT_GLOVES: - { - setPaperdollItem(PAPERDOLL_GLOVES, item); - break; - } - case L2Item.SLOT_HEAD: - { - setPaperdollItem(PAPERDOLL_HEAD, item); - break; - } - case L2Item.SLOT_HAIR: - { - final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR); - if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) - { - setPaperdollItem(PAPERDOLL_HAIR2, null); - } - else - { - setPaperdollItem(PAPERDOLL_HAIR, null); - } - setPaperdollItem(PAPERDOLL_HAIR, item); - break; - } - case L2Item.SLOT_HAIR2: - { - final L2ItemInstance hair2 = getPaperdollItem(PAPERDOLL_HAIR); - if ((hair2 != null) && (hair2.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) - { - setPaperdollItem(PAPERDOLL_HAIR, null); - } - else - { - setPaperdollItem(PAPERDOLL_HAIR2, null); - } - setPaperdollItem(PAPERDOLL_HAIR2, item); - break; - } - case L2Item.SLOT_HAIRALL: + setPaperdollItem(PAPERDOLL_LEGS, item); + } + else if (targetSlot == L2Item.SLOT_FEET) + { + setPaperdollItem(PAPERDOLL_FEET, item); + } + else if (targetSlot == L2Item.SLOT_GLOVES) + { + setPaperdollItem(PAPERDOLL_GLOVES, item); + } + else if (targetSlot == L2Item.SLOT_HEAD) + { + setPaperdollItem(PAPERDOLL_HEAD, item); + } + else if (targetSlot == L2Item.SLOT_HAIR) + { + final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR); + if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) { setPaperdollItem(PAPERDOLL_HAIR2, null); - setPaperdollItem(PAPERDOLL_HAIR, item); - break; } - case L2Item.SLOT_UNDERWEAR: + else { - setPaperdollItem(PAPERDOLL_UNDER, item); - break; + setPaperdollItem(PAPERDOLL_HAIR, null); } - case L2Item.SLOT_BACK: + setPaperdollItem(PAPERDOLL_HAIR, item); + } + else if (targetSlot == L2Item.SLOT_HAIR2) + { + final L2ItemInstance hair2 = getPaperdollItem(PAPERDOLL_HAIR); + if ((hair2 != null) && (hair2.getItem().getBodyPart() == L2Item.SLOT_HAIRALL)) { - setPaperdollItem(PAPERDOLL_CLOAK, item); - break; + setPaperdollItem(PAPERDOLL_HAIR, null); } - case L2Item.SLOT_L_BRACELET: + else { - setPaperdollItem(PAPERDOLL_LBRACELET, item); - break; - } - case L2Item.SLOT_R_BRACELET: - { - setPaperdollItem(PAPERDOLL_RBRACELET, item); - break; - } - case L2Item.SLOT_DECO: - { - equipTalisman(item); - break; - } - case L2Item.SLOT_BELT: - { - setPaperdollItem(PAPERDOLL_BELT, item); - break; - } - case L2Item.SLOT_ALLDRESS: - { - // formal dress - setPaperdollItem(PAPERDOLL_LEGS, null); - setPaperdollItem(PAPERDOLL_LHAND, null); - setPaperdollItem(PAPERDOLL_RHAND, null); - setPaperdollItem(PAPERDOLL_HEAD, null); - setPaperdollItem(PAPERDOLL_FEET, null); - setPaperdollItem(PAPERDOLL_GLOVES, null); - setPaperdollItem(PAPERDOLL_CHEST, item); - break; - } - case L2Item.SLOT_BROOCH: - { - setPaperdollItem(PAPERDOLL_BROOCH, item); - break; - } - case L2Item.SLOT_BROOCH_JEWEL: - { - equipBroochJewel(item); - break; - } - case L2Item.SLOT_AGATHION: - { - equipAgathion(item); - break; - } - default: - { - LOGGER.warning("Unknown body slot " + targetSlot + " for Item ID: " + item.getId()); + setPaperdollItem(PAPERDOLL_HAIR2, null); } + setPaperdollItem(PAPERDOLL_HAIR2, item); + } + else if (targetSlot == L2Item.SLOT_HAIRALL) + { + setPaperdollItem(PAPERDOLL_HAIR2, null); + setPaperdollItem(PAPERDOLL_HAIR, item); + } + else if (targetSlot == L2Item.SLOT_UNDERWEAR) + { + setPaperdollItem(PAPERDOLL_UNDER, item); + } + else if (targetSlot == L2Item.SLOT_BACK) + { + setPaperdollItem(PAPERDOLL_CLOAK, item); + } + else if (targetSlot == L2Item.SLOT_L_BRACELET) + { + setPaperdollItem(PAPERDOLL_LBRACELET, item); + } + else if (targetSlot == L2Item.SLOT_R_BRACELET) + { + setPaperdollItem(PAPERDOLL_RBRACELET, item); + } + else if (targetSlot == L2Item.SLOT_DECO) + { + equipTalisman(item); + } + else if (targetSlot == L2Item.SLOT_BELT) + { + setPaperdollItem(PAPERDOLL_BELT, item); + } + else if (targetSlot == L2Item.SLOT_ALLDRESS) + { + setPaperdollItem(PAPERDOLL_LEGS, null); + setPaperdollItem(PAPERDOLL_LHAND, null); + setPaperdollItem(PAPERDOLL_RHAND, null); + setPaperdollItem(PAPERDOLL_HEAD, null); + setPaperdollItem(PAPERDOLL_FEET, null); + setPaperdollItem(PAPERDOLL_GLOVES, null); + setPaperdollItem(PAPERDOLL_CHEST, item); + } + else if (targetSlot == L2Item.SLOT_BROOCH) + { + setPaperdollItem(PAPERDOLL_BROOCH, item); + } + else if (targetSlot == L2Item.SLOT_BROOCH_JEWEL) + { + equipBroochJewel(item); + } + else if (targetSlot == L2Item.SLOT_AGATHION) + { + equipAgathion(item); + } + else + { + LOGGER.warning("Unknown body slot " + targetSlot + " for Item ID: " + item.getId()); } } @@ -2097,7 +2022,7 @@ public abstract class Inventory extends ItemContainer * Blocks the given item slot from being equipped. * @param itemSlot mask from L2Item */ - public void blockItemSlot(int itemSlot) + public void blockItemSlot(long itemSlot) { _blockedItemSlotsMask |= itemSlot; } @@ -2106,7 +2031,7 @@ public abstract class Inventory extends ItemContainer * Unblocks the given item slot so it can be equipped. * @param itemSlot mask from L2Item */ - public void unblockItemSlot(int itemSlot) + public void unblockItemSlot(long itemSlot) { _blockedItemSlotsMask &= ~itemSlot; } @@ -2115,7 +2040,7 @@ public abstract class Inventory extends ItemContainer * @param itemSlot mask from L2Item * @return if the given item slot is blocked or not. */ - public boolean isItemSlotBlocked(int itemSlot) + public boolean isItemSlotBlocked(long itemSlot) { return (_blockedItemSlotsMask & itemSlot) == itemSlot; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Armor.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Armor.java index dbba43acd0..a492657b7d 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Armor.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Armor.java @@ -41,7 +41,7 @@ public final class L2Armor extends L2Item super.set(set); _type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE); - final int _bodyPart = getBodyPart(); + final long _bodyPart = getBodyPart(); if ((_bodyPart == L2Item.SLOT_NECK) || ((_bodyPart & L2Item.SLOT_L_EAR) != 0) || ((_bodyPart & L2Item.SLOT_L_FINGER) != 0) || ((_bodyPart & L2Item.SLOT_R_BRACELET) != 0) || ((_bodyPart & L2Item.SLOT_L_BRACELET) != 0)) { _type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE; diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java index a97d3aacff..4ceded8379 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2Item.java @@ -111,7 +111,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable public static final int SLOT_BELT = 0x10000000; public static final int SLOT_BROOCH = 0x20000000; public static final int SLOT_BROOCH_JEWEL = 0x40000000; - public static final int SLOT_AGATHION = 0x80000000; + public static final long SLOT_AGATHION = 0x3000000000L; public static final int SLOT_WOLF = -100; public static final int SLOT_HATCHLING = -101; @@ -134,7 +134,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable private int _duration; private long _time; private int _autoDestroyTime; - private int _bodyPart; + private long _bodyPart; private int _referencePrice; private int _crystalCount; private boolean _sellable; @@ -507,7 +507,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable /** * @return the part of the body used with the item. */ - public final int getBodyPart() + public final long getBodyPart() { return _bodyPart; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java index a2d2ca1f5e..e265dad855 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/L2WarehouseItem.java @@ -171,7 +171,7 @@ public class L2WarehouseItem /** * @return the part of body used with this item. */ - public final int getBodyPart() + public final long getBodyPart() { return _item.getBodyPart(); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java index d9baca8329..c95df4e66f 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/appearance/AppearanceStone.java @@ -49,7 +49,7 @@ public class AppearanceStone private final AppearanceMagicType _magicType; private List _crystalTypes; private List _targetTypes; - private List _bodyParts; + private List _bodyParts; private List _races; private List _racesNot; private List _allVisualIds; @@ -103,7 +103,7 @@ public class AppearanceStone addCrystalType(crystalType); } - final int bodyPart = ItemTable.SLOTS.get(set.getString("bodyPart", "none")); + final long bodyPart = ItemTable.SLOTS.get(set.getString("bodyPart", "none")); if (bodyPart != L2Item.SLOT_NONE) { addBodyPart(bodyPart); @@ -195,7 +195,7 @@ public class AppearanceStone return _targetTypes != null ? _targetTypes : Collections.emptyList(); } - public void addBodyPart(Integer part) + public void addBodyPart(long part) { if (_bodyParts == null) { @@ -218,7 +218,7 @@ public class AppearanceStone return _allVisualIds != null ? _allVisualIds : Collections.emptyList(); } - public List getBodyParts() + public List getBodyParts() { return _bodyParts != null ? _bodyParts : Collections.emptyList(); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java index 241af23261..c105a03b76 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/enchant/EnchantRateItem.java @@ -54,7 +54,7 @@ public final class EnchantRateItem * Adds body slot verification. * @param slot */ - public void addSlot(int slot) + public void addSlot(long slot) { _slot |= slot; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java index 10a153adb4..44bc9e5d8a 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/stats/IStatsFunction.java @@ -112,13 +112,13 @@ public interface IStatsFunction for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted)) { final L2Item item = equippedItem.getItem(); - final int bodypart = item.getBodyPart(); + final long bodypart = item.getBodyPart(); if ((bodypart == L2Item.SLOT_HAIR) || // (bodypart == L2Item.SLOT_HAIR2) || // (bodypart == L2Item.SLOT_HAIRALL)) { // TODO: Item after enchant shows pDef, but scroll says mDef increase. - if (stat != Stats.PHYSICAL_DEFENCE && stat != Stats.MAGICAL_DEFENCE) + if ((stat != Stats.PHYSICAL_DEFENCE) && (stat != Stats.MAGICAL_DEFENCE)) { continue; } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java index 1a84fae4b6..5711875d56 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/zone/type/L2SiegeZone.java @@ -214,7 +214,7 @@ public class L2SiegeZone extends L2ZoneType } else { - final int slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); + final long slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); activeChar.getInventory().unEquipItemInBodySlot(slot); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 2c8f91608b..ab403a0e59 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -564,7 +564,7 @@ public class EnterWorld implements IClientIncomingPacket } else { - final int slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); + final long slot = activeChar.getInventory().getSlotFromItem(activeChar.getInventory().getItemByItemId(9819)); activeChar.getInventory().unEquipItemInBodySlot(slot); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java index 7c24354f3f..61dc3e3dcc 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/UseItem.java @@ -192,61 +192,49 @@ public final class UseItem implements IClientIncomingPacket activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); return; } - - switch (item.getItem().getBodyPart()) + // Prevent players to equip weapon while wearing combat flag + // Don't allow weapon/shield equipment if a cursed weapon is equipped. + if ((item.getItem().getBodyPart() == L2Item.SLOT_LR_HAND) || (item.getItem().getBodyPart() == L2Item.SLOT_L_HAND) || (item.getItem().getBodyPart() == L2Item.SLOT_R_HAND)) { - case L2Item.SLOT_LR_HAND: - case L2Item.SLOT_L_HAND: - case L2Item.SLOT_R_HAND: + if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) { - // Prevent players to equip weapon while wearing combat flag - if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - - if (activeChar.isMounted() || activeChar.isDisarmed()) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - - // Don't allow weapon/shield equipment if a cursed weapon is equipped. - if (activeChar.isCursedWeaponEquipped()) - { - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } - case L2Item.SLOT_DECO: + if (activeChar.isMounted() || activeChar.isDisarmed()) { - if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } - case L2Item.SLOT_BROOCH_JEWEL: + if (activeChar.isCursedWeaponEquipped()) { - if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) - { - final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH); - sm.addItemName(item); - activeChar.sendPacket(sm); - return; - } - break; + return; } - case L2Item.SLOT_AGATHION: + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_DECO) + { + if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0)) { - if (!item.isEquipped() && (activeChar.getInventory().getAgathionSlots() == 0)) - { - activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); - return; - } - break; + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; + } + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL) + { + if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) + { + final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH); + sm.addItemName(item); + activeChar.sendPacket(sm); + return; + } + } + else if (item.getItem().getBodyPart() == L2Item.SLOT_AGATHION) + { + if (!item.isEquipped() && (activeChar.getInventory().getAgathionSlots() == 0)) + { + activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); + return; } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/readme.txt b/L2J_Mobius_Classic_2.2_Antharas/readme.txt index 1f7f46e8be..d59948e5bc 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/readme.txt +++ b/L2J_Mobius_Classic_2.2_Antharas/readme.txt @@ -69,6 +69,7 @@ Antharas: https://eu.4game.com/lineage2classic/play/antharas/ -Parsed new items from client -Parsed new NPCs from L2Wiki and client -Clan Arena +-New Agathion item support Customs: -Newbie Helper NPC location info