From 4efd356cbfd03899f119b3f589582148c262b503 Mon Sep 17 00:00:00 2001 From: P0nk Date: Sun, 7 Nov 2021 11:38:32 +0100 Subject: [PATCH] Turn item id magic numbers into constants --- src/main/java/client/Character.java | 60 +-- .../command/commands/gm3/SeedCommand.java | 4 +- .../command/commands/gm4/ForceVacCommand.java | 7 +- .../creator/novice/BeginnerCreator.java | 3 +- .../client/creator/novice/LegendCreator.java | 3 +- .../creator/novice/NoblesseCreator.java | 3 +- .../client/creator/veteran/BowmanCreator.java | 12 +- .../creator/veteran/MagicianCreator.java | 13 +- .../client/creator/veteran/PirateCreator.java | 15 +- .../client/creator/veteran/ThiefCreator.java | 14 +- .../creator/veteran/WarriorCreator.java | 13 +- .../manipulator/InventoryManipulator.java | 22 +- .../processor/action/MakerProcessor.java | 3 +- .../processor/action/SpawnPetProcessor.java | 6 +- .../client/processor/npc/DueyProcessor.java | 5 +- .../processor/npc/StorageProcessor.java | 3 +- .../java/constants/game/GameConstants.java | 1 - src/main/java/constants/id/ItemId.java | 442 ++++++++++++++++++ .../constants/inventory/ItemConstants.java | 41 +- .../handlers/AbstractDealDamageHandler.java | 19 +- .../handlers/CashOperationHandler.java | 3 +- .../channel/handlers/ChangeMapHandler.java | 7 +- .../handlers/FaceExpressionHandler.java | 3 +- .../channel/handlers/NewYearCardHandler.java | 13 +- .../handlers/PlayerInteractionHandler.java | 5 +- .../channel/handlers/RangedAttackHandler.java | 11 +- .../handlers/RemoteGachaponHandler.java | 3 +- .../channel/handlers/RingActionHandler.java | 26 +- .../channel/handlers/ScrollHandler.java | 8 +- .../channel/handlers/UseCashItemHandler.java | 11 +- .../channel/handlers/UseCatchItemHandler.java | 39 +- .../channel/handlers/UseChairHandler.java | 4 +- .../handlers/UseItemEffectHandler.java | 3 +- .../channel/handlers/UseItemHandler.java | 11 +- .../handlers/UseOwlOfMinervaHandler.java | 6 +- .../handlers/login/CreateCharHandler.java | 20 +- .../scripting/AbstractPlayerInteraction.java | 6 +- src/main/java/server/CashShop.java | 7 +- .../java/server/ItemInformationProvider.java | 62 +-- src/main/java/server/Shop.java | 25 +- src/main/java/server/StatEffect.java | 55 +-- src/main/java/server/gachapon/Global.java | 4 +- src/main/java/server/gachapon/Ludibrium.java | 4 +- .../java/server/life/PlayerNPCFactory.java | 13 +- .../server/minigame/RockPaperScissor.java | 3 +- .../server/partyquest/AriantColiseum.java | 7 +- src/main/java/server/partyquest/Pyramid.java | 9 +- src/main/java/tools/PacketCreator.java | 9 +- src/main/java/tools/packets/Fishing.java | 3 +- .../java/tools/packets/WeddingPackets.java | 67 +-- 50 files changed, 790 insertions(+), 346 deletions(-) create mode 100644 src/main/java/constants/id/ItemId.java diff --git a/src/main/java/client/Character.java b/src/main/java/client/Character.java index 3627f57f32..07089d5a91 100644 --- a/src/main/java/client/Character.java +++ b/src/main/java/client/Character.java @@ -36,6 +36,7 @@ import client.processor.npc.FredrickProcessor; import config.YamlConfig; import constants.game.ExpTable; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import constants.skills.*; import net.packet.Packet; @@ -1879,7 +1880,7 @@ public class Character extends AbstractCharacterObject { if (ItemConstants.isPartyItem(itemid)) { List pchr = this.getPartyMembersOnSameMap(); - if (!ItemConstants.isPartyAllcure(itemid)) { + if (!ItemId.isPartyAllCure(itemid)) { StatEffect mse = ii.getItemEffect(itemid); if (!pchr.isEmpty()) { @@ -1946,7 +1947,7 @@ public class Character extends AbstractCharacterObject { Item mItem = mapitem.getItem(); boolean hasSpaceInventory = true; - if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866 || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = InventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) { + if (ItemId.isNxCard(mapitem.getItemId()) || mapitem.getMeso() > 0 || ii.isConsumeOnPickup(mapitem.getItemId()) || (hasSpaceInventory = InventoryManipulator.checkSpace(client, mapitem.getItemId(), mItem.getQuantity(), mItem.getOwner()))) { int mapId = this.getMapId(); if ((mapId > 209000000 && mapId < 209000016) || (mapId >= 990000500 && mapId <= 990000502)) {//happyville trees and guild PQ @@ -1964,9 +1965,9 @@ public class Character extends AbstractCharacterObject { } this.getMap().pickItemDrop(pickupPacket, mapitem); - } else if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { + } else if (ItemId.isNxCard(mapitem.getItemId())) { // Add NX to account, show effect and make item disappear - int nxGain = mapitem.getItemId() == 4031865 ? 100 : 250; + int nxGain = mapitem.getItemId() == ItemId.NX_CARD_100 ? 100 : 250; this.getCashShop().gainCash(1, nxGain); showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300); @@ -2014,15 +2015,15 @@ public class Character extends AbstractCharacterObject { return; } } - } else if (mapitem.getItemId() == 4031865 || mapitem.getItemId() == 4031866) { + } else if (ItemId.isNxCard(mapitem.getItemId())) { // Add NX to account, show effect and make item disappear - int nxGain = mapitem.getItemId() == 4031865 ? 100 : 250; + int nxGain = mapitem.getItemId() == ItemId.NX_CARD_100 ? 100 : 250; this.getCashShop().gainCash(1, nxGain); showHint("You have earned #e#b" + nxGain + " NX#k#n. (" + this.getCashShop().getCash(1) + " NX)", 300); } else if (applyConsumeOnPickup(mItem.getItemId())) { } else if (InventoryManipulator.addFromDrop(client, mItem, true)) { - if (mItem.getItemId() == 4031868) { + if (mItem.getItemId() == ItemId.ARPQ_SPIRIT_JEWEL) { updateAriantScore(); } } else { @@ -3252,7 +3253,7 @@ public class Character extends AbstractCharacterObject { public void updateAriantScore(int dropQty) { AriantColiseum arena = this.getAriantColiseum(); if (arena != null) { - arena.updateAriantScore(this, countItem(4031868)); + arena.updateAriantScore(this, countItem(ItemId.ARPQ_SPIRIT_JEWEL)); if (dropQty > 0) { arena.addLostShards(dropQty); @@ -4311,7 +4312,7 @@ public class Character extends AbstractCharacterObject { if (this.isRidingBattleship()) { List> statups = new ArrayList<>(1); statups.add(new Pair<>(BuffStat.MONSTER_RIDING, 0)); - this.sendPacket(PacketCreator.giveBuff(1932000, 5221006, statups)); + this.sendPacket(PacketCreator.giveBuff(ItemId.BATTLESHIP, 5221006, statups)); this.announceBattleshipHp(); } } @@ -4358,9 +4359,9 @@ public class Character extends AbstractCharacterObject { private static boolean isPriorityBuffSourceid(int sourceid) { switch (sourceid) { - case -2022631: - case -2022632: - case -2022633: + case -ItemId.ROSE_SCENT: + case -ItemId.FREESIA_SCENT: + case -ItemId.LAVENDER_SCENT: return true; default: @@ -5120,7 +5121,7 @@ public class Character extends AbstractCharacterObject { } public boolean haveWeddingRing() { - int[] rings = {1112806, 1112803, 1112807, 1112809}; + int[] rings = {ItemId.WEDDING_RING_STAR, ItemId.WEDDING_RING_MOONSTONE, ItemId.WEDDING_RING_GOLDEN, ItemId.WEDDING_RING_SILVER}; for (int ringid : rings) { if (haveItemWithId(ringid, true)) { @@ -6207,7 +6208,10 @@ public class Character extends AbstractCharacterObject { } public boolean attemptCatchFish(int baitLevel) { - return YamlConfig.config.server.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && this.getPosition().getY() > 0 && ItemConstants.isFishingChair(chair.get()) && this.getWorldServer().registerFisherPlayer(this, baitLevel); + return YamlConfig.config.server.USE_FISHING_SYSTEM && GameConstants.isFishingArea(mapid) && + this.getPosition().getY() > 0 && + ItemConstants.isFishingChair(chair.get()) && + this.getWorldServer().registerFisherPlayer(this, baitLevel); } public void leaveMap() { @@ -6480,8 +6484,8 @@ public class Character extends AbstractCharacterObject { if (YamlConfig.config.server.USE_PERFECT_PITCH && level >= 30) { //milestones? - if (InventoryManipulator.checkSpace(client, 4310000, (short) 1, "")) { - InventoryManipulator.addById(client, 4310000, (short) 1, "", -1); + if (InventoryManipulator.checkSpace(client, ItemId.PERFECT_PITCH, (short) 1, "")) { + InventoryManipulator.addById(client, ItemId.PERFECT_PITCH, (short) 1, "", -1); } } else if (level == 10) { Runnable r = new Runnable() { @@ -6835,7 +6839,7 @@ public class Character extends AbstractCharacterObject { public void addPlayerRing(Ring ring) { int ringItemId = ring.getItemId(); - if (ItemConstants.isWeddingRing(ringItemId)) { + if (ItemId.isWeddingRing(ringItemId)) { this.addMarriageRing(ring); } else if (ring.getItemId() > 1112012) { this.addFriendshipRing(ring); @@ -7570,7 +7574,7 @@ public class Character extends AbstractCharacterObject { if (eim != null) { eim.playerKilled(this); } - int[] charmID = {5130000, 4031283, 4140903}; + int[] charmID = {ItemId.SAFETY_CHARM, ItemId.EASTER_BASKET, ItemId.EASTER_CHARM}; int possesed = 0; int i; for (i = 0; i < charmID.length; i++) { @@ -9387,7 +9391,7 @@ public class Character extends AbstractCharacterObject { int itemid = item.getItemId(); if (ItemConstants.isRechargeable(itemid)) { quantity = item.getQuantity(); - } else if (ItemConstants.isWeddingToken(itemid) || ItemConstants.isWeddingRing(itemid)) { + } else if (ItemId.isWeddingToken(itemid) || ItemId.isWeddingRing(itemid)) { return (0); } @@ -9643,7 +9647,7 @@ public class Character extends AbstractCharacterObject { strLines.add(""); strLines.add(this.getClient().getChannelServer().getServerMessage().isEmpty() ? 0 : 1, "Get off my lawn!!"); - this.sendPacket(PacketCreator.getAvatarMega(mapOwner, medal, this.getClient().getChannel(), 5390006, strLines, true)); + this.sendPacket(PacketCreator.getAvatarMega(mapOwner, medal, this.getClient().getChannel(), ItemId.ROARING_TIGER_MESSENGER, strLines, true)); } } @@ -10304,13 +10308,13 @@ public class Character extends AbstractCharacterObject { public void equippedItem(Equip equip) { int itemid = equip.getItemId(); - if (itemid == 1122017) { + if (itemid == ItemId.PENDANT_OF_THE_SPIRIT) { this.equipPendantOfSpirit(); - } else if (itemid == 1812000) { // meso magnet + } else if (itemid == ItemId.MESO_MAGNET) { equippedMesoMagnet = true; - } else if (itemid == 1812001) { // item pouch + } else if (itemid == ItemId.ITEM_POUCH) { equippedItemPouch = true; - } else if (itemid == 1812007) { // item ignore pendant + } else if (itemid == ItemId.ITEM_IGNORE) { equippedPetItemIgnore = true; } } @@ -10318,13 +10322,13 @@ public class Character extends AbstractCharacterObject { public void unequippedItem(Equip equip) { int itemid = equip.getItemId(); - if (itemid == 1122017) { + if (itemid == ItemId.PENDANT_OF_THE_SPIRIT) { this.unequipPendantOfSpirit(); - } else if (itemid == 1812000) { // meso magnet + } else if (itemid == ItemId.MESO_MAGNET) { equippedMesoMagnet = false; - } else if (itemid == 1812001) { // item pouch + } else if (itemid == ItemId.ITEM_POUCH) { equippedItemPouch = false; - } else if (itemid == 1812007) { // item ignore pendant + } else if (itemid == ItemId.ITEM_IGNORE) { equippedPetItemIgnore = false; } } diff --git a/src/main/java/client/command/commands/gm3/SeedCommand.java b/src/main/java/client/command/commands/gm3/SeedCommand.java index 9dc32d4b68..3cbbfac219 100644 --- a/src/main/java/client/command/commands/gm3/SeedCommand.java +++ b/src/main/java/client/command/commands/gm3/SeedCommand.java @@ -27,6 +27,7 @@ import client.Character; import client.Client; import client.command.Command; import client.inventory.Item; +import constants.id.ItemId; import java.awt.*; @@ -43,7 +44,8 @@ public class SeedCommand extends Command { return; } Point[] pos = {new Point(7, -207), new Point(179, -447), new Point(-3, -687), new Point(-357, -687), new Point(-538, -447), new Point(-359, -207)}; - int[] seed = {4001097, 4001096, 4001095, 4001100, 4001099, 4001098}; + int[] seed = {ItemId.PINK_PRIMROSE_SEED, ItemId.PURPLE_PRIMROSE_SEED, ItemId.GREEN_PRIMROSE_SEED, + ItemId.BLUE_PRIMROSE_SEED, ItemId.YELLOW_PRIMROSE_SEED, ItemId.BROWN_PRIMROSE_SEED}; for (int i = 0; i < pos.length; i++) { Item item = new Item(seed[i], (byte) 0, (short) 1); player.getMap().spawnItemDrop(player, player, item, pos[i], false, true); diff --git a/src/main/java/client/command/commands/gm4/ForceVacCommand.java b/src/main/java/client/command/commands/gm4/ForceVacCommand.java index 3a949e734b..02a3a816a9 100644 --- a/src/main/java/client/command/commands/gm4/ForceVacCommand.java +++ b/src/main/java/client/command/commands/gm4/ForceVacCommand.java @@ -28,6 +28,7 @@ import client.Client; import client.command.Command; import client.inventory.Pet; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import server.maps.MapItem; import server.maps.MapObject; import server.maps.MapObjectType; @@ -57,9 +58,9 @@ public class ForceVacCommand extends Command { if (mapItem.getMeso() > 0) { player.gainMeso(mapItem.getMeso(), true); } else if (player.applyConsumeOnPickup(mapItem.getItemId())) { // thanks Vcoc for pointing out consumables on pickup not being processed here - } else if (mapItem.getItemId() == 4031865 || mapItem.getItemId() == 4031866) { + } else if (ItemId.isNxCard(mapItem.getItemId())) { // Add NX to account, show effect and make item disappear - player.getCashShop().gainCash(1, mapItem.getItemId() == 4031865 ? 100 : 250); + player.getCashShop().gainCash(1, mapItem.getItemId() == ItemId.NX_CARD_100 ? 100 : 250); } else if (mapItem.getItem().getItemId() >= 5000000 && mapItem.getItem().getItemId() <= 5000100) { int petId = Pet.createPet(mapItem.getItem().getItemId()); if (petId == -1) { @@ -67,7 +68,7 @@ public class ForceVacCommand extends Command { } InventoryManipulator.addById(c, mapItem.getItem().getItemId(), mapItem.getItem().getQuantity(), null, petId); } else if (InventoryManipulator.addFromDrop(c, mapItem.getItem(), true)) { - if (mapItem.getItemId() == 4031868) { + if (mapItem.getItemId() == ItemId.NX_CARD_100) { player.updateAriantScore(); } } diff --git a/src/main/java/client/creator/novice/BeginnerCreator.java b/src/main/java/client/creator/novice/BeginnerCreator.java index db05e7905e..258297c602 100644 --- a/src/main/java/client/creator/novice/BeginnerCreator.java +++ b/src/main/java/client/creator/novice/BeginnerCreator.java @@ -24,6 +24,7 @@ import client.Job; import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; +import constants.id.ItemId; /** * @author RonanLana @@ -32,7 +33,7 @@ public class BeginnerCreator extends CharacterFactory { private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon); - giveItem(recipe, 4161001, 1, InventoryType.ETC); + giveItem(recipe, ItemId.BEGINNERS_GUIDE, 1, InventoryType.ETC); return recipe; } diff --git a/src/main/java/client/creator/novice/LegendCreator.java b/src/main/java/client/creator/novice/LegendCreator.java index 92dde031ce..8a5c1890f0 100644 --- a/src/main/java/client/creator/novice/LegendCreator.java +++ b/src/main/java/client/creator/novice/LegendCreator.java @@ -24,6 +24,7 @@ import client.Job; import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; +import constants.id.ItemId; /** * @author RonanLana @@ -32,7 +33,7 @@ public class LegendCreator extends CharacterFactory { private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon); - giveItem(recipe, 4161048, 1, InventoryType.ETC); + giveItem(recipe, ItemId.LEGENDS_GUIDE, 1, InventoryType.ETC); return recipe; } diff --git a/src/main/java/client/creator/novice/NoblesseCreator.java b/src/main/java/client/creator/novice/NoblesseCreator.java index c64b185fac..2e3a24aa43 100644 --- a/src/main/java/client/creator/novice/NoblesseCreator.java +++ b/src/main/java/client/creator/novice/NoblesseCreator.java @@ -24,6 +24,7 @@ import client.Job; import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; +import constants.id.ItemId; /** * @author RonanLana @@ -32,7 +33,7 @@ public class NoblesseCreator extends CharacterFactory { private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { CharacterFactoryRecipe recipe = new CharacterFactoryRecipe(job, level, map, top, bottom, shoes, weapon); - giveItem(recipe, 4161047, 1, InventoryType.ETC); + giveItem(recipe, ItemId.NOBLESSE_GUIDE, 1, InventoryType.ETC); return recipe; } diff --git a/src/main/java/client/creator/veteran/BowmanCreator.java b/src/main/java/client/creator/veteran/BowmanCreator.java index 6372649d4d..b2d9671621 100644 --- a/src/main/java/client/creator/veteran/BowmanCreator.java +++ b/src/main/java/client/creator/veteran/BowmanCreator.java @@ -25,14 +25,16 @@ import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import server.ItemInformationProvider; /** * @author RonanLana */ public class BowmanCreator extends CharacterFactory { - private static final int[] equips = {1040067, 1041054, 1060056, 1061050, 1072081}; - private static final int[] weapons = {1452005, 1462000}; + private static final int[] equips = {ItemId.GREEN_HUNTERS_ARMOR, ItemId.GREEN_HUNTRESS_ARMOR, + ItemId.GREEN_HUNTERS_PANTS, ItemId.GREEN_HUNTRESS_PANTS, ItemId.GREEN_HUNTER_BOOTS}; + private static final int[] weapons = {ItemId.RYDEN, ItemId.MOUNTAIN_CROSSBOW}; private static final int[] startingHpMp = {797, 404}; private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { @@ -52,9 +54,9 @@ public class BowmanCreator extends CharacterFactory { giveEquipment(recipe, ii, weapons[i]); } - giveItem(recipe, 2000002, 100, InventoryType.USE); - giveItem(recipe, 2000003, 100, InventoryType.USE); - giveItem(recipe, 3010000, 1, InventoryType.SETUP); + giveItem(recipe, ItemId.WHITE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.BLUE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.RELAXER, 1, InventoryType.SETUP); return recipe; } diff --git a/src/main/java/client/creator/veteran/MagicianCreator.java b/src/main/java/client/creator/veteran/MagicianCreator.java index c8cfba2bad..cdffcb5979 100644 --- a/src/main/java/client/creator/veteran/MagicianCreator.java +++ b/src/main/java/client/creator/veteran/MagicianCreator.java @@ -27,6 +27,7 @@ import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import constants.skills.Magician; import server.ItemInformationProvider; @@ -34,8 +35,8 @@ import server.ItemInformationProvider; * @author RonanLana */ public class MagicianCreator extends CharacterFactory { - private static final int[] equips = {0, 1041041, 0, 1061034, 1072075}; - private static final int[] weapons = {1372003, 1382017}; + private static final int[] equips = {0, ItemId.PURPLE_FAIRY_TOP, 0, ItemId.PURPLE_FAIRY_SKIRT, ItemId.RED_MAGICSHOES}; + private static final int[] weapons = {ItemId.MITHRIL_WAND, ItemId.CIRCLE_WINDED_STAFF}; private static final int[] startingHpMp = {405, 729}; private static final int[] mpGain = {0, 40, 80, 118, 156, 194, 230, 266, 302, 336, 370}; @@ -53,16 +54,16 @@ public class MagicianCreator extends CharacterFactory { recipe.setMeso(100000); if (gender == 0) { - giveEquipment(recipe, ii, 1050003); + giveEquipment(recipe, ii, ItemId.BLUE_WIZARD_ROBE); } for (int i = 1; i < weapons.length; i++) { giveEquipment(recipe, ii, weapons[i]); } - giveItem(recipe, 2000001, 100, InventoryType.USE); - giveItem(recipe, 2000006, 100, InventoryType.USE); - giveItem(recipe, 3010000, 1, InventoryType.SETUP); + giveItem(recipe, ItemId.ORANGE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.MANA_ELIXIR, 100, InventoryType.USE); + giveItem(recipe, ItemId.RELAXER, 1, InventoryType.SETUP); if (improveSp > 0) { improveSp += 5; diff --git a/src/main/java/client/creator/veteran/PirateCreator.java b/src/main/java/client/creator/veteran/PirateCreator.java index 6da6912bda..e6a3d6e986 100644 --- a/src/main/java/client/creator/veteran/PirateCreator.java +++ b/src/main/java/client/creator/veteran/PirateCreator.java @@ -25,14 +25,15 @@ import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import server.ItemInformationProvider; /** * @author RonanLana */ public class PirateCreator extends CharacterFactory { - private static final int[] equips = {0, 0, 0, 0, 1072294}; - private static final int[] weapons = {1482004, 1492004}; + private static final int[] equips = {0, 0, 0, 0, ItemId.BROWN_PAULIE_BOOTS}; + private static final int[] weapons = {ItemId.PRIME_HANDS, ItemId.COLD_MIND}; private static final int[] startingHpMp = {846, 503}; private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { @@ -48,17 +49,17 @@ public class PirateCreator extends CharacterFactory { recipe.setMeso(100000); - giveEquipment(recipe, ii, 1052107); + giveEquipment(recipe, ii, ItemId.BROWN_POLLARD); for (int i = 1; i < weapons.length; i++) { giveEquipment(recipe, ii, weapons[i]); } - giveItem(recipe, 2330000, 800, InventoryType.USE); + giveItem(recipe, ItemId.BULLET, 800, InventoryType.USE); - giveItem(recipe, 2000002, 100, InventoryType.USE); - giveItem(recipe, 2000003, 100, InventoryType.USE); - giveItem(recipe, 3010000, 1, InventoryType.SETUP); + giveItem(recipe, ItemId.WHITE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.BLUE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.RELAXER, 1, InventoryType.SETUP); return recipe; } diff --git a/src/main/java/client/creator/veteran/ThiefCreator.java b/src/main/java/client/creator/veteran/ThiefCreator.java index 61623d1c64..a210d845fc 100644 --- a/src/main/java/client/creator/veteran/ThiefCreator.java +++ b/src/main/java/client/creator/veteran/ThiefCreator.java @@ -25,14 +25,16 @@ import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import server.ItemInformationProvider; /** * @author RonanLana */ public class ThiefCreator extends CharacterFactory { - private static final int[] equips = {1040057, 1041047, 1060043, 1061043, 1072032}; - private static final int[] weapons = {1472008, 1332012}; + private static final int[] equips = {ItemId.DARK_BROWN_STEALER, ItemId.RED_STEAL, ItemId.DARK_BROWN_STEALER_PANTS, + ItemId.RED_STEAL_PANTS, ItemId.BRONZE_CHAIN_BOOTS}; + private static final int[] weapons = {ItemId.STEEL_GUARDS, ItemId.REEF_CLAW}; private static final int[] startingHpMp = {794, 407}; private static CharacterFactoryRecipe createRecipe(Job job, int level, int map, int top, int bottom, int shoes, int weapon) { @@ -52,11 +54,11 @@ public class ThiefCreator extends CharacterFactory { giveEquipment(recipe, ii, weapons[i]); } - giveItem(recipe, 2070000, 500, InventoryType.USE); + giveItem(recipe, ItemId.SUBI_THROWING_STARS, 500, InventoryType.USE); - giveItem(recipe, 2000002, 100, InventoryType.USE); - giveItem(recipe, 2000003, 100, InventoryType.USE); - giveItem(recipe, 3010000, 1, InventoryType.SETUP); + giveItem(recipe, ItemId.WHITE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.BLUE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.RELAXER, 1, InventoryType.SETUP); return recipe; } diff --git a/src/main/java/client/creator/veteran/WarriorCreator.java b/src/main/java/client/creator/veteran/WarriorCreator.java index ba263006f9..4896d1438c 100644 --- a/src/main/java/client/creator/veteran/WarriorCreator.java +++ b/src/main/java/client/creator/veteran/WarriorCreator.java @@ -27,6 +27,7 @@ import client.creator.CharacterFactory; import client.creator.CharacterFactoryRecipe; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import constants.skills.Warrior; import server.ItemInformationProvider; @@ -34,8 +35,8 @@ import server.ItemInformationProvider; * @author RonanLana */ public class WarriorCreator extends CharacterFactory { - private static final int[] equips = {1040021, 0, 1060016, 0, 1072039}; - private static final int[] weapons = {1302008, 1442001, 1422001, 1312005}; + private static final int[] equips = {ItemId.RED_HWARANG_SHIRT, 0, ItemId.BLACK_MARTIAL_ARTS_PANTS, 0, ItemId.MITHRIL_BATTLE_GRIEVES}; + private static final int[] weapons = {ItemId.GLADIUS, ItemId.MITHRIL_POLE_ARM, ItemId.MITHRIL_MAUL, ItemId.FIREMANS_AXE}; private static final int[] startingHpMp = {905, 208}; private static final int[] hpGain = {0, 72, 144, 212, 280, 348, 412, 476, 540, 600, 660}; @@ -53,7 +54,7 @@ public class WarriorCreator extends CharacterFactory { recipe.setMeso(100000); if (gender == 1) { - giveEquipment(recipe, ii, 1051010); + giveEquipment(recipe, ii, ItemId.DARK_ENGRIT); } for (int i = 1; i < weapons.length; i++) { @@ -75,9 +76,9 @@ public class WarriorCreator extends CharacterFactory { } } - giveItem(recipe, 2000002, 100, InventoryType.USE); - giveItem(recipe, 2000003, 100, InventoryType.USE); - giveItem(recipe, 3010000, 1, InventoryType.SETUP); + giveItem(recipe, ItemId.WHITE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.BLUE_POTION, 100, InventoryType.USE); + giveItem(recipe, ItemId.RELAXER, 1, InventoryType.SETUP); return recipe; } diff --git a/src/main/java/client/inventory/manipulator/InventoryManipulator.java b/src/main/java/client/inventory/manipulator/InventoryManipulator.java index 48f30b510b..cf2d885f22 100644 --- a/src/main/java/client/inventory/manipulator/InventoryManipulator.java +++ b/src/main/java/client/inventory/manipulator/InventoryManipulator.java @@ -27,6 +27,7 @@ import client.Client; import client.inventory.*; import client.newyear.NewYearCardRecord; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import server.ItemInformationProvider; import server.maps.MapleMap; @@ -523,7 +524,8 @@ public class InventoryManipulator { if (source == null || !ii.canWearEquipment(chr, source, dst)) { c.sendPacket(PacketCreator.enableActions()); return; - } else if ((((source.getItemId() >= 1902000 && source.getItemId() <= 1902002) || source.getItemId() == 1912000) && chr.isCygnus()) || ((source.getItemId() >= 1902005 && source.getItemId() <= 1902007) || source.getItemId() == 1912005) && !chr.isCygnus()) {// Adventurer taming equipment + } else if ((ItemId.isExplorerMount(source.getItemId()) && chr.isCygnus()) || + ((ItemId.isCygnusMount(source.getItemId())) && !chr.isCygnus())) {// Adventurer taming equipment return; } boolean itemChanged = false; @@ -684,7 +686,7 @@ public class InventoryManipulator { } else if (isDroppedItemRestricted(it)) { return true; } else { - return ItemConstants.isWeddingRing(it.getItemId()); + return ItemId.isWeddingRing(it.getItemId()); } } @@ -724,12 +726,12 @@ public class InventoryManipulator { c.sendPacket(PacketCreator.modifyInventory(true, Collections.singletonList(new ModifyInventory(1, source)))); if (ItemConstants.isNewYearCardEtc(itemId)) { - if (itemId == 4300000) { + if (itemId == ItemId.NEW_YEARS_CARD_SEND) { NewYearCardRecord.removeAllNewYearCard(true, chr); - c.getAbstractPlayerInteraction().removeAll(4300000); + c.getAbstractPlayerInteraction().removeAll(ItemId.NEW_YEARS_CARD_SEND); } else { NewYearCardRecord.removeAllNewYearCard(false, chr); - c.getAbstractPlayerInteraction().removeAll(4301000); + c.getAbstractPlayerInteraction().removeAll(ItemId.NEW_YEARS_CARD_RECEIVED); } } @@ -755,12 +757,12 @@ public class InventoryManipulator { if (src < 0) { chr.equipChanged(); } else if (ItemConstants.isNewYearCardEtc(itemId)) { - if (itemId == 4300000) { + if (itemId == ItemId.NEW_YEARS_CARD_SEND) { NewYearCardRecord.removeAllNewYearCard(true, chr); - c.getAbstractPlayerInteraction().removeAll(4300000); + c.getAbstractPlayerInteraction().removeAll(ItemId.NEW_YEARS_CARD_SEND); } else { NewYearCardRecord.removeAllNewYearCard(false, chr); - c.getAbstractPlayerInteraction().removeAll(4301000); + c.getAbstractPlayerInteraction().removeAll(ItemId.NEW_YEARS_CARD_RECEIVED); } } @@ -777,11 +779,11 @@ public class InventoryManipulator { chr.setItemEffect(0); map.broadcastMessage(PacketCreator.itemEffect(chr.getId(), 0)); } - } else if (itemId == 5370000 || itemId == 5370001) { + } else if (itemId == ItemId.CHALKBOARD_1 || itemId == ItemId.CHALKBOARD_2) { if (source.getQuantity() <= 0) { chr.setChalkboard(null); } - } else if (itemId == 4031868) { + } else if (itemId == ItemId.ARPQ_SPIRIT_JEWEL) { chr.updateAriantScore(quantityNow); } } diff --git a/src/main/java/client/processor/action/MakerProcessor.java b/src/main/java/client/processor/action/MakerProcessor.java index fce4d19004..3f11ed9e6b 100644 --- a/src/main/java/client/processor/action/MakerProcessor.java +++ b/src/main/java/client/processor/action/MakerProcessor.java @@ -27,6 +27,7 @@ import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.packet.InPacket; import server.ItemInformationProvider; @@ -385,7 +386,7 @@ public class MakerProcessor { if (!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) { eqp.setUpgradeSlots((byte) (eqp.getUpgradeSlots() + 1)); } - item = ItemInformationProvider.getInstance().scrollEquipWithId(eqp, 2049100, true, 2049100, c.getPlayer().isGM()); + item = ItemInformationProvider.getInstance().scrollEquipWithId(eqp, ItemId.CHAOS_SCROll_60, true, ItemId.CHAOS_SCROll_60, c.getPlayer().isGM()); } if (!reagentids.isEmpty()) { diff --git a/src/main/java/client/processor/action/SpawnPetProcessor.java b/src/main/java/client/processor/action/SpawnPetProcessor.java index 92cfbf44b4..c920fd89fc 100644 --- a/src/main/java/client/processor/action/SpawnPetProcessor.java +++ b/src/main/java/client/processor/action/SpawnPetProcessor.java @@ -25,6 +25,7 @@ import client.SkillFactory; import client.inventory.InventoryType; import client.inventory.Pet; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import provider.DataProvider; import provider.DataProviderFactory; import provider.DataTool; @@ -49,10 +50,9 @@ public class SpawnPetProcessor { } int petid = pet.getItemId(); - if (petid == 5000028 || petid == 5000047) //Handles Dragon AND Robos - { + if (petid == ItemId.DRAGON_PET || petid == ItemId.ROBO_PET) { if (chr.haveItem(petid + 1)) { - chr.dropMessage(5, "You can't hatch your " + (petid == 5000028 ? "Dragon egg" : "Robo egg") + " if you already have a Baby " + (petid == 5000028 ? "Dragon." : "Robo.")); + chr.dropMessage(5, "You can't hatch your " + (petid == ItemId.DRAGON_PET ? "Dragon egg" : "Robo egg") + " if you already have a Baby " + (petid == ItemId.DRAGON_PET ? "Dragon." : "Robo.")); c.sendPacket(PacketCreator.enableActions()); return; } else { diff --git a/src/main/java/client/processor/npc/DueyProcessor.java b/src/main/java/client/processor/npc/DueyProcessor.java index 2f102f0dbe..8e70ff2719 100644 --- a/src/main/java/client/processor/npc/DueyProcessor.java +++ b/src/main/java/client/processor/npc/DueyProcessor.java @@ -33,6 +33,7 @@ import client.inventory.ItemFactory; import client.inventory.manipulator.InventoryManipulator; import client.inventory.manipulator.KarmaManipulator; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.server.channel.Channel; import server.DueyPackage; @@ -284,7 +285,7 @@ public class DueyProcessor { int fee = Trade.getFee(sendMesos); if (!quick) { fee += 5000; - } else if (!c.getPlayer().haveItem(5330000)) { + } else if (!c.getPlayer().haveItem(ItemId.QUICK_DELIVERY_TICKET)) { AutobanFactory.PACKET_EDIT.alert(c.getPlayer(), c.getPlayer().getName() + " tried to packet edit with Quick Delivery on duey."); FilePrinter.printError(FilePrinter.EXPLOITS + c.getPlayer().getName() + ".txt", c.getPlayer().getName() + " tried to use duey with Quick Delivery, mesos " + sendMesos + " and amount " + amount); c.disconnect(true, false); @@ -324,7 +325,7 @@ public class DueyProcessor { } if (quick) { - InventoryManipulator.removeById(c, InventoryType.CASH, 5330000, (short) 1, false, false); + InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.QUICK_DELIVERY_TICKET, (short) 1, false, false); } int packageId = createPackage(sendMesos, sendMessage, c.getPlayer().getName(), recipientCid, quick); diff --git a/src/main/java/client/processor/npc/StorageProcessor.java b/src/main/java/client/processor/npc/StorageProcessor.java index 793d5c8bcc..08839a97dd 100644 --- a/src/main/java/client/processor/npc/StorageProcessor.java +++ b/src/main/java/client/processor/npc/StorageProcessor.java @@ -30,6 +30,7 @@ import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; import client.inventory.manipulator.KarmaManipulator; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.packet.InPacket; import server.ItemInformationProvider; @@ -132,7 +133,7 @@ public class StorageProcessor { try { item = inv.getItem(slot); if (item != null && item.getItemId() == itemId && (item.getQuantity() >= quantity || ItemConstants.isRechargeable(itemId))) { - if (ItemConstants.isWeddingRing(itemId) || ItemConstants.isWeddingToken(itemId)) { + if (ItemId.isWeddingRing(itemId) || ItemId.isWeddingToken(itemId)) { c.sendPacket(PacketCreator.enableActions()); return; } diff --git a/src/main/java/constants/game/GameConstants.java b/src/main/java/constants/game/GameConstants.java index eabe935cdd..882a2aac21 100644 --- a/src/main/java/constants/game/GameConstants.java +++ b/src/main/java/constants/game/GameConstants.java @@ -20,7 +20,6 @@ import java.util.*; */ public class GameConstants { public static String[] WORLD_NAMES = {"Scania", "Bera", "Broa", "Windia", "Khaini", "Bellocan", "Mardia", "Kradia", "Yellonde", "Demethos", "Galicia", "El Nido", "Zenith", "Arcenia", "Kastia", "Judis", "Plana", "Kalluna", "Stius", "Croa", "Medere"}; - public static final int[] OWL_DATA = new int[]{1082002, 2070005, 2070006, 1022047, 1102041, 2044705, 2340000, 2040017, 1092030, 2040804}; public static final String[] stats = {"tuc", "reqLevel", "reqJob", "reqSTR", "reqDEX", "reqINT", "reqLUK", "reqPOP", "cash", "cursed", "success", "setItemID", "equipTradeBlock", "durability", "randOption", "randStat", "masterLevel", "reqSkillLevel", "elemDefault", "incRMAS", "incRMAF", "incRMAI", "incRMAL", "canLevel", "skill", "charmEXP"}; public static final int[] CASH_DATA = new int[]{50200004, 50200069, 50200117, 50100008, 50000047}; diff --git a/src/main/java/constants/id/ItemId.java b/src/main/java/constants/id/ItemId.java new file mode 100644 index 0000000000..95ad8f2ec7 --- /dev/null +++ b/src/main/java/constants/id/ItemId.java @@ -0,0 +1,442 @@ +package constants.id; + +import java.util.stream.IntStream; + +public class ItemId { + // Misc + public static final int PENDANT_OF_THE_SPIRIT = 1122017; + public static final int HEART_SHAPED_CHOCOLATE = 5110000; + public static final int HAPPY_BIRTHDAY = 2022153; + public static final int FISHING_CHAIR = 3011000; + public static final int MINI_GAME_BASE = 4080000; + public static final int MATCH_CARDS = 4080100; + public static final int MAGICAL_MITTEN = 1472063; + public static final int RPS_CERTIFICATE_BASE = 4031332; + public static final int GOLDEN_MAPLE_LEAF = 4000313; + public static final int PERFECT_PITCH = 4310000; + public static final int MAGIC_ROCK = 4006000; + public static final int GOLDEN_CHICKEN_EFFECT = 4290000; + public static final int BUMMER_EFFECT = 4290001; + public static final int ARPQ_SHIELD = 2022269; + public static final int ROARING_TIGER_MESSENGER = 5390006; + + public static boolean isExpIncrease(int itemId) { + return itemId >= 2022450 && itemId <= 2022452; + } + + public static boolean isRateCoupon(int itemId) { + int itemType = itemId / 1000; + return itemType == 5211 || itemType == 5360; + } + + public static boolean isMonsterCard(int itemId) { + int itemType = itemId / 10000; + return itemType == 238; + } + + public static boolean isPyramidBuff(int itemId) { + return (itemId >= 2022585 && itemId <= 2022588) || (itemId >= 2022616 && itemId <= 2022617); + } + + public static boolean isDojoBuff(int itemId) { + return itemId >= 2022359 && itemId <= 2022421; + } + + // Potion + public static final int WHITE_POTION = 2000002; + public static final int BLUE_POTION = 2000003; + public static final int ORANGE_POTION = 2000001; + public static final int MANA_ELIXIR = 2000006; + + // HP/MP recovery + public static final int SORCERERS_POTION = 2022337; + public static final int RUSSELLONS_PILLS = 2022198; + + // Environment + public static final int RED_BEAN_PORRIDGE = 2022001; + public static final int SOFT_WHITE_BUN = 2022186; + public static final int AIR_BUBBLE = 2022040; + + // Chair + public static final int RELAXER = 3010000; + private static final int CHAIR_MIN = RELAXER; + private static final int CHAIR_MAX = FISHING_CHAIR; + + public static boolean isChair(int itemId) { + return itemId >= CHAIR_MIN && itemId <= CHAIR_MAX; + // alt: return itemId / 10000 == 301; + } + + // Throwing star + public static final int SUBI_THROWING_STARS = 2070000; + public static final int HWABI_THROWING_STARS = 2070007; + public static final int BALANCED_FURY = 2070018; + public static final int CRYSTAL_ILBI_THROWING_STARS = 2070016; + private static final int THROWING_STAR_MIN = SUBI_THROWING_STARS; + private static final int THROWING_STAR_MAX = 2070016; + public static final int DEVIL_RAIN_THROWING_STAR = 2070014; + + public static int[] allThrowingStarIds() { + return IntStream.range(THROWING_STAR_MIN, THROWING_STAR_MAX + 1).toArray(); + } + + // Bullet + public static final int BULLET = 2330000; + private static final int BULLET_MIN = BULLET; + private static final int BULLET_MAX = 2330005; + public static final int BLAZE_CAPSULE = 2331000; + public static final int GLAZE_CAPSULE = 2332000; + + public static int[] allBulletIds() { + return IntStream.range(BULLET_MIN, BULLET_MAX + 1).toArray(); + } + + // Starter + public static final int BEGINNERS_GUIDE = 4161001; + public static final int LEGENDS_GUIDE = 4161048; + public static final int NOBLESSE_GUIDE = 4161047; + public static final int SWORD = 1302000; // Weapon + public static final int HAND_AXE = 1312004; + public static final int WOODEN_CLUB = 1322005; + public static final int BASIC_POLEARM = 1442079; + public static final int WHITE_UNDERSHIRT = 1040002; // Top + public static final int UNDERSHIRT = 1040006; + public static final int GREY_TSHIRT = 1040010; + public static final int WHITE_TUBETOP = 1041002; + public static final int YELLOW_TSHIRT = 1041006; + public static final int GREEN_TSHIRT = 1041010; + public static final int RED_STRIPED_TOP = 1041011; + public static final int SIMPLE_WARRIOR_TOP = 1042167; + public static final int BLUE_JEAN_SHORTS = 1060002; // Bottom + public static final int BROWN_COTTON_SHORTS = 1060006; + public static final int RED_MINISKIRT = 1061002; + public static final int INDIGO_MINISKIRT = 1061008; + public static final int SIMPLE_WARRIOR_PANTS = 1062115; + public static final int RED_RUBBER_BOOTS = 1072001; + public static final int LEATHER_SANDALS = 1072005; + public static final int YELLOW_RUBBER_BOOTS = 1072037; + public static final int BLUE_RUBBER_BOOTS = 1072038; + public static final int AVERAGE_MUSASHI_SHOES = 1072383; + public static final int BLACK_TOBEN = 30000; // Hair + public static final int ZETA = 30010; + public static final int BLACK_REBEL = 30020; + public static final int BLACK_BUZZ = 30030; + public static final int BLACK_SAMMY = 31000; + public static final int BLACK_EDGY = 31040; + public static final int BLACK_CONNIE = 31050; + public static final int MOTIVATED_LOOK_M = 20000; // Face + public static final int PERPLEXED_STARE = 20001; + public static final int LEISURE_LOOK_M = 20002; + public static final int MOTIVATED_LOOK_F = 21000; + public static final int FEARFUL_STARE_M = 21001; + public static final int LEISURE_LOOK_F = 21002; + public static final int FEARFUL_STARE_F = 21201; + public static final int PERPLEXED_STARE_HAZEL = 20401; + public static final int LEISURE_LOOK_HAZEL = 20402; + public static final int MOTIVATED_LOOK_AMETHYST = 21700; + public static final int MOTIVATED_LOOK_BLUE = 20100; + + // Warrior + public static final int RED_HWARANG_SHIRT = 1040021; + public static final int BLACK_MARTIAL_ARTS_PANTS = 1060016; + public static final int MITHRIL_BATTLE_GRIEVES = 1072039; + public static final int GLADIUS = 1302008; + public static final int MITHRIL_POLE_ARM = 1442001; + public static final int MITHRIL_MAUL = 1422001; + public static final int FIREMANS_AXE = 1312005; + public static final int DARK_ENGRIT = 1051010; + + // Bowman + public static final int GREEN_HUNTERS_ARMOR = 1040067; + public static final int GREEN_HUNTRESS_ARMOR = 1041054; + public static final int GREEN_HUNTERS_PANTS = 1060056; + public static final int GREEN_HUNTRESS_PANTS = 1061050; + public static final int GREEN_HUNTER_BOOTS = 1072081; + public static final int RYDEN = 1452005; + public static final int MOUNTAIN_CROSSBOW = 1462000; + + // Magician + public static final int BLUE_WIZARD_ROBE = 1050003; + public static final int PURPLE_FAIRY_TOP = 1041041; + public static final int PURPLE_FAIRY_SKIRT = 1061034; + public static final int RED_MAGICSHOES = 1072075; + public static final int MITHRIL_WAND = 1372003; + public static final int CIRCLE_WINDED_STAFF = 1382017; + + // Thief + public static final int DARK_BROWN_STEALER = 1040057; + public static final int RED_STEAL = 1041047; + public static final int DARK_BROWN_STEALER_PANTS = 1060043; + public static final int RED_STEAL_PANTS = 1061043; + public static final int BRONZE_CHAIN_BOOTS = 1072032; + public static final int STEEL_GUARDS = 1472008; + public static final int REEF_CLAW = 1332012; + + // Pirate + public static final int BROWN_PAULIE_BOOTS = 1072294; + public static final int PRIME_HANDS = 1482004; + public static final int COLD_MIND = 1492004; + public static final int BROWN_POLLARD = 1052107; + + // Three snails + public static final int SNAIL_SHELL = 4000019; + public static final int BLUE_SNAIL_SHELL = 4000000; + public static final int RED_SNAIL_SHELL = 4000016; + + // Special scroll + public static final int COLD_PROTECTION_SCROLl = 2041058; + public static final int SPIKES_SCROLL = 2040727; + public static final int VEGAS_SPELL_10 = 5610000; + public static final int VEGAS_SPELL_60 = 5610001; + public static final int CHAOS_SCROll_60 = 2049100; + public static final int LIAR_TREE_SAP = 2049101; + public static final int MAPLE_SYRUP = 2049102; + public static final int WHITE_SCROLL = 2340000; + public static final int CLEAN_SLATE_1 = 2049000; + public static final int CLEAN_SLATE_3 = 2049001; + public static final int CLEAN_SLATE_5 = 2049002; + public static final int CLEAN_SLATE_20 = 2049003; + public static final int RING_STR_100_SCROLL = 2041100; + public static final int DRAGON_STONE_SCROLL = 2041200; + public static final int BELT_STR_100_SCROLL = 2041300; + + // Cure debuff + public static final int ALL_CURE_POTION = 2050004; + public static final int EYEDROP = 2050001; + public static final int TONIC = 2050002; + public static final int HOLY_WATER = 2050003; + public static final int ANTI_BANISH_SCROLL = 2030100; + private static final int DOJO_PARTY_ALL_CURE = 2022433; + private static final int CARNIVAL_PARTY_ALL_CURE = 2022163; + public static final int WHITE_ELIXIR = 2022544; + + public static boolean isPartyAllCure(int itemId) { + return itemId == DOJO_PARTY_ALL_CURE || itemId == CARNIVAL_PARTY_ALL_CURE; + } + + // Special effect + public static final int PHARAOHS_BLESSING_1 = 2022585; + public static final int PHARAOHS_BLESSING_2 = 2022586; + public static final int PHARAOHS_BLESSING_3 = 2022587; + public static final int PHARAOHS_BLESSING_4 = 2022588; + + // Evolve pet + public static final int DRAGON_PET = 5000028; + public static final int ROBO_PET = 5000047; + + // Pet equip + public static final int MESO_MAGNET = 1812000; + public static final int ITEM_POUCH = 1812001; + public static final int ITEM_IGNORE = 1812007; + + public static boolean isPet(int itemId) { + return itemId / 1000 == 5000; + } + + // Expirable pet + public static final int PET_SNAIL = 5000054; + + // Permanent pet + private static final int PERMA_PINK_BEAN = 5000060; + private static final int PERMA_KINO = 5000100; + private static final int PERMA_WHITE_TIGER = 5000101; + private static final int PERMA_MINI_YETI = 5000102; + + public static int[] getPermaPets() { + return new int[]{PERMA_PINK_BEAN, PERMA_KINO, PERMA_WHITE_TIGER, PERMA_MINI_YETI}; + } + + // Maker + public static final int BASIC_MONSTER_CRYSTAL_1 = 4260000; + public static final int BASIC_MONSTER_CRYSTAL_2 = 4260001; + public static final int BASIC_MONSTER_CRYSTAL_3 = 4260002; + public static final int INTERMEDIATE_MONSTER_CRYSTAL_1 = 4260003; + public static final int INTERMEDIATE_MONSTER_CRYSTAL_2 = 4260004; + public static final int INTERMEDIATE_MONSTER_CRYSTAL_3 = 4260005; + public static final int ADVANCED_MONSTER_CRYSTAL_1 = 4260006; + public static final int ADVANCED_MONSTER_CRYSTAL_2 = 4260007; + public static final int ADVANCED_MONSTER_CRYSTAL_3 = 4260008; + + // NPC weather (PQ) + public static final int NPC_WEATHER_GROWLIE = 5120016; // Henesys PQ + + // Safety charm + public static final int SAFETY_CHARM = 5130000; + public static final int EASTER_BASKET = 4031283; + public static final int EASTER_CHARM = 4140903; + + // Engagement box + public static final int ENGAGEMENT_BOX_MOONSTONE = 2240000; + public static final int ENGAGEMENT_BOX_STAR = 2240001; + public static final int ENGAGEMENT_BOX_GOLDEN = 2240002; + public static final int ENGAGEMENT_BOX_SILVER = 2240003; + public static final int EMPTY_ENGAGEMENT_BOX_MOONSTONE = 4031357; + public static final int ENGAGEMENT_RING_MOONSTONE = 4031358; + public static final int EMPTY_ENGAGEMENT_BOX_STAR = 4031359; + public static final int ENGAGEMENT_RING_STAR = 4031360; + public static final int EMPTY_ENGAGEMENT_BOX_GOLDEN = 4031361; + public static final int ENGAGEMENT_RING_GOLDEN = 4031362; + public static final int EMPTY_ENGAGEMENT_BOX_SILVER = 4031363; + public static final int ENGAGEMENT_RING_SILVER = 4031364; + + public static boolean isWeddingToken(int itemId) { + return itemId >= ItemId.EMPTY_ENGAGEMENT_BOX_MOONSTONE && itemId <= ItemId.ENGAGEMENT_RING_SILVER; + } + + // Wedding etc + public static final int PARENTS_BLESSING = 4031373; + public static final int OFFICIATORS_PERMISSION = 4031374; + public static final int ONYX_CHEST_FOR_COUPLE = 4031424; + + // Wedding ticket + public static final int NORMAL_WEDDING_TICKET_CATHEDRAL = 5251000; + public static final int NORMAL_WEDDING_TICKET_CHAPEL = 5251001; + public static final int PREMIUM_WEDDING_TICKET_CHAPEL = 5251002; + public static final int PREMIUM_WEDDING_TICKET_CATHEDRAL = 5251003; + + // Wedding reservation + public static final int PREMIUM_CATHEDRAL_RESERVATION_RECEIPT = 4031375; + public static final int PREMIUM_CHAPEL_RESERVATION_RECEIPT = 4031376; + public static final int NORMAL_CATHEDRAL_RESERVATION_RECEIPT = 4031480; + public static final int NORMAL_CHAPEL_RESERVATION_RECEIPT = 4031481; + + // Wedding invite + public static final int INVITATION_CHAPEL = 4031377; + public static final int INVITATION_CATHEDRAL = 4031395; + public static final int RECEIVED_INVITATION_CHAPEL = 4031406; + public static final int RECEIVED_INVITATION_CATHEDRAL = 4031407; + + public static final int CARAT_RING_BASE = 1112300; // Unsure about math on this and the following one + public static final int CARAT_RING_BOX_BASE = 2240004; + private static final int CARAT_RING_BOX_MAX = 2240015; + + public static final int ENGAGEMENT_BOX_MIN = ENGAGEMENT_BOX_MOONSTONE; + public static final int ENGAGEMENT_BOX_MAX = CARAT_RING_BOX_MAX; + + // Wedding ring + public static final int WEDDING_RING_MOONSTONE = 1112803; + public static final int WEDDING_RING_STAR = 1112806; + public static final int WEDDING_RING_GOLDEN = 1112807; + public static final int WEDDING_RING_SILVER = 1112809; + + public static boolean isWeddingRing(int itemId) { + return itemId == WEDDING_RING_MOONSTONE || itemId == WEDDING_RING_STAR || + itemId == WEDDING_RING_GOLDEN || itemId == WEDDING_RING_SILVER; + } + + // Priority buff + public static final int ROSE_SCENT = 2022631; + public static final int FREESIA_SCENT = 2022632; + public static final int LAVENDER_SCENT = 2022633; + + // Cash shop + public static final int WHEEL_OF_FORTUNE = 5510000; + public static final int CASH_SHOP_SURPRISE = 5222000; + public static final int EXP_COUPON_2X_4H = 5211048; + public static final int DROP_COUPON_2X_4H = 5360042; + public static final int EXP_COUPON_3X_2H = 5211060; + public static final int QUICK_DELIVERY_TICKET = 5330000; + public static final int CHALKBOARD_1 = 5370000; + public static final int CHALKBOARD_2 = 5370001; + public static final int REMOTE_GACHAPON_TICKET = 5451000; + public static final int AP_RESET = 5050000; + public static final int NAME_CHANGE = 5400000; + public static final int WORLD_TRANSFER = 5401000; + public static final int MAPLE_LIFE_B = 5432000; + public static final int VICIOUS_HAMMER = 5570000; + + public static final int NX_CARD_100 = 4031865; + public static final int NX_CARD_250 = 4031866; + + public static boolean isNxCard(int itemId) { + return itemId == NX_CARD_100 || itemId == NX_CARD_250; + } + + // Face expression + private static final int FACE_EXPRESSION_MIN = 5160000; + private static final int FACE_EXPRESSION_MAX = 5160014; + + public static boolean isFaceExpression(int itemId) { + return itemId >= FACE_EXPRESSION_MIN && itemId <= FACE_EXPRESSION_MAX; + } + + // New Year card + public static final int NEW_YEARS_CARD = 2160101; + public static final int NEW_YEARS_CARD_SEND = 4300000; + public static final int NEW_YEARS_CARD_RECEIVED = 4301000; + + // Popular owl items + private static final int WORK_GLOVES = 1082002; + private static final int STEELY_THROWING_KNIVES = 2070005; + private static final int ILBI_THROWING_STARS = 2070006; + private static final int OWL_BALL_MASK = 1022047; + private static final int PINK_ADVENTURER_CAPE = 1102041; + private static final int CLAW_30_SCROLL = 2044705; + private static final int HELMET_60_ACC_SCROLL = 2040017; + private static final int MAPLE_SHIELD = 1092030; + private static final int GLOVES_ATT_60_SCROLL = 2040804; + + public static int[] getOwlItems() { + return new int[]{WORK_GLOVES, STEELY_THROWING_KNIVES, ILBI_THROWING_STARS, OWL_BALL_MASK, PINK_ADVENTURER_CAPE, + CLAW_30_SCROLL, WHITE_SCROLL, HELMET_60_ACC_SCROLL, MAPLE_SHIELD, GLOVES_ATT_60_SCROLL}; + } + + // Henesys PQ + public static final int GREEN_PRIMROSE_SEED = 4001095; + public static final int PURPLE_PRIMROSE_SEED = 4001096; + public static final int PINK_PRIMROSE_SEED = 4001097; + public static final int BROWN_PRIMROSE_SEED = 4001098; + public static final int YELLOW_PRIMROSE_SEED = 4001099; + public static final int BLUE_PRIMROSE_SEED = 4001100; + public static final int MOON_BUNNYS_RICE_CAKE = 4001101; + + // Catch mobs items + public static final int PHEROMONE_PERFUME = 2270000; + public static final int POUCH = 2270001; + public static final int GHOST_SACK = 4031830; + public static final int ARPQ_ELEMENT_ROCK = 2270002; + public static final int ARPQ_SPIRIT_JEWEL = 4031868; + public static final int MAGIC_CANE = 2270003; + public static final int TAMED_RUDOLPH = 4031887; + public static final int TRANSPARENT_MARBLE_1 = 2270005; + public static final int MONSTER_MARBLE_1 = 2109001; + public static final int TRANSPARENT_MARBLE_2 = 2270006; + public static final int MONSTER_MARBLE_2 = 2109002; + public static final int TRANSPARENT_MARBLE_3 = 2270007; + public static final int MONSTER_MARBLE_3 = 2109003; + public static final int EPQ_PURIFICATION_MARBLE = 2270004; + public static final int EPQ_MONSTER_MARBLE = 4001169; + public static final int FISH_NET = 2270008; + public static final int FISH_NET_WITH_A_CATCH = 2022323; + + // Mount + public static final int BATTLESHIP = 1932000; + + // Explorer mount + public static final int HOG = 1902000; + private static final int SILVER_MANE = 1902001; + private static final int RED_DRACO = 1902002; + private static final int EXPLORER_SADDLE = 1912000; + + public static boolean isExplorerMount(int itemId) { + return itemId >= HOG && itemId <= RED_DRACO || itemId == EXPLORER_SADDLE; + } + + // Cygnus mount + private static final int MIMIANA = 1902005; + private static final int MIMIO = 1902006; + private static final int SHINJOU = 1902007; + private static final int CYGNUS_SADDLE = 1912005; + + public static boolean isCygnusMount(int itemId) { + return itemId >= MIMIANA && itemId <= SHINJOU || itemId == CYGNUS_SADDLE; + } + + // Dev equips + public static final int GREEN_HEADBAND = 1002067; + public static final int TIMELESS_NIBLEHEIM = 1402046; + public static final int BLUE_KORBEN = 1082140; + public static final int MITHRIL_PLATINE_PANTS = 1060091; + public static final int BLUE_CARZEN_BOOTS = 1072154; + public static final int MITHRIL_PLATINE = 1040103; +} diff --git a/src/main/java/constants/inventory/ItemConstants.java b/src/main/java/constants/inventory/ItemConstants.java index e7a9cd7a2b..537cfc7e2c 100644 --- a/src/main/java/constants/inventory/ItemConstants.java +++ b/src/main/java/constants/inventory/ItemConstants.java @@ -23,6 +23,7 @@ package constants.inventory; import client.inventory.InventoryType; import config.YamlConfig; +import constants.id.ItemId; import java.util.HashMap; import java.util.HashSet; @@ -51,9 +52,9 @@ public final class ItemConstants { public final static Set permanentItemids = new HashSet<>(); static { - int[] pi = {5000060, 5000100, 5000101, 5000102}; // i ain't going to open one gigantic itemid cache just for 4 perma itemids, no way! - for (int i : pi) { - permanentItemids.add(i); + // i ain't going to open one gigantic itemid cache just for 4 perma itemids, no way! + for (int petItemId : ItemId.getPermaPets()) { + permanentItemids.add(petItemId); } } @@ -108,7 +109,7 @@ public final class ItemConstants { } public static boolean isExpirablePet(int itemId) { - return YamlConfig.config.server.USE_ERASE_PET_ON_EXPIRATION || itemId == 5000054; + return YamlConfig.config.server.USE_ERASE_PET_ON_EXPIRATION || itemId == ItemId.PET_SNAIL; } public static boolean isPermanentItem(int itemId) { @@ -133,11 +134,11 @@ public final class ItemConstants { } public static boolean isTownScroll(int itemId) { - return itemId >= 2030000 && itemId < 2030100; + return itemId >= 2030000 && itemId < ItemId.ANTI_BANISH_SCROLL; } public static boolean isAntibanishScroll(int itemId) { - return itemId == 2030100; + return itemId == ItemId.ANTI_BANISH_SCROLL; } public static boolean isCleanSlate(int scrollId) { @@ -145,14 +146,14 @@ public final class ItemConstants { } public static boolean isModifierScroll(int scrollId) { - return scrollId == 2040727 || scrollId == 2041058; + return scrollId == ItemId.SPIKES_SCROLL || scrollId == ItemId.COLD_PROTECTION_SCROLl; } public static boolean isFlagModifier(int scrollId, short flag) { - if (scrollId == 2041058 && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) { + if (scrollId == ItemId.COLD_PROTECTION_SCROLl && ((flag & ItemConstants.COLD) == ItemConstants.COLD)) { return true; } - return scrollId == 2040727 && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES); + return scrollId == ItemId.SPIKES_SCROLL && ((flag & ItemConstants.SPIKES) == ItemConstants.SPIKES); } public static boolean isChaosScroll(int scrollId) { @@ -172,10 +173,6 @@ public final class ItemConstants { return itemId >= 2022430 && itemId <= 2022433 || itemId >= 2022160 && itemId <= 2022163; } - public static boolean isPartyAllcure(int itemId) { - return itemId == 2022433 || itemId == 2022163; - } - public static boolean isHiredMerchant(int itemId) { return itemId / 10000 == 503; } @@ -227,21 +224,13 @@ public final class ItemConstants { } public static boolean isFishingChair(int itemId) { - return itemId == 3011000; + return itemId == ItemId.FISHING_CHAIR; } public static boolean isMedal(int itemId) { return itemId >= 1140000 && itemId < 1143000; } - public static boolean isWeddingRing(int itemId) { - return itemId >= 1112803 && itemId <= 1112809; - } - - public static boolean isWeddingToken(int itemId) { - return itemId >= 4031357 && itemId <= 4031364; - } - public static boolean isFace(int itemId) { return itemId >= 20000 && itemId < 22000; } @@ -249,12 +238,4 @@ public final class ItemConstants { public static boolean isHair(int itemId) { return itemId >= 30000 && itemId < 35000; } - - public static boolean isFaceExpression(int itemId) { - return itemId / 10000 == 516; - } - - public static boolean isChair(int itemId) { - return itemId / 10000 == 301; - } } diff --git a/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java b/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java index ac7d98593c..fe7aa626d1 100644 --- a/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java +++ b/src/main/java/net/server/channel/handlers/AbstractDealDamageHandler.java @@ -28,6 +28,7 @@ import client.status.MonsterStatus; import client.status.MonsterStatusEffect; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.skills.*; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -439,19 +440,11 @@ public abstract class AbstractDealDamageHandler extends AbstractPacketHandler { if (skillLv > 0) { AbstractPlayerInteraction api = player.getAbstractPlayerInteraction(); - int shellId; - switch (skillLv) { - case 1: - shellId = 4000019; - break; - - case 2: - shellId = 4000000; - break; - - default: - shellId = 4000016; - } + int shellId = switch (skillLv) { + case 1 -> ItemId.SNAIL_SHELL; + case 2 -> ItemId.BLUE_SNAIL_SHELL; + default -> ItemId.RED_SNAIL_SHELL; + }; if (api.haveItem(shellId, 1)) { api.gainItem(shellId, (short) -1, false); diff --git a/src/main/java/net/server/channel/handlers/CashOperationHandler.java b/src/main/java/net/server/channel/handlers/CashOperationHandler.java index 9677243a21..36ad88c0d6 100644 --- a/src/main/java/net/server/channel/handlers/CashOperationHandler.java +++ b/src/main/java/net/server/channel/handlers/CashOperationHandler.java @@ -30,6 +30,7 @@ import client.inventory.InventoryType; import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -293,7 +294,7 @@ public final class CashOperationHandler extends AbstractPacketHandler { chr.getClient().sendPacket(PacketCreator.serverNotice(1, "You cannot put the pet you currently equip into the Cash Shop inventory.")); c.enableCSActions(); return; - } else if (ItemConstants.isWeddingRing(item.getItemId()) || ItemConstants.isWeddingToken(item.getItemId())) { + } else if (ItemId.isWeddingRing(item.getItemId()) || ItemId.isWeddingToken(item.getItemId())) { chr.getClient().sendPacket(PacketCreator.serverNotice(1, "You cannot put relationship items into the Cash Shop inventory.")); c.enableCSActions(); return; diff --git a/src/main/java/net/server/channel/handlers/ChangeMapHandler.java b/src/main/java/net/server/channel/handlers/ChangeMapHandler.java index 7dba890c9c..c420e1d003 100644 --- a/src/main/java/net/server/channel/handlers/ChangeMapHandler.java +++ b/src/main/java/net/server/channel/handlers/ChangeMapHandler.java @@ -25,6 +25,7 @@ import client.Character; import client.Client; import client.inventory.InventoryType; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; import server.Trade; @@ -91,11 +92,11 @@ public final class ChangeMapHandler extends AbstractPacketHandler { if (targetid != -1) { if (!chr.isAlive()) { MapleMap map = chr.getMap(); - if (wheel && chr.haveItemWithId(5510000, false)) { + if (wheel && chr.haveItemWithId(ItemId.WHEEL_OF_FORTUNE, false)) { // thanks lucasziron (lziron) for showing revivePlayer() triggering by Wheel - InventoryManipulator.removeById(c, InventoryType.CASH, 5510000, 1, true, false); - chr.sendPacket(PacketCreator.showWheelsLeft(chr.getItemQuantity(5510000, false))); + InventoryManipulator.removeById(c, InventoryType.CASH, ItemId.WHEEL_OF_FORTUNE, 1, true, false); + chr.sendPacket(PacketCreator.showWheelsLeft(chr.getItemQuantity(ItemId.WHEEL_OF_FORTUNE, false))); chr.updateHp(50); chr.changeMap(map, map.findClosestPlayerSpawnpoint(chr.getPosition())); diff --git a/src/main/java/net/server/channel/handlers/FaceExpressionHandler.java b/src/main/java/net/server/channel/handlers/FaceExpressionHandler.java index ae98b6969a..daa015ff85 100644 --- a/src/main/java/net/server/channel/handlers/FaceExpressionHandler.java +++ b/src/main/java/net/server/channel/handlers/FaceExpressionHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.Character; import client.Client; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -35,7 +36,7 @@ public final class FaceExpressionHandler extends AbstractPacketHandler { if (emote > 7) { int itemid = 5159992 + emote; // thanks RajanGrewal (Darter) for reporting unchecked emote itemid - if (!ItemConstants.isFaceExpression(itemid) || chr.getInventory(ItemConstants.getInventoryType(itemid)).findById(itemid) == null) { + if (!ItemId.isFaceExpression(itemid) || chr.getInventory(ItemConstants.getInventoryType(itemid)).findById(itemid) == null) { return; } } else if (emote < 1) { diff --git a/src/main/java/net/server/channel/handlers/NewYearCardHandler.java b/src/main/java/net/server/channel/handlers/NewYearCardHandler.java index d62e17880c..8a12340d39 100644 --- a/src/main/java/net/server/channel/handlers/NewYearCardHandler.java +++ b/src/main/java/net/server/channel/handlers/NewYearCardHandler.java @@ -23,6 +23,7 @@ import client.Character; import client.Client; import client.inventory.Item; import client.newyear.NewYearCardRecord; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -48,13 +49,13 @@ public final class NewYearCardHandler extends AbstractPacketHandler { byte reqMode = p.readByte(); //[00] -> NewYearReq (0 = Send) if (reqMode == 0) { // card has been sent - if (player.haveItem(2160101)) { // new year's card + if (player.haveItem(ItemId.NEW_YEARS_CARD)) { // new year's card short slot = p.readShort(); //[00 2C] -> nPOS (Item Slot Pos) int itemid = p.readInt(); //[00 20 F5 E5] -> nItemID (item id) int status = getValidNewYearCardStatus(itemid, player, slot); if (status == 0) { - if (player.canHold(4300000, 1)) { + if (player.canHold(ItemId.NEW_YEARS_CARD_SEND, 1)) { String receiver = p.readString(); //[04 00 54 65 73 74] -> sReceiverName (person to send to) int receiverid = getReceiverId(receiver, c.getWorld()); @@ -66,8 +67,8 @@ public final class NewYearCardHandler extends AbstractPacketHandler { NewYearCardRecord.saveNewYearCard(newyear); player.addNewYearRecord(newyear); - player.getAbstractPlayerInteraction().gainItem(2160101, (short) -1); - player.getAbstractPlayerInteraction().gainItem(4300000, (short) 1); + player.getAbstractPlayerInteraction().gainItem(ItemId.NEW_YEARS_CARD, (short) -1); + player.getAbstractPlayerInteraction().gainItem(ItemId.NEW_YEARS_CARD_SEND, (short) 1); Server.getInstance().setNewYearCard(newyear); newyear.startNewYearCardTask(); @@ -94,11 +95,11 @@ public final class NewYearCardHandler extends AbstractPacketHandler { if (newyear != null && newyear.getReceiverId() == player.getId() && !newyear.isReceiverCardReceived()) { if (!newyear.isSenderCardDiscarded()) { - if (player.canHold(4301000, 1)) { + if (player.canHold(ItemId.NEW_YEARS_CARD_RECEIVED, 1)) { newyear.stopNewYearCardTask(); NewYearCardRecord.updateNewYearCard(newyear); - player.getAbstractPlayerInteraction().gainItem(4301000, (short) 1); + player.getAbstractPlayerInteraction().gainItem(ItemId.NEW_YEARS_CARD_RECEIVED, (short) 1); if (!newyear.getMessage().isEmpty()) { player.dropMessage(6, "[New Year] " + newyear.getSenderName() + ": " + newyear.getMessage()); } diff --git a/src/main/java/net/server/channel/handlers/PlayerInteractionHandler.java b/src/main/java/net/server/channel/handlers/PlayerInteractionHandler.java index 8fdfa362cb..cb51008853 100644 --- a/src/main/java/net/server/channel/handlers/PlayerInteractionHandler.java +++ b/src/main/java/net/server/channel/handlers/PlayerInteractionHandler.java @@ -31,6 +31,7 @@ import client.inventory.manipulator.InventoryManipulator; import client.inventory.manipulator.KarmaManipulator; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -168,7 +169,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler { } else if (type < 0) { type = 0; } - if (!chr.haveItem(4080000 + type)) { + if (!chr.haveItem(ItemId.MINI_GAME_BASE + type)) { chr.sendPacket(PacketCreator.getMiniRoomError(6)); return; } @@ -202,7 +203,7 @@ public final class PlayerInteractionHandler extends AbstractPacketHandler { } else if (type < 0) { type = 0; } - if (!chr.haveItem(4080100)) { + if (!chr.haveItem(ItemId.MATCH_CARDS)) { chr.sendPacket(PacketCreator.getMiniRoomError(6)); return; } diff --git a/src/main/java/net/server/channel/handlers/RangedAttackHandler.java b/src/main/java/net/server/channel/handlers/RangedAttackHandler.java index 5c3624a052..4f0481d3e8 100644 --- a/src/main/java/net/server/channel/handlers/RangedAttackHandler.java +++ b/src/main/java/net/server/channel/handlers/RangedAttackHandler.java @@ -30,6 +30,7 @@ import client.inventory.WeaponType; import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import constants.skills.*; import net.packet.InPacket; @@ -136,15 +137,15 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler { boolean bow = ItemConstants.isArrowForBow(id); boolean cbow = ItemConstants.isArrowForCrossBow(id); if (item.getQuantity() >= bulletCount) { //Fixes the bug where you can't use your last arrow. - if (type == WeaponType.CLAW && ItemConstants.isThrowingStar(id) && weapon.getItemId() != 1472063) { - if (((id == 2070007 || id == 2070018) && chr.getLevel() < 70) || (id == 2070016 && chr.getLevel() < 50)) { + if (type == WeaponType.CLAW && ItemConstants.isThrowingStar(id) && weapon.getItemId() != ItemId.MAGICAL_MITTEN) { + if (((id == ItemId.HWABI_THROWING_STARS || id == ItemId.BALANCED_FURY) && chr.getLevel() < 70) || (id == ItemId.CRYSTAL_ILBI_THROWING_STARS && chr.getLevel() < 50)) { } else { projectile = id; break; } } else if ((type == WeaponType.GUN && ItemConstants.isBullet(id))) { - if (id == 2331000 && id == 2332000) { - if (chr.getLevel() > 69) { + if (id == ItemId.BLAZE_CAPSULE || id == ItemId.GLAZE_CAPSULE) { + if (chr.getLevel() >= 70) { projectile = id; break; } @@ -152,7 +153,7 @@ public final class RangedAttackHandler extends AbstractDealDamageHandler { projectile = id; break; } - } else if ((type == WeaponType.BOW && bow) || (type == WeaponType.CROSSBOW && cbow) || (weapon.getItemId() == 1472063 && (bow || cbow))) { + } else if ((type == WeaponType.BOW && bow) || (type == WeaponType.CROSSBOW && cbow) || (weapon.getItemId() == ItemId.MAGICAL_MITTEN && (bow || cbow))) { projectile = id; break; } diff --git a/src/main/java/net/server/channel/handlers/RemoteGachaponHandler.java b/src/main/java/net/server/channel/handlers/RemoteGachaponHandler.java index ef91a56e7e..de58534aad 100644 --- a/src/main/java/net/server/channel/handlers/RemoteGachaponHandler.java +++ b/src/main/java/net/server/channel/handlers/RemoteGachaponHandler.java @@ -23,6 +23,7 @@ package net.server.channel.handlers; import client.Client; import client.autoban.AutobanFactory; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -36,7 +37,7 @@ public final class RemoteGachaponHandler extends AbstractPacketHandler { public final void handlePacket(InPacket p, Client c) { int ticket = p.readInt(); int gacha = p.readInt(); - if (ticket != 5451000) { + if (ticket != ItemId.REMOTE_GACHAPON_TICKET) { AutobanFactory.GENERAL.alert(c.getPlayer(), " Tried to use RemoteGachaponHandler with item id: " + ticket); c.disconnect(false, false); return; diff --git a/src/main/java/net/server/channel/handlers/RingActionHandler.java b/src/main/java/net/server/channel/handlers/RingActionHandler.java index 50e1950e42..389be85986 100644 --- a/src/main/java/net/server/channel/handlers/RingActionHandler.java +++ b/src/main/java/net/server/channel/handlers/RingActionHandler.java @@ -29,6 +29,7 @@ import client.inventory.InventoryType; import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; import client.processor.npc.DueyProcessor; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; import net.server.channel.Channel; @@ -51,12 +52,19 @@ import java.sql.SQLException; * @author Drago (Dragohe4rt) - on Wishlist */ public final class RingActionHandler extends AbstractPacketHandler { - private static int getBoxId(int useItemId) { - return useItemId == 2240000 ? 4031357 : (useItemId == 2240001 ? 4031359 : (useItemId == 2240002 ? 4031361 : (useItemId == 2240003 ? 4031363 : (1112300 + (useItemId - 2240004))))); + + private static int getEngagementBoxId(int useItemId) { + return switch (useItemId) { + case ItemId.ENGAGEMENT_BOX_MOONSTONE -> ItemId.EMPTY_ENGAGEMENT_BOX_MOONSTONE; + case ItemId.ENGAGEMENT_BOX_STAR -> ItemId.EMPTY_ENGAGEMENT_BOX_STAR; + case ItemId.ENGAGEMENT_BOX_GOLDEN -> ItemId.EMPTY_ENGAGEMENT_BOX_GOLDEN; + case ItemId.ENGAGEMENT_BOX_SILVER -> ItemId.EMPTY_ENGAGEMENT_BOX_SILVER; + default -> ItemId.CARAT_RING_BASE + (useItemId - ItemId.CARAT_RING_BOX_BASE); + }; } public static void sendEngageProposal(final Client c, final String name, final int itemid) { - final int newBoxId = getBoxId(itemid); + final int newBoxId = getEngagementBoxId(itemid); final Character target = c.getChannelServer().getPlayerStorage().getCharacterByName(name); final Character source = c.getPlayer(); @@ -93,7 +101,7 @@ public final class RingActionHandler extends AbstractPacketHandler { source.dropMessage(1, "Make sure your partner is on the same map!"); source.sendPacket(WeddingPackets.OnMarriageResult((byte) 0)); return; - } else if (!source.haveItem(itemid) || itemid < 2240000 || itemid > 2240015) { + } else if (!source.haveItem(itemid) || itemid < ItemId.ENGAGEMENT_BOX_MIN || itemid > ItemId.ENGAGEMENT_BOX_MAX) { source.sendPacket(WeddingPackets.OnMarriageResult((byte) 0)); return; } else if (target.isMarried()) { @@ -328,7 +336,7 @@ public final class RingActionHandler extends AbstractPacketHandler { } if (accepted) { - final int newItemId = getBoxId(itemid); + final int newItemId = getEngagementBoxId(itemid); if (!InventoryManipulator.checkSpace(c, newItemId, 1, "") || !InventoryManipulator.checkSpace(source.getClient(), newItemId, 1, "")) { target.sendPacket(PacketCreator.enableActions()); return; @@ -380,7 +388,7 @@ public final class RingActionHandler extends AbstractPacketHandler { return; } - if ((itemId != 4031377 && itemId != 4031395) || !c.getPlayer().haveItem(itemId)) { + if ((itemId != ItemId.INVITATION_CHAPEL && itemId != ItemId.INVITATION_CATHEDRAL) || !c.getPlayer().haveItem(itemId)) { c.sendPacket(PacketCreator.enableActions()); return; } @@ -399,7 +407,7 @@ public final class RingActionHandler extends AbstractPacketHandler { if (registration != null) { if (wserv.addMarriageGuest(marriageId, guest)) { boolean cathedral = registration.getLeft(); - int newItemId = cathedral ? 4031407 : 4031406; + int newItemId = cathedral ? ItemId.RECEIVED_INVITATION_CATHEDRAL : ItemId.RECEIVED_INVITATION_CHAPEL; Channel cserv = c.getChannelServer(); int resStatus = cserv.getWeddingReservationStatus(marriageId, cathedral); @@ -443,7 +451,7 @@ public final class RingActionHandler extends AbstractPacketHandler { slot = (byte) p.readInt(); int invitationid = p.readInt(); - if (invitationid == 4031406 || invitationid == 4031407) { + if (invitationid == ItemId.RECEIVED_INVITATION_CHAPEL || invitationid == ItemId.RECEIVED_INVITATION_CATHEDRAL) { Item item = c.getPlayer().getInventory(InventoryType.ETC).getItem(slot); if (item == null || item.getItemId() != invitationid) { c.sendPacket(PacketCreator.enableActions()); @@ -451,7 +459,7 @@ public final class RingActionHandler extends AbstractPacketHandler { } // collision case: most soon-to-come wedding will show up - Pair coupleId = c.getWorldServer().getWeddingCoupleForGuest(c.getPlayer().getId(), invitationid == 4031407); + Pair coupleId = c.getWorldServer().getWeddingCoupleForGuest(c.getPlayer().getId(), invitationid == ItemId.RECEIVED_INVITATION_CATHEDRAL); if (coupleId != null) { int groomId = coupleId.getLeft(), brideId = coupleId.getRight(); c.sendPacket(WeddingPackets.sendWeddingInvitation(Character.getNameById(groomId), Character.getNameById(brideId))); diff --git a/src/main/java/net/server/channel/handlers/ScrollHandler.java b/src/main/java/net/server/channel/handlers/ScrollHandler.java index ad9fa900d0..2fc9bc3307 100644 --- a/src/main/java/net/server/channel/handlers/ScrollHandler.java +++ b/src/main/java/net/server/channel/handlers/ScrollHandler.java @@ -28,6 +28,7 @@ import client.SkillFactory; import client.inventory.*; import client.inventory.Equip.ScrollResult; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -89,7 +90,7 @@ public final class ScrollHandler extends AbstractPacketHandler { return; } if (whiteScroll) { - wscroll = useInventory.findById(2340000); + wscroll = useInventory.findById(ItemId.WHITE_SCROLL); if (wscroll == null) { whiteScroll = false; } @@ -138,7 +139,7 @@ public final class ScrollHandler extends AbstractPacketHandler { final List mods = new ArrayList<>(); if (scrollSuccess == Equip.ScrollResult.CURSE) { - if (!ItemConstants.isWeddingRing(toScroll.getItemId())) { + if (!ItemId.isWeddingRing(toScroll.getItemId())) { mods.add(new ModifyInventory(3, toScroll)); if (dst < 0) { Inventory inv = chr.getInventory(InventoryType.EQUIPPED); @@ -195,7 +196,8 @@ public final class ScrollHandler extends AbstractPacketHandler { switch (sid) { case 20492: //scroll for accessory (pendant, belt, ring) - return canScroll(2041100, itemid) || canScroll(2041200, itemid) || canScroll(2041300, itemid); + return canScroll(ItemId.RING_STR_100_SCROLL, itemid) || canScroll(ItemId.DRAGON_STONE_SCROLL, itemid) || + canScroll(ItemId.BELT_STR_100_SCROLL, itemid); default: return (scrollid / 100) % 100 == (itemid / 10000) % 100; diff --git a/src/main/java/net/server/channel/handlers/UseCashItemHandler.java b/src/main/java/net/server/channel/handlers/UseCashItemHandler.java index f3c0e9b1d8..eba6616dab 100644 --- a/src/main/java/net/server/channel/handlers/UseCashItemHandler.java +++ b/src/main/java/net/server/channel/handlers/UseCashItemHandler.java @@ -33,6 +33,7 @@ import client.processor.stat.AssignAPProcessor; import client.processor.stat.AssignSPProcessor; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -145,7 +146,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler { return; } - if (itemId > 5050000) { + if (itemId > ItemId.AP_RESET) { int SPTo = p.readInt(); if (!AssignSPProcessor.canSPAssign(c, SPTo)) { // exploit found thanks to Arnah return; @@ -452,15 +453,15 @@ public final class UseCashItemHandler extends AbstractPacketHandler { } else if (itemType == 540) { p.readByte(); p.readInt(); - if (itemId == 5400000) { //name change + if (itemId == ItemId.NAME_CHANGE) { c.sendPacket(PacketCreator.showNameChangeCancel(player.cancelPendingNameChange())); - } else if (itemId == 5401000) { //world transfer + } else if (itemId == ItemId.WORLD_TRANSFER) { c.sendPacket(PacketCreator.showWorldTransferCancel(player.cancelPendingWorldTranfer())); } remove(c, position, itemId); c.sendPacket(PacketCreator.enableActions()); } else if (itemType == 543) { - if (itemId == 5432000 && !c.gainCharacterSlot()) { + if (itemId == ItemId.MAPLE_LIFE_B && !c.gainCharacterSlot()) { player.dropMessage(1, "You have already used up all 12 extra character slots."); c.sendPacket(PacketCreator.enableActions()); return; @@ -527,7 +528,7 @@ public final class UseCashItemHandler extends AbstractPacketHandler { int itemSlot = p.readInt(); p.readInt(); final Equip equip = (Equip) player.getInventory(InventoryType.EQUIP).getItem((short) itemSlot); - if (equip.getVicious() >= 2 || player.getInventory(InventoryType.CASH).findById(5570000) == null) { + if (equip.getVicious() >= 2 || player.getInventory(InventoryType.CASH).findById(ItemId.VICIOUS_HAMMER) == null) { return; } equip.setVicious(equip.getVicious() + 1); diff --git a/src/main/java/net/server/channel/handlers/UseCatchItemHandler.java b/src/main/java/net/server/channel/handlers/UseCatchItemHandler.java index 06fa2dc3f5..a8b33a8b74 100644 --- a/src/main/java/net/server/channel/handlers/UseCatchItemHandler.java +++ b/src/main/java/net/server/channel/handlers/UseCatchItemHandler.java @@ -26,6 +26,7 @@ import client.Client; import client.autoban.AutobanManager; import client.inventory.InventoryType; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -56,23 +57,23 @@ public final class UseCatchItemHandler extends AbstractPacketHandler { return; } switch (itemId) { - case 2270000: + case ItemId.PHEROMONE_PERFUME: if (mob.getId() == 9300101) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 1902000, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.HOG, (short) 1, "", -1); } c.sendPacket(PacketCreator.enableActions()); break; - case 2270001: + case ItemId.POUCH: if (mob.getId() == 9500197) { if ((abm.getLastSpam(10) + 1000) < currentServerTime()) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 4031830, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.GHOST_SACK, (short) 1, "", -1); } else { abm.spam(10); c.sendPacket(PacketCreator.catchMessage(0)); @@ -81,16 +82,16 @@ public final class UseCatchItemHandler extends AbstractPacketHandler { c.sendPacket(PacketCreator.enableActions()); } break; - case 2270002: + case ItemId.ARPQ_ELEMENT_ROCK: if (mob.getId() == 9300157) { if ((abm.getLastSpam(10) + 800) < currentServerTime()) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) { - if (chr.canHold(4031868, 1)) { + if (chr.canHold(ItemId.ARPQ_SPIRIT_JEWEL, 1)) { if (Math.random() < 0.5) { // 50% chance chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 4031868, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.ARPQ_SPIRIT_JEWEL, (short) 1, "", -1); } else { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 0)); } @@ -106,79 +107,79 @@ public final class UseCatchItemHandler extends AbstractPacketHandler { c.sendPacket(PacketCreator.enableActions()); } break; - case 2270003: + case ItemId.MAGIC_CANE: if (mob.getId() == 9500320) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 4031887, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.TAMED_RUDOLPH, (short) 1, "", -1); } else { c.sendPacket(PacketCreator.catchMessage(0)); } } c.sendPacket(PacketCreator.enableActions()); break; - case 2270005: + case ItemId.TRANSPARENT_MARBLE_1: if (mob.getId() == 9300187) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 2109001, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.MONSTER_MARBLE_1, (short) 1, "", -1); } else { c.sendPacket(PacketCreator.catchMessage(0)); } } c.sendPacket(PacketCreator.enableActions()); break; - case 2270006: + case ItemId.TRANSPARENT_MARBLE_2: if (mob.getId() == 9300189) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 2109002, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.MONSTER_MARBLE_2, (short) 1, "", -1); } else { c.sendPacket(PacketCreator.catchMessage(0)); } } c.sendPacket(PacketCreator.enableActions()); break; - case 2270007: + case ItemId.TRANSPARENT_MARBLE_3: if (mob.getId() == 9300191) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 3)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 2109003, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.MONSTER_MARBLE_3, (short) 1, "", -1); } else { c.sendPacket(PacketCreator.catchMessage(0)); } } c.sendPacket(PacketCreator.enableActions()); break; - case 2270004: + case ItemId.EPQ_PURIFICATION_MARBLE: if (mob.getId() == 9300175) { if (mob.getHp() < ((mob.getMaxHp() / 10) * 4)) { chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 4001169, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.EPQ_MONSTER_MARBLE, (short) 1, "", -1); } else { c.sendPacket(PacketCreator.catchMessage(0)); } } c.sendPacket(PacketCreator.enableActions()); break; - case 2270008: + case ItemId.FISH_NET: if (mob.getId() == 9500336) { if ((abm.getLastSpam(10) + 3000) < currentServerTime()) { abm.spam(10); chr.getMap().broadcastMessage(PacketCreator.catchMonster(monsterid, itemId, (byte) 1)); mob.getMap().killMonster(mob, null, false); InventoryManipulator.removeById(c, InventoryType.USE, itemId, 1, true, true); - InventoryManipulator.addById(c, 2022323, (short) 1, "", -1); + InventoryManipulator.addById(c, ItemId.FISH_NET_WITH_A_CATCH, (short) 1, "", -1); } else { chr.message("You cannot use the Fishing Net yet."); } diff --git a/src/main/java/net/server/channel/handlers/UseChairHandler.java b/src/main/java/net/server/channel/handlers/UseChairHandler.java index 317e5c80ec..ccc0fb8e23 100644 --- a/src/main/java/net/server/channel/handlers/UseChairHandler.java +++ b/src/main/java/net/server/channel/handlers/UseChairHandler.java @@ -23,7 +23,7 @@ package net.server.channel.handlers; import client.Client; import client.inventory.InventoryType; -import constants.inventory.ItemConstants; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -33,7 +33,7 @@ public final class UseChairHandler extends AbstractPacketHandler { int itemId = p.readInt(); // thanks Darter (YungMoozi) for reporting unchecked chair item - if (!ItemConstants.isChair(itemId) || c.getPlayer().getInventory(InventoryType.SETUP).findById(itemId) == null) { + if (!ItemId.isChair(itemId) || c.getPlayer().getInventory(InventoryType.SETUP).findById(itemId) == null) { return; } diff --git a/src/main/java/net/server/channel/handlers/UseItemEffectHandler.java b/src/main/java/net/server/channel/handlers/UseItemEffectHandler.java index 7cb9307773..325c97d7a9 100644 --- a/src/main/java/net/server/channel/handlers/UseItemEffectHandler.java +++ b/src/main/java/net/server/channel/handlers/UseItemEffectHandler.java @@ -24,6 +24,7 @@ package net.server.channel.handlers; import client.Client; import client.inventory.InventoryType; import client.inventory.Item; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; import tools.PacketCreator; @@ -33,7 +34,7 @@ public final class UseItemEffectHandler extends AbstractPacketHandler { public final void handlePacket(InPacket p, Client c) { Item toUse; int itemId = p.readInt(); - if (itemId == 4290001 || itemId == 4290000) { + if (itemId == ItemId.BUMMER_EFFECT || itemId == ItemId.GOLDEN_CHICKEN_EFFECT) { toUse = c.getPlayer().getInventory(InventoryType.ETC).findById(itemId); } else { toUse = c.getPlayer().getInventory(InventoryType.CASH).findById(itemId); diff --git a/src/main/java/net/server/channel/handlers/UseItemHandler.java b/src/main/java/net/server/channel/handlers/UseItemHandler.java index b0d7a802a5..7cdb773220 100644 --- a/src/main/java/net/server/channel/handlers/UseItemHandler.java +++ b/src/main/java/net/server/channel/handlers/UseItemHandler.java @@ -28,6 +28,7 @@ import client.inventory.InventoryType; import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.AbstractPacketHandler; import net.packet.InPacket; @@ -53,20 +54,20 @@ public final class UseItemHandler extends AbstractPacketHandler { int itemId = p.readInt(); Item toUse = chr.getInventory(InventoryType.USE).getItem(slot); if (toUse != null && toUse.getQuantity() > 0 && toUse.getItemId() == itemId) { - if (itemId == 2050004) { + if (itemId == ItemId.ALL_CURE_POTION) { chr.dispelDebuffs(); remove(c, slot); return; - } else if (itemId == 2050001) { + } else if (itemId == ItemId.EYEDROP) { chr.dispelDebuff(Disease.DARKNESS); remove(c, slot); return; - } else if (itemId == 2050002) { + } else if (itemId == ItemId.TONIC) { chr.dispelDebuff(Disease.WEAKEN); chr.dispelDebuff(Disease.SLOW); remove(c, slot); return; - } else if (itemId == 2050003) { + } else if (itemId == ItemId.HOLY_WATER) { chr.dispelDebuff(Disease.SEAL); chr.dispelDebuff(Disease.CURSE); remove(c, slot); @@ -95,7 +96,7 @@ public final class UseItemHandler extends AbstractPacketHandler { remove(c, slot); - if (toUse.getItemId() != 2022153) { + if (toUse.getItemId() != ItemId.HAPPY_BIRTHDAY) { ii.getItemEffect(toUse.getItemId()).applyTo(chr); } else { StatEffect mse = ii.getItemEffect(toUse.getItemId()); diff --git a/src/main/java/net/server/channel/handlers/UseOwlOfMinervaHandler.java b/src/main/java/net/server/channel/handlers/UseOwlOfMinervaHandler.java index 7e276f59bd..cfb937703d 100644 --- a/src/main/java/net/server/channel/handlers/UseOwlOfMinervaHandler.java +++ b/src/main/java/net/server/channel/handlers/UseOwlOfMinervaHandler.java @@ -20,7 +20,7 @@ package net.server.channel.handlers; import client.Client; -import constants.game.GameConstants; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; import tools.PacketCreator; @@ -43,8 +43,8 @@ public final class UseOwlOfMinervaHandler extends AbstractPacketHandler { if (owlSearched.size() < 5) { owlLeaderboards = new LinkedList<>(); - for (int i : GameConstants.OWL_DATA) { - owlLeaderboards.add(i); + for (int itemId : ItemId.getOwlItems()) { + owlLeaderboards.add(itemId); } } else { // descending order diff --git a/src/main/java/net/server/handlers/login/CreateCharHandler.java b/src/main/java/net/server/handlers/login/CreateCharHandler.java index e79a78bd89..52933041f3 100644 --- a/src/main/java/net/server/handlers/login/CreateCharHandler.java +++ b/src/main/java/net/server/handlers/login/CreateCharHandler.java @@ -25,6 +25,7 @@ import client.Client; import client.creator.novice.BeginnerCreator; import client.creator.novice.LegendCreator; import client.creator.novice.NoblesseCreator; +import constants.id.ItemId; import net.AbstractPacketHandler; import net.packet.InPacket; import tools.FilePrinter; @@ -36,12 +37,19 @@ import java.util.Set; public final class CreateCharHandler extends AbstractPacketHandler { - private final static Set IDs = new HashSet<>(Arrays.asList(1302000, 1312004, 1322005, 1442079,// weapons - 1040002, 1040006, 1040010, 1041002, 1041006, 1041010, 1041011, 1042167,// bottom - 1060002, 1060006, 1061002, 1061008, 1062115, // top - 1072001, 1072005, 1072037, 1072038, 1072383,// shoes - 30000, 30010, 30020, 30030, 31000, 31040, 31050,// hair - 20000, 20001, 20002, 21000, 21001, 21002, 21201, 20401, 20402, 21700, 20100 //face + private final static Set IDs = new HashSet<>(Arrays.asList( + ItemId.SWORD, ItemId.HAND_AXE, ItemId.WOODEN_CLUB, ItemId.BASIC_POLEARM,// weapons + ItemId.WHITE_UNDERSHIRT, ItemId.UNDERSHIRT, ItemId.GREY_TSHIRT, ItemId.WHITE_TUBETOP, ItemId.YELLOW_TSHIRT, + ItemId.GREEN_TSHIRT, ItemId.RED_STRIPED_TOP, ItemId.SIMPLE_WARRIOR_TOP,// bottom + ItemId.BLUE_JEAN_SHORTS, ItemId.BROWN_COTTON_SHORTS, ItemId.RED_MINISKIRT, ItemId.INDIGO_MINISKIRT, + ItemId.SIMPLE_WARRIOR_PANTS, // top + ItemId.RED_RUBBER_BOOTS, ItemId.LEATHER_SANDALS, ItemId.YELLOW_RUBBER_BOOTS, ItemId.BLUE_RUBBER_BOOTS, + ItemId.AVERAGE_MUSASHI_SHOES,// shoes + ItemId.BLACK_TOBEN, ItemId.ZETA, ItemId.BLACK_REBEL, ItemId.BLACK_BUZZ, ItemId.BLACK_SAMMY, + ItemId.BLACK_EDGY, ItemId.BLACK_CONNIE,// hair + ItemId.MOTIVATED_LOOK_M, ItemId.PERPLEXED_STARE, ItemId.LEISURE_LOOK_M, ItemId.MOTIVATED_LOOK_F, + ItemId.FEARFUL_STARE_M, ItemId.LEISURE_LOOK_F, ItemId.FEARFUL_STARE_F, ItemId.PERPLEXED_STARE_HAZEL, + ItemId.LEISURE_LOOK_HAZEL, ItemId.MOTIVATED_LOOK_AMETHYST, ItemId.MOTIVATED_LOOK_BLUE //face //#NeverTrustStevenCode )); diff --git a/src/main/java/scripting/AbstractPlayerInteraction.java b/src/main/java/scripting/AbstractPlayerInteraction.java index 2a1ae7871e..25ab8625e3 100644 --- a/src/main/java/scripting/AbstractPlayerInteraction.java +++ b/src/main/java/scripting/AbstractPlayerInteraction.java @@ -28,6 +28,7 @@ import client.inventory.*; import client.inventory.manipulator.InventoryManipulator; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.server.Server; import net.server.guild.Guild; @@ -611,7 +612,7 @@ public class AbstractPlayerInteraction { if (!(c.getPlayer().isGM() && YamlConfig.config.server.USE_PERFECT_GM_SCROLL)) { eqp.setUpgradeSlots((byte) (eqp.getUpgradeSlots() + 1)); } - item = ItemInformationProvider.getInstance().scrollEquipWithId(item, 2049100, true, 2049100, c.getPlayer().isGM()); + item = ItemInformationProvider.getInstance().scrollEquipWithId(item, ItemId.CHAOS_SCROll_60, true, ItemId.CHAOS_SCROll_60, c.getPlayer().isGM()); } } } else { @@ -763,7 +764,8 @@ public class AbstractPlayerInteraction { } public void removeHPQItems() { - int[] items = {4001095, 4001096, 4001097, 4001098, 4001099, 4001100, 4001101}; + int[] items = {ItemId.GREEN_PRIMROSE_SEED, ItemId.PURPLE_PRIMROSE_SEED, ItemId.PINK_PRIMROSE_SEED, + ItemId.BROWN_PRIMROSE_SEED, ItemId.YELLOW_PRIMROSE_SEED, ItemId.BLUE_PRIMROSE_SEED, ItemId.MOON_BUNNYS_RICE_CAKE}; for (int item : items) { removePartyItems(item); } diff --git a/src/main/java/server/CashShop.java b/src/main/java/server/CashShop.java index f899076f99..0e7531ec46 100644 --- a/src/main/java/server/CashShop.java +++ b/src/main/java/server/CashShop.java @@ -23,6 +23,7 @@ package server; import client.inventory.*; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import net.server.Server; import net.server.audit.locks.MonitoredLockType; @@ -103,13 +104,13 @@ public class CashShop { if (ItemConstants.EXPIRING_ITEMS) { if (period == 1) { - if (itemId == 5211048 || itemId == 5360042) { // 4 Hour 2X coupons, the period is 1, but we don't want them to last a day. + if (itemId == ItemId.EXP_COUPON_2X_4H || itemId == ItemId.DROP_COUPON_2X_4H) { // 4 Hour 2X coupons, the period is 1, but we don't want them to last a day. item.setExpiration(Server.getInstance().getCurrentTime() + HOURS.toMillis(4)); /* } else if(itemId == 5211047 || itemId == 5360014) { // 3 Hour 2X coupons, unused as of now item.setExpiration(Server.getInstance().getCurrentTime() + HOURS.toMillis(3)); */ - } else if (itemId == 5211060) { // 2 Hour 3X coupons. + } else if (itemId == ItemId.EXP_COUPON_3X_2H) { // 2 Hour 3X coupons. item.setExpiration(Server.getInstance().getCurrentTime() + HOURS.toMillis(2)); } else { item.setExpiration(Server.getInstance().getCurrentTime() + DAYS.toMillis(1)); @@ -525,7 +526,7 @@ public class CashShop { } public synchronized Pair openCashShopSurprise() { - Item css = getCashShopItemByItemid(5222000); + Item css = getCashShopItemByItemid(ItemId.CASH_SHOP_SURPRISE); if (css != null) { CashItem cItem = CashItemFactory.getRandomCashItem(); diff --git a/src/main/java/server/ItemInformationProvider.java b/src/main/java/server/ItemInformationProvider.java index 574edbf47f..888425ed25 100644 --- a/src/main/java/server/ItemInformationProvider.java +++ b/src/main/java/server/ItemInformationProvider.java @@ -26,6 +26,7 @@ import client.*; import client.autoban.AutobanFactory; import client.inventory.*; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.EquipSlot; import constants.inventory.ItemConstants; import constants.skills.Assassin; @@ -1037,17 +1038,17 @@ public class ItemInformationProvider { double prop = (double) stats.get("success"); switch (vegaItemId) { - case 5610000: + case ItemId.VEGAS_SPELL_10: if (prop == 10.0f) { prop = 30.0f; } break; - case 5610001: + case ItemId.VEGAS_SPELL_60: if (prop == 60.0f) { prop = 90.0f; } break; - case 2049100: + case ItemId.CHAOS_SCROll_60: prop = 100.0f; break; } @@ -1055,25 +1056,25 @@ public class ItemInformationProvider { if (assertGM || rollSuccessChance(prop)) { short flag = nEquip.getFlag(); switch (scrollId) { - case 2040727: + case ItemId.SPIKES_SCROLL: flag |= ItemConstants.SPIKES; nEquip.setFlag((byte) flag); break; - case 2041058: + case ItemId.COLD_PROTECTION_SCROLl: flag |= ItemConstants.COLD; nEquip.setFlag((byte) flag); break; - case 2049000: - case 2049001: - case 2049002: - case 2049003: + case ItemId.CLEAN_SLATE_1: + case ItemId.CLEAN_SLATE_3: + case ItemId.CLEAN_SLATE_5: + case ItemId.CLEAN_SLATE_20: if (canUseCleanSlate(nEquip)) { nEquip.setUpgradeSlots((byte) (nEquip.getUpgradeSlots() + 1)); } break; - case 2049100: - case 2049101: - case 2049102: + case ItemId.CHAOS_SCROll_60: + case ItemId.LIAR_TREE_SAP: + case ItemId.MAPLE_SYRUP: scrollEquipWithChaos(nEquip, YamlConfig.config.server.CHSCROLL_STAT_RANGE); break; @@ -1787,7 +1788,7 @@ public class ItemInformationProvider { public boolean canWearEquipment(Character chr, Equip equip, int dst) { int id = equip.getItemId(); - if (ItemConstants.isWeddingRing(id) && chr.hasJustMarried()) { + if (ItemId.isWeddingRing(id) && chr.hasJustMarried()) { chr.dropMessage(5, "The Wedding Ring cannot be equipped on this map."); // will dc everyone due to doubled couple effect return false; } @@ -1966,32 +1967,19 @@ public class ItemInformationProvider { int range = (level - 1) / 10; if (range < 5) { - return 4260000; + return ItemId.BASIC_MONSTER_CRYSTAL_1; } else if (range > 11) { - return 4260008; + return ItemId.ADVANCED_MONSTER_CRYSTAL_3; } else { - switch (range) { - case 5: - return 4260001; - - case 6: - return 4260002; - - case 7: - return 4260003; - - case 8: - return 4260004; - - case 9: - return 4260005; - - case 10: - return 4260006; - - default: - return 4260007; - } + return switch (range) { + case 5 -> ItemId.BASIC_MONSTER_CRYSTAL_2; + case 6 -> ItemId.BASIC_MONSTER_CRYSTAL_3; + case 7 -> ItemId.INTERMEDIATE_MONSTER_CRYSTAL_1; + case 8 -> ItemId.INTERMEDIATE_MONSTER_CRYSTAL_2; + case 9 -> ItemId.INTERMEDIATE_MONSTER_CRYSTAL_3; + case 10 -> ItemId.ADVANCED_MONSTER_CRYSTAL_1; + default -> ItemId.ADVANCED_MONSTER_CRYSTAL_2; + }; } } diff --git a/src/main/java/server/Shop.java b/src/main/java/server/Shop.java index 72fc26cb54..cb170e1266 100644 --- a/src/main/java/server/Shop.java +++ b/src/main/java/server/Shop.java @@ -26,6 +26,7 @@ import client.inventory.InventoryType; import client.inventory.Item; import client.inventory.Pet; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import constants.inventory.ItemConstants; import tools.DatabaseConnection; import tools.PacketCreator; @@ -48,18 +49,18 @@ public class Shop { private final int npcId; private final List items; private final int tokenvalue = 1000000000; - private final int token = 4000313; + private final int token = ItemId.GOLDEN_MAPLE_LEAF; static { - for (int i = 2070000; i < 2070017; i++) { - rechargeableItems.add(i); + for (int throwingStarId : ItemId.allThrowingStarIds()) { + rechargeableItems.add(throwingStarId); } - rechargeableItems.add(2331000);//Blaze Capsule - rechargeableItems.add(2332000);//Glaze Capsule - rechargeableItems.add(2070018); - rechargeableItems.remove(2070014); // doesn't exist - for (int i = 2330000; i <= 2330005; i++) { - rechargeableItems.add(i); + rechargeableItems.add(ItemId.BLAZE_CAPSULE); + rechargeableItems.add(ItemId.GLAZE_CAPSULE); + rechargeableItems.add(ItemId.BALANCED_FURY); + rechargeableItems.remove(ItemId.DEVIL_RAIN_THROWING_STAR); // doesn't exist + for (int bulletId : ItemId.allBulletIds()) { + rechargeableItems.add(bulletId); } } @@ -114,16 +115,16 @@ public class Shop { } else if (item.getPitch() > 0) { int amount = (int) Math.min((float) item.getPitch() * quantity, Integer.MAX_VALUE); - if (c.getPlayer().getInventory(InventoryType.ETC).countById(4310000) >= amount) { + if (c.getPlayer().getInventory(InventoryType.ETC).countById(ItemId.PERFECT_PITCH) >= amount) { if (InventoryManipulator.checkSpace(c, itemId, quantity, "")) { if (!ItemConstants.isRechargeable(itemId)) { InventoryManipulator.addById(c, itemId, quantity, "", -1); - InventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false); + InventoryManipulator.removeById(c, InventoryType.ETC, ItemId.PERFECT_PITCH, amount, false, false); } else { short slotMax = ii.getSlotMax(c, item.getItemId()); quantity = slotMax; InventoryManipulator.addById(c, itemId, quantity, "", -1); - InventoryManipulator.removeById(c, InventoryType.ETC, 4310000, amount, false, false); + InventoryManipulator.removeById(c, InventoryType.ETC, ItemId.PERFECT_PITCH, amount, false, false); } c.sendPacket(PacketCreator.shopTransaction((byte) 0)); } else { diff --git a/src/main/java/server/StatEffect.java b/src/main/java/server/StatEffect.java index b2c47a9337..486082c146 100644 --- a/src/main/java/server/StatEffect.java +++ b/src/main/java/server/StatEffect.java @@ -30,6 +30,7 @@ import client.inventory.manipulator.InventoryManipulator; import client.status.MonsterStatus; import client.status.MonsterStatusEffect; import config.YamlConfig; +import constants.id.ItemId; import constants.inventory.ItemConstants; import constants.skills.*; import net.packet.Packet; @@ -158,9 +159,9 @@ public class StatEffect { } private static byte mapProtection(int sourceid) { - if (sourceid == 2022001 || sourceid == 2022186) { + if (sourceid == ItemId.RED_BEAN_PORRIDGE || sourceid == ItemId.SOFT_WHITE_BUN) { return 1; //elnath cold - } else if (sourceid == 2022040) { + } else if (sourceid == ItemId.AIR_BUBBLE) { return 2; //aqua road underwater } else { return 0; @@ -252,14 +253,14 @@ public class StatEffect { if (ret.overTime && ret.getSummonMovementType() == null) { if (!skill) { - if (isPyramidBuff(sourceid)) { + if (ItemId.isPyramidBuff(sourceid)) { ret.berserk = DataTool.getInt("berserk", source, 0); ret.booster = DataTool.getInt("booster", source, 0); addBuffStatPairToListIfNotZero(statups, BuffStat.BERSERK, ret.berserk); addBuffStatPairToListIfNotZero(statups, BuffStat.BOOSTER, ret.booster); - } else if (isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) { + } else if (ItemId.isDojoBuff(sourceid) || isHpMpRecovery(sourceid)) { ret.mhpR = (byte) DataTool.getInt("mhpR", source, 0); ret.mhpRRate = (short) (DataTool.getInt("mhpRRate", source, 0) * 100); ret.mmpR = (byte) DataTool.getInt("mmpR", source, 0); @@ -268,7 +269,7 @@ public class StatEffect { addBuffStatPairToListIfNotZero(statups, BuffStat.HPREC, (int) ret.mhpR); addBuffStatPairToListIfNotZero(statups, BuffStat.MPREC, (int) ret.mmpR); - } else if (isRateCoupon(sourceid)) { + } else if (ItemId.isRateCoupon(sourceid)) { switch (DataTool.getInt("expR", source, 0)) { case 1: addBuffStatPairToListIfNotZero(statups, BuffStat.COUPON_EXP1, 1); @@ -300,7 +301,7 @@ public class StatEffect { addBuffStatPairToListIfNotZero(statups, BuffStat.COUPON_DRP3, 1); break; } - } else if (isMonsterCard(sourceid)) { + } else if (ItemId.isMonsterCard(sourceid)) { int prob = 0, itemupCode = Integer.MAX_VALUE; List> areas = null; boolean inParty = false; @@ -370,7 +371,7 @@ public class StatEffect { } ret.cardStats = new CardItemupStats(itemupCode, prob, areas, inParty); - } else if (isExpIncrease(sourceid)) { + } else if (ItemId.isExpIncrease(sourceid)) { addBuffStatPairToListIfNotZero(statups, BuffStat.EXP_INCREASE, DataTool.getInt("expinc", source, 0)); } } else { @@ -908,7 +909,7 @@ public class StatEffect { Portal pt; if (moveTo == 999999999) { - if (sourceid != 2030100) { + if (sourceid != ItemId.ANTI_BANISH_SCROLL) { target = applyto.getMap().getReturnMap(); pt = target.getRandomPlayerSpawnpoint(); } else { @@ -1012,7 +1013,7 @@ public class StatEffect { door.getTarget().spawnDoor(door.getAreaDoor()); door.getTown().spawnDoor(door.getTownDoor()); } else { - InventoryManipulator.addFromDrop(applyto.getClient(), new Item(4006000, (short) 0, (short) 1), false); + InventoryManipulator.addFromDrop(applyto.getClient(), new Item(ItemId.MAGIC_ROCK, (short) 0, (short) 1), false); if (door.getOwnerId() == -3) { applyto.dropMessage(5, "Mystic Door cannot be cast far from a spawn point. Nearest one is at " + door.getDoorStatus().getRight() + "pts " + door.getDoorStatus().getLeft()); @@ -1229,7 +1230,7 @@ public class StatEffect { } if (sourceid == Corsair.BATTLE_SHIP) { - ridingMountId = 1932000; + ridingMountId = ItemId.BATTLESHIP; } else if (sourceid == Beginner.SPACESHIP || sourceid == Noblesse.SPACESHIP) { ridingMountId = 1932000 + applyto.getSkillLevel(sourceid); } else if (sourceid == Beginner.YETI_MOUNT1 || sourceid == Noblesse.YETI_MOUNT1 || sourceid == Legend.YETI_MOUNT1) { @@ -1523,38 +1524,12 @@ public class StatEffect { return sourceid == Beginner.MAP_CHAIR || sourceid == Noblesse.MAP_CHAIR || sourceid == Legend.MAP_CHAIR; } - public boolean isDojoBuff() { - return sourceid >= 2022359 && sourceid <= 2022421; - } - - public static boolean isDojoBuff(int sourceid) { - return sourceid >= 2022359 && sourceid <= 2022421; - } - public static boolean isHpMpRecovery(int sourceid) { - return sourceid == 2022198 || sourceid == 2022337; - } - - public static boolean isPyramidBuff(int sourceid) { - return sourceid >= 2022585 && sourceid <= 2022617; - } - - public static boolean isRateCoupon(int sourceid) { - int itemType = sourceid / 1000; - return itemType == 5211 || itemType == 5360; - } - - public static boolean isExpIncrease(int sourceid) { - return sourceid >= 2022450 && sourceid <= 2022452; + return sourceid == ItemId.RUSSELLONS_PILLS || sourceid == ItemId.SORCERERS_POTION; } public static boolean isAriantShield(int sourceid) { - return sourceid == 2022269; - } - - public static boolean isMonsterCard(int sourceid) { - int itemType = sourceid / 10000; - return itemType == 238; + return sourceid == ItemId.ARPQ_SHIELD; } private boolean isDs() { @@ -1586,7 +1561,7 @@ public class StatEffect { } private boolean isCouponBuff() { - return isRateCoupon(sourceid); + return ItemId.isRateCoupon(sourceid); } private boolean isAriantShield() { @@ -1649,7 +1624,7 @@ public class StatEffect { if (skill) { return isHerosWill(sourceid); } else { - return sourceid == 2022544; + return sourceid == ItemId.WHITE_ELIXIR; } } diff --git a/src/main/java/server/gachapon/Global.java b/src/main/java/server/gachapon/Global.java index 1a89174bfd..1e91490ce0 100644 --- a/src/main/java/server/gachapon/Global.java +++ b/src/main/java/server/gachapon/Global.java @@ -1,5 +1,7 @@ package server.gachapon; +import constants.id.ItemId; + /** * @author Alan (SharpAceX) * @author Ronan - added ores and reworked global loots @@ -15,7 +17,7 @@ public class Global extends GachaponItems { /* Ores */ 4004000, 4004001, 4004002, 4004003, 4004004, - 4006000, 4006001, + ItemId.MAGIC_ROCK, 4006001, 4010000, 4010001, 4010002, 4010003, 4010004, 4010005, 4010006, 4010007, 4020000, 4020001, 4020002, 4020003, 4020004, 4020005, 4020006, 4020007, 4020008 }; diff --git a/src/main/java/server/gachapon/Ludibrium.java b/src/main/java/server/gachapon/Ludibrium.java index e75175e6d4..c09c195a04 100644 --- a/src/main/java/server/gachapon/Ludibrium.java +++ b/src/main/java/server/gachapon/Ludibrium.java @@ -1,5 +1,7 @@ package server.gachapon; +import constants.id.ItemId; + /** * @author Ronan - parsed MapleSEA loots *

@@ -16,7 +18,7 @@ public class Ludibrium extends GachaponItems { 2048000, 2040601, 2041019, 2041007, 2041016, 2041022, 2041001, 2041010, 2041013, 2041004, 2044701, 2043301, 2040301, 2048004, 2048001, 2040901, 2040701, 2040704, 2040707, 2040602, 2041020, 2041008, 2041017, 2041023, 2041002, 2041011, 2041014, 2041005, 2044702, 2043302, 2040302, 2040002, 2044402, 2048005, 2048002, 2040702, 2040705, 2040708, 2044302, 2043802, 2040402, 2043702, 2044811, /* Useable drop */ - 2000004, 2000005, 4006000, 4006001, + 2000004, 2000005, ItemId.MAGIC_ROCK, 4006001, /* Common equipment */ 1032003, 1432009, 1302022, 1302029, 1102014, 1102018, 1312014, 1302026, 1102015, 1032011, 1312013, 1032008, 1032019, 1032007, 1332030, 1032020, 1032004, 1302027, 1032022, 1312012, 1032021, 1032006, 1302028, 1322003, 1032016, 1032015, 1302024, 1092008, 1032018, 1302021, 1032014, 1332021, 1322012, 1032005, 1032013, 1102012, 1302025, 1302013, 1032002, 1032001, 1032012, 1302017, 1032010, 1402014, 1102017, 1102013, 1442021, 1032009, diff --git a/src/main/java/server/life/PlayerNPCFactory.java b/src/main/java/server/life/PlayerNPCFactory.java index 6f8df71154..ed7692a548 100644 --- a/src/main/java/server/life/PlayerNPCFactory.java +++ b/src/main/java/server/life/PlayerNPCFactory.java @@ -19,6 +19,7 @@ */ package server.life; +import constants.id.ItemId; import net.server.Server; import provider.Data; import provider.DataProvider; @@ -114,12 +115,12 @@ public class PlayerNPCFactory { int FH = 4, RX0 = -143, RX1 = -243, CX = -193, CY = 117, scriptId = 9977777; Map equips = new HashMap<>(); - equips.put((short) -1, 1002067); - equips.put((short) -11, 1402046); - equips.put((short) -8, 1082140); - equips.put((short) -6, 1060091); - equips.put((short) -7, 1072154); - equips.put((short) -5, 1040103); + equips.put((short) -1, ItemId.GREEN_HEADBAND); + equips.put((short) -11, ItemId.TIMELESS_NIBLEHEIM); + equips.put((short) -8, ItemId.BLUE_KORBEN); + equips.put((short) -6, ItemId.MITHRIL_PLATINE_PANTS); + equips.put((short) -7, ItemId.BLUE_CARZEN_BOOTS); + equips.put((short) -5, ItemId.MITHRIL_PLATINE); List dnpcSet = dnpcMaps.get(mapid); if (dnpcSet == null) { diff --git a/src/main/java/server/minigame/RockPaperScissor.java b/src/main/java/server/minigame/RockPaperScissor.java index 81595874d1..8266a092a0 100644 --- a/src/main/java/server/minigame/RockPaperScissor.java +++ b/src/main/java/server/minigame/RockPaperScissor.java @@ -3,6 +3,7 @@ package server.minigame; import client.Client; import client.inventory.Item; import client.inventory.manipulator.InventoryManipulator; +import constants.id.ItemId; import tools.PacketCreator; import tools.Randomizer; @@ -71,7 +72,7 @@ public class RockPaperScissor { public final void reward(final Client c) { if (win) { - InventoryManipulator.addFromDrop(c, new Item(4031332 + round, (short) 0, (short) 1), true); + InventoryManipulator.addFromDrop(c, new Item(ItemId.RPS_CERTIFICATE_BASE + round, (short) 0, (short) 1), true); } c.getPlayer().setRPS(null); } diff --git a/src/main/java/server/partyquest/AriantColiseum.java b/src/main/java/server/partyquest/AriantColiseum.java index c0735c369a..c9a74f1951 100644 --- a/src/main/java/server/partyquest/AriantColiseum.java +++ b/src/main/java/server/partyquest/AriantColiseum.java @@ -21,6 +21,7 @@ package server.partyquest; import client.Character; import constants.game.GameConstants; +import constants.id.ItemId; import server.TimerManager; import server.expeditions.Expedition; import server.expeditions.ExpeditionType; @@ -180,8 +181,8 @@ public class AriantColiseum { } chr.setAriantColiseum(null); - int shards = chr.countItem(4031868); - chr.getAbstractPlayerInteraction().removeAll(4031868); + int shards = chr.countItem(ItemId.ARPQ_SPIRIT_JEWEL); + chr.getAbstractPlayerInteraction().removeAll(ItemId.ARPQ_SPIRIT_JEWEL); chr.updateAriantScore(shards); } } @@ -241,7 +242,7 @@ public class AriantColiseum { } runnerups.remove(firstTop); - if (isUnfairMatch(firstTop, secondTop, map.getDroppedItemsCountById(4031868) + lostShards, runnerups)) { + if (isUnfairMatch(firstTop, secondTop, map.getDroppedItemsCountById(ItemId.ARPQ_SPIRIT_JEWEL) + lostShards, runnerups)) { rewardTier.put(winner, 1); } } diff --git a/src/main/java/server/partyquest/Pyramid.java b/src/main/java/server/partyquest/Pyramid.java index 501a39c6bb..a73e56252b 100644 --- a/src/main/java/server/partyquest/Pyramid.java +++ b/src/main/java/server/partyquest/Pyramid.java @@ -23,6 +23,7 @@ package server.partyquest; import client.Character; +import constants.id.ItemId; import net.server.world.Party; import server.ItemInformationProvider; import server.TimerManager; @@ -186,7 +187,7 @@ public class Pyramid extends PartyQuest { buffcount++; ItemInformationProvider ii = ItemInformationProvider.getInstance(); for (Character chr : getParticipants()) { - ii.getItemEffect(2022585).applyTo(chr); + ii.getItemEffect(ItemId.PHARAOHS_BLESSING_1).applyTo(chr); } } else if (buffcount == 1 && total >= 500) { @@ -195,7 +196,7 @@ public class Pyramid extends PartyQuest { ItemInformationProvider ii = ItemInformationProvider.getInstance(); for (Character chr : getParticipants()) { chr.sendPacket(PacketCreator.getEnergy("massacre_skill", skill)); - ii.getItemEffect(2022586).applyTo(chr); + ii.getItemEffect(ItemId.PHARAOHS_BLESSING_2).applyTo(chr); } } else if (buffcount == 2 && total >= 1000) { buffcount++; @@ -203,7 +204,7 @@ public class Pyramid extends PartyQuest { ItemInformationProvider ii = ItemInformationProvider.getInstance(); for (Character chr : getParticipants()) { chr.sendPacket(PacketCreator.getEnergy("massacre_skill", skill)); - ii.getItemEffect(2022587).applyTo(chr); + ii.getItemEffect(ItemId.PHARAOHS_BLESSING_3).applyTo(chr); } } else if (buffcount == 3 && total >= 1500) { skill++; @@ -214,7 +215,7 @@ public class Pyramid extends PartyQuest { ItemInformationProvider ii = ItemInformationProvider.getInstance(); for (Character chr : getParticipants()) { chr.sendPacket(PacketCreator.getEnergy("massacre_skill", skill)); - ii.getItemEffect(2022588).applyTo(chr); + ii.getItemEffect(ItemId.PHARAOHS_BLESSING_4).applyTo(chr); } } else if (buffcount == 5 && total >= 2500) { skill++; diff --git a/src/main/java/tools/PacketCreator.java b/src/main/java/tools/PacketCreator.java index 7227677280..68f03650e2 100644 --- a/src/main/java/tools/PacketCreator.java +++ b/src/main/java/tools/PacketCreator.java @@ -33,6 +33,7 @@ import client.status.MonsterStatusEffect; import config.YamlConfig; import constants.game.ExpTable; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import constants.skills.Buccaneer; import constants.skills.Corsair; @@ -1922,7 +1923,7 @@ public class PacketCreator { }*/ addCharLook(p, chr, false); - p.writeInt(chr.getInventory(InventoryType.CASH).countById(5110000)); + p.writeInt(chr.getInventory(InventoryType.CASH).countById(ItemId.HEART_SHAPED_CHOCOLATE)); p.writeInt(chr.getItemEffect()); p.writeInt(ItemConstants.getInventoryType(chr.getChair()) == InventoryType.SETUP ? chr.getChair() : 0); @@ -6771,8 +6772,8 @@ public class PacketCreator { p.writeInt(marriageRing.getItemId()); p.writeInt(marriageRing.getItemId()); } else { - p.writeInt(1112803); // Engagement Ring's Outcome (doesn't matter for engagement) - p.writeInt(1112803); // Engagement Ring's Outcome (doesn't matter for engagement) + p.writeInt(ItemId.WEDDING_RING_MOONSTONE); // Engagement Ring's Outcome (doesn't matter for engagement) + p.writeInt(ItemId.WEDDING_RING_MOONSTONE); // Engagement Ring's Outcome (doesn't matter for engagement) } p.writeFixedString(StringUtil.getRightPaddedStr(chr.getGender() == 0 ? chr.getName() : Character.getNameById(chr.getPartnerId()), '\0', 13)); p.writeFixedString(StringUtil.getRightPaddedStr(chr.getGender() == 0 ? Character.getNameById(chr.getPartnerId()) : chr.getName(), '\0', 13)); @@ -6805,7 +6806,7 @@ public class PacketCreator { public static Packet hpqMessage(String text) { final OutPacket p = OutPacket.create(SendOpcode.BLOW_WEATHER); // not 100% sure p.writeByte(0); - p.writeInt(5120016); + p.writeInt(ItemId.NPC_WEATHER_GROWLIE); p.writeFixedString(text); return p; } diff --git a/src/main/java/tools/packets/Fishing.java b/src/main/java/tools/packets/Fishing.java index 04691eeac6..b001820082 100644 --- a/src/main/java/tools/packets/Fishing.java +++ b/src/main/java/tools/packets/Fishing.java @@ -22,6 +22,7 @@ package tools.packets; import client.Character; import config.YamlConfig; import constants.game.GameConstants; +import constants.id.ItemId; import constants.inventory.ItemConstants; import server.ItemInformationProvider; import tools.PacketCreator; @@ -124,7 +125,7 @@ public class Fishing { public static int getRandomItem() { int rand = (int) (100.0 * Math.random()); - int[] commons = {1002851, 2002020, 2002020, 2000006, 2000018, 2002018, 2002024, 2002027, 2002027, 2000018, 2000018, 2000018, 2000018, 2002030, 2002018, 2000016}; // filler' up + int[] commons = {1002851, 2002020, 2002020, ItemId.MANA_ELIXIR, 2000018, 2002018, 2002024, 2002027, 2002027, 2000018, 2000018, 2000018, 2000018, 2002030, 2002018, 2000016}; // filler' up int[] uncommons = {1000025, 1002662, 1002812, 1002850, 1002881, 1002880, 1012072, 4020009, 2043220, 2043022, 2040543, 2044420, 2040943, 2043713, 2044220, 2044120, 2040429, 2043220, 2040943}; // filler' uptoo int[] rares = {1002859, 1002553, 1002762, 1002763, 1002764, 1002765, 1002766, 1002663, 1002788, 1002949, 2049100, 2340000, 2040822, 2040822, 2040822, 2040822}; // filler' uplast diff --git a/src/main/java/tools/packets/WeddingPackets.java b/src/main/java/tools/packets/WeddingPackets.java index f5eefa621d..f5f096171b 100644 --- a/src/main/java/tools/packets/WeddingPackets.java +++ b/src/main/java/tools/packets/WeddingPackets.java @@ -8,6 +8,7 @@ package tools.packets; import client.Character; import client.inventory.Item; +import constants.id.ItemId; import net.opcodes.SendOpcode; import net.packet.OutPacket; import net.packet.Packet; @@ -155,37 +156,37 @@ public class WeddingPackets extends PacketCreator { } public enum WeddingItem { - WR_MOONSTONE(1112803), // Wedding Ring - WR_STARGEM(1112806), - WR_GOLDENHEART(1112807), - WR_SILVERSWAN(1112809), - ERB_MOONSTONE(2240000), // Engagement Ring Box - ERB_STARGEM(2240001), - ERB_GOLDENHEART(2240002), - ERB_SILVERSWAN(2240003), - ERBE_MOONSTONE(4031357), // Engagement Ring Box (Empty) - ER_MOONSTONE(4031358), // Engagement Ring - ERBE_STARGEM(4031359), - ER_STARGEM(4031360), - ERBE_GOLDENHEART(4031361), - ER_GOLDENHEART(4031362), - ERBE_SILVERSWAN(4031363), - ER_SILVERSWAN(4031364), - PARENTS_BLESSING(4031373), // Parents Blessing - OFFICIATORS_PERMISSION(4031374), // Officiator's Permission - WR_CATHEDRAL_PREMIUM(4031375), // Wedding Ring? - WR_VEGAS_PREMIUM(4031376), - IB_VEGAS(4031377), // toSend invitation - IB_CATHEDRAL(4031395), // toSend invitation - IG_VEGAS(4031406), // rcvd invitation - IG_CATHEDRAL(4031407), // rcvd invitation - OB_FORCOUPLE(4031424), // Onyx Box? For Couple - WR_CATHEDRAL_NORMAL(4031480), // Wedding Ring? - WR_VEGAS_NORMAL(4031481), - WT_CATHEDRAL_NORMAL(5251000), // Wedding Ticket - WT_VEGAS_NORMAL(5251001), - WT_VEGAS_PREMIUM(5251002), - WT_CATHEDRAL_PREMIUM(5251003); + WR_MOONSTONE(ItemId.WEDDING_RING_MOONSTONE), // Wedding Ring + WR_STARGEM(ItemId.WEDDING_RING_STAR), + WR_GOLDENHEART(ItemId.WEDDING_RING_GOLDEN), + WR_SILVERSWAN(ItemId.WEDDING_RING_SILVER), + ERB_MOONSTONE(ItemId.ENGAGEMENT_BOX_MOONSTONE), // Engagement Ring Box + ERB_STARGEM(ItemId.ENGAGEMENT_BOX_STAR), + ERB_GOLDENHEART(ItemId.ENGAGEMENT_BOX_GOLDEN), + ERB_SILVERSWAN(ItemId.ENGAGEMENT_BOX_SILVER), + ERBE_MOONSTONE(ItemId.EMPTY_ENGAGEMENT_BOX_MOONSTONE), // Engagement Ring Box (Empty) + ER_MOONSTONE(ItemId.ENGAGEMENT_RING_MOONSTONE), // Engagement Ring + ERBE_STARGEM(ItemId.EMPTY_ENGAGEMENT_BOX_STAR), + ER_STARGEM(ItemId.ENGAGEMENT_RING_STAR), + ERBE_GOLDENHEART(ItemId.EMPTY_ENGAGEMENT_BOX_GOLDEN), + ER_GOLDENHEART(ItemId.ENGAGEMENT_RING_GOLDEN), + ERBE_SILVERSWAN(ItemId.EMPTY_ENGAGEMENT_BOX_SILVER), + ER_SILVERSWAN(ItemId.ENGAGEMENT_RING_SILVER), + PARENTS_BLESSING(ItemId.PARENTS_BLESSING), // Parents Blessing + OFFICIATORS_PERMISSION(ItemId.OFFICIATORS_PERMISSION), // Officiator's Permission + WR_CATHEDRAL_PREMIUM(ItemId.PREMIUM_CATHEDRAL_RESERVATION_RECEIPT), // Wedding Ring? + WR_VEGAS_PREMIUM(ItemId.PREMIUM_CHAPEL_RESERVATION_RECEIPT), + IB_VEGAS(ItemId.INVITATION_CHAPEL), // toSend invitation + IB_CATHEDRAL(ItemId.INVITATION_CATHEDRAL), // toSend invitation + IG_VEGAS(ItemId.RECEIVED_INVITATION_CHAPEL), // rcvd invitation + IG_CATHEDRAL(ItemId.RECEIVED_INVITATION_CATHEDRAL), // rcvd invitation + OB_FORCOUPLE(ItemId.ONYX_CHEST_FOR_COUPLE), // Onyx Box? For Couple + WR_CATHEDRAL_NORMAL(ItemId.NORMAL_CATHEDRAL_RESERVATION_RECEIPT), // Wedding Ring? + WR_VEGAS_NORMAL(ItemId.NORMAL_CHAPEL_RESERVATION_RECEIPT), + WT_CATHEDRAL_NORMAL(ItemId.NORMAL_WEDDING_TICKET_CATHEDRAL), // Wedding Ticket + WT_VEGAS_NORMAL(ItemId.NORMAL_WEDDING_TICKET_CHAPEL), + WT_VEGAS_PREMIUM(ItemId.PREMIUM_WEDDING_TICKET_CHAPEL), + WT_CATHEDRAL_PREMIUM(ItemId.PREMIUM_WEDDING_TICKET_CATHEDRAL); private final int wi; WeddingItem(int wi) { @@ -284,8 +285,8 @@ public class WeddingPackets extends PacketCreator { p.writeInt(chr.getMarriageItemId()); p.writeInt(chr.getMarriageItemId()); } else { - p.writeInt(1112803); // Engagement Ring's Outcome (doesn't matter for engagement) - p.writeInt(1112803); // Engagement Ring's Outcome (doesn't matter for engagement) + p.writeInt(ItemId.WEDDING_RING_MOONSTONE); // Engagement Ring's Outcome (doesn't matter for engagement) + p.writeInt(ItemId.WEDDING_RING_MOONSTONE); // Engagement Ring's Outcome (doesn't matter for engagement) } p.writeFixedString(StringUtil.getRightPaddedStr(chr.getGender() == 0 ? chr.getName() : Character.getNameById(chr.getPartnerId()), '\0', 13)); p.writeFixedString(StringUtil.getRightPaddedStr(chr.getGender() == 0 ? Character.getNameById(chr.getPartnerId()) : chr.getName(), '\0', 13));