Proper Agathion slot mask.

This commit is contained in:
MobiusDev
2018-10-11 18:34:58 +00:00
parent 866bbde935
commit c0a6ffbb64
40 changed files with 906 additions and 1084 deletions

View File

@@ -38,14 +38,14 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public final class Disarmor extends AbstractEffect public final class Disarmor extends AbstractEffect
{ {
private final Map<Integer, Integer> _unequippedItems; // PlayerObjId, ItemObjId private final Map<Integer, Integer> _unequippedItems; // PlayerObjId, ItemObjId
private final int _slot; private final long _slot;
public Disarmor(StatsSet params) public Disarmor(StatsSet params)
{ {
_unequippedItems = new ConcurrentHashMap<>(); _unequippedItems = new ConcurrentHashMap<>();
final String slot = params.getString("slot", "chest"); 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) if (_slot == L2Item.SLOT_NONE)
{ {
LOGGER.severe("Unknown bodypart slot for effect: " + slot); LOGGER.severe("Unknown bodypart slot for effect: " + slot);

View File

@@ -73,7 +73,7 @@ public class EquipArmorSkillCondition implements ISkillCondition
// So from here, chest armor matches conditions // 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 // return True if chest armor is a Full Armor
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
{ {

View File

@@ -102,7 +102,7 @@ public class AppearanceItemData implements IGameXmlReader
} }
case "bodyPart": case "bodyPart":
{ {
final int part = ItemTable.SLOTS.get(c.getTextContent()); final long part = ItemTable.SLOTS.get(c.getTextContent());
stone.addBodyPart(part); stone.addBodyPart(part);
break; break;
} }

View File

@@ -58,7 +58,7 @@ public class ItemTable
private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName()); private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName());
private static Logger LOGGER_ITEMS = Logger.getLogger("item"); private static Logger LOGGER_ITEMS = Logger.getLogger("item");
public static final Map<String, Integer> SLOTS = new HashMap<>(); public static final Map<String, Long> SLOTS = new HashMap<>();
private L2Item[] _allTemplates; private L2Item[] _allTemplates;
private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>(); private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>();
@@ -66,45 +66,45 @@ public class ItemTable
private final Map<Integer, L2Weapon> _weapons = new HashMap<>(); private final Map<Integer, L2Weapon> _weapons = new HashMap<>();
static static
{ {
SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR); SLOTS.put("shirt", (long) L2Item.SLOT_UNDERWEAR);
SLOTS.put("lbracelet", L2Item.SLOT_L_BRACELET); SLOTS.put("lbracelet", (long) L2Item.SLOT_L_BRACELET);
SLOTS.put("rbracelet", L2Item.SLOT_R_BRACELET); SLOTS.put("rbracelet", (long) L2Item.SLOT_R_BRACELET);
SLOTS.put("talisman", L2Item.SLOT_DECO); SLOTS.put("talisman", (long) L2Item.SLOT_DECO);
SLOTS.put("chest", L2Item.SLOT_CHEST); SLOTS.put("chest", (long) L2Item.SLOT_CHEST);
SLOTS.put("fullarmor", L2Item.SLOT_FULL_ARMOR); SLOTS.put("fullarmor", (long) L2Item.SLOT_FULL_ARMOR);
SLOTS.put("head", L2Item.SLOT_HEAD); SLOTS.put("head", (long) L2Item.SLOT_HEAD);
SLOTS.put("hair", L2Item.SLOT_HAIR); SLOTS.put("hair", (long) L2Item.SLOT_HAIR);
SLOTS.put("hairall", L2Item.SLOT_HAIRALL); SLOTS.put("hairall", (long) L2Item.SLOT_HAIRALL);
SLOTS.put("underwear", L2Item.SLOT_UNDERWEAR); SLOTS.put("underwear", (long) L2Item.SLOT_UNDERWEAR);
SLOTS.put("back", L2Item.SLOT_BACK); SLOTS.put("back", (long) L2Item.SLOT_BACK);
SLOTS.put("neck", L2Item.SLOT_NECK); SLOTS.put("neck", (long) L2Item.SLOT_NECK);
SLOTS.put("legs", L2Item.SLOT_LEGS); SLOTS.put("legs", (long) L2Item.SLOT_LEGS);
SLOTS.put("feet", L2Item.SLOT_FEET); SLOTS.put("feet", (long) L2Item.SLOT_FEET);
SLOTS.put("gloves", L2Item.SLOT_GLOVES); SLOTS.put("gloves", (long) L2Item.SLOT_GLOVES);
SLOTS.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); SLOTS.put("chest,legs", (long) L2Item.SLOT_CHEST | L2Item.SLOT_LEGS);
SLOTS.put("belt", L2Item.SLOT_BELT); SLOTS.put("belt", (long) L2Item.SLOT_BELT);
SLOTS.put("rhand", L2Item.SLOT_R_HAND); SLOTS.put("rhand", (long) L2Item.SLOT_R_HAND);
SLOTS.put("lhand", L2Item.SLOT_L_HAND); SLOTS.put("lhand", (long) L2Item.SLOT_L_HAND);
SLOTS.put("lrhand", L2Item.SLOT_LR_HAND); SLOTS.put("lrhand", (long) L2Item.SLOT_LR_HAND);
SLOTS.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); SLOTS.put("rear;lear", (long) L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR);
SLOTS.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); SLOTS.put("rfinger;lfinger", (long) L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER);
SLOTS.put("wolf", L2Item.SLOT_WOLF); SLOTS.put("wolf", (long) L2Item.SLOT_WOLF);
SLOTS.put("greatwolf", L2Item.SLOT_GREATWOLF); SLOTS.put("greatwolf", (long) L2Item.SLOT_GREATWOLF);
SLOTS.put("hatchling", L2Item.SLOT_HATCHLING); SLOTS.put("hatchling", (long) L2Item.SLOT_HATCHLING);
SLOTS.put("strider", L2Item.SLOT_STRIDER); SLOTS.put("strider", (long) L2Item.SLOT_STRIDER);
SLOTS.put("babypet", L2Item.SLOT_BABYPET); SLOTS.put("babypet", (long) L2Item.SLOT_BABYPET);
SLOTS.put("brooch", L2Item.SLOT_BROOCH); SLOTS.put("brooch", (long) L2Item.SLOT_BROOCH);
SLOTS.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL); SLOTS.put("brooch_jewel", (long) L2Item.SLOT_BROOCH_JEWEL);
SLOTS.put("agathion", L2Item.SLOT_AGATHION); SLOTS.put("agathion", L2Item.SLOT_AGATHION);
SLOTS.put("none", L2Item.SLOT_NONE); SLOTS.put("none", (long) L2Item.SLOT_NONE);
// retail compatibility // retail compatibility
SLOTS.put("onepiece", L2Item.SLOT_FULL_ARMOR); SLOTS.put("onepiece", (long) L2Item.SLOT_FULL_ARMOR);
SLOTS.put("hair2", L2Item.SLOT_HAIR2); SLOTS.put("hair2", (long) L2Item.SLOT_HAIR2);
SLOTS.put("dhair", L2Item.SLOT_HAIRALL); SLOTS.put("dhair", (long) L2Item.SLOT_HAIRALL);
SLOTS.put("alldress", L2Item.SLOT_ALLDRESS); SLOTS.put("alldress", (long) L2Item.SLOT_ALLDRESS);
SLOTS.put("deco1", L2Item.SLOT_DECO); SLOTS.put("deco1", (long) L2Item.SLOT_DECO);
SLOTS.put("waist", L2Item.SLOT_BELT); SLOTS.put("waist", (long) L2Item.SLOT_BELT);
} }
/** /**

View File

@@ -40,19 +40,16 @@ public enum CrystallizationType
{ {
return ARMOR; 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: return ACCESORY;
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 NONE; return NONE;

View File

@@ -104,7 +104,7 @@ public class CombatFlag
{ {
// Reset player stats // Reset player stats
_player.setCombatFlagEquipped(false); _player.setCombatFlagEquipped(false);
final int slot = _player.getInventory().getSlotFromItem(_item); final long slot = _player.getInventory().getSlotFromItem(_item);
_player.getInventory().unEquipItemInBodySlot(slot); _player.getInventory().unEquipItemInBodySlot(slot);
_player.destroyItem("CombatFlag", _item, null, true); _player.destroyItem("CombatFlag", _item, null, true);
_item = null; _item = null;

View File

@@ -2197,7 +2197,7 @@ public final class L2PcInstance extends L2Playable
} }
sendPacket(sm); sendPacket(sm);
final int slot = _inventory.getSlotFromItem(item); final long slot = _inventory.getSlotFromItem(item);
// we can't unequip talisman by body slot // we can't unequip talisman by body slot
if ((slot == L2Item.SLOT_DECO) || (slot == L2Item.SLOT_BROOCH_JEWEL) || (slot == L2Item.SLOT_AGATHION)) 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 else
{ {
final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819));
_inventory.unEquipItemInBodySlot(slot); _inventory.unEquipItemInBodySlot(slot);
destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true);
} }
@@ -10887,7 +10887,7 @@ public final class L2PcInstance extends L2Playable
} }
else else
{ {
final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819));
_inventory.unEquipItemInBodySlot(slot); _inventory.unEquipItemInBodySlot(slot);
destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true);
} }

View File

@@ -70,7 +70,7 @@ public final class ConditionUsingItemType extends Condition
// So from here, chest armor matches conditions // 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 // return True if chest armor is a Full Armor
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
{ {

View File

@@ -35,7 +35,7 @@ public class AppearanceHolder
private final AppearanceHandType _handType; private final AppearanceHandType _handType;
private final AppearanceMagicType _magicType; private final AppearanceMagicType _magicType;
private final AppearanceTargetType _targetType; private final AppearanceTargetType _targetType;
private final Integer _bodyPart; private final long _bodyPart;
public AppearanceHolder(StatsSet set) public AppearanceHolder(StatsSet set)
{ {
@@ -73,7 +73,7 @@ public class AppearanceHolder
return _targetType; return _targetType;
} }
public int getBodyPart() public long getBodyPart()
{ {
return _bodyPart; return _bodyPart;
} }

View File

@@ -902,108 +902,104 @@ public abstract class Inventory extends ItemContainer
return _paperdoll[slot] == null; 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;
{ }
return PAPERDOLL_UNDER; else if (slot == L2Item.SLOT_R_EAR)
} {
case L2Item.SLOT_R_EAR: return PAPERDOLL_REAR;
{ }
return PAPERDOLL_REAR; else if ((slot == L2Item.SLOT_LR_EAR) || (slot == L2Item.SLOT_L_EAR))
} {
case L2Item.SLOT_LR_EAR: return PAPERDOLL_LEAR;
case L2Item.SLOT_L_EAR: }
{ else if (slot == L2Item.SLOT_NECK)
return PAPERDOLL_LEAR; {
} return PAPERDOLL_NECK;
case L2Item.SLOT_NECK: }
{ else if ((slot == L2Item.SLOT_R_FINGER) || (slot == L2Item.SLOT_LR_FINGER))
return PAPERDOLL_NECK; {
} return PAPERDOLL_RFINGER;
case L2Item.SLOT_R_FINGER: }
case L2Item.SLOT_LR_FINGER: else if (slot == L2Item.SLOT_L_FINGER)
{ {
return PAPERDOLL_RFINGER; return PAPERDOLL_LFINGER;
} }
case L2Item.SLOT_L_FINGER: else if (slot == L2Item.SLOT_HEAD)
{ {
return PAPERDOLL_LFINGER; return PAPERDOLL_HEAD;
} }
case L2Item.SLOT_HEAD: else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND))
{ {
return PAPERDOLL_HEAD; return PAPERDOLL_RHAND;
} }
case L2Item.SLOT_R_HAND: else if (slot == L2Item.SLOT_L_HAND)
case L2Item.SLOT_LR_HAND: {
{ return PAPERDOLL_LHAND;
return PAPERDOLL_RHAND; }
} else if (slot == L2Item.SLOT_GLOVES)
case L2Item.SLOT_L_HAND: {
{ return PAPERDOLL_GLOVES;
return PAPERDOLL_LHAND; }
} else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_FULL_ARMOR) || (slot == L2Item.SLOT_ALLDRESS))
case L2Item.SLOT_GLOVES: {
{ return PAPERDOLL_CHEST;
return PAPERDOLL_GLOVES; }
} else if (slot == L2Item.SLOT_LEGS)
case L2Item.SLOT_CHEST: {
case L2Item.SLOT_FULL_ARMOR: return PAPERDOLL_LEGS;
case L2Item.SLOT_ALLDRESS: }
{ else if (slot == L2Item.SLOT_FEET)
return PAPERDOLL_CHEST; {
} return PAPERDOLL_FEET;
case L2Item.SLOT_LEGS: }
{ else if (slot == L2Item.SLOT_BACK)
return PAPERDOLL_LEGS; {
} return PAPERDOLL_CLOAK;
case L2Item.SLOT_FEET: }
{ else if ((slot == L2Item.SLOT_HAIR) || (slot == L2Item.SLOT_HAIRALL))
return PAPERDOLL_FEET; {
} return PAPERDOLL_HAIR;
case L2Item.SLOT_BACK: }
{ else if (slot == L2Item.SLOT_HAIR2)
return PAPERDOLL_CLOAK; {
} return PAPERDOLL_HAIR2;
case L2Item.SLOT_HAIR: }
case L2Item.SLOT_HAIRALL: else if (slot == L2Item.SLOT_R_BRACELET)
{ {
return PAPERDOLL_HAIR; return PAPERDOLL_RBRACELET;
} }
case L2Item.SLOT_HAIR2: else if (slot == L2Item.SLOT_L_BRACELET)
{ {
return PAPERDOLL_HAIR2; return PAPERDOLL_LBRACELET;
} }
case L2Item.SLOT_R_BRACELET: else if (slot == L2Item.SLOT_DECO)
{ {
return PAPERDOLL_RBRACELET; return PAPERDOLL_DECO1; // return first we deal with it later
} }
case L2Item.SLOT_L_BRACELET: else if (slot == L2Item.SLOT_BELT)
{ {
return PAPERDOLL_LBRACELET; return PAPERDOLL_BELT;
} }
case L2Item.SLOT_DECO: else if (slot == L2Item.SLOT_BROOCH)
{ {
return PAPERDOLL_DECO1; // return first we deal with it later return PAPERDOLL_BROOCH;
} }
case L2Item.SLOT_BELT: else if (slot == L2Item.SLOT_BROOCH_JEWEL)
{ {
return PAPERDOLL_BELT; return PAPERDOLL_BROOCH_JEWEL1;
} }
case L2Item.SLOT_BROOCH: else if (slot == L2Item.SLOT_AGATHION)
{ {
return PAPERDOLL_BROOCH; return PAPERDOLL_AGATHION1;
}
case L2Item.SLOT_BROOCH_JEWEL:
{
return PAPERDOLL_BROOCH_JEWEL1;
}
case L2Item.SLOT_AGATHION:
{
return PAPERDOLL_AGATHION1;
}
} }
return -1; return -1;
} }
@@ -1174,9 +1170,9 @@ public abstract class Inventory extends ItemContainer
return _wearedMask; return _wearedMask;
} }
public int getSlotFromItem(L2ItemInstance item) public long getSlotFromItem(L2ItemInstance item)
{ {
int slot = -1; long slot = -1;
final int location = item.getLocationSlot(); final int location = item.getLocationSlot();
switch (location) switch (location)
{ {
@@ -1315,11 +1311,11 @@ public abstract class Inventory extends ItemContainer
/** /**
* Unequips item in body slot and returns alterations.<BR> * Unequips item in body slot and returns alterations.<BR>
* <B>If you dont need return value use {@link Inventory#unEquipItemInBodySlot(int)} instead</B> * <B>If you dont need return value use {@link Inventory#unEquipItemInBodySlot(long)} instead</B>
* @param slot : int designating the slot of the paperdoll * @param slot : int designating the slot of the paperdoll
* @return L2ItemInstance[] : list of changes * @return L2ItemInstance[] : list of changes
*/ */
public L2ItemInstance[] unEquipItemInBodySlotAndRecord(int slot) public L2ItemInstance[] unEquipItemInBodySlotAndRecord(long slot)
{ {
final ChangeRecorder recorder = newRecorder(); final ChangeRecorder recorder = newRecorder();
@@ -1374,141 +1370,111 @@ public abstract class Inventory extends ItemContainer
* @param slot : int designating the slot * @param slot : int designating the slot
* @return {@link L2ItemInstance} designating the item placed in 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; int pdollSlot = -1;
switch (slot) if (slot == L2Item.SLOT_L_EAR)
{ {
case L2Item.SLOT_L_EAR: pdollSlot = PAPERDOLL_LEAR;
{ }
pdollSlot = PAPERDOLL_LEAR; else if (slot == L2Item.SLOT_R_EAR)
break; {
} pdollSlot = PAPERDOLL_REAR;
case L2Item.SLOT_R_EAR: }
{ else if (slot == L2Item.SLOT_NECK)
pdollSlot = PAPERDOLL_REAR; {
break; pdollSlot = PAPERDOLL_NECK;
} }
case L2Item.SLOT_NECK: else if (slot == L2Item.SLOT_R_FINGER)
{ {
pdollSlot = PAPERDOLL_NECK; pdollSlot = PAPERDOLL_RFINGER;
break; }
} else if (slot == L2Item.SLOT_L_FINGER)
case L2Item.SLOT_R_FINGER: {
{ pdollSlot = PAPERDOLL_LFINGER;
pdollSlot = PAPERDOLL_RFINGER; }
break; else if (slot == L2Item.SLOT_HAIR)
} {
case L2Item.SLOT_L_FINGER: pdollSlot = PAPERDOLL_HAIR;
{ }
pdollSlot = PAPERDOLL_LFINGER; else if (slot == L2Item.SLOT_HAIR2)
break; {
} pdollSlot = PAPERDOLL_HAIR2;
case L2Item.SLOT_HAIR: }
{ else if (slot == L2Item.SLOT_HAIRALL)
pdollSlot = PAPERDOLL_HAIR; {
break; setPaperdollItem(PAPERDOLL_HAIR, null);
} pdollSlot = PAPERDOLL_HAIR;
case L2Item.SLOT_HAIR2: }
{ else if (slot == L2Item.SLOT_HEAD)
pdollSlot = PAPERDOLL_HAIR2; {
break; pdollSlot = PAPERDOLL_HEAD;
} }
case L2Item.SLOT_HAIRALL: else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND))
{ {
setPaperdollItem(PAPERDOLL_HAIR, null); pdollSlot = PAPERDOLL_RHAND;
pdollSlot = PAPERDOLL_HAIR; }
break; else if (slot == L2Item.SLOT_L_HAND)
} {
case L2Item.SLOT_HEAD: pdollSlot = PAPERDOLL_LHAND;
{ }
pdollSlot = PAPERDOLL_HEAD; else if (slot == L2Item.SLOT_GLOVES)
break; {
} pdollSlot = PAPERDOLL_GLOVES;
case L2Item.SLOT_R_HAND: }
case L2Item.SLOT_LR_HAND: else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_ALLDRESS) || (slot == L2Item.SLOT_FULL_ARMOR))
{ {
pdollSlot = PAPERDOLL_RHAND; pdollSlot = PAPERDOLL_CHEST;
break; }
} else if (slot == L2Item.SLOT_LEGS)
case L2Item.SLOT_L_HAND: {
{ pdollSlot = PAPERDOLL_LEGS;
pdollSlot = PAPERDOLL_LHAND; }
break; else if (slot == L2Item.SLOT_BACK)
} {
case L2Item.SLOT_GLOVES: pdollSlot = PAPERDOLL_CLOAK;
{ }
pdollSlot = PAPERDOLL_GLOVES; else if (slot == L2Item.SLOT_FEET)
break; {
} pdollSlot = PAPERDOLL_FEET;
case L2Item.SLOT_CHEST: }
case L2Item.SLOT_ALLDRESS: else if (slot == L2Item.SLOT_UNDERWEAR)
case L2Item.SLOT_FULL_ARMOR: {
{ pdollSlot = PAPERDOLL_UNDER;
pdollSlot = PAPERDOLL_CHEST; }
break; else if (slot == L2Item.SLOT_L_BRACELET)
} {
case L2Item.SLOT_LEGS: pdollSlot = PAPERDOLL_LBRACELET;
{ }
pdollSlot = PAPERDOLL_LEGS; else if (slot == L2Item.SLOT_R_BRACELET)
break; {
} pdollSlot = PAPERDOLL_RBRACELET;
case L2Item.SLOT_BACK: }
{ else if (slot == L2Item.SLOT_DECO)
pdollSlot = PAPERDOLL_CLOAK; {
break; pdollSlot = PAPERDOLL_DECO1;
} }
case L2Item.SLOT_FEET: else if (slot == L2Item.SLOT_BELT)
{ {
pdollSlot = PAPERDOLL_FEET; pdollSlot = PAPERDOLL_BELT;
break; }
} else if (slot == L2Item.SLOT_BROOCH)
case L2Item.SLOT_UNDERWEAR: {
{ pdollSlot = PAPERDOLL_BROOCH;
pdollSlot = PAPERDOLL_UNDER; }
break; else if (slot == L2Item.SLOT_BROOCH_JEWEL)
} {
case L2Item.SLOT_L_BRACELET: pdollSlot = PAPERDOLL_BROOCH_JEWEL1;
{ }
pdollSlot = PAPERDOLL_LBRACELET; else if (slot == L2Item.SLOT_AGATHION)
break; {
} pdollSlot = PAPERDOLL_AGATHION1;
case L2Item.SLOT_R_BRACELET: }
{ else
pdollSlot = PAPERDOLL_RBRACELET; {
break; LOGGER.info("Unhandled slot type: " + slot);
} LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace()));
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()));
}
} }
if (pdollSlot >= 0) 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. // Check if player is using Formal Wear and item isn't Wedding Bouquet.
final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST); final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST);
if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS)) if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS))
{ {
// only chest target can pass this // 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: return;
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;
}
} }
} }
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, null);
setPaperdollItem(PAPERDOLL_RHAND, item);
break;
} }
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); setPaperdollItem(PAPERDOLL_LEAR, item);
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;
} }
case L2Item.SLOT_R_HAND: else if (_paperdoll[PAPERDOLL_REAR] == null)
{ {
// don't care about arrows, listener will unequip them (hopefully) setPaperdollItem(PAPERDOLL_REAR, item);
setPaperdollItem(PAPERDOLL_RHAND, item);
break;
} }
case L2Item.SLOT_L_EAR: else
case L2Item.SLOT_R_EAR:
case L2Item.SLOT_LR_EAR:
{ {
if (_paperdoll[PAPERDOLL_LEAR] == null) setPaperdollItem(PAPERDOLL_LEAR, item);
{
setPaperdollItem(PAPERDOLL_LEAR, item);
}
else if (_paperdoll[PAPERDOLL_REAR] == null)
{
setPaperdollItem(PAPERDOLL_REAR, item);
}
else
{
setPaperdollItem(PAPERDOLL_LEAR, item);
}
break;
} }
case L2Item.SLOT_L_FINGER: }
case L2Item.SLOT_R_FINGER: else if ((targetSlot == L2Item.SLOT_L_FINGER) || (targetSlot == L2Item.SLOT_R_FINGER) || (targetSlot == L2Item.SLOT_LR_FINGER))
case L2Item.SLOT_LR_FINGER: {
if (_paperdoll[PAPERDOLL_LFINGER] == null)
{ {
if (_paperdoll[PAPERDOLL_LFINGER] == null) setPaperdollItem(PAPERDOLL_LFINGER, item);
{
setPaperdollItem(PAPERDOLL_LFINGER, item);
}
else if (_paperdoll[PAPERDOLL_RFINGER] == null)
{
setPaperdollItem(PAPERDOLL_RFINGER, item);
}
else
{
setPaperdollItem(PAPERDOLL_LFINGER, item);
}
break;
} }
case L2Item.SLOT_NECK: else if (_paperdoll[PAPERDOLL_RFINGER] == null)
{ {
setPaperdollItem(PAPERDOLL_NECK, item); setPaperdollItem(PAPERDOLL_RFINGER, item);
break;
} }
case L2Item.SLOT_FULL_ARMOR: else
{ {
setPaperdollItem(PAPERDOLL_LEGS, null); setPaperdollItem(PAPERDOLL_LFINGER, item);
setPaperdollItem(PAPERDOLL_CHEST, item);
break;
} }
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); setPaperdollItem(PAPERDOLL_CHEST, null);
break;
} }
case L2Item.SLOT_LEGS: setPaperdollItem(PAPERDOLL_LEGS, item);
{ }
// handle full armor else if (targetSlot == L2Item.SLOT_FEET)
final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); {
if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) setPaperdollItem(PAPERDOLL_FEET, item);
{ }
setPaperdollItem(PAPERDOLL_CHEST, null); else if (targetSlot == L2Item.SLOT_GLOVES)
} {
setPaperdollItem(PAPERDOLL_LEGS, item); setPaperdollItem(PAPERDOLL_GLOVES, item);
break; }
} else if (targetSlot == L2Item.SLOT_HEAD)
case L2Item.SLOT_FEET: {
{ setPaperdollItem(PAPERDOLL_HEAD, item);
setPaperdollItem(PAPERDOLL_FEET, item); }
break; else if (targetSlot == L2Item.SLOT_HAIR)
} {
case L2Item.SLOT_GLOVES: final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR);
{ if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL))
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_HAIR2, null); setPaperdollItem(PAPERDOLL_HAIR2, null);
setPaperdollItem(PAPERDOLL_HAIR, item);
break;
} }
case L2Item.SLOT_UNDERWEAR: else
{ {
setPaperdollItem(PAPERDOLL_UNDER, item); setPaperdollItem(PAPERDOLL_HAIR, null);
break;
} }
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); setPaperdollItem(PAPERDOLL_HAIR, null);
break;
} }
case L2Item.SLOT_L_BRACELET: else
{ {
setPaperdollItem(PAPERDOLL_LBRACELET, item); setPaperdollItem(PAPERDOLL_HAIR2, null);
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, 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. * Blocks the given item slot from being equipped.
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
*/ */
public void blockItemSlot(int itemSlot) public void blockItemSlot(long itemSlot)
{ {
_blockedItemSlotsMask |= itemSlot; _blockedItemSlotsMask |= itemSlot;
} }
@@ -2106,7 +2031,7 @@ public abstract class Inventory extends ItemContainer
* Unblocks the given item slot so it can be equipped. * Unblocks the given item slot so it can be equipped.
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
*/ */
public void unblockItemSlot(int itemSlot) public void unblockItemSlot(long itemSlot)
{ {
_blockedItemSlotsMask &= ~itemSlot; _blockedItemSlotsMask &= ~itemSlot;
} }
@@ -2115,7 +2040,7 @@ public abstract class Inventory extends ItemContainer
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
* @return if the given item slot is blocked or not. * @return if the given item slot is blocked or not.
*/ */
public boolean isItemSlotBlocked(int itemSlot) public boolean isItemSlotBlocked(long itemSlot)
{ {
return (_blockedItemSlotsMask & itemSlot) == itemSlot; return (_blockedItemSlotsMask & itemSlot) == itemSlot;
} }

View File

@@ -41,7 +41,7 @@ public final class L2Armor extends L2Item
super.set(set); super.set(set);
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE); _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)) 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; _type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;

