Turn item id magic numbers into constants

This commit is contained in:
P0nk
2021-11-07 11:38:32 +01:00
parent a4c079c2e8
commit 4efd356cbf
50 changed files with 790 additions and 346 deletions

View File

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

View File

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

View File

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

View File

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