From bb8e8780bd55e45c8a22d9d891cdce709ca19f84 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 24 Feb 2024 08:01:22 -0500 Subject: [PATCH] More parser work. --- src/engine/Enum.java | 8 ++++++++ src/engine/objects/ItemTemplate.java | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index 57d79e76..50c50007 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -3047,4 +3047,12 @@ public class Enum { NoDrop, Rare; } + + public enum ItemUseFlags { + USE_SELF, + USE_TARGET, + EMPTY_DESTROY, + EMPTY_NEWITEM; + } + } diff --git a/src/engine/objects/ItemTemplate.java b/src/engine/objects/ItemTemplate.java index ad58467f..277e6763 100644 --- a/src/engine/objects/ItemTemplate.java +++ b/src/engine/objects/ItemTemplate.java @@ -48,6 +48,8 @@ public class ItemTemplate { public float item_bulk_factor; public float item_defense_rating; public EnumSet item_flags = EnumSet.noneOf(Enum.ItemFlags.class); + public EnumSet item_use_flags = EnumSet.noneOf(Enum.ItemUseFlags.class); + public int item_initial_charges; public ItemTemplate(JSONObject jsonObject) { @@ -136,5 +138,14 @@ public class ItemTemplate { for (Object o : itemflags) item_flags.add(Enum.ItemFlags.valueOf((String) o)); + JSONArray itemUseflags = (JSONArray) jsonObject.get("item_use_flags"); + + if (itemUseflags.isEmpty() == false) + for (Object o : itemUseflags) + item_use_flags.add(Enum.ItemUseFlags.valueOf((String) o)); + + item_initial_charges = ((Long) jsonObject.get("item_initial_charges")).intValue(); + } + }