View File

@@ -111,7 +111,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
public static final int SLOT_BELT = 0x10000000; public static final int SLOT_BELT = 0x10000000;
public static final int SLOT_BROOCH = 0x20000000; public static final int SLOT_BROOCH = 0x20000000;
public static final int SLOT_BROOCH_JEWEL = 0x40000000; 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_WOLF = -100;
public static final int SLOT_HATCHLING = -101; public static final int SLOT_HATCHLING = -101;
@@ -134,7 +134,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
private int _duration; private int _duration;
private long _time; private long _time;
private int _autoDestroyTime; private int _autoDestroyTime;
private int _bodyPart; private long _bodyPart;
private long _referencePrice; private long _referencePrice;
private int _crystalCount; private int _crystalCount;
private boolean _sellable; 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. * @return the part of the body used with the item.
*/ */
public final int getBodyPart() public final long getBodyPart()
{ {
return _bodyPart; return _bodyPart;
} }

View File

@@ -171,7 +171,7 @@ public class L2WarehouseItem
/** /**
* @return the part of body used with this item. * @return the part of body used with this item.
*/ */
public final int getBodyPart() public final long getBodyPart()
{ {
return _item.getBodyPart(); return _item.getBodyPart();
} }

View File

@@ -49,7 +49,7 @@ public class AppearanceStone
private final AppearanceMagicType _magicType; private final AppearanceMagicType _magicType;
private List<CrystalType> _crystalTypes; private List<CrystalType> _crystalTypes;
private List<AppearanceTargetType> _targetTypes; private List<AppearanceTargetType> _targetTypes;
private List<Integer> _bodyParts; private List<Long> _bodyParts;
private List<Race> _races; private List<Race> _races;
private List<Race> _racesNot; private List<Race> _racesNot;
private List<AppearanceHolder> _allVisualIds; private List<AppearanceHolder> _allVisualIds;
@@ -103,7 +103,7 @@ public class AppearanceStone
addCrystalType(crystalType); 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) if (bodyPart != L2Item.SLOT_NONE)
{ {
addBodyPart(bodyPart); addBodyPart(bodyPart);
@@ -195,7 +195,7 @@ public class AppearanceStone
return _targetTypes != null ? _targetTypes : Collections.emptyList(); return _targetTypes != null ? _targetTypes : Collections.emptyList();
} }
public void addBodyPart(Integer part) public void addBodyPart(long part)
{ {
if (_bodyParts == null) if (_bodyParts == null)
{ {
@@ -218,7 +218,7 @@ public class AppearanceStone
return _allVisualIds != null ? _allVisualIds : Collections.emptyList(); return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
} }
public List<Integer> getBodyParts() public List<Long> getBodyParts()
{ {
return _bodyParts != null ? _bodyParts : Collections.emptyList(); return _bodyParts != null ? _bodyParts : Collections.emptyList();
} }

View File

@@ -54,7 +54,7 @@ public final class EnchantRateItem
* Adds body slot verification. * Adds body slot verification.
* @param slot * @param slot
*/ */
public void addSlot(int slot) public void addSlot(long slot)
{ {
_slot |= slot; _slot |= slot;
} }

View File

@@ -112,13 +112,13 @@ public interface IStatsFunction
for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted)) for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted))
{ {
final L2Item item = equippedItem.getItem(); final L2Item item = equippedItem.getItem();
final int bodypart = item.getBodyPart(); final long bodypart = item.getBodyPart();
if ((bodypart == L2Item.SLOT_HAIR) || // if ((bodypart == L2Item.SLOT_HAIR) || //
(bodypart == L2Item.SLOT_HAIR2) || // (bodypart == L2Item.SLOT_HAIR2) || //
(bodypart == L2Item.SLOT_HAIRALL)) (bodypart == L2Item.SLOT_HAIRALL))
{ {
// TODO: Item after enchant shows pDef, but scroll says mDef increase. // 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; continue;
} }

View File

@@ -214,7 +214,7 @@ public class L2SiegeZone extends L2ZoneType
} }
else 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.getInventory().unEquipItemInBodySlot(slot);
activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true);
} }

