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