Support for Artifact item slots.

Contributed by hlwrave.
This commit is contained in:
MobiusDev
2018-10-11 18:33:37 +00:00
parent adc5bbc219
commit 866bbde935
88 changed files with 2704 additions and 1343 deletions

View File

@@ -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;
}

View File

@@ -129,7 +129,9 @@ public final class ArmorSetsData implements IGameXmlReader
final int minPieces = parseInteger(attrs, "minimumPieces", set.getMinimumPieces());
final int minEnchant = parseInteger(attrs, "minimumEnchant", 0);
final boolean isOptional = parseBoolean(attrs, "optional", false);
set.addSkill(new ArmorsetSkillHolder(skillId, skillLevel, minPieces, minEnchant, isOptional));
final int artifactSlotMask = parseInteger(attrs, "slotMask", 0);
final int artifactBookSlot = parseInteger(attrs, "bookSlot", 0);
set.addSkill(new ArmorsetSkillHolder(skillId, skillLevel, minPieces, minEnchant, isOptional, artifactSlotMask, artifactBookSlot));
});
break;
}

View File

@@ -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<String, Integer> SLOTS = new HashMap<>();
public static final Map<String, Long> SLOTS = new HashMap<>();
private L2Item[] _allTemplates;
private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>();
@@ -66,45 +66,47 @@ public class ItemTable
private final Map<Integer, L2Weapon> _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("artifactbook", L2Item.SLOT_ARTIFACT_BOOK);
SLOTS.put("artifact", L2Item.SLOT_ARTIFACT);
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);
}
/**

View File

@@ -40,19 +40,18 @@ 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) //
|| (item.getBodyPart() == L2Item.SLOT_ARTIFACT_BOOK) //
|| (item.getBodyPart() == L2Item.SLOT_ARTIFACT))
{
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;

View File

@@ -61,7 +61,29 @@ public enum InventorySlot implements IUpdateTypeComponent
BROOCH_JEWEL3(Inventory.PAPERDOLL_BROOCH_JEWEL3),
BROOCH_JEWEL4(Inventory.PAPERDOLL_BROOCH_JEWEL4),
BROOCH_JEWEL5(Inventory.PAPERDOLL_BROOCH_JEWEL5),
BROOCH_JEWEL6(Inventory.PAPERDOLL_BROOCH_JEWEL6);
BROOCH_JEWEL6(Inventory.PAPERDOLL_BROOCH_JEWEL6),
ARTIFACT_BOOK(Inventory.PAPERDOLL_ARTIFACT_BOOK),
ARTIFACT1(Inventory.PAPERDOLL_ARTIFACT1),
ARTIFACT2(Inventory.PAPERDOLL_ARTIFACT2),
ARTIFACT3(Inventory.PAPERDOLL_ARTIFACT3),
ARTIFACT4(Inventory.PAPERDOLL_ARTIFACT4),
ARTIFACT5(Inventory.PAPERDOLL_ARTIFACT5),
ARTIFACT6(Inventory.PAPERDOLL_ARTIFACT6),
ARTIFACT7(Inventory.PAPERDOLL_ARTIFACT7),
ARTIFACT8(Inventory.PAPERDOLL_ARTIFACT8),
ARTIFACT9(Inventory.PAPERDOLL_ARTIFACT9),
ARTIFACT10(Inventory.PAPERDOLL_ARTIFACT10),
ARTIFACT11(Inventory.PAPERDOLL_ARTIFACT11),
ARTIFACT12(Inventory.PAPERDOLL_ARTIFACT12),
ARTIFACT13(Inventory.PAPERDOLL_ARTIFACT13),
ARTIFACT14(Inventory.PAPERDOLL_ARTIFACT14),
ARTIFACT15(Inventory.PAPERDOLL_ARTIFACT15),
ARTIFACT16(Inventory.PAPERDOLL_ARTIFACT16),
ARTIFACT17(Inventory.PAPERDOLL_ARTIFACT17),
ARTIFACT18(Inventory.PAPERDOLL_ARTIFACT18),
ARTIFACT19(Inventory.PAPERDOLL_ARTIFACT19),
ARTIFACT20(Inventory.PAPERDOLL_ARTIFACT20),
ARTIFACT21(Inventory.PAPERDOLL_ARTIFACT21);
private final int _paperdollSlot;

View File

@@ -114,6 +114,34 @@ public enum Movie
SC_RAMONA_TRANS_B(120, true),
SC_HELIOS_TRANS_A(121, true),
SC_HELIOS_TRANS_B(122, true),
// 152
SC_KAIN_INTRO(123, true),
SC_CAMILLE_INTRO(124, true),
SC_CAMILLE_ENDING(125, true),
SI_DEFENCE_SUCCESS(126, true),
SI_DEFENCE_FAIL(127, true),
SI_INZONE_FIN(128, true),
SI_ENTER_CITADEL(129, true),
SI_CHOICE_OF_KAIN_A(130, true),
SI_CHOICE_OF_KAIN_B(131, true),
EPIC_KAIN_SCENE(132, true),
ARENA_START_BLUETEAM(133, true),
ARENA_START_REDTEAM(134, true),
SC_ETIS_VAN_ETINA_TRANS(135, true),
SC_ETIS_VAN_ETINA_ENDING(136, true),
SC_KAIN_BOSS_ENDING(137, true),
SC_ANTARAS_INTRO(138, true),
SC_ANTARAS_TRANS(139, true),
EP5_ASTATINE_QST_START(140, true),
EP5_ASTATINE_QST_END(141, true),
EP5_HELIOS_QST_END(142, true),
EP5_ETINA_QST_START_A(143, true),
EP5_ETINA_QST_START_B(144, true),
EP5_ETINA_QST_END(145, true),
SC_INZONE_CAMILLE_INTRO(146, true),
SC_INZONE_KAIN_INTRO(147, true),
SC_INZONE_HELIOS_TRANS_A(148, true),
SC_INZONE_HELIOS_TRANS_B(149, true),
LAND_KSERTH_A(1000, true),
LAND_KSERTH_B(1001, true),
LAND_UNDEAD_A(1002, true),

View File

@@ -26,8 +26,6 @@ import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
public class CombatFlag
{
// private static final Logger LOGGER = Logger.getLogger(CombatFlag.class.getName());
private L2PcInstance _player = null;
private int _playerId = 0;
private L2ItemInstance _item = null;
@@ -104,7 +102,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;

View File

@@ -54,6 +54,39 @@ public final class L2ArmorSet
Inventory.PAPERDOLL_GLOVES,
Inventory.PAPERDOLL_FEET
};
private static final int[] ARTIFACT_1_SLOTS = new int[]
{
Inventory.PAPERDOLL_ARTIFACT1,
Inventory.PAPERDOLL_ARTIFACT2,
Inventory.PAPERDOLL_ARTIFACT3,
Inventory.PAPERDOLL_ARTIFACT4,
Inventory.PAPERDOLL_ARTIFACT13,
Inventory.PAPERDOLL_ARTIFACT16,
Inventory.PAPERDOLL_ARTIFACT19,
};
private static final int[] ARTIFACT_2_SLOTS = new int[]
{
Inventory.PAPERDOLL_ARTIFACT5,
Inventory.PAPERDOLL_ARTIFACT6,
Inventory.PAPERDOLL_ARTIFACT7,
Inventory.PAPERDOLL_ARTIFACT8,
Inventory.PAPERDOLL_ARTIFACT14,
Inventory.PAPERDOLL_ARTIFACT17,
Inventory.PAPERDOLL_ARTIFACT20,
};
private static final int[] ARTIFACT_3_SLOTS = new int[]
{
Inventory.PAPERDOLL_ARTIFACT9,
Inventory.PAPERDOLL_ARTIFACT10,
Inventory.PAPERDOLL_ARTIFACT11,
Inventory.PAPERDOLL_ARTIFACT12,
Inventory.PAPERDOLL_ARTIFACT15,
Inventory.PAPERDOLL_ARTIFACT18,
Inventory.PAPERDOLL_ARTIFACT21,
};
/**
* @param id
@@ -202,6 +235,59 @@ public final class L2ArmorSet
return enchantLevel;
}
/**
* Condition for 3 Lv. Set Effect Applied Skill
* @param player
* @param bookSlot
* @return total paperdoll(busy) count for 1 of 3 artifact book slots
*/
public int getArtifactSlotMask(L2PcInstance player, int bookSlot)
{
final PcInventory inv = player.getInventory();
int slotMask = 0;
switch (bookSlot)
{
case 1:
{
for (int artifactSlot : ARTIFACT_1_SLOTS)
{
final L2ItemInstance itemPart = inv.getPaperdollItem(artifactSlot);
if ((itemPart != null) && _requiredItems.contains(itemPart.getId()))
{
slotMask += artifactSlot;
}
}
break;
}
case 2:
{
for (int artifactSlot : ARTIFACT_2_SLOTS)
{
final L2ItemInstance itemPart = inv.getPaperdollItem(artifactSlot);
if ((itemPart != null) && _requiredItems.contains(itemPart.getId()))
{
slotMask += artifactSlot;
}
}
break;
}
case 3:
{
for (int artifactSlot : ARTIFACT_3_SLOTS)
{
final L2ItemInstance itemPart = inv.getPaperdollItem(artifactSlot);
if ((itemPart != null) && _requiredItems.contains(itemPart.getId()))
{
slotMask += artifactSlot;
}
}
break;
}
}
return slotMask;
}
public boolean hasOptionalEquipped(L2PcInstance player, Function<L2ItemInstance, Integer> idProvider)
{
return player.getInventory().getPaperdollItems().stream().anyMatch(item -> _optionalItems.contains(idProvider.apply(item)));

View File

@@ -2197,9 +2197,9 @@ 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))
if ((slot == L2Item.SLOT_DECO) || (slot == L2Item.SLOT_BROOCH_JEWEL) || (slot == L2Item.SLOT_AGATHION) || (slot == L2Item.SLOT_ARTIFACT))
{
items = _inventory.unEquipItemInSlotAndRecord(item.getLocationSlot());
}
@@ -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);
}