View File

@@ -563,7 +563,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
else 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.getInventory().unEquipItemInBodySlot(slot);
activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true);
} }

View File

@@ -192,61 +192,49 @@ public final class UseItem implements IClientIncomingPacket
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
return; return;
} }
// Prevent players to equip weapon while wearing combat flag
switch (item.getItem().getBodyPart()) // 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: if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819))
case L2Item.SLOT_L_HAND:
case L2Item.SLOT_R_HAND:
{ {
// Prevent players to equip weapon while wearing combat flag activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) return;
{
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;
} }
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;
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
return;
}
break;
} }
case L2Item.SLOT_BROOCH_JEWEL: if (activeChar.isCursedWeaponEquipped())
{ {
if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) return;
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH);
sm.addItemName(item);
activeChar.sendPacket(sm);
return;
}
break;
} }
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;
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); }
return; }
} else if (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL)
break; {
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;
} }
} }

View File

@@ -85,6 +85,7 @@ Salvation:
-Parsed new items from client -Parsed new items from client
-TODO: Skills -TODO: Skills
-TODO: Skill trees -TODO: Skill trees
-New Agathion item support
Events: Events:
-Birth of Draco -Birth of Draco

View File

@@ -38,14 +38,14 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public final class Disarmor extends AbstractEffect public final class Disarmor extends AbstractEffect
{ {
private final Map<Integer, Integer> _unequippedItems; // PlayerObjId, ItemObjId private final Map<Integer, Integer> _unequippedItems; // PlayerObjId, ItemObjId
private final int _slot; private final long _slot;
public Disarmor(StatsSet params) public Disarmor(StatsSet params)
{ {
_unequippedItems = new ConcurrentHashMap<>(); _unequippedItems = new ConcurrentHashMap<>();
final String slot = params.getString("slot", "chest"); 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) if (_slot == L2Item.SLOT_NONE)
{ {
LOGGER.severe("Unknown bodypart slot for effect: " + slot); LOGGER.severe("Unknown bodypart slot for effect: " + slot);

View File

@@ -73,7 +73,7 @@ public class EquipArmorSkillCondition implements ISkillCondition
// So from here, chest armor matches conditions // 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 // return True if chest armor is a Full Armor
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
{ {

View File

@@ -102,7 +102,7 @@ public class AppearanceItemData implements IGameXmlReader
} }
case "bodyPart": case "bodyPart":
{ {
final int part = ItemTable.SLOTS.get(c.getTextContent()); final long part = ItemTable.SLOTS.get(c.getTextContent());
stone.addBodyPart(part); stone.addBodyPart(part);
break; break;
} }

View File

@@ -58,7 +58,7 @@ public class ItemTable
private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName()); private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName());
private static Logger LOGGER_ITEMS = Logger.getLogger("item"); private static Logger LOGGER_ITEMS = Logger.getLogger("item");
public static final Map<String, Integer> SLOTS = new HashMap<>(); public static final Map<String, Long> SLOTS = new HashMap<>();
private L2Item[] _allTemplates; private L2Item[] _allTemplates;
private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>(); private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>();
@@ -66,45 +66,45 @@ public class ItemTable
private final Map<Integer, L2Weapon> _weapons = new HashMap<>(); private final Map<Integer, L2Weapon> _weapons = new HashMap<>();
static static
{ {
SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR); SLOTS.put("shirt", (long) L2Item.SLOT_UNDERWEAR);
SLOTS.put("lbracelet", L2Item.SLOT_L_BRACELET); SLOTS.put("lbracelet", (long) L2Item.SLOT_L_BRACELET);
SLOTS.put("rbracelet", L2Item.SLOT_R_BRACELET); SLOTS.put("rbracelet", (long) L2Item.SLOT_R_BRACELET);
SLOTS.put("talisman", L2Item.SLOT_DECO); SLOTS.put("talisman", (long) L2Item.SLOT_DECO);
SLOTS.put("chest", L2Item.SLOT_CHEST); SLOTS.put("chest", (long) L2Item.SLOT_CHEST);
SLOTS.put("fullarmor", L2Item.SLOT_FULL_ARMOR); SLOTS.put("fullarmor", (long) L2Item.SLOT_FULL_ARMOR);
SLOTS.put("head", L2Item.SLOT_HEAD); SLOTS.put("head", (long) L2Item.SLOT_HEAD);
SLOTS.put("hair", L2Item.SLOT_HAIR); SLOTS.put("hair", (long) L2Item.SLOT_HAIR);
SLOTS.put("hairall", L2Item.SLOT_HAIRALL); SLOTS.put("hairall", (long) L2Item.SLOT_HAIRALL);
SLOTS.put("underwear", L2Item.SLOT_UNDERWEAR); SLOTS.put("underwear", (long) L2Item.SLOT_UNDERWEAR);
SLOTS.put("back", L2Item.SLOT_BACK); SLOTS.put("back", (long) L2Item.SLOT_BACK);
SLOTS.put("neck", L2Item.SLOT_NECK); SLOTS.put("neck", (long) L2Item.SLOT_NECK);
SLOTS.put("legs", L2Item.SLOT_LEGS); SLOTS.put("legs", (long) L2Item.SLOT_LEGS);
SLOTS.put("feet", L2Item.SLOT_FEET); SLOTS.put("feet", (long) L2Item.SLOT_FEET);
SLOTS.put("gloves", L2Item.SLOT_GLOVES); SLOTS.put("gloves", (long) L2Item.SLOT_GLOVES);
SLOTS.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS); SLOTS.put("chest,legs", (long) L2Item.SLOT_CHEST | L2Item.SLOT_LEGS);
SLOTS.put("belt", L2Item.SLOT_BELT); SLOTS.put("belt", (long) L2Item.SLOT_BELT);
SLOTS.put("rhand", L2Item.SLOT_R_HAND); SLOTS.put("rhand", (long) L2Item.SLOT_R_HAND);
SLOTS.put("lhand", L2Item.SLOT_L_HAND); SLOTS.put("lhand", (long) L2Item.SLOT_L_HAND);
SLOTS.put("lrhand", L2Item.SLOT_LR_HAND); SLOTS.put("lrhand", (long) L2Item.SLOT_LR_HAND);
SLOTS.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR); SLOTS.put("rear;lear", (long) L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR);
SLOTS.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER); SLOTS.put("rfinger;lfinger", (long) L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER);
SLOTS.put("wolf", L2Item.SLOT_WOLF); SLOTS.put("wolf", (long) L2Item.SLOT_WOLF);
SLOTS.put("greatwolf", L2Item.SLOT_GREATWOLF); SLOTS.put("greatwolf", (long) L2Item.SLOT_GREATWOLF);
SLOTS.put("hatchling", L2Item.SLOT_HATCHLING); SLOTS.put("hatchling", (long) L2Item.SLOT_HATCHLING);
SLOTS.put("strider", L2Item.SLOT_STRIDER); SLOTS.put("strider", (long) L2Item.SLOT_STRIDER);
SLOTS.put("babypet", L2Item.SLOT_BABYPET); SLOTS.put("babypet", (long) L2Item.SLOT_BABYPET);
SLOTS.put("brooch", L2Item.SLOT_BROOCH); SLOTS.put("brooch", (long) L2Item.SLOT_BROOCH);
SLOTS.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL); SLOTS.put("brooch_jewel", (long) L2Item.SLOT_BROOCH_JEWEL);
SLOTS.put("agathion", L2Item.SLOT_AGATHION); SLOTS.put("agathion", L2Item.SLOT_AGATHION);
SLOTS.put("none", L2Item.SLOT_NONE); SLOTS.put("none", (long) L2Item.SLOT_NONE);
// retail compatibility // retail compatibility
SLOTS.put("onepiece", L2Item.SLOT_FULL_ARMOR); SLOTS.put("onepiece", (long) L2Item.SLOT_FULL_ARMOR);
SLOTS.put("hair2", L2Item.SLOT_HAIR2); SLOTS.put("hair2", (long) L2Item.SLOT_HAIR2);
SLOTS.put("dhair", L2Item.SLOT_HAIRALL); SLOTS.put("dhair", (long) L2Item.SLOT_HAIRALL);
SLOTS.put("alldress", L2Item.SLOT_ALLDRESS); SLOTS.put("alldress", (long) L2Item.SLOT_ALLDRESS);
SLOTS.put("deco1", L2Item.SLOT_DECO); SLOTS.put("deco1", (long) L2Item.SLOT_DECO);
SLOTS.put("waist", L2Item.SLOT_BELT); SLOTS.put("waist", (long) L2Item.SLOT_BELT);
} }
/** /**

View File

@@ -40,19 +40,16 @@ public enum CrystallizationType
{ {
return ARMOR; 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: return ACCESORY;
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 NONE; return NONE;

View File

@@ -104,7 +104,7 @@ public class CombatFlag
{ {
// Reset player stats // Reset player stats
_player.setCombatFlagEquipped(false); _player.setCombatFlagEquipped(false);
final int slot = _player.getInventory().getSlotFromItem(_item); final long slot = _player.getInventory().getSlotFromItem(_item);
_player.getInventory().unEquipItemInBodySlot(slot); _player.getInventory().unEquipItemInBodySlot(slot);
_player.destroyItem("CombatFlag", _item, null, true); _player.destroyItem("CombatFlag", _item, null, true);
_item = null; _item = null;

View File

@@ -2168,7 +2168,7 @@ public final class L2PcInstance extends L2Playable
} }
sendPacket(sm); sendPacket(sm);
final int slot = _inventory.getSlotFromItem(item); final long slot = _inventory.getSlotFromItem(item);
// we can't unequip talisman by body slot // we can't unequip talisman by body slot
if ((slot == L2Item.SLOT_DECO) || (slot == L2Item.SLOT_BROOCH_JEWEL) || (slot == L2Item.SLOT_AGATHION)) 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 else
{ {
final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819));
_inventory.unEquipItemInBodySlot(slot); _inventory.unEquipItemInBodySlot(slot);
destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true);
} }
@@ -10813,7 +10813,7 @@ public final class L2PcInstance extends L2Playable
} }
else else
{ {
final int slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819)); final long slot = _inventory.getSlotFromItem(_inventory.getItemByItemId(9819));
_inventory.unEquipItemInBodySlot(slot); _inventory.unEquipItemInBodySlot(slot);
destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true); destroyItem("CombatFlag", _inventory.getItemByItemId(9819), null, true);
} }

View File

@@ -70,7 +70,7 @@ public final class ConditionUsingItemType extends Condition
// So from here, chest armor matches conditions // 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 // return True if chest armor is a Full Armor
if (chestBodyPart == L2Item.SLOT_FULL_ARMOR) if (chestBodyPart == L2Item.SLOT_FULL_ARMOR)
{ {

View File

@@ -35,7 +35,7 @@ public class AppearanceHolder
private final AppearanceHandType _handType; private final AppearanceHandType _handType;
private final AppearanceMagicType _magicType; private final AppearanceMagicType _magicType;
private final AppearanceTargetType _targetType; private final AppearanceTargetType _targetType;
private final Integer _bodyPart; private final long _bodyPart;
public AppearanceHolder(StatsSet set) public AppearanceHolder(StatsSet set)
{ {
@@ -73,7 +73,7 @@ public class AppearanceHolder
return _targetType; return _targetType;
} }
public int getBodyPart() public long getBodyPart()
{ {
return _bodyPart; return _bodyPart;
} }

View File

@@ -902,108 +902,104 @@ public abstract class Inventory extends ItemContainer
return _paperdoll[slot] == null; 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;
{ }
return PAPERDOLL_UNDER; else if (slot == L2Item.SLOT_R_EAR)
} {
case L2Item.SLOT_R_EAR: return PAPERDOLL_REAR;
{ }
return PAPERDOLL_REAR; else if ((slot == L2Item.SLOT_LR_EAR) || (slot == L2Item.SLOT_L_EAR))
} {
case L2Item.SLOT_LR_EAR: return PAPERDOLL_LEAR;
case L2Item.SLOT_L_EAR: }
{ else if (slot == L2Item.SLOT_NECK)
return PAPERDOLL_LEAR; {
} return PAPERDOLL_NECK;
case L2Item.SLOT_NECK: }
{ else if ((slot == L2Item.SLOT_R_FINGER) || (slot == L2Item.SLOT_LR_FINGER))
return PAPERDOLL_NECK; {
} return PAPERDOLL_RFINGER;
case L2Item.SLOT_R_FINGER: }
case L2Item.SLOT_LR_FINGER: else if (slot == L2Item.SLOT_L_FINGER)
{ {
return PAPERDOLL_RFINGER; return PAPERDOLL_LFINGER;
} }
case L2Item.SLOT_L_FINGER: else if (slot == L2Item.SLOT_HEAD)
{ {
return PAPERDOLL_LFINGER; return PAPERDOLL_HEAD;
} }
case L2Item.SLOT_HEAD: else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND))
{ {
return PAPERDOLL_HEAD; return PAPERDOLL_RHAND;
} }
case L2Item.SLOT_R_HAND: else if (slot == L2Item.SLOT_L_HAND)
case L2Item.SLOT_LR_HAND: {
{ return PAPERDOLL_LHAND;
return PAPERDOLL_RHAND; }
} else if (slot == L2Item.SLOT_GLOVES)
case L2Item.SLOT_L_HAND: {
{ return PAPERDOLL_GLOVES;
return PAPERDOLL_LHAND; }
} else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_FULL_ARMOR) || (slot == L2Item.SLOT_ALLDRESS))
case L2Item.SLOT_GLOVES: {
{ return PAPERDOLL_CHEST;
return PAPERDOLL_GLOVES; }
} else if (slot == L2Item.SLOT_LEGS)
case L2Item.SLOT_CHEST: {
case L2Item.SLOT_FULL_ARMOR: return PAPERDOLL_LEGS;
case L2Item.SLOT_ALLDRESS: }
{ else if (slot == L2Item.SLOT_FEET)
return PAPERDOLL_CHEST; {
} return PAPERDOLL_FEET;
case L2Item.SLOT_LEGS: }
{ else if (slot == L2Item.SLOT_BACK)
return PAPERDOLL_LEGS; {
} return PAPERDOLL_CLOAK;
case L2Item.SLOT_FEET: }
{ else if ((slot == L2Item.SLOT_HAIR) || (slot == L2Item.SLOT_HAIRALL))
return PAPERDOLL_FEET; {
} return PAPERDOLL_HAIR;
case L2Item.SLOT_BACK: }
{ else if (slot == L2Item.SLOT_HAIR2)
return PAPERDOLL_CLOAK; {
} return PAPERDOLL_HAIR2;
case L2Item.SLOT_HAIR: }
case L2Item.SLOT_HAIRALL: else if (slot == L2Item.SLOT_R_BRACELET)
{ {
return PAPERDOLL_HAIR; return PAPERDOLL_RBRACELET;
} }
case L2Item.SLOT_HAIR2: else if (slot == L2Item.SLOT_L_BRACELET)
{ {
return PAPERDOLL_HAIR2; return PAPERDOLL_LBRACELET;
} }
case L2Item.SLOT_R_BRACELET: else if (slot == L2Item.SLOT_DECO)
{ {
return PAPERDOLL_RBRACELET; return PAPERDOLL_DECO1; // return first we deal with it later
} }
case L2Item.SLOT_L_BRACELET: else if (slot == L2Item.SLOT_BELT)
{ {
return PAPERDOLL_LBRACELET; return PAPERDOLL_BELT;
} }
case L2Item.SLOT_DECO: else if (slot == L2Item.SLOT_BROOCH)
{ {
return PAPERDOLL_DECO1; // return first we deal with it later return PAPERDOLL_BROOCH;
} }
case L2Item.SLOT_BELT: else if (slot == L2Item.SLOT_BROOCH_JEWEL)
{ {
return PAPERDOLL_BELT; return PAPERDOLL_BROOCH_JEWEL1;
} }
case L2Item.SLOT_BROOCH: else if (slot == L2Item.SLOT_AGATHION)
{ {
return PAPERDOLL_BROOCH; return PAPERDOLL_AGATHION1;
}
case L2Item.SLOT_BROOCH_JEWEL:
{
return PAPERDOLL_BROOCH_JEWEL1;
}
case L2Item.SLOT_AGATHION:
{
return PAPERDOLL_AGATHION1;
}
} }
return -1; return -1;
} }
@@ -1174,9 +1170,9 @@ public abstract class Inventory extends ItemContainer
return _wearedMask; return _wearedMask;
} }
public int getSlotFromItem(L2ItemInstance item) public long getSlotFromItem(L2ItemInstance item)
{ {
int slot = -1; long slot = -1;
final int location = item.getLocationSlot(); final int location = item.getLocationSlot();
switch (location) switch (location)
{ {
@@ -1315,11 +1311,11 @@ public abstract class Inventory extends ItemContainer
/** /**
* Unequips item in body slot and returns alterations.<BR> * Unequips item in body slot and returns alterations.<BR>
* <B>If you dont need return value use {@link Inventory#unEquipItemInBodySlot(int)} instead</B> * <B>If you dont need return value use {@link Inventory#unEquipItemInBodySlot(long)} instead</B>
* @param slot : int designating the slot of the paperdoll * @param slot : int designating the slot of the paperdoll
* @return L2ItemInstance[] : list of changes * @return L2ItemInstance[] : list of changes
*/ */
public L2ItemInstance[] unEquipItemInBodySlotAndRecord(int slot) public L2ItemInstance[] unEquipItemInBodySlotAndRecord(long slot)
{ {
final ChangeRecorder recorder = newRecorder(); final ChangeRecorder recorder = newRecorder();
@@ -1374,141 +1370,111 @@ public abstract class Inventory extends ItemContainer
* @param slot : int designating the slot * @param slot : int designating the slot
* @return {@link L2ItemInstance} designating the item placed in 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; int pdollSlot = -1;
switch (slot) if (slot == L2Item.SLOT_L_EAR)
{ {
case L2Item.SLOT_L_EAR: pdollSlot = PAPERDOLL_LEAR;
{ }
pdollSlot = PAPERDOLL_LEAR; else if (slot == L2Item.SLOT_R_EAR)
break; {
} pdollSlot = PAPERDOLL_REAR;
case L2Item.SLOT_R_EAR: }
{ else if (slot == L2Item.SLOT_NECK)
pdollSlot = PAPERDOLL_REAR; {
break; pdollSlot = PAPERDOLL_NECK;
} }
case L2Item.SLOT_NECK: else if (slot == L2Item.SLOT_R_FINGER)
{ {
pdollSlot = PAPERDOLL_NECK; pdollSlot = PAPERDOLL_RFINGER;
break; }
} else if (slot == L2Item.SLOT_L_FINGER)
case L2Item.SLOT_R_FINGER: {
{ pdollSlot = PAPERDOLL_LFINGER;
pdollSlot = PAPERDOLL_RFINGER; }
break; else if (slot == L2Item.SLOT_HAIR)
} {
case L2Item.SLOT_L_FINGER: pdollSlot = PAPERDOLL_HAIR;
{ }
pdollSlot = PAPERDOLL_LFINGER; else if (slot == L2Item.SLOT_HAIR2)
break; {
} pdollSlot = PAPERDOLL_HAIR2;
case L2Item.SLOT_HAIR: }
{ else if (slot == L2Item.SLOT_HAIRALL)
pdollSlot = PAPERDOLL_HAIR; {
break; setPaperdollItem(PAPERDOLL_HAIR, null);
} pdollSlot = PAPERDOLL_HAIR;
case L2Item.SLOT_HAIR2: }
{ else if (slot == L2Item.SLOT_HEAD)
pdollSlot = PAPERDOLL_HAIR2; {
break; pdollSlot = PAPERDOLL_HEAD;
} }
case L2Item.SLOT_HAIRALL: else if ((slot == L2Item.SLOT_R_HAND) || (slot == L2Item.SLOT_LR_HAND))
{ {
setPaperdollItem(PAPERDOLL_HAIR, null); pdollSlot = PAPERDOLL_RHAND;
pdollSlot = PAPERDOLL_HAIR; }
break; else if (slot == L2Item.SLOT_L_HAND)
} {
case L2Item.SLOT_HEAD: pdollSlot = PAPERDOLL_LHAND;
{ }
pdollSlot = PAPERDOLL_HEAD; else if (slot == L2Item.SLOT_GLOVES)
break; {
} pdollSlot = PAPERDOLL_GLOVES;
case L2Item.SLOT_R_HAND: }
case L2Item.SLOT_LR_HAND: else if ((slot == L2Item.SLOT_CHEST) || (slot == L2Item.SLOT_ALLDRESS) || (slot == L2Item.SLOT_FULL_ARMOR))
{ {
pdollSlot = PAPERDOLL_RHAND; pdollSlot = PAPERDOLL_CHEST;
break; }
} else if (slot == L2Item.SLOT_LEGS)
case L2Item.SLOT_L_HAND: {
{ pdollSlot = PAPERDOLL_LEGS;
pdollSlot = PAPERDOLL_LHAND; }
break; else if (slot == L2Item.SLOT_BACK)
} {
case L2Item.SLOT_GLOVES: pdollSlot = PAPERDOLL_CLOAK;
{ }
pdollSlot = PAPERDOLL_GLOVES; else if (slot == L2Item.SLOT_FEET)
break; {
} pdollSlot = PAPERDOLL_FEET;
case L2Item.SLOT_CHEST: }
case L2Item.SLOT_ALLDRESS: else if (slot == L2Item.SLOT_UNDERWEAR)
case L2Item.SLOT_FULL_ARMOR: {
{ pdollSlot = PAPERDOLL_UNDER;
pdollSlot = PAPERDOLL_CHEST; }
break; else if (slot == L2Item.SLOT_L_BRACELET)
} {
case L2Item.SLOT_LEGS: pdollSlot = PAPERDOLL_LBRACELET;
{ }
pdollSlot = PAPERDOLL_LEGS; else if (slot == L2Item.SLOT_R_BRACELET)
break; {
} pdollSlot = PAPERDOLL_RBRACELET;
case L2Item.SLOT_BACK: }
{ else if (slot == L2Item.SLOT_DECO)
pdollSlot = PAPERDOLL_CLOAK; {
break; pdollSlot = PAPERDOLL_DECO1;
} }
case L2Item.SLOT_FEET: else if (slot == L2Item.SLOT_BELT)
{ {
pdollSlot = PAPERDOLL_FEET; pdollSlot = PAPERDOLL_BELT;
break; }
} else if (slot == L2Item.SLOT_BROOCH)
case L2Item.SLOT_UNDERWEAR: {
{ pdollSlot = PAPERDOLL_BROOCH;
pdollSlot = PAPERDOLL_UNDER; }
break; else if (slot == L2Item.SLOT_BROOCH_JEWEL)
} {
case L2Item.SLOT_L_BRACELET: pdollSlot = PAPERDOLL_BROOCH_JEWEL1;
{ }
pdollSlot = PAPERDOLL_LBRACELET; else if (slot == L2Item.SLOT_AGATHION)
break; {
} pdollSlot = PAPERDOLL_AGATHION1;
case L2Item.SLOT_R_BRACELET: }
{ else
pdollSlot = PAPERDOLL_RBRACELET; {
break; LOGGER.info("Unhandled slot type: " + slot);
} LOGGER.info(CommonUtil.getTraceString(Thread.currentThread().getStackTrace()));
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()));
}
} }
if (pdollSlot >= 0) 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. // Check if player is using Formal Wear and item isn't Wedding Bouquet.
final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST); final L2ItemInstance formal = getPaperdollItem(PAPERDOLL_CHEST);
if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS)) if ((item.getId() != 21163) && (formal != null) && (formal.getItem().getBodyPart() == L2Item.SLOT_ALLDRESS))
{ {
// only chest target can pass this // 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: return;
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;
}
} }
} }
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, null);
setPaperdollItem(PAPERDOLL_RHAND, item);
break;
} }
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); setPaperdollItem(PAPERDOLL_LEAR, item);
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;
} }
case L2Item.SLOT_R_HAND: else if (_paperdoll[PAPERDOLL_REAR] == null)
{ {
// don't care about arrows, listener will unequip them (hopefully) setPaperdollItem(PAPERDOLL_REAR, item);
setPaperdollItem(PAPERDOLL_RHAND, item);
break;
} }
case L2Item.SLOT_L_EAR: else
case L2Item.SLOT_R_EAR:
case L2Item.SLOT_LR_EAR:
{ {
if (_paperdoll[PAPERDOLL_LEAR] == null) setPaperdollItem(PAPERDOLL_LEAR, item);
{
setPaperdollItem(PAPERDOLL_LEAR, item);
}
else if (_paperdoll[PAPERDOLL_REAR] == null)
{
setPaperdollItem(PAPERDOLL_REAR, item);
}
else
{
setPaperdollItem(PAPERDOLL_LEAR, item);
}
break;
} }
case L2Item.SLOT_L_FINGER: }
case L2Item.SLOT_R_FINGER: else if ((targetSlot == L2Item.SLOT_L_FINGER) || (targetSlot == L2Item.SLOT_R_FINGER) || (targetSlot == L2Item.SLOT_LR_FINGER))
case L2Item.SLOT_LR_FINGER: {
if (_paperdoll[PAPERDOLL_LFINGER] == null)
{ {
if (_paperdoll[PAPERDOLL_LFINGER] == null) setPaperdollItem(PAPERDOLL_LFINGER, item);
{
setPaperdollItem(PAPERDOLL_LFINGER, item);
}
else if (_paperdoll[PAPERDOLL_RFINGER] == null)
{
setPaperdollItem(PAPERDOLL_RFINGER, item);
}
else
{
setPaperdollItem(PAPERDOLL_LFINGER, item);
}
break;
} }
case L2Item.SLOT_NECK: else if (_paperdoll[PAPERDOLL_RFINGER] == null)
{ {
setPaperdollItem(PAPERDOLL_NECK, item); setPaperdollItem(PAPERDOLL_RFINGER, item);
break;
} }
case L2Item.SLOT_FULL_ARMOR: else
{ {
setPaperdollItem(PAPERDOLL_LEGS, null); setPaperdollItem(PAPERDOLL_LFINGER, item);
setPaperdollItem(PAPERDOLL_CHEST, item);
break;
} }
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); setPaperdollItem(PAPERDOLL_CHEST, null);
break;
} }
case L2Item.SLOT_LEGS: setPaperdollItem(PAPERDOLL_LEGS, item);
{ }
// handle full armor else if (targetSlot == L2Item.SLOT_FEET)
final L2ItemInstance chest = getPaperdollItem(PAPERDOLL_CHEST); {
if ((chest != null) && (chest.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)) setPaperdollItem(PAPERDOLL_FEET, item);
{ }
setPaperdollItem(PAPERDOLL_CHEST, null); else if (targetSlot == L2Item.SLOT_GLOVES)
} {
setPaperdollItem(PAPERDOLL_LEGS, item); setPaperdollItem(PAPERDOLL_GLOVES, item);
break; }
} else if (targetSlot == L2Item.SLOT_HEAD)
case L2Item.SLOT_FEET: {
{ setPaperdollItem(PAPERDOLL_HEAD, item);
setPaperdollItem(PAPERDOLL_FEET, item); }
break; else if (targetSlot == L2Item.SLOT_HAIR)
} {
case L2Item.SLOT_GLOVES: final L2ItemInstance hair = getPaperdollItem(PAPERDOLL_HAIR);
{ if ((hair != null) && (hair.getItem().getBodyPart() == L2Item.SLOT_HAIRALL))
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_HAIR2, null); setPaperdollItem(PAPERDOLL_HAIR2, null);
setPaperdollItem(PAPERDOLL_HAIR, item);
break;
} }
case L2Item.SLOT_UNDERWEAR: else
{ {
setPaperdollItem(PAPERDOLL_UNDER, item); setPaperdollItem(PAPERDOLL_HAIR, null);
break;
} }
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); setPaperdollItem(PAPERDOLL_HAIR, null);
break;
} }
case L2Item.SLOT_L_BRACELET: else
{ {
setPaperdollItem(PAPERDOLL_LBRACELET, item); setPaperdollItem(PAPERDOLL_HAIR2, null);
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, 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. * Blocks the given item slot from being equipped.
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
*/ */
public void blockItemSlot(int itemSlot) public void blockItemSlot(long itemSlot)
{ {
_blockedItemSlotsMask |= itemSlot; _blockedItemSlotsMask |= itemSlot;
} }
@@ -2106,7 +2031,7 @@ public abstract class Inventory extends ItemContainer
* Unblocks the given item slot so it can be equipped. * Unblocks the given item slot so it can be equipped.
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
*/ */
public void unblockItemSlot(int itemSlot) public void unblockItemSlot(long itemSlot)
{ {
_blockedItemSlotsMask &= ~itemSlot; _blockedItemSlotsMask &= ~itemSlot;
} }
@@ -2115,7 +2040,7 @@ public abstract class Inventory extends ItemContainer
* @param itemSlot mask from L2Item * @param itemSlot mask from L2Item
* @return if the given item slot is blocked or not. * @return if the given item slot is blocked or not.
*/ */
public boolean isItemSlotBlocked(int itemSlot) public boolean isItemSlotBlocked(long itemSlot)
{ {
return (_blockedItemSlotsMask & itemSlot) == itemSlot; return (_blockedItemSlotsMask & itemSlot) == itemSlot;
} }

View File

@@ -41,7 +41,7 @@ public final class L2Armor extends L2Item
super.set(set); super.set(set);
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE); _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)) 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; _type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;

