From 38a3ad85c84dd4c61051f7b41c5be469add6cde4 Mon Sep 17 00:00:00 2001 From: OMGeeky <> Date: Fri, 27 Dec 2024 10:12:48 +0100 Subject: [PATCH] add description field to actor conditions --- .../rpg/atcontentstudio/model/gamedata/ActorCondition.java | 6 +++++- .../rpg/atcontentstudio/model/tools/i18n/PotGenerator.java | 1 + .../ui/gamedataeditors/ActorConditionEditor.java | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java index b721ed4..e60b2d9 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java +++ b/src/com/gpl/rpg/atcontentstudio/model/gamedata/ActorCondition.java @@ -29,7 +29,8 @@ public class ActorCondition extends JSONElement { //public String id; inherited. public String icon_id; public String display_name; - + public String description; + // Available from parsed state public ACCategory category = null; public Integer positive = null; @@ -157,6 +158,7 @@ public class ActorCondition extends JSONElement { @Override public void parse(Map aCondJson) { + if (aCondJson.get("description") != null) this.description = (String) aCondJson.get("description"); if (aCondJson.get("category") != null) this.category = ACCategory.valueOf((String) aCondJson.get("category")); this.positive = JSONElement.getInteger((Number) aCondJson.get("isPositive")); Map abilityEffect = (Map) aCondJson.get("abilityEffect"); @@ -266,6 +268,7 @@ public class ActorCondition extends JSONElement { clone.state = this.state; clone.id = this.id; clone.display_name = this.display_name; + clone.description = this.description; clone.icon_id = this.icon_id; clone.category = this.category; clone.positive = this.positive; @@ -294,6 +297,7 @@ public class ActorCondition extends JSONElement { jsonAC.put("id", this.id); if (this.icon_id != null) jsonAC.put("iconID", this.icon_id); if (this.display_name != null) jsonAC.put("name", this.display_name); + if (this.description != null) jsonAC.put("description", this.description); if (this.category != null) jsonAC.put("category", this.category.toString()); if (this.positive != null && this.positive == 1) jsonAC.put("isPositive", this.positive); if (this.stacking != null && this.stacking == 1) jsonAC.put("isStacking", this.stacking); diff --git a/src/com/gpl/rpg/atcontentstudio/model/tools/i18n/PotGenerator.java b/src/com/gpl/rpg/atcontentstudio/model/tools/i18n/PotGenerator.java index df42692..7e7932f 100644 --- a/src/com/gpl/rpg/atcontentstudio/model/tools/i18n/PotGenerator.java +++ b/src/com/gpl/rpg/atcontentstudio/model/tools/i18n/PotGenerator.java @@ -28,6 +28,7 @@ public class PotGenerator { for (ActorCondition ac : gsrc.gameData.actorConditions) { pushString(stringsResources, resourcesStrings, ac.display_name, getPotContextComment(ac)); + pushString(stringsResources, resourcesStrings, ac.description, getPotContextComment(ac)+":description"); } for (Dialogue d : gsrc.gameData.dialogues ) { diff --git a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java index b87c20e..9d6ef94 100644 --- a/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java +++ b/src/com/gpl/rpg/atcontentstudio/ui/gamedataeditors/ActorConditionEditor.java @@ -30,6 +30,7 @@ public class ActorConditionEditor extends JSONElementEditor { private JButton acIcon; private JTextField idField; private JTextField nameField; + private JTextField descriptionField; @SuppressWarnings("rawtypes") private JComboBox categoryBox; private IntegerBasedCheckBox positiveBox; @@ -81,6 +82,7 @@ public class ActorConditionEditor extends JSONElementEditor { idField = addTextField(pane, "Internal ID: ", ac.id, ac.writable, listener); nameField = addTranslatableTextField(pane, "Display name: ", ac.display_name, ac.writable, listener); + descriptionField = addTranslatableTextField(pane, "Description: ", ac.description, ac.writable, listener); categoryBox = addEnumValueBox(pane, "Category: ", ActorCondition.ACCategory.values(), ac.category, ac.writable, listener); positiveBox = addIntegerBasedCheckBox(pane, "Positive", ac.positive, ac.writable, listener); stackingBox = addIntegerBasedCheckBox(pane, "Stacking", ac.stacking, ac.writable, listener); @@ -172,6 +174,10 @@ public class ActorConditionEditor extends JSONElementEditor { ActorConditionEditor.this.name = aCond.getDesc(); aCond.childrenChanged(new ArrayList()); ATContentStudio.frame.editorChanged(ActorConditionEditor.this); + }else if (source == descriptionField) { + aCond.description = (String) value; + aCond.childrenChanged(new ArrayList()); + ATContentStudio.frame.editorChanged(ActorConditionEditor.this); } else if (source == acIcon) { aCond.icon_id = (String) value; aCond.childrenChanged(new ArrayList());