View File

@@ -681,6 +681,15 @@ public class PcStat extends PlayableStat
return (int) getValue(Stats.AGATHION_SLOTS, 0);
}
/**
* Gets the maximum artifact book count.
* @return the maximum artifact book count
*/
public int getArtifactSlots()
{
return (int) getValue(Stats.ARTIFACT_SLOTS, 0);
}
@Override
protected void onRecalculateStats(boolean broadcast)
{

View File

@@ -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)
{

View File

@@ -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;
}

View File

@@ -29,14 +29,18 @@ public class ArmorsetSkillHolder extends SkillHolder
{
private final int _minimumPieces;
private final int _minEnchant;
private final int _artifactSlotMask;
private final int _artifactBookSlot;
private final boolean _isOptional;
public ArmorsetSkillHolder(int skillId, int skillLvl, int minimumPieces, int minEnchant, boolean isOptional)
public ArmorsetSkillHolder(int skillId, int skillLvl, int minimumPieces, int minEnchant, boolean isOptional, int artifactSlotMask, int artifactBookSlot)
{
super(skillId, skillLvl);
_minimumPieces = minimumPieces;
_minEnchant = minEnchant;
_isOptional = isOptional;
_artifactSlotMask = artifactSlotMask;
_artifactBookSlot = artifactBookSlot;
}
public int getMinimumPieces()
@@ -56,6 +60,12 @@ public class ArmorsetSkillHolder extends SkillHolder
public boolean validateConditions(L2PcInstance player, L2ArmorSet armorSet, Function<L2ItemInstance, Integer> idProvider)
{
// Player's doesn't have full busy (1 of 3) artifact real slot
if (_artifactSlotMask > armorSet.getArtifactSlotMask(player, _artifactBookSlot))
{
return false;
}
// Player doesn't have enough items equipped to use this skill
if (_minimumPieces > armorSet.getPiecesCount(player, idProvider))
{

View File

@@ -41,8 +41,8 @@ public final class L2Armor extends L2Item
super.set(set);
_type = set.getEnum("armor_type", ArmorType.class, ArmorType.NONE);
final int _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))
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) || ((_bodyPart & L2Item.SLOT_ARTIFACT_BOOK) != 0))
{
_type1 = L2Item.TYPE1_WEAPON_RING_EARRING_NECKLACE;
_type2 = L2Item.TYPE2_ACCESSORY;

View File

@@ -111,7 +111,9 @@ 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 long SLOT_ARTIFACT_BOOK = 0x20000000000L;
public static final long SLOT_ARTIFACT = 0x40000000000L;
public static final int SLOT_WOLF = -100;
public static final int SLOT_HATCHLING = -101;
@@ -134,7 +136,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 +505,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;
}