View File

@@ -111,7 +111,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
public static final int SLOT_BELT = 0x10000000; public static final int SLOT_BELT = 0x10000000;
public static final int SLOT_BROOCH = 0x20000000; public static final int SLOT_BROOCH = 0x20000000;
public static final int SLOT_BROOCH_JEWEL = 0x40000000; 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_WOLF = -100;
public static final int SLOT_HATCHLING = -101; public static final int SLOT_HATCHLING = -101;
@@ -134,7 +134,7 @@ public abstract class L2Item extends ListenersContainer implements IIdentifiable
private int _duration; private int _duration;
private long _time; private long _time;
private int _autoDestroyTime; private int _autoDestroyTime;
private int _bodyPart; private long _bodyPart;
private int _referencePrice; private int _referencePrice;
private int _crystalCount; private int _crystalCount;
private boolean _sellable; 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. * @return the part of the body used with the item.
*/ */
public final int getBodyPart() public final long getBodyPart()
{ {
return _bodyPart; return _bodyPart;
} }

View File

@@ -171,7 +171,7 @@ public class L2WarehouseItem
/** /**
* @return the part of body used with this item. * @return the part of body used with this item.
*/ */
public final int getBodyPart() public final long getBodyPart()
{ {
return _item.getBodyPart(); return _item.getBodyPart();
} }

