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

@@ -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<Character> 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<Pair<BuffStat, Integer>> 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;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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