View File

@@ -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();
}

View File

@@ -49,7 +49,7 @@ public class AppearanceStone
private final AppearanceMagicType _magicType;
private List<CrystalType> _crystalTypes;
private List<AppearanceTargetType> _targetTypes;
private List<Integer> _bodyParts;
private List<Long> _bodyParts;
private List<Race> _races;
private List<Race> _racesNot;
private List<AppearanceHolder> _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<Integer> getBodyParts()
public List<Long> getBodyParts()
{
return _bodyParts != null ? _bodyParts : Collections.emptyList();
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -251,6 +251,9 @@ public enum Stats
// Agathions
AGATHION_SLOTS("agathionSlots"),
// Artifacts
ARTIFACT_SLOTS("artifactSlots"),
// Summon Points
MAX_SUMMON_POINTS("summonPoints"),

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -192,64 +192,61 @@ 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;
}
case 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;
}
break;
return;
}
}
else if (item.getItem().getBodyPart() == L2Item.SLOT_DECO)
{
if (!item.isEquipped() && (activeChar.getInventory().getTalismanSlots() == 0))
{
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;
}
}
else if (item.getItem().getBodyPart() == L2Item.SLOT_ARTIFACT)
{
if (!item.isEquipped() && (activeChar.getInventory().getArtifactSlots() == 0))
{
final SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVEN_T_EQUIPPED_AN_ARTIFACT_BOOK_SO_S1_CANNOT_BE_EQUIPPED);
sm.addItemName(item);
activeChar.sendPacket(sm);
return;
}
}
if (activeChar.isCastingNow())
{
// Create and Bind the next action to the AI

View File

@@ -88,7 +88,29 @@ public class CharSelectionInfo implements IClientOutgoingPacket
Inventory.PAPERDOLL_BROOCH_JEWEL3,
Inventory.PAPERDOLL_BROOCH_JEWEL4,
Inventory.PAPERDOLL_BROOCH_JEWEL5,
Inventory.PAPERDOLL_BROOCH_JEWEL6
Inventory.PAPERDOLL_BROOCH_JEWEL6,
Inventory.PAPERDOLL_ARTIFACT_BOOK, // 152
Inventory.PAPERDOLL_ARTIFACT1, // 152
Inventory.PAPERDOLL_ARTIFACT2, // 152
Inventory.PAPERDOLL_ARTIFACT3, // 152
Inventory.PAPERDOLL_ARTIFACT4, // 152
Inventory.PAPERDOLL_ARTIFACT5, // 152
Inventory.PAPERDOLL_ARTIFACT6, // 152
Inventory.PAPERDOLL_ARTIFACT7, // 152
Inventory.PAPERDOLL_ARTIFACT8, // 152
Inventory.PAPERDOLL_ARTIFACT9, // 152
Inventory.PAPERDOLL_ARTIFACT10, // 152
Inventory.PAPERDOLL_ARTIFACT11, // 152
Inventory.PAPERDOLL_ARTIFACT12, // 152
Inventory.PAPERDOLL_ARTIFACT13, // 152
Inventory.PAPERDOLL_ARTIFACT14, // 152
Inventory.PAPERDOLL_ARTIFACT15, // 152
Inventory.PAPERDOLL_ARTIFACT16, // 152
Inventory.PAPERDOLL_ARTIFACT17, // 152
Inventory.PAPERDOLL_ARTIFACT18, // 152
Inventory.PAPERDOLL_ARTIFACT19, // 152
Inventory.PAPERDOLL_ARTIFACT20, // 152
Inventory.PAPERDOLL_ARTIFACT21 // 152
};
private static final int[] PAPERDOLL_ORDER_VISUAL_ID = new int[]
@@ -215,29 +237,6 @@ public class CharSelectionInfo implements IClientOutgoingPacket
packet.writeD(charInfoPackage.getPaperdollItemId(slot));
}
packet.writeD(0x00); // Book // 152
packet.writeD(0x00); // Balance artifact (1) // 152
packet.writeD(0x00); // Balance artifact (2) // 152
packet.writeD(0x00); // Balance artifact (3) // 152
packet.writeD(0x00); // Balance artifact (4) // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
packet.writeD(0x00); // 152
for (int slot : getPaperdollOrderVisualId())
{
packet.writeD(charInfoPackage.getPaperdollItemVisualId(slot));

View File

@@ -69,7 +69,7 @@ public class ExStorageMaxCount implements IClientOutgoingPacket
packet.writeD(_inventoryQuestItems);
packet.writeD(40); // TODO: Find me!
packet.writeD(40); // TODO: Find me!
packet.writeD(0x00); // Artifact slots // 152
packet.writeD(0x64); // Artifact slots (Fixed)
return true;
}
}