View File

@@ -49,7 +49,7 @@ public class AppearanceStone
private final AppearanceMagicType _magicType; private final AppearanceMagicType _magicType;
private List<CrystalType> _crystalTypes; private List<CrystalType> _crystalTypes;
private List<AppearanceTargetType> _targetTypes; private List<AppearanceTargetType> _targetTypes;
private List<Integer> _bodyParts; private List<Long> _bodyParts;
private List<Race> _races; private List<Race> _races;
private List<Race> _racesNot; private List<Race> _racesNot;
private List<AppearanceHolder> _allVisualIds; private List<AppearanceHolder> _allVisualIds;
@@ -103,7 +103,7 @@ public class AppearanceStone
addCrystalType(crystalType); 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) if (bodyPart != L2Item.SLOT_NONE)
{ {
addBodyPart(bodyPart); addBodyPart(bodyPart);
@@ -195,7 +195,7 @@ public class AppearanceStone
return _targetTypes != null ? _targetTypes : Collections.emptyList(); return _targetTypes != null ? _targetTypes : Collections.emptyList();
} }
public void addBodyPart(Integer part) public void addBodyPart(long part)
{ {
if (_bodyParts == null) if (_bodyParts == null)
{ {
@@ -218,7 +218,7 @@ public class AppearanceStone
return _allVisualIds != null ? _allVisualIds : Collections.emptyList(); return _allVisualIds != null ? _allVisualIds : Collections.emptyList();
} }
public List<Integer> getBodyParts() public List<Long> getBodyParts()
{ {
return _bodyParts != null ? _bodyParts : Collections.emptyList(); return _bodyParts != null ? _bodyParts : Collections.emptyList();
} }

View File

@@ -54,7 +54,7 @@ public final class EnchantRateItem
* Adds body slot verification. * Adds body slot verification.
* @param slot * @param slot
*/ */
public void addSlot(int slot) public void addSlot(long slot)
{ {
_slot |= slot; _slot |= slot;
} }

View File

@@ -112,13 +112,13 @@ public interface IStatsFunction
for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted)) for (L2ItemInstance equippedItem : creature.getInventory().getPaperdollItems(L2ItemInstance::isEquipped, L2ItemInstance::isEnchanted))
{ {
final L2Item item = equippedItem.getItem(); final L2Item item = equippedItem.getItem();
final int bodypart = item.getBodyPart(); final long bodypart = item.getBodyPart();
if ((bodypart == L2Item.SLOT_HAIR) || // if ((bodypart == L2Item.SLOT_HAIR) || //
(bodypart == L2Item.SLOT_HAIR2) || // (bodypart == L2Item.SLOT_HAIR2) || //
(bodypart == L2Item.SLOT_HAIRALL)) (bodypart == L2Item.SLOT_HAIRALL))
{ {
// TODO: Item after enchant shows pDef, but scroll says mDef increase. // 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; continue;
} }

View File

@@ -214,7 +214,7 @@ public class L2SiegeZone extends L2ZoneType
} }
else 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.getInventory().unEquipItemInBodySlot(slot);
activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true);
} }

