Browse Source

Type enum with back support

combat-2
MagicBot 9 months ago
parent
commit
15635534b0
  1. 45
      src/engine/Enum.java
  2. 3
      src/engine/objects/ItemTemplate.java

45
src/engine/Enum.java

@ -565,23 +565,50 @@ public class Enum { @@ -565,23 +565,50 @@ public class Enum {
// Enum for ItemBase flags
public enum ItemType {
DECORATION(0),
UNKNOWN(0),
WEAPON(1),
ARMOR(2),
HAIR(3),
BASE(3),
GOLD(4),
RUNE(5),
SCROLL(5),
BOOK(6),
COMMANDROD(7),
WAND(7),
POTION(8),
TEARS(8),
KEY(9),
GUILDCHARTER(10),
CHARTER(10),
GUILDTREE(11),
SOUNDSOURCE(12),
JEWELRY(13),
CONTAINER(14),
FOUNTAIN(15),
FOOD(16),
DRINKCONTAINER(17),
MAPMARKER(18),
DEED(19),
EMPLOYMENTCONTRACT(20),
PETTOTEM(21),
SLAVECOLLAR(22),
BLANKKEY(23),
WARRANT(24),
FURNITUREDEED(25),
TENT(26),
REAGENT(27),
DEVICE(28),
FORMULA(29),
BUCKET(30),
TREASURE(31),
RUNE(32),
OFFERING(33),
RESOURCE(34),
REALMCHARTER(35),
// old itembase support
DECORATION(0),
HAIR(3),
COMMANDROD(7),
TEARS(8),
GUILDCHARTER(10),
WINE(16),
ALEJUG(17),
DEED(19),
CONTRACT(20),
PET(21),
FURNITURE(25),
@ -589,9 +616,7 @@ public class Enum { @@ -589,9 +616,7 @@ public class Enum {
FARMABLE(27),
WATERBUCKET(30),
GIFT(31),
OFFERING(33),
RESOURCE(34),
REALMCHARTER(35);
;
private final static HashMap<Integer, ItemType> _typeLookup = new HashMap<>();
private final int _value;

3
src/engine/objects/ItemTemplate.java

@ -78,8 +78,7 @@ public class ItemTemplate { @@ -78,8 +78,7 @@ public class ItemTemplate {
// Parsing an enum
// item_type = Enum.ItemType.valueOf((String) jsonObject.get("item_type"));
item_type = Enum.ItemType.valueOf((String) jsonObject.get("item_type"));
item_eq_slots_value = ((Long) jsonObject.get("item_eq_slots_value")).intValue();
item_eq_slots_type = (boolean) jsonObject.get("item_eq_slots_type");

Loading…
Cancel
Save