View File

@@ -69,7 +69,7 @@ public class ExUserInfoEquipSlot extends AbstractMaskPacket<InventorySlot>
OutgoingPackets.EX_USER_INFO_EQUIP_SLOT.writeId(packet);
packet.writeD(_activeChar.getObjectId());
packet.writeH(60); // 152
packet.writeH(InventorySlot.values().length); // 152
packet.writeB(_masks);
final PcInventory inventory = _activeChar.getInventory();

View File

@@ -70,7 +70,29 @@ public interface IClientOutgoingPacket extends IOutgoingPacket
Inventory.PAPERDOLL_BROOCH_JEWEL3,
Inventory.PAPERDOLL_BROOCH_JEWEL4,
Inventory.PAPERDOLL_BROOCH_JEWEL5,
Inventory.PAPERDOLL_BROOCH_JEWEL6
Inventory.PAPERDOLL_BROOCH_JEWEL6,
Inventory.PAPERDOLL_ARTIFACT_BOOK,
Inventory.PAPERDOLL_ARTIFACT1,
Inventory.PAPERDOLL_ARTIFACT2,
Inventory.PAPERDOLL_ARTIFACT3,
Inventory.PAPERDOLL_ARTIFACT4,
Inventory.PAPERDOLL_ARTIFACT5,
Inventory.PAPERDOLL_ARTIFACT6,
Inventory.PAPERDOLL_ARTIFACT7,
Inventory.PAPERDOLL_ARTIFACT8,
Inventory.PAPERDOLL_ARTIFACT9,
Inventory.PAPERDOLL_ARTIFACT10,
Inventory.PAPERDOLL_ARTIFACT11,
Inventory.PAPERDOLL_ARTIFACT12,
Inventory.PAPERDOLL_ARTIFACT13,
Inventory.PAPERDOLL_ARTIFACT14,
Inventory.PAPERDOLL_ARTIFACT15,
Inventory.PAPERDOLL_ARTIFACT16,
Inventory.PAPERDOLL_ARTIFACT17,
Inventory.PAPERDOLL_ARTIFACT18,
Inventory.PAPERDOLL_ARTIFACT19,
Inventory.PAPERDOLL_ARTIFACT20,
Inventory.PAPERDOLL_ARTIFACT21,
};
int[] PAPERDOLL_ORDER_AUGMENT = new int[]

View File

@@ -334,13 +334,13 @@ public class UserInfo extends AbstractMaskPacket<UserInfoType>
{
packet.writeC(0x01); // Charm slots
packet.writeC(_activeChar.getInventory().getAgathionSlots() - 1);
packet.writeC(0x00); // Artifact set slots // 152
packet.writeC(_activeChar.getInventory().getArtifactSlots()); // Artifact set slots // 152
}
else
{
packet.writeC(0x00); // Charm slots
packet.writeC(0x00);
packet.writeC(0x00); // Artifact set slots // 152
packet.writeC(_activeChar.getInventory().getArtifactSlots()); // Artifact set slots // 152
}
}