View File

@@ -564,7 +564,7 @@ public class EnterWorld implements IClientIncomingPacket
} }
else 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.getInventory().unEquipItemInBodySlot(slot);
activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true); activeChar.destroyItem("CombatFlag", activeChar.getInventory().getItemByItemId(9819), null, true);
} }

View File

@@ -192,61 +192,49 @@ public final class UseItem implements IClientIncomingPacket
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
return; return;
} }
// Prevent players to equip weapon while wearing combat flag
switch (item.getItem().getBodyPart()) // 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: if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819))
case L2Item.SLOT_L_HAND:
case L2Item.SLOT_R_HAND:
{ {
// Prevent players to equip weapon while wearing combat flag activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
if ((activeChar.getActiveWeaponItem() != null) && (activeChar.getActiveWeaponItem().getId() == 9819)) return;
{
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;
} }
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;
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM);
return;
}
break;
} }
case L2Item.SLOT_BROOCH_JEWEL: if (activeChar.isCursedWeaponEquipped())
{ {
if (!item.isEquipped() && (activeChar.getInventory().getBroochJewelSlots() == 0)) return;
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_EQUIP_S1_WITHOUT_EQUIPPING_A_BROOCH);
sm.addItemName(item);
activeChar.sendPacket(sm);
return;
}
break;
} }
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;
activeChar.sendPacket(SystemMessageId.YOU_DO_NOT_MEET_THE_REQUIRED_CONDITION_TO_EQUIP_THAT_ITEM); }
return; }
} else if (item.getItem().getBodyPart() == L2Item.SLOT_BROOCH_JEWEL)
break; {
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;
} }
} }

View File

@@ -69,6 +69,7 @@ Antharas: https://eu.4game.com/lineage2classic/play/antharas/
-Parsed new items from client -Parsed new items from client
-Parsed new NPCs from L2Wiki and client -Parsed new NPCs from L2Wiki and client
-Clan Arena -Clan Arena
-New Agathion item support
Customs: Customs:
-Newbie Helper NPC location info -Newbie Helper NPC location info