Equipment slot refactor started.

This commit is contained in:
2024-03-08 12:19:57 -05:00
parent 7d1d8891ff
commit d8d017669a
15 changed files with 163 additions and 443 deletions
+7 -7
View File
@@ -40,8 +40,8 @@ public class ItemTemplate {
public Enum.ItemType item_type;
public int item_eq_slots_value;
public boolean item_eq_slots_type;
public EnumSet<Enum.ItemEquipSlotType> item_eq_slots_or = EnumSet.noneOf(Enum.ItemEquipSlotType.class);
public EnumSet<Enum.ItemEquipSlotType> item_eq_slots_and = EnumSet.noneOf(Enum.ItemEquipSlotType.class);
public EnumSet<Enum.EquipSlotType> item_eq_slots_or = EnumSet.noneOf(Enum.EquipSlotType.class);
public EnumSet<Enum.EquipSlotType> item_eq_slots_and = EnumSet.noneOf(Enum.EquipSlotType.class);
public boolean item_takeable;
public int item_value;
public int item_wt;
@@ -147,13 +147,13 @@ public class ItemTemplate {
if (eq_slots_or.isEmpty() == false)
for (Object o : eq_slots_or)
item_eq_slots_or.add(Enum.ItemEquipSlotType.valueOf((String) o));
item_eq_slots_or.add(Enum.EquipSlotType.valueOf((String) o));
JSONArray eq_slots_and = (JSONArray) jsonObject.get("item_eq_slots_and");
if (eq_slots_and.isEmpty() == false)
for (Object o : eq_slots_and)
item_eq_slots_and.add(Enum.ItemEquipSlotType.valueOf((String) o));
item_eq_slots_and.add(Enum.EquipSlotType.valueOf((String) o));
item_takeable = (boolean) jsonObject.get("item_takeable");
item_value = ((Long) jsonObject.get("item_value")).intValue();
@@ -370,12 +370,12 @@ public class ItemTemplate {
}
public static boolean isTwoHanded(ItemTemplate template) {
public static boolean isTwoHanded(Item item) {
if (!template.item_type.equals(Enum.ItemType.WEAPON))
if (!item.template.item_type.equals(Enum.ItemType.WEAPON))
return false;
return template.item_eq_slots_or.contains(EnumSet.of(Enum.ItemEquipSlotType.LHELD, Enum.ItemEquipSlotType.RHELD));
return item.template.item_eq_slots_and.contains(EnumSet.of(Enum.EquipSlotType.LHELD, Enum.EquipSlotType.RHELD));
}