diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/data/ItemTable.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/data/ItemTable.java index 554a280d6e..7cc5fd345e 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/data/ItemTable.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/data/ItemTable.java @@ -37,89 +37,90 @@ public class ItemTable { private static Logger _log = Logger.getLogger(ItemTable.class.getName()); - // private static final int TYPE_ETC_ITEM = 0; - // private static final int TYPE_ARMOR = 1; - // private static final int TYPE_WEAPON = 2; + private static final int TYPE_ETC_ITEM = 0; + private static final int TYPE_ARMOR = 1; + private static final int TYPE_WEAPON = 2; private static final HashMap _materials = new HashMap<>(); static { - _materials.put("steel", 0); - _materials.put("fine_steel", 1); - _materials.put("cotton", 1); - _materials.put("blood_steel", 2); - _materials.put("bronze", 3); - _materials.put("silver", 4); - _materials.put("gold", 5); - _materials.put("mithril", 6); - _materials.put("oriharukon", 7); - _materials.put("paper", 8); - _materials.put("wood", 9); - _materials.put("cloth", 10); - _materials.put("leather", 11); - _materials.put("bone", 12); - _materials.put("horn", 13); - _materials.put("damascus", 14); - _materials.put("adamantaite", 15); - _materials.put("chrysolite", 16); - _materials.put("crystal", 17); - _materials.put("liquid", 18); - _materials.put("scale_of_dragon", 19); - _materials.put("dyestuff", 20); - _materials.put("cobweb", 21); + _materials.put("steel", Item.MATERIAL_STEEL); + _materials.put("fine_steel", Item.MATERIAL_FINE_STEEL); + _materials.put("cotton", Item.MATERIAL_FINE_STEEL); + _materials.put("blood_steel", Item.MATERIAL_BLOOD_STEEL); + _materials.put("bronze", Item.MATERIAL_BRONZE); + _materials.put("silver", Item.MATERIAL_SILVER); + _materials.put("gold", Item.MATERIAL_GOLD); + _materials.put("mithril", Item.MATERIAL_MITHRIL); + _materials.put("oriharukon", Item.MATERIAL_ORIHARUKON); + _materials.put("paper", Item.MATERIAL_PAPER); + _materials.put("wood", Item.MATERIAL_WOOD); + _materials.put("cloth", Item.MATERIAL_CLOTH); + _materials.put("leather", Item.MATERIAL_LEATHER); + _materials.put("bone", Item.MATERIAL_BONE); + _materials.put("horn", Item.MATERIAL_HORN); + _materials.put("damascus", Item.MATERIAL_DAMASCUS); + _materials.put("adamantaite", Item.MATERIAL_ADAMANTAITE); + _materials.put("chrysolite", Item.MATERIAL_CHRYSOLITE); + _materials.put("crystal", Item.MATERIAL_CRYSTAL); + _materials.put("liquid", Item.MATERIAL_LIQUID); + _materials.put("scale_of_dragon", Item.MATERIAL_SCALE_OF_DRAGON); + _materials.put("dyestuff", Item.MATERIAL_DYESTUFF); + _materials.put("cobweb", Item.MATERIAL_COBWEB); } private static final HashMap _crystalTypes = new HashMap<>(); static { - _crystalTypes.put("none", 1); - _crystalTypes.put("d", 2); - _crystalTypes.put("c", 3); - _crystalTypes.put("b", 4); - _crystalTypes.put("a", 5); - _crystalTypes.put("s", 6); + _crystalTypes.put("none", Item.CRYSTAL_NONE); + _crystalTypes.put("d", Item.CRYSTAL_D); + _crystalTypes.put("c", Item.CRYSTAL_C); + _crystalTypes.put("b", Item.CRYSTAL_B); + _crystalTypes.put("a", Item.CRYSTAL_A); + _crystalTypes.put("s", Item.CRYSTAL_S); } private static final HashMap _weaponTypes = new HashMap<>(); static { - _weaponTypes.put("none", 1); - _weaponTypes.put("sword", 2); - _weaponTypes.put("blunt", 3); - _weaponTypes.put("dagger", 4); - _weaponTypes.put("bow", 5); - _weaponTypes.put("pole", 6); - _weaponTypes.put("etc", 7); - _weaponTypes.put("fist", 8); - _weaponTypes.put("dual", 9); - _weaponTypes.put("dualfist", 10); + _weaponTypes.put("none", Weapon.WEAPON_TYPE_NONE); + _weaponTypes.put("sword", Weapon.WEAPON_TYPE_SWORD); + _weaponTypes.put("blunt", Weapon.WEAPON_TYPE_BLUNT); + _weaponTypes.put("dagger", Weapon.WEAPON_TYPE_DAGGER); + _weaponTypes.put("bow", Weapon.WEAPON_TYPE_BOW); + _weaponTypes.put("pole", Weapon.WEAPON_TYPE_POLE); + _weaponTypes.put("etc", Weapon.WEAPON_TYPE_ETC); + _weaponTypes.put("fist", Weapon.WEAPON_TYPE_FIST); + _weaponTypes.put("dual", Weapon.WEAPON_TYPE_DUAL); + _weaponTypes.put("dualfist", Weapon.WEAPON_TYPE_DUALFIST); } private static final HashMap _armorTypes = new HashMap<>(); static { - _armorTypes.put("none", 1); - _armorTypes.put("light", 2); - _armorTypes.put("heavy", 3); - _armorTypes.put("magic", 4); + _armorTypes.put("none", Armor.ARMORTYPE_NONE); + _armorTypes.put("light", Armor.ARMORTYPE_LIGHT); + _armorTypes.put("heavy", Armor.ARMORTYPE_HEAVY); + _armorTypes.put("magic", Armor.ARMORTYPE_MAGIC); } private static final HashMap _slots = new HashMap<>(); static { - _slots.put("none", 0); - _slots.put("underwear", 1); - _slots.put("rear,lear", 6); - _slots.put("neck", 8); - _slots.put("rfinger,lfinger", 48); - _slots.put("head", 64); - _slots.put("rhand", 128); - _slots.put("lhand", 256); - _slots.put("gloves", 512); - _slots.put("chest", 1024); - _slots.put("legs", 2048); - _slots.put("chest,legs", 3072); - _slots.put("feet", 4096); - _slots.put("back", 8192); - _slots.put("lrhand", 16384); - _slots.put("fullarmor", 32768); + _slots.put("none", Item.SLOT_NONE); + _slots.put("underwear", Item.SLOT_UNDERWEAR); + _slots.put("rear,lear", Item.SLOT_R_EAR + Item.SLOT_L_EAR); + _slots.put("neck", Item.SLOT_NECK); + _slots.put("rfinger,lfinger", Item.SLOT_R_FINGER + Item.SLOT_L_FINGER); + _slots.put("head", Item.SLOT_HEAD); + _slots.put("rhand", Item.SLOT_R_HAND); + _slots.put("lhand", Item.SLOT_L_HAND); + _slots.put("gloves", Item.SLOT_GLOVES); + _slots.put("chest", Item.SLOT_CHEST); + _slots.put("legs", Item.SLOT_LEGS); + _slots.put("chest,legs", Item.SLOT_CHEST + Item.SLOT_LEGS); + _slots.put("feet", Item.SLOT_FEET); + _slots.put("back", Item.SLOT_BACK); + _slots.put("lrhand", Item.SLOT_LR_HAND); + _slots.put("fullarmor", Item.SLOT_FULL_ARMOR); } + private Item[] _allTemplates; private HashMap _etcItems; private HashMap _armors; @@ -136,6 +137,11 @@ public class ItemTable return _instance; } + public boolean isInitialized() + { + return _initialized; + } + public ItemTable() { File weaponFile; @@ -159,47 +165,54 @@ public class ItemTable buildFastLookupTable(); } - public boolean isInitialized() - { - return _initialized; - } - private void parseEtcItems(File data) { - _etcItems = parseFile(data, 0); + _etcItems = parseFile(data, TYPE_ETC_ITEM); _log.config("Loaded " + _etcItems.size() + " etc items."); fixEtcItems(_etcItems); } + private void parseArmors(File data) + { + _armors = parseFile(data, TYPE_ARMOR); + _log.config("Loaded " + _armors.size() + " armors."); + } + + private void parseWeapons(File data) + { + _weapons = parseFile(data, TYPE_WEAPON); + _log.config("Laoded " + _weapons.size() + " weapons."); + } + private void fixEtcItems(HashMap items) { for (int key : items.keySet()) { final EtcItem item = (EtcItem) items.get(key); - if ((item.getWeight() == 0) && (item.getEtcItemType() != 7) && !item.getName().startsWith("world_map") && !item.getName().startsWith("crystal_")) + if ((item.getWeight() == 0) && (item.getEtcItemType() != EtcItem.TYPE_MONEY) && !item.getName().startsWith("world_map") && !item.getName().startsWith("crystal_")) { - item.setType2(3); - item.setEtcItemType(6); + item.setType2(Item.TYPE2_QUEST); + item.setEtcItemType(EtcItem.TYPE_QUEST); continue; } if (item.getName().startsWith("sb_")) { - item.setType2(5); - item.setEtcItemType(9); + item.setType2(Item.TYPE2_OTHER); + item.setEtcItemType(EtcItem.TYPE_SPELLBOOK); continue; } if (item.getName().startsWith("rp_")) { - item.setType2(5); - item.setEtcItemType(4); + item.setType2(Item.TYPE2_OTHER); + item.setEtcItemType(EtcItem.TYPE_RECIPE); continue; } if (!item.getName().startsWith("q_")) { continue; } - item.setType2(3); - item.setEtcItemType(6); + item.setType2(Item.TYPE2_QUEST); + item.setEtcItemType(EtcItem.TYPE_QUEST); } } @@ -222,17 +235,17 @@ public class ItemTable } switch (type) { - case 0: + case TYPE_ETC_ITEM: { temp = parseEtcLine(line); break; } - case 1: + case TYPE_ARMOR: { temp = parseArmorLine(line); break; } - case 2: + case TYPE_WEAPON: { temp = parseWeaponLine(line); } @@ -265,47 +278,47 @@ public class ItemTable result.setName(st.nextToken()); result.setCrystallizable(Boolean.valueOf(st.nextToken())); final String itemType = st.nextToken(); - result.setType1(4); + result.setType1(Item.TYPE1_ITEM_QUESTITEM_ADENA); if (itemType.equals("none")) { - result.setType2(5); - result.setEtcItemType(8); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_OTHER); } else if (itemType.equals("arrow")) { - result.setType2(5); - result.setEtcItemType(0); - result.setBodyPart(256); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_ARROW); + result.setBodyPart(Item.SLOT_L_HAND); } else if (itemType.equals("castle_guard")) { - result.setType2(5); - result.setEtcItemType(5); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_SCROLL); } else if (itemType.equals("material")) { - result.setType2(5); - result.setEtcItemType(1); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_MATERIAL); } else if (itemType.equals("pet_collar")) { - result.setType2(5); - result.setEtcItemType(2); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_PET_COLLAR); } else if (itemType.equals("potion")) { - result.setType2(5); - result.setEtcItemType(3); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_POTION); } else if (itemType.equals("recipe")) { - result.setType2(5); - result.setEtcItemType(4); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_RECIPE); } else if (itemType.equals("scroll")) { - result.setType2(5); - result.setEtcItemType(5); + result.setType2(Item.TYPE2_OTHER); + result.setEtcItemType(EtcItem.TYPE_SCROLL); } else { @@ -316,8 +329,8 @@ public class ItemTable if (consume.equals("asset")) { result.setStackable(true); - result.setEtcItemType(7); - result.setType2(4); + result.setEtcItemType(EtcItem.TYPE_MONEY); + result.setType2(Item.TYPE2_MONEY); } else if (consume.equals("stackable")) { @@ -331,8 +344,7 @@ public class ItemTable } catch (Exception e) { - _log.warning("Data error on etc item:" + result + " line: " + line); - e.printStackTrace(); + _log.warning("Data error on etc item:" + result + " line: " + line + " " + e); } return result; } @@ -351,15 +363,15 @@ public class ItemTable final Integer armor = _armorTypes.get(st.nextToken()); result.setArmorType(armor); final int slot = result.getBodyPart(); - if ((slot == 8) || ((slot & 4) != 0) || ((slot & 0x20) != 0)) + if ((slot == Item.SLOT_NECK) || ((slot & Item.SLOT_L_EAR) != 0) || ((slot & Item.SLOT_L_FINGER) != 0)) { - result.setType1(0); - result.setType2(2); + result.setType1(Item.TYPE1_WEAPON_RING_EARRING_NECKLACE); + result.setType2(Item.TYPE2_ACCESSORY); } else { - result.setType1(1); - result.setType2(1); + result.setType1(Item.TYPE1_SHIELD_ARMOR); + result.setType2(Item.TYPE2_SHIELD_ARMOR); } result.setWeight(Integer.parseInt(st.nextToken())); final Integer material = _materials.get(st.nextToken()); @@ -374,8 +386,7 @@ public class ItemTable } catch (Exception e) { - _log.warning("Data error on armor:" + result + " line: " + line); - e.printStackTrace(); + _log.warning("Data error on armor:" + result + " line: " + line + " " + e); } return result; } @@ -388,8 +399,8 @@ public class ItemTable final StringTokenizer st = new StringTokenizer(line, ";"); result.setItemId(Integer.parseInt(st.nextToken())); result.setName(st.nextToken()); - result.setType1(0); - result.setType2(0); + result.setType1(Item.TYPE1_WEAPON_RING_EARRING_NECKLACE); + result.setType2(Item.TYPE2_WEAPON); final Integer bodyPart = _slots.get(st.nextToken()); result.setBodyPart(bodyPart); result.setCrystallizable(Boolean.valueOf(st.nextToken())); @@ -406,8 +417,8 @@ public class ItemTable result.setWeaponType(weapon); if (weapon == 1) { - result.setType1(1); - result.setType2(1); + result.setType1(Item.TYPE1_SHIELD_ARMOR); + result.setType2(Item.TYPE2_SHIELD_ARMOR); } result.setCritical(Integer.parseInt(st.nextToken())); result.setHitModifier(Double.parseDouble(st.nextToken())); @@ -421,24 +432,11 @@ public class ItemTable } catch (Exception e) { - _log.warning("Data error on weapon:" + result + " line: " + line); - e.printStackTrace(); + _log.warning("Data error on weapon:" + result + " line: " + line + " " + e); } return result; } - private void parseArmors(File data) - { - _armors = parseFile(data, 1); - _log.config("Loaded " + _armors.size() + " armors."); - } - - private void parseWeapons(File data) - { - _weapons = parseFile(data, 2); - _log.config("Laoded " + _weapons.size() + " weapons."); - } - private void buildFastLookupTable() { int highestId = 0; diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/handler/itemhandlers/SoulShots.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/handler/itemhandlers/SoulShots.java index e64ef18e7e..df1ef20435 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/handler/itemhandlers/SoulShots.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/handler/itemhandlers/SoulShots.java @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.model.actor.instance.ItemInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.network.serverpackets.MagicSkillUser; import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; +import org.l2jmobius.gameserver.templates.Item; import org.l2jmobius.gameserver.templates.Weapon; public class SoulShots implements IItemHandler @@ -59,7 +60,7 @@ public class SoulShots implements IItemHandler activeChar.sendPacket(new SystemMessage(SystemMessage.CANNOT_USE_SOULSHOTS)); return 0; } - if (((grade == 1) && (SoulshotId != 1835)) || ((grade == 2) && (SoulshotId != 1463)) || ((grade == 3) && (SoulshotId != 1464)) || ((grade == 4) && (SoulshotId != 1465)) || ((grade == 5) && (SoulshotId != 1466)) || ((grade == 6) && (SoulshotId != 1467))) + if (((grade == Item.CRYSTAL_NONE) && (SoulshotId != 1835)) || ((grade == Item.CRYSTAL_D) && (SoulshotId != 1463)) || ((grade == Item.CRYSTAL_C) && (SoulshotId != 1464)) || ((grade == Item.CRYSTAL_B) && (SoulshotId != 1465)) || ((grade == Item.CRYSTAL_A) && (SoulshotId != 1466)) || ((grade == Item.CRYSTAL_S) && (SoulshotId != 1467))) { activeChar.sendPacket(new SystemMessage(SystemMessage.SOULSHOTS_GRADE_MISMATCH)); return 0; diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/Inventory.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/Inventory.java index 98b78df8cd..de930e6077 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/Inventory.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/Inventory.java @@ -31,6 +31,7 @@ import org.l2jmobius.gameserver.templates.Weapon; public class Inventory { private static Logger _log = Logger.getLogger(Inventory.class.getName()); + public static final int PAPERDOLL_UNDER = 0; public static final int PAPERDOLL_LEAR = 1; public static final int PAPERDOLL_REAR = 2; @@ -46,6 +47,7 @@ public class Inventory public static final int PAPERDOLL_FEET = 12; public static final int PAPERDOLL_BACK = 13; public static final int PAPERDOLL_LRHAND = 14; + private final ItemInstance[] _paperdoll = new ItemInstance[16]; private ItemInstance _adena; private final List _items = new CopyOnWriteArrayList<>(); @@ -133,102 +135,102 @@ public class Inventory public Collection unEquipItemInBodySlot(int slot) { - final List unequipedItems = new ArrayList<>(); + final List changedItems = new ArrayList<>(); int pdollSlot = -1; switch (slot) { - case 4: + case Item.SLOT_L_EAR: { - pdollSlot = 1; + pdollSlot = PAPERDOLL_LEAR; break; } - case 2: + case Item.SLOT_R_EAR: { - pdollSlot = 2; + pdollSlot = PAPERDOLL_REAR; break; } - case 8: + case Item.SLOT_NECK: { - pdollSlot = 3; + pdollSlot = PAPERDOLL_NECK; break; } - case 16: + case Item.SLOT_R_FINGER: { - pdollSlot = 5; + pdollSlot = PAPERDOLL_RFINGER; break; } - case 32: + case Item.SLOT_L_FINGER: { - pdollSlot = 4; + pdollSlot = PAPERDOLL_LFINGER; break; } - case 64: + case Item.SLOT_HEAD: { - pdollSlot = 6; + pdollSlot = PAPERDOLL_HEAD; break; } - case 128: + case Item.SLOT_R_HAND: { - pdollSlot = 7; + pdollSlot = PAPERDOLL_RHAND; break; } - case 256: + case Item.SLOT_L_HAND: { - pdollSlot = 8; + pdollSlot = PAPERDOLL_LHAND; break; } - case 512: + case Item.SLOT_GLOVES: { - pdollSlot = 9; + pdollSlot = PAPERDOLL_GLOVES; break; } - case 1024: - case 32768: + case Item.SLOT_CHEST: + case Item.SLOT_FULL_ARMOR: { - pdollSlot = 10; + pdollSlot = PAPERDOLL_CHEST; break; } - case 2048: + case Item.SLOT_LEGS: { - pdollSlot = 11; + pdollSlot = PAPERDOLL_LEGS; break; } - case 16384: + case Item.SLOT_LR_HAND: { - unEquipSlot(unequipedItems, 8); - unEquipSlot(7); - pdollSlot = 14; + unEquipSlot(changedItems, PAPERDOLL_LHAND); + unEquipSlot(PAPERDOLL_RHAND); + pdollSlot = PAPERDOLL_LRHAND; break; } - case 8192: + case Item.SLOT_BACK: { - pdollSlot = 13; + pdollSlot = PAPERDOLL_BACK; break; } - case 4096: + case Item.SLOT_FEET: { - pdollSlot = 12; + pdollSlot = PAPERDOLL_FEET; break; } - case 1: + case Item.SLOT_UNDERWEAR: { - pdollSlot = 0; + pdollSlot = PAPERDOLL_UNDER; } } - unEquipSlot(unequipedItems, pdollSlot); - return unequipedItems; + unEquipSlot(changedItems, pdollSlot); + return changedItems; } public Collection unEquipItemOnPaperdoll(int pdollSlot) { - final List unequipedItems = new ArrayList<>(); + final List changedItems = new ArrayList<>(); if (pdollSlot == 14) { - unEquipSlot(unequipedItems, 8); - unEquipSlot(7); + unEquipSlot(changedItems, PAPERDOLL_LHAND); + unEquipSlot(PAPERDOLL_RHAND); } - unEquipSlot(unequipedItems, pdollSlot); - return unequipedItems; + unEquipSlot(changedItems, pdollSlot); + return changedItems; } public List equipItem(ItemInstance item) @@ -237,147 +239,151 @@ public class Inventory final int targetSlot = item.getItem().getBodyPart(); switch (targetSlot) { - case 16384: + case Item.SLOT_LR_HAND: { ItemInstance arrow; - unEquipSlot(changedItems, 8); - final ItemInstance old1 = unEquipSlot(14); + unEquipSlot(changedItems, PAPERDOLL_LHAND); + final ItemInstance old1 = unEquipSlot(PAPERDOLL_LRHAND); if (old1 != null) { changedItems.add(old1); - unEquipSlot(7); - unEquipSlot(changedItems, 8); + unEquipSlot(PAPERDOLL_RHAND); + unEquipSlot(changedItems, PAPERDOLL_LHAND); } else { - unEquipSlot(changedItems, 7); + unEquipSlot(changedItems, PAPERDOLL_RHAND); } - setPaperdollItem(7, item); - setPaperdollItem(14, item); - if ((((Weapon) item.getItem()).getWeaponType() != 5) || ((arrow = findArrowForBow(item.getItem())) == null)) + setPaperdollItem(PAPERDOLL_RHAND, item); + setPaperdollItem(PAPERDOLL_LRHAND, item); + if ((((Weapon) item.getItem()).getWeaponType() != Weapon.WEAPON_TYPE_BOW) || ((arrow = findArrowForBow(item.getItem())) == null)) { break; } - setPaperdollItem(8, arrow); + setPaperdollItem(PAPERDOLL_LHAND, arrow); arrow.setLastChange(2); changedItems.add(arrow); break; } - case 256: + case Item.SLOT_L_HAND: { - final ItemInstance old1 = unEquipSlot(14); + final ItemInstance old1 = unEquipSlot(PAPERDOLL_LRHAND); if (old1 != null) { - unEquipSlot(changedItems, 7); + unEquipSlot(changedItems, PAPERDOLL_RHAND); } - unEquipSlot(changedItems, 8); - setPaperdollItem(8, item); + unEquipSlot(changedItems, PAPERDOLL_LHAND); + setPaperdollItem(PAPERDOLL_LHAND, item); break; } - case 128: + case Item.SLOT_R_HAND: { - if (unEquipSlot(changedItems, 14)) + if (unEquipSlot(changedItems, PAPERDOLL_LRHAND)) { - unEquipSlot(changedItems, 8); - unEquipSlot(7); + unEquipSlot(changedItems, PAPERDOLL_LHAND); + unEquipSlot(PAPERDOLL_RHAND); } else { - unEquipSlot(changedItems, 7); + unEquipSlot(changedItems, PAPERDOLL_RHAND); } - setPaperdollItem(7, item); + setPaperdollItem(PAPERDOLL_RHAND, item); break; } - case 6: + case Item.SLOT_R_EAR: + case Item.SLOT_L_EAR: + case Item.SLOT_R_EAR + Item.SLOT_L_EAR: { if (_paperdoll[1] == null) { - setPaperdollItem(1, item); + setPaperdollItem(PAPERDOLL_LEAR, item); break; } if (_paperdoll[2] == null) { - setPaperdollItem(2, item); + setPaperdollItem(PAPERDOLL_REAR, item); break; } - unEquipSlot(changedItems, 1); - setPaperdollItem(1, item); + unEquipSlot(changedItems, PAPERDOLL_LEAR); + setPaperdollItem(PAPERDOLL_LEAR, item); break; } - case 48: + case Item.SLOT_R_FINGER: + case Item.SLOT_L_FINGER: + case Item.SLOT_R_FINGER + Item.SLOT_L_FINGER: { if (_paperdoll[4] == null) { - setPaperdollItem(4, item); + setPaperdollItem(PAPERDOLL_LFINGER, item); break; } if (_paperdoll[5] == null) { - setPaperdollItem(5, item); + setPaperdollItem(PAPERDOLL_RFINGER, item); break; } - unEquipSlot(changedItems, 4); - setPaperdollItem(4, item); + unEquipSlot(changedItems, PAPERDOLL_LFINGER); + setPaperdollItem(PAPERDOLL_LFINGER, item); break; } - case 8: + case Item.SLOT_NECK: { - unEquipSlot(changedItems, 3); - setPaperdollItem(3, item); + unEquipSlot(changedItems, PAPERDOLL_NECK); + setPaperdollItem(PAPERDOLL_NECK, item); break; } - case 32768: + case Item.SLOT_FULL_ARMOR: { - unEquipSlot(changedItems, 10); - unEquipSlot(changedItems, 11); - setPaperdollItem(10, item); + unEquipSlot(changedItems, PAPERDOLL_CHEST); + unEquipSlot(changedItems, PAPERDOLL_LEGS); + setPaperdollItem(PAPERDOLL_CHEST, item); break; } - case 1024: + case Item.SLOT_CHEST: { - unEquipSlot(changedItems, 10); - setPaperdollItem(10, item); + unEquipSlot(changedItems, PAPERDOLL_CHEST); + setPaperdollItem(PAPERDOLL_CHEST, item); break; } - case 2048: + case Item.SLOT_LEGS: { final ItemInstance chest = getPaperdollItem(10); - if ((chest != null) && (chest.getItem().getBodyPart() == 32768)) + if ((chest != null) && (chest.getItem().getBodyPart() == Item.SLOT_FULL_ARMOR)) { - unEquipSlot(changedItems, 10); + unEquipSlot(changedItems, PAPERDOLL_CHEST); } - unEquipSlot(changedItems, 11); - setPaperdollItem(11, item); + unEquipSlot(changedItems, PAPERDOLL_LEGS); + setPaperdollItem(PAPERDOLL_LEGS, item); break; } - case 4096: + case Item.SLOT_FEET: { - unEquipSlot(changedItems, 12); - setPaperdollItem(12, item); + unEquipSlot(changedItems, PAPERDOLL_FEET); + setPaperdollItem(PAPERDOLL_FEET, item); break; } - case 512: + case Item.SLOT_GLOVES: { - unEquipSlot(changedItems, 9); - setPaperdollItem(9, item); + unEquipSlot(changedItems, PAPERDOLL_GLOVES); + setPaperdollItem(PAPERDOLL_GLOVES, item); break; } - case 64: + case Item.SLOT_HEAD: { - unEquipSlot(changedItems, 6); - setPaperdollItem(6, item); + unEquipSlot(changedItems, PAPERDOLL_HEAD); + setPaperdollItem(PAPERDOLL_HEAD, item); break; } - case 1: + case Item.SLOT_UNDERWEAR: { - unEquipSlot(changedItems, 0); - setPaperdollItem(0, item); + unEquipSlot(changedItems, PAPERDOLL_UNDER); + setPaperdollItem(PAPERDOLL_UNDER, item); break; } - case 8192: + case Item.SLOT_BACK: { - unEquipSlot(changedItems, 13); - setPaperdollItem(13, item); + unEquipSlot(changedItems, PAPERDOLL_BACK); + setPaperdollItem(PAPERDOLL_BACK, item); break; } default: @@ -576,32 +582,32 @@ public class Inventory int arrowsId = 0; switch (bow.getCrystalType()) { - case 1: + case Item.CRYSTAL_NONE: { arrowsId = 17; break; } - case 2: + case Item.CRYSTAL_D: { arrowsId = 1341; break; } - case 3: + case Item.CRYSTAL_C: { arrowsId = 1342; break; } - case 4: + case Item.CRYSTAL_B: { arrowsId = 1343; break; } - case 5: + case Item.CRYSTAL_A: { arrowsId = 1344; break; } - case 6: + case Item.CRYSTAL_S: { arrowsId = 1345; break; diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index 73858a0272..dfd87a34ef 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -1086,7 +1086,7 @@ public abstract class Creature extends WorldObject sendPacket(af); return; } - if ((getActiveWeapon().getWeaponType() == 5) && !checkAndEquipArrows()) + if ((getActiveWeapon().getWeaponType() == Weapon.WEAPON_TYPE_BOW) && !checkAndEquipArrows()) { setInCombat(false); setCurrentState(CreatureState.IDLE); @@ -1159,7 +1159,7 @@ public abstract class Creature extends WorldObject _hitTask = ThreadPool.schedule(new HitTask(this, target, damage, crit, miss, false), calculateHitSpeed(weaponItem, 1)); _hitTask = ThreadPool.schedule(new HitTask(this, target, damage, crit, miss, false), calculateHitSpeed(weaponItem, 2)); } - else if (getActiveWeapon().getWeaponType() == 5) + else if (getActiveWeapon().getWeaponType() == Weapon.WEAPON_TYPE_BOW) { if (getCurrentMp() < weaponItem.getMpConsume()) { @@ -1211,7 +1211,7 @@ public abstract class Creature extends WorldObject } if (_currentlyAttacking) { - if (getActiveWeapon().getWeaponType() == 5) + if (getActiveWeapon().getWeaponType() == Weapon.WEAPON_TYPE_BOW) { reduceArrowCount(); _attackTask = ThreadPool.schedule(new AttackTask(this), calculateAttackSpeed(getActiveWeapon())); @@ -1353,7 +1353,7 @@ public abstract class Creature extends WorldObject atkspd = 325; } atkspd = ((886 - atkspd) * 5) / 2; - atkspd = weaponItem.getWeaponType() == 4 ? (atkspd += 50) : (weaponItem.getWeaponType() == 10 ? (atkspd += 100) : (weaponItem.getWeaponType() == 9 ? (atkspd += 100) : ((weaponItem.getItemId() == 248) || (weaponItem.getItemId() == 252) ? (atkspd += 100) : (atkspd += 50)))); + atkspd = weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DAGGER ? (atkspd += 50) : (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUALFIST ? (atkspd += 100) : (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUAL ? (atkspd += 100) : ((weaponItem.getItemId() == 248) || (weaponItem.getItemId() == 252) ? (atkspd += 100) : (atkspd += 50)))); return atkspd; } @@ -1365,7 +1365,7 @@ public abstract class Creature extends WorldObject hitspd = 325; } hitspd = ((886 - hitspd) * 5) / 2; - hitspd = weaponItem.getWeaponType() == 4 ? (hitspd -= 50) : (weaponItem.getWeaponType() == 10 ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 100)) : (weaponItem.getWeaponType() == 9 ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 100)) : (((weaponItem.getItemId() == 248) || (weaponItem.getItemId() == 252)) && (weaponItem.getWeaponType() == 8) ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 150)) : ((weaponItem.getItemId() != 248) && (weaponItem.getItemId() != 252) && (weaponItem.getWeaponType() == 8) ? (hitspd -= 250) : (hitspd -= 200))))); + hitspd = weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DAGGER ? (hitspd -= 50) : (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUALFIST ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 100)) : (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUAL ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 100)) : (((weaponItem.getItemId() == 248) || (weaponItem.getItemId() == 252)) && (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_FIST) ? (hit == 1 ? (hitspd -= 750) : (hitspd -= 150)) : ((weaponItem.getItemId() != 248) && (weaponItem.getItemId() != 252) && (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_FIST) ? (hitspd -= 250) : (hitspd -= 200))))); return hitspd; } diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/ItemInstance.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/ItemInstance.java index bdd1b1f37a..85e8adb5c7 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/ItemInstance.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/ItemInstance.java @@ -48,7 +48,7 @@ public class ItemInstance extends WorldObject public boolean isEquipable() { - return (_item.getBodyPart() != 0) && !(_item instanceof EtcItem); + return (_item.getBodyPart() != Item.SLOT_NONE) && !(_item instanceof EtcItem); } public boolean isEquipped() diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 257944058d..89b449f52f 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -1184,7 +1184,7 @@ public class PlayerInstance extends Creature public int getAttackRange() { final Weapon weapon = getActiveWeapon(); - if ((weapon != null) && (weapon.getWeaponType() == 5)) + if ((weapon != null) && (weapon.getWeaponType() == Weapon.WEAPON_TYPE_BOW)) { return 500; } @@ -1495,19 +1495,19 @@ public class PlayerInstance extends Creature final int weaponType = getActiveWeapon().getWeaponType(); final int skillId = skill.getId(); - if ((skillId == 56) && (weaponType != 5)) + if ((skillId == 56) && (weaponType != Weapon.WEAPON_TYPE_BOW)) { return; } - if ((skillId == 16) && (weaponType != 4)) + if ((skillId == 16) && (weaponType != Weapon.WEAPON_TYPE_DAGGER)) { return; } - if ((skillId == 3) && (weaponType != 3) && (weaponType != 2)) + if ((skillId == 3) && (weaponType != Weapon.WEAPON_TYPE_BLUNT) && (weaponType != Weapon.WEAPON_TYPE_SWORD)) { return; } - if ((skillId == 29) && (weaponType != 10)) + if ((skillId == 29) && (weaponType != Weapon.WEAPON_TYPE_DUALFIST)) { return; } @@ -1653,11 +1653,11 @@ public class PlayerInstance extends Creature protected boolean isUsingDualWeapon() { final Weapon weaponItem = getActiveWeapon(); - if (weaponItem.getWeaponType() == 9) + if (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUAL) { return true; } - if (weaponItem.getWeaponType() == 10) + if (weaponItem.getWeaponType() == Weapon.WEAPON_TYPE_DUALFIST) { return true; } diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/network/serverpackets/EquipUpdate.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/network/serverpackets/EquipUpdate.java index 4907319ea4..c42a6bd0ac 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/network/serverpackets/EquipUpdate.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/network/serverpackets/EquipUpdate.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.serverpackets; import org.l2jmobius.gameserver.model.actor.instance.ItemInstance; +import org.l2jmobius.gameserver.templates.Item; public class EquipUpdate extends ServerBasePacket { @@ -40,72 +41,72 @@ public class EquipUpdate extends ServerBasePacket writeD(_item.getObjectId()); switch (_item.getItem().getBodyPart()) { - case 4: + case Item.SLOT_L_EAR: { bodypart = 1; break; } - case 2: + case Item.SLOT_R_EAR: { bodypart = 2; break; } - case 8: + case Item.SLOT_NECK: { bodypart = 3; break; } - case 16: + case Item.SLOT_R_FINGER: { bodypart = 4; break; } - case 32: + case Item.SLOT_L_FINGER: { bodypart = 5; break; } - case 64: + case Item.SLOT_HEAD: { bodypart = 6; break; } - case 128: + case Item.SLOT_R_HAND: { bodypart = 7; break; } - case 256: + case Item.SLOT_L_HAND: { bodypart = 8; break; } - case 512: + case Item.SLOT_GLOVES: { bodypart = 9; break; } - case 1024: + case Item.SLOT_CHEST: { bodypart = 10; break; } - case 2048: + case Item.SLOT_LEGS: { bodypart = 11; break; } - case 4096: + case Item.SLOT_FEET: { bodypart = 12; break; } - case 8192: + case Item.SLOT_BACK: { bodypart = 13; break; } - case 16384: + case Item.SLOT_LR_HAND: { bodypart = 14; } diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Armor.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Armor.java index b452ab1d74..497a520907 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Armor.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Armor.java @@ -23,6 +23,7 @@ public class Armor extends Item public static final int ARMORTYPE_LIGHT = 2; public static final int ARMORTYPE_HEAVY = 3; public static final int ARMORTYPE_MAGIC = 4; + private int _armorType; private int _avoidModifier; private int _pDef; diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/EtcItem.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/EtcItem.java index c65d1daa04..60905dea2b 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/EtcItem.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/EtcItem.java @@ -23,12 +23,13 @@ public class EtcItem extends Item public static final int TYPE_MATERIAL = 1; public static final int TYPE_PET_COLLAR = 2; public static final int TYPE_POTION = 3; - public static final int TYPE_RECEIPE = 4; + public static final int TYPE_RECIPE = 4; public static final int TYPE_SCROLL = 5; public static final int TYPE_QUEST = 6; public static final int TYPE_MONEY = 7; public static final int TYPE_OTHER = 8; public static final int TYPE_SPELLBOOK = 9; + private int _type; public int getEtcItemType() diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Item.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Item.java index eb302de103..d379fc7b44 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Item.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Item.java @@ -24,12 +24,14 @@ public abstract class Item implements Serializable public static final int TYPE1_WEAPON_RING_EARRING_NECKLACE = 0; public static final int TYPE1_SHIELD_ARMOR = 1; public static final int TYPE1_ITEM_QUESTITEM_ADENA = 4; + public static final int TYPE2_WEAPON = 0; public static final int TYPE2_SHIELD_ARMOR = 1; public static final int TYPE2_ACCESSORY = 2; public static final int TYPE2_QUEST = 3; public static final int TYPE2_MONEY = 4; public static final int TYPE2_OTHER = 5; + public static final int SLOT_NONE = 0; public static final int SLOT_UNDERWEAR = 1; public static final int SLOT_R_EAR = 2; @@ -47,6 +49,7 @@ public abstract class Item implements Serializable public static final int SLOT_BACK = 8192; public static final int SLOT_LR_HAND = 16384; public static final int SLOT_FULL_ARMOR = 32768; + public static final int MATERIAL_STEEL = 0; public static final int MATERIAL_FINE_STEEL = 1; public static final int MATERIAL_BLOOD_STEEL = 2; @@ -69,12 +72,14 @@ public abstract class Item implements Serializable public static final int MATERIAL_SCALE_OF_DRAGON = 19; public static final int MATERIAL_DYESTUFF = 20; public static final int MATERIAL_COBWEB = 21; + public static final int CRYSTAL_NONE = 1; public static final int CRYSTAL_D = 2; public static final int CRYSTAL_C = 3; public static final int CRYSTAL_B = 4; public static final int CRYSTAL_A = 5; public static final int CRYSTAL_S = 6; + private int _itemId; private String _name; private int _type1; diff --git a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Weapon.java b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Weapon.java index 6f3f0df8dc..b8aab14ceb 100644 --- a/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Weapon.java +++ b/L2J_Mobius_C1_HarbingersOfWar/java/org/l2jmobius/gameserver/templates/Weapon.java @@ -29,6 +29,7 @@ public class Weapon extends Item public static final int WEAPON_TYPE_FIST = 8; public static final int WEAPON_TYPE_DUAL = 9; public static final int WEAPON_TYPE_DUALFIST = 10; + private int _soulShotCount; private int _spiritShotCount; private int _pDam;