This commit is contained in:
OMGeeky
2025-06-24 20:10:18 +02:00
parent 6c296868c0
commit 1c83eedd80
35 changed files with 270 additions and 195 deletions

View File

@@ -152,12 +152,14 @@ public class AboutEditor extends Editor {
editorTabsHolder.add("Welcome", getInfoPane(WELCOME_STRING, "text/html"));
editorTabsHolder.add("JSON.simple License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.JSON.simple.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("RSyntaxTextArea License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/RSyntaxTextArea.License.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("RSyntaxTextArea License",
getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/RSyntaxTextArea.License.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("JIDE Common Layer License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.JIDE.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("libtiled-java License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.libtiled.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("prefuse License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/license-prefuse.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("BeanShell License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.LGPLv3.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("SipHash for Java License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.siphash-zackehh.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("SipHash for Java License",
getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.siphash-zackehh.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("jsoup License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.jsoup.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("General PO Parser License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.GPLv3.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));
editorTabsHolder.add("Minify.java License", getInfoPane(new Scanner(ATContentStudio.class.getResourceAsStream("/LICENSE.minify.txt"), "UTF-8").useDelimiter("\\A").next(), "text/text"));

View File

@@ -189,6 +189,7 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
});
return tfField;
}
public static <T extends JTextComponent> T addTextComponent(JPanel pane, String label, boolean editable, final FieldUpdateListener listener, T tfField, boolean specialNewLinesHandling, boolean scrollable) {
JPanel tfPane = new JPanel();
tfPane.setLayout(new JideBoxLayout(tfPane, JideBoxLayout.LINE_AXIS, 6));
@@ -196,9 +197,9 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
tfPane.add(tfLabel, JideBoxLayout.FIX);
tfField.setEditable(editable);
JComponent component;
if (scrollable){
if (scrollable) {
component = new JScrollPane(tfField);
}else{
} else {
component = tfField;
}
tfPane.add(component, JideBoxLayout.VARY);
@@ -218,21 +219,21 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
@Override
public void removeUpdate(DocumentEvent e) {
String text = tfField.getText();
if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
if (specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
listener.valueChanged(tfField, text);
}
@Override
public void insertUpdate(DocumentEvent e) {
String text = tfField.getText();
if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
if (specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
listener.valueChanged(tfField, text);
}
@Override
public void changedUpdate(DocumentEvent e) {
String text = tfField.getText();
if(specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
if (specialNewLinesHandling) text = text.replaceAll("\n", Matcher.quoteReplacement("\n"));
listener.valueChanged(tfField, text);
}
});
@@ -291,11 +292,12 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
});
return spinner;
}
public static JSpinner addIntegerField(JPanel pane, String label, Integer initialValue, Integer defaultValue, boolean allowNegatives, boolean editable, final FieldUpdateListener listener) {
int value = initialValue != null ? initialValue : defaultValue;
int minimum = allowNegatives ? Integer.MIN_VALUE : 0;
int minimum = allowNegatives ? Integer.MIN_VALUE : 0;
int maximum = Integer.MAX_VALUE;
return addNumberField(pane, label, editable, listener, minimum, maximum, 1, value, defaultValue);
return addNumberField(pane, label, editable, listener, minimum, maximum, 1, value, defaultValue);
}
@@ -361,7 +363,10 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
entryTypeBox.setEnabled(editable);
tfPane.add(entryTypeBox, JideBoxLayout.FIX);
/////////////////////////////////////////////////////////////////////////////////////////////////// make sure "chance" is between 1 and 100. If lower than 1 get 1. If higher than 100, get chance/maxChance * 100... Then do the same with defaultChance, in case no value exist.
final SpinnerNumberModel percentModel = new SpinnerNumberModel(initialValue != null ? ((chance > 1 ? chance : 1) < 100 ? chance : (chance * 100 / maxChance)) : ((defaultChance > 1 ? defaultChance : 1) < 100 ? defaultChance : (defaultChance * 100 / defaultMaxChance)), 1, 100, 1);
final SpinnerNumberModel percentModel = new SpinnerNumberModel(
initialValue != null ? ((chance > 1 ? chance : 1) < 100 ? chance : (chance * 100 / maxChance)) : ((defaultChance > 1 ? defaultChance : 1) < 100 ? defaultChance : (defaultChance * 100 /
defaultMaxChance)),
1, 100, 1);
final SpinnerNumberModel ratioChanceModel = new SpinnerNumberModel(initialValue != null ? chance : defaultChance, 1, Integer.MAX_VALUE, 1);
final JSpinner chanceSpinner = new JSpinner(currentFormIsRatio ? ratioChanceModel : percentModel);
@@ -1105,10 +1110,10 @@ public abstract class Editor extends JPanel implements ProjectElementListener {
}
public <E extends Common.ActorConditionEffect, T extends OrderedListenerListModel<?, E>> void updateConditionEffect(ActorCondition value,
GameDataElement backlink,
E selectedHitEffectTargetCondition,
T hitTargetConditionsModel) {
public <E extends Common.ActorConditionEffect, T extends OrderedListenerListModel<?, E>> void updateConditionEffect(ActorCondition value,
GameDataElement backlink,
E selectedHitEffectTargetCondition,
T hitTargetConditionsModel) {
if (selectedHitEffectTargetCondition.condition != null) {
selectedHitEffectTargetCondition.condition.removeBacklink(backlink);
}

View File

@@ -5,7 +5,6 @@ import com.gpl.rpg.atcontentstudio.Notification;
import com.gpl.rpg.atcontentstudio.NotificationListener;
import javax.swing.*;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import java.awt.*;
import java.util.LinkedHashMap;

View File

@@ -1,6 +1,5 @@
package com.gpl.rpg.atcontentstudio.ui;
import javax.swing.event.ListDataEvent;
import javax.swing.event.ListDataListener;
import java.util.ArrayList;
import java.util.Collection;

View File

@@ -624,19 +624,25 @@ public class ProjectsTree extends JPanel {
public void insertNode(TreePath node) {
for (TreeModelListener l : listeners) {
l.treeNodesInserted(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath().getPath(), new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())}, new Object[]{node.getLastPathComponent()}));
l.treeNodesInserted(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath().getPath(),
new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())},
new Object[]{node.getLastPathComponent()}));
}
}
public void changeNode(TreePath node) {
for (TreeModelListener l : listeners) {
l.treeNodesChanged(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath(), new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())}, new Object[]{node.getLastPathComponent()}));
l.treeNodesChanged(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath(),
new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())},
new Object[]{node.getLastPathComponent()}));
}
}
public void removeNode(TreePath node) {
for (TreeModelListener l : listeners) {
l.treeNodesRemoved(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath(), new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())}, new Object[]{node.getLastPathComponent()}));
l.treeNodesRemoved(new TreeModelEvent(node.getLastPathComponent(), node.getParentPath(),
new int[]{((ProjectTreeNode) node.getParentPath().getLastPathComponent()).getIndex((ProjectTreeNode) node.getLastPathComponent())},
new Object[]{node.getLastPathComponent()}));
}
}

View File

@@ -65,11 +65,13 @@ public class WorkspaceActions {
public ATCSAction deleteProject = new ATCSAction("Delete project", "Deletes the project, and all created/altered data, from disk") {
public void actionPerformed(ActionEvent e) {
if (selectedNode instanceof Project) {
if (JOptionPane.showConfirmDialog(ATContentStudio.frame, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (JOptionPane.showConfirmDialog(ATContentStudio.frame, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?",
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
Workspace.deleteProject((Project) selectedNode);
}
} else if (selectedNode instanceof ClosedProject) {
if (JOptionPane.showConfirmDialog(ATContentStudio.frame, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
if (JOptionPane.showConfirmDialog(ATContentStudio.frame, "Are you sure you wish to delete this project ?\nAll files created for it will be deleted too...", "Delete this project ?",
JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
Workspace.deleteProject((ClosedProject) selectedNode);
}
}
@@ -380,7 +382,8 @@ public class WorkspaceActions {
public ATCSAction exitATCS = new ATCSAction("Exit", "Closes the program") {
public void actionPerformed(ActionEvent e) {
if (Workspace.activeWorkspace.needsSaving()) {
int answer = JOptionPane.showConfirmDialog(ATContentStudio.frame, "There are unsaved changes in your workspace.\nExiting ATCS will discard these changes.\nDo you really want to exit?", "Unsaved changes. Confirm exit.", JOptionPane.YES_NO_OPTION);
int answer = JOptionPane.showConfirmDialog(ATContentStudio.frame, "There are unsaved changes in your workspace.\nExiting ATCS will discard these changes.\nDo you really want to exit?",
"Unsaved changes. Confirm exit.", JOptionPane.YES_NO_OPTION);
if (answer == JOptionPane.YES_OPTION) {
System.exit(0);
}

View File

@@ -89,7 +89,7 @@ public class ActorConditionEditor extends JSONElementEditor {
} else {
roundEffect = new ActorCondition.RoundEffect();
}
roundVisualField = addEnumValueBox(roundEffectPane, "Visual effect ID:", ActorCondition.VisualEffectID.values(), roundEffect.visual_effect, ac.writable, listener);//addTextField(roundEffectPane, "Visual effect ID: ", roundEffect.visual_effect, ac.writable, listener);
roundVisualField = addEnumValueBox(roundEffectPane, "Visual effect ID:", ActorCondition.VisualEffectID.values(), roundEffect.visual_effect, ac.writable, listener);
roundHpMinField = addIntegerField(roundEffectPane, "HP Bonus Min: ", roundEffect.hp_boost_min, true, ac.writable, listener);
roundHpMaxField = addIntegerField(roundEffectPane, "HP Bonus Max: ", roundEffect.hp_boost_max, true, ac.writable, listener);
roundApMinField = addIntegerField(roundEffectPane, "AP Bonus Min: ", roundEffect.ap_boost_min, true, ac.writable, listener);
@@ -106,7 +106,7 @@ public class ActorConditionEditor extends JSONElementEditor {
} else {
fullRoundEffect = new ActorCondition.RoundEffect();
}
fullRoundVisualField = addEnumValueBox(fullRoundEffectPane, "Visual effect ID:", ActorCondition.VisualEffectID.values(), fullRoundEffect.visual_effect, ac.writable, listener);//addTextField(fullRoundEffectPane, "Visual effect ID: ", fullRoundEffect.visual_effect, ac.writable, listener);
fullRoundVisualField = addEnumValueBox(fullRoundEffectPane, "Visual effect ID:", ActorCondition.VisualEffectID.values(), fullRoundEffect.visual_effect, ac.writable, listener);
fullRoundHpMinField = addIntegerField(fullRoundEffectPane, "HP Bonus min: ", fullRoundEffect.hp_boost_min, true, ac.writable, listener);
fullRoundHpMaxField = addIntegerField(fullRoundEffectPane, "HP Bonus max: ", fullRoundEffect.hp_boost_max, true, ac.writable, listener);
fullRoundApMinField = addIntegerField(fullRoundEffectPane, "AP Bonus min: ", fullRoundEffect.ap_boost_min, true, ac.writable, listener);
@@ -505,18 +505,17 @@ public class ActorConditionEditor extends JSONElementEditor {
}
private boolean isEmpty(ActorCondition.RoundEffect round_effect) {
return round_effect == null || (
round_effect.visual_effect == null &&
return round_effect == null ||
(round_effect.visual_effect == null &&
round_effect.hp_boost_min == null &&
round_effect.hp_boost_max == null &&
round_effect.ap_boost_min == null &&
round_effect.ap_boost_max == null
);
round_effect.ap_boost_max == null);
}
private boolean isEmpty(ActorCondition.AbilityEffect ability_effect) {
return ability_effect == null || (
ability_effect.max_hp_boost == null &&
return ability_effect == null ||
(ability_effect.max_hp_boost == null &&
ability_effect.max_ap_boost == null &&
ability_effect.increase_move_cost == null &&
ability_effect.increase_use_cost == null &&
@@ -527,8 +526,7 @@ public class ActorConditionEditor extends JSONElementEditor {
ability_effect.increase_damage_max == null &&
ability_effect.increase_critical_skill == null &&
ability_effect.increase_block_chance == null &&
ability_effect.increase_damage_resistance == null
);
ability_effect.increase_damage_resistance == null);
}
}

View File

@@ -48,7 +48,12 @@ public class CommonEditor {
} else {
label.setIcon(new ImageIcon(effect.condition.getIcon()));
label.setText(
effect.chance + "% chances to give actor condition " + effect.condition.getDesc() + " x" + effect.magnitude + (forever ? " forever" : " for " + effect.duration + " rounds"));
effect.chance +
"% chances to give actor condition " +
effect.condition.getDesc() +
" x" +
effect.magnitude +
(forever ? " forever" : " for " + effect.duration + " rounds"));
}
} else {
label.setText("New, undefined actor condition effect.");
@@ -143,7 +148,7 @@ public class CommonEditor {
protected final String applyToTargetHint;
private JList hitTargetConditionsList;
private final ConditionEffectEditorPane<LIST_MODEL_SOURCE, ELEMENT, MODEL> hitTargetConditionPane ;
private final ConditionEffectEditorPane<LIST_MODEL_SOURCE, ELEMENT, MODEL> hitTargetConditionPane;
/*
* create a new HitEffectPane with the selections (probably passed in from last time)
@@ -193,7 +198,7 @@ public class CommonEditor {
@Override
public boolean valueChanged(JComponent source, Object value, GameDataElement backlink) {
boolean updateHit = false;
if(super.valueChanged(source, value, backlink)){
if (super.valueChanged(source, value, backlink)) {
updateHit = true;
} else if (source == hitTargetConditionsList) {
updateHit = true;
@@ -295,7 +300,7 @@ public class CommonEditor {
updateHit = true;
} else if (source == sourceConditionsList) {
updateHit = true;
} else if (sourceConditionPane.valueChanged(source, value, backlink)){
} else if (sourceConditionPane.valueChanged(source, value, backlink)) {
updateHit = true;
}
return updateHit;
@@ -360,7 +365,7 @@ public class CommonEditor {
Project proj = editor.target.getProject();
conditionBox = editor.addActorConditionBox(pane, proj, "Actor Condition: ", condition.condition, writable,
listener);
listener);
conditionChance = Editor.addDoubleField(pane, "Chance: ", condition.chance, writable, listener);
conditionClear = new JRadioButton("Clear active condition");

View File

@@ -234,7 +234,8 @@ public class DialogueEditor extends JSONElementEditor {
case changeMapFilter:
rewardMap = addMapBox(pane, ((Dialogue) target).getProject(), "Map Name: ", reward.map, writable, listener);
rewardObjId = null;
rewardObjIdCombo = addEnumValueBox(pane, "Color Filter", TMXMap.ColorFilter.values(), reward.reward_obj_id != null ? TMXMap.ColorFilter.valueOf(reward.reward_obj_id) : TMXMap.ColorFilter.none, writable, listener);
rewardObjIdCombo = addEnumValueBox(pane, "Color Filter", TMXMap.ColorFilter.values(),
reward.reward_obj_id != null ? TMXMap.ColorFilter.valueOf(reward.reward_obj_id) : TMXMap.ColorFilter.none, writable, listener);
rewardObj = null;
rewardValue = null;
break;
@@ -278,7 +279,8 @@ public class DialogueEditor extends JSONElementEditor {
if (!immunity) radioGroup.add(rewardConditionClear);
if (immunity) {
rewardConditionTimed.setSelected(reward.reward_value == null || (!reward.reward_value.equals(ActorCondition.DURATION_FOREVER) && !reward.reward_value.equals(ActorCondition.MAGNITUDE_CLEAR)));
rewardConditionTimed.setSelected(
reward.reward_value == null || (!reward.reward_value.equals(ActorCondition.DURATION_FOREVER) && !reward.reward_value.equals(ActorCondition.MAGNITUDE_CLEAR)));
rewardConditionForever.setSelected(reward.reward_value != null && !reward.reward_value.equals(ActorCondition.DURATION_FOREVER));
rewardConditionClear.setSelected(reward.reward_value != null && !reward.reward_value.equals(ActorCondition.MAGNITUDE_CLEAR));
} else {

View File

@@ -4,9 +4,14 @@ import com.gpl.rpg.atcontentstudio.ATContentStudio;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.Project;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.*;
import com.gpl.rpg.atcontentstudio.model.gamedata.ActorCondition;
import com.gpl.rpg.atcontentstudio.model.gamedata.Item;
import com.gpl.rpg.atcontentstudio.model.gamedata.ItemCategory;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.ui.*;
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
import com.gpl.rpg.atcontentstudio.ui.IntegerBasedCheckBox;
import com.gpl.rpg.atcontentstudio.ui.OrderedListenerListModel;
import com.gpl.rpg.atcontentstudio.utils.BasicLambda;
import com.gpl.rpg.atcontentstudio.utils.BasicLambdaWithArg;
import com.gpl.rpg.atcontentstudio.utils.BasicLambdaWithReturn;
@@ -97,7 +102,8 @@ public class ItemEditor extends JSONElementEditor {
typeBox = addEnumValueBox(pane, "Type: ", Item.DisplayType.values(), item.display_type, item.writable, listener);
manualPriceBox = addIntegerBasedCheckBox(pane, "Has manual price", item.has_manual_price, item.writable, listener);
baseManualPrice = item.base_market_cost;
baseCostField = addIntegerField(pane, "Base market cost: ", (item.has_manual_price != null && item.has_manual_price == 1) ? item.base_market_cost : item.computePrice(), false, item.writable, listener);
baseCostField = addIntegerField(pane, "Base market cost: ", (item.has_manual_price != null && item.has_manual_price == 1) ? item.base_market_cost : item.computePrice(), false, item.writable,
listener);
if (!manualPriceBox.isSelected()) {
baseCostField.setEnabled(false);
}
@@ -128,22 +134,23 @@ public class ItemEditor extends JSONElementEditor {
String titleEquipConditions = "Actor Conditions applied when equipped: ";
equipConditionsModel = new EquipConditionsListModel(equipEffect);
CommonEditor.ConditionsCellRenderer cellRendererEquipConditions = new CommonEditor.ConditionsCellRenderer();
BasicLambdaWithArg<ActorConditionEffect> selectedSetEquipConditions = (value)->selectedEquipEffectCondition = value;
BasicLambdaWithReturn<ActorConditionEffect> selectedGetEquipConditions = ()->selectedEquipEffectCondition ;
BasicLambda selectedResetEquipConditions = ()->selectedEquipEffectCondition = null;
BasicLambdaWithArg<ActorConditionEffect> selectedSetEquipConditions = (value) -> selectedEquipEffectCondition = value;
BasicLambdaWithReturn<ActorConditionEffect> selectedGetEquipConditions = () -> selectedEquipEffectCondition;
BasicLambda selectedResetEquipConditions = () -> selectedEquipEffectCondition = null;
BasicLambdaWithArg<JPanel> updatePaneEquipConditions = (editorPane) -> updateEquipConditionEditorPane(editorPane, selectedEquipEffectCondition, listener);
var resultEquipConditions = UiUtils.getCollapsibleItemList(listener,
equipConditionsModel,
selectedResetEquipConditions,
selectedSetEquipConditions,
selectedGetEquipConditions,
(x) -> {},
updatePaneEquipConditions,
item.writable,
ActorConditionEffect::new,
cellRendererEquipConditions,
titleEquipConditions,
(x) -> null);
equipConditionsModel,
selectedResetEquipConditions,
selectedSetEquipConditions,
selectedGetEquipConditions,
(x) -> {
},
updatePaneEquipConditions,
item.writable,
ActorConditionEffect::new,
cellRendererEquipConditions,
titleEquipConditions,
(x) -> null);
equipConditionsList = resultEquipConditions.list;
CollapsiblePanel equipConditionsPane = resultEquipConditions.collapsiblePanel;
if (item.equip_effect == null || item.equip_effect.conditions == null || item.equip_effect.conditions.isEmpty()) {

View File

@@ -3,9 +3,13 @@ package com.gpl.rpg.atcontentstudio.ui.gamedataeditors;
import com.gpl.rpg.atcontentstudio.ATContentStudio;
import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.*;
import com.gpl.rpg.atcontentstudio.model.gamedata.Dialogue;
import com.gpl.rpg.atcontentstudio.model.gamedata.Droplist;
import com.gpl.rpg.atcontentstudio.model.gamedata.NPC;
import com.gpl.rpg.atcontentstudio.model.sprites.Spritesheet;
import com.gpl.rpg.atcontentstudio.ui.*;
import com.gpl.rpg.atcontentstudio.ui.CollapsiblePanel;
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
import com.gpl.rpg.atcontentstudio.ui.IntegerBasedCheckBox;
import com.gpl.rpg.atcontentstudio.ui.gamedataeditors.dialoguetree.DialogueGraphView;
import com.gpl.rpg.atcontentstudio.utils.UiUtils;
import com.jidesoft.swing.JideBoxLayout;
@@ -15,7 +19,6 @@ import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import static com.gpl.rpg.atcontentstudio.model.gamedata.Common.*;
@@ -57,7 +60,8 @@ public class NPCEditor extends JSONElementEditor {
private JSpinner dmgRes;
private CommonEditor.HitEffectPane hitEffectPane = new CommonEditor.HitEffectPane("Effect on every hit: ", TimedActorConditionEffect::new, this, null, null);
private CommonEditor.HitRecievedEffectPane hitReceivedEffectPane = new CommonEditor.HitRecievedEffectPane("Effect on every hit received: ", TimedActorConditionEffect::new, this, "NPC", "Attacker");
private CommonEditor.HitRecievedEffectPane hitReceivedEffectPane = new CommonEditor.HitRecievedEffectPane("Effect on every hit received: ", TimedActorConditionEffect::new, this, "NPC",
"Attacker");
private CommonEditor.DeathEffectPane deathEffectPane = new CommonEditor.DeathEffectPane("Effect when killed: ", TimedActorConditionEffect::new, this, "Killer");
private JPanel dialogueGraphPane;
@@ -170,7 +174,6 @@ public class NPCEditor extends JSONElementEditor {
}
public class NPCFieldUpdater implements FieldUpdateListener {
@Override
@@ -263,7 +266,7 @@ public class NPCEditor extends JSONElementEditor {
npc.block_chance = (Integer) value;
} else if (source == dmgRes) {
npc.damage_resistance = (Integer) value;
} else if(hitEffectPane.valueChanged(source, value, npc)) {
} else if (hitEffectPane.valueChanged(source, value, npc)) {
updateHit = true;
} else if (hitReceivedEffectPane.valueChanged(source, value, npc)) {
updateHitReceived = true;
@@ -289,7 +292,7 @@ public class NPCEditor extends JSONElementEditor {
if (deathEffectPane.effect.isNull()) {
npc.death_effect = null;
} else {
npc.death_effect = deathEffectPane. effect;
npc.death_effect = deathEffectPane.effect;
}
}

View File

@@ -5,7 +5,9 @@ import com.gpl.rpg.atcontentstudio.model.GameDataElement;
import com.gpl.rpg.atcontentstudio.model.ProjectTreeNode;
import com.gpl.rpg.atcontentstudio.model.gamedata.Quest;
import com.gpl.rpg.atcontentstudio.model.gamedata.QuestStage;
import com.gpl.rpg.atcontentstudio.ui.*;
import com.gpl.rpg.atcontentstudio.ui.FieldUpdateListener;
import com.gpl.rpg.atcontentstudio.ui.IntegerBasedCheckBox;
import com.gpl.rpg.atcontentstudio.ui.OrderedListenerListModel;
import com.gpl.rpg.atcontentstudio.utils.BasicLambda;
import com.gpl.rpg.atcontentstudio.utils.BasicLambdaWithArg;
import com.gpl.rpg.atcontentstudio.utils.BasicLambdaWithReturn;
@@ -13,11 +15,7 @@ import com.gpl.rpg.atcontentstudio.utils.UiUtils;
import com.jidesoft.swing.JideBoxLayout;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
@@ -64,23 +62,24 @@ public class QuestEditor extends JSONElementEditor {
String title = "Quest stages: ";
StagesCellRenderer cellRenderer = new StagesCellRenderer();
stagesListModel = new StagesListModel(quest);
BasicLambdaWithArg<QuestStage> selectedSet = (value)->selectedStage = value;
BasicLambdaWithReturn<QuestStage> selectedGet = ()->selectedStage ;
BasicLambda selectedReset = ()->selectedStage = null;
BasicLambdaWithArg<QuestStage> selectedSet = (value) -> selectedStage = value;
BasicLambdaWithReturn<QuestStage> selectedGet = () -> selectedStage;
BasicLambda selectedReset = () -> selectedStage = null;
BasicLambdaWithArg<JPanel> updatePane = (editorPane) -> updateStageEditorPane(editorPane, selectedStage, listener);
var result = UiUtils.getCollapsibleItemList(listener,
stagesListModel,
selectedReset,
selectedSet,
selectedGet,
(x) -> {},
updatePane,
quest.writable,
() -> new QuestStage(quest),
cellRenderer,
title,
(x) -> null);
stagesListModel,
selectedReset,
selectedSet,
selectedGet,
(x) -> {
},
updatePane,
quest.writable,
() -> new QuestStage(quest),
cellRenderer,
title,
(x) -> null);
stagesList = result.list;
if (quest.stages == null || quest.stages.isEmpty()) {

View File

@@ -1541,7 +1541,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
@Override
public void actionPerformed(ActionEvent e) {
if (map.needsSaving()) {
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this, "You have unsaved changes in ATCS.\nYou'd better save your changes in ATCS before opening this map with the external editor.\nDo you want to save before opening the file?", "Save before opening?", JOptionPane.YES_NO_CANCEL_OPTION);
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this,
"You have unsaved changes in ATCS.\nYou'd better save your changes in ATCS before opening this map with the external editor.\nDo you want to save before opening the file?",
"Save before opening?", JOptionPane.YES_NO_CANCEL_OPTION);
if (confirm == JOptionPane.CANCEL_OPTION) return;
if (confirm == JOptionPane.YES_OPTION) {
map.save();
@@ -1559,7 +1561,9 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
@Override
public void actionPerformed(ActionEvent e) {
if (map.needsSaving()) {
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this, "You modified this map in ATCS. All ATCS-made changes will be lost if you confirm.\n On the other hand, if you save using ATCS, all external changes will be lost.\n Do you want to reload?", "Confirm reload?", JOptionPane.OK_CANCEL_OPTION);
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this,
"You modified this map in ATCS. All ATCS-made changes will be lost if you confirm.\n On the other hand, if you save using ATCS, all external changes will be lost.\n Do you want to reload?",
"Confirm reload?", JOptionPane.OK_CANCEL_OPTION);
if (confirm == JOptionPane.CANCEL_OPTION) return;
}
reload.setEnabled(false);
@@ -1581,11 +1585,14 @@ public class TMXMapEditor extends Editor implements TMXMap.MapChangedOnDiskListe
public void actionPerformed(ActionEvent e) {
if (map.state != TMXMap.State.saved) {
if (map.changedOnDisk) {
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this, "You modified this map in an external tool. All external changes will be lost if you confirm.\n On the other hand, if you reload in ATCS, all ATCS-made changes will be lost.\n Do you want to save?", "Confirm save?", JOptionPane.OK_CANCEL_OPTION);
int confirm = JOptionPane.showConfirmDialog(TMXMapEditor.this,
"You modified this map in an external tool. All external changes will be lost if you confirm.\n On the other hand, if you reload in ATCS, all ATCS-made changes will be lost.\n Do you want to save?",
"Confirm save?", JOptionPane.OK_CANCEL_OPTION);
if (confirm == JOptionPane.CANCEL_OPTION) return;
File backup = FileUtils.backupFile(map.tmxFile);
if (backup != null) {
JOptionPane.showMessageDialog(TMXMapEditor.this, "The externally-modified file was backed up as " + backup.getAbsolutePath(), "File backed up", JOptionPane.INFORMATION_MESSAGE);
JOptionPane.showMessageDialog(TMXMapEditor.this, "The externally-modified file was backed up as " + backup.getAbsolutePath(), "File backed up",
JOptionPane.INFORMATION_MESSAGE);
} else {
JOptionPane.showMessageDialog(TMXMapEditor.this, "The externally-modified file could not be backed up.", "File backup failed", JOptionPane.ERROR_MESSAGE);
}

View File

@@ -307,7 +307,9 @@ public class ItemsTableView extends ElementTableView {
case 22:
return (!canUse && item.hit_received_effect != null) ? item.hit_received_effect.ap_boost_max : null;//"On hit recv - AP max";
case 23:
return (!canUse && item.hit_received_effect != null && item.hit_received_effect.conditions_source != null) ? item.hit_received_effect.conditions_source.size() : null;//"On hit recv - # conditions";
return (!canUse &&
item.hit_received_effect != null &&
item.hit_received_effect.conditions_source != null) ? item.hit_received_effect.conditions_source.size() : null;//"On hit recv - # conditions";
case 24:
return (!canUse && item.hit_received_effect != null) ? item.hit_received_effect.hp_boost_min : null;//"On hit recv - Tgt HP min";
case 25: