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

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

View File

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

View File

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