diff --git a/Controller/ArrayField.java b/Controller/ArrayField.java index 2f43d73..b96d58f 100644 --- a/Controller/ArrayField.java +++ b/Controller/ArrayField.java @@ -7,6 +7,7 @@ */ public enum ArrayField { // ITEM + // gemID1 -> gemID for name, gemID2 -> gemID for description gemID1, gemUnk1, gemInventorySlot, gemUnk2, gemValue, gemRank, gemUnk3, gemID2, // gems // MINE diff --git a/Controller/SaveFileController.java b/Controller/SaveFileController.java index 51309d0..a2e2237 100644 --- a/Controller/SaveFileController.java +++ b/Controller/SaveFileController.java @@ -405,6 +405,108 @@ public int viewToModelMapID(String mapID) { put("Slumber", "12"); put("Rebirth", "14"); }}); + + final HashBiMap gemNames = HashBiMap.create(new HashMap() {{ + put("None", "0"); + put("Strength Up", "1"); + put("Chill Defence", "2"); + put("Sleep Resist", "3"); + put("Slow Resist", "4"); + put("Bind Resist", "5"); + put("Buff Time Plus", "6"); + put("Weapon Power", "7"); + put("Strength Down", "8"); + put("Blaze Plus", "9"); + put("Blaze Attack", "10"); + put("Spike", "11"); + put("Revival HP Up", "12"); + put("Initial Tension", "13"); + put("Aggro Up", "14"); + put("EXP Up", "15"); + put("Weaken", "16"); // Unused + put("HP Up", "17"); + put("Poison Defence", "18"); + put("Spike Defence", "19"); + put("Paralysis Resist", "20"); + put("Debuff Resist", "21"); + put("Recovery Up", "22"); + put("Aura Heal", "23"); + put("Damage Heal", "24"); + put("Arts Heal", "25"); + put("HP Steal", "26"); + put("Unbeatable", "27"); + put("AP Up", "28"); + put("Aquatic Cloak", "29"); + put("Auto-Heal Up", "30"); + put("Terrain Defence", "31"); + put("HP Weaken", "32"); // Unused + put("Ether Up", "33"); + put("Double Attack", "34"); + put("Daze Resist", "35"); + put("Pierce Resist", "36"); + put("Daze Plus", "37"); + put("Phys Def Down", "38"); + put("Paralysis", "39"); + put("Lightning Attack", "40"); + put("Electric Plus", "41"); + put("Back Atk Plus", "42"); + put("First Attack Plus", "43"); + put("Daze Up", "44"); + put("Cast Quicken", "45"); // Unused + put("Tension Swing", "46"); + put("Daze Tension", "47"); + put("Ether Weaken", "48"); // Unused + put("Ether Def Up", "49"); + put("Blaze Defence", "50"); + put("Lock-On Resist", "51"); + put("Confuse Resist", "52"); + put("Critical Resist", "53"); // Unused + put("Ether Protect", "54"); + put("Slow", "55"); + put("Bind", "56"); + put("Ether Def Down", "57"); + put("Chill Plus", "58"); + put("Chill Attack", "59"); + put("Auto-Atk Stealth", "60"); + put("Arts Stealth", "61"); + put("Talent Boost", "62"); + put("Heat Sink", "63"); + put("Ether Smash", "64"); // Unused + put("Agility Up", "65"); + put("Topple Resist", "66"); + put("Good Footing", "67"); + put("Arts Seal Resist", "68"); + put("Accuracy Up", "69"); // Unused + put("Haste", "70"); + put("Topple Plus", "71"); + put("Bleed Attack", "72"); + put("Bleed Plus", "73"); + put("Topple Up", "74"); + put("Agility Down", "75"); + put("Break", "76"); + put("Quick Step", "77"); + put("Fall Defence", "78"); + put("Aerial Cloak", "79"); + put("Agility Weaken", "80"); // Unused + put("Muscle Up", "81"); + put("Attack Stability", "82"); + put("Attack Plus", "83"); + put("Critical Up", "84"); + put("Bleed Defence", "85"); + put("Divine Protect", "86"); + put("Physical Protect", "87"); + put("Night Vision", "88"); + put("Debuff Plus", "89"); + put("Armour Power", "90"); // Unused + put("Ether Down", "91"); + put("Poison Plus", "92"); + put("Poison Attack", "93"); + put("Aggro Down", "94"); + put("Earth Cloak", "95"); + put("Muscle Waste", "96"); // Unused + put("Unbeatable", "97"); + put("Impurity", "98"); // Unused + }}); /** * Translates model values to view (user-facing) values @@ -478,6 +580,9 @@ public Object modelToView(ArrayField colName, Object modelVal) { case boxRank: viewVal = boxRankMap.inverse().get(modelVal.toString()); break; + case gemID1: case gemID2: + viewVal = gemNames.inverse().get(modelVal.toString()); + break; } return viewVal; } @@ -553,6 +658,9 @@ public String viewToModel(ArrayField colName, String viewVal) { case boxRank: modelVal = boxRankMap.get(viewVal); break; + case gemID1: case gemID2: + modelVal = gemNames.get(viewVal.toString()); + break; } return modelVal; } diff --git a/Model/.gitignore b/Model/.gitignore index dc8230c..6b43aa0 100644 --- a/Model/.gitignore +++ b/Model/.gitignore @@ -15,3 +15,4 @@ /SaveFile$CRC16.class /SaveField.class /ArrayField.class +/StaticElement.class diff --git a/View/ITEMView.java b/View/ITEMView.java index 723c689..545b276 100644 --- a/View/ITEMView.java +++ b/View/ITEMView.java @@ -1,5 +1,6 @@ package View; import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -36,28 +37,127 @@ public ITEMView(GUI gui) { ITEMMoney.setColumns(10); gui.setTextField(SaveField.money, ITEMMoney, gui.int32); - String[] gemColumnNames = new String[] {"Gem ID 1", "Gem ID 2", "Rank", "Value", "Inventory Slot", "Unknown 1", "Unknown 2", "Unknown 3"}; + String[] gemColumnNames = new String[] {"Gem ID (Name)", "Gem ID (Description)", "Rank", "Value", "Inventory Slot", "Unknown 1", "Unknown 2", "Unknown 3"}; gemTable = new JTable(); gemTable.setModel(new DefaultTableModel(gemColumnNames, 300)); - // set gemID1 to uint11 + final String[] gemNames = { + "None", + "Strength Up", + "Chill Defence", + "Sleep Resist", + "Slow Resist", + "Bind Resist", + "Buff Time Plus", + "Weapon Power", + "Strength Down", + "Blaze Plus", + "Blaze Attack", + "Spike", + "Revival HP Up", + "Initial Tension", + "Aggro Up", + "EXP Up", + "Weaken", // Unused + "HP Up", + "Poison Defence", + "Spike Defence", + "Paralysis Resist", + "Debuff Resist", + "Recovery Up", + "Aura Heal", + "Damage Heal", + "Arts Heal", + "HP Steal", + "Unbeatable", + "AP Up", + "Aquatic Cloak", + "Auto-Heal Up", + "Terrain Defence", + "HP Weaken", // Unused + "Ether Up", + "Double Attack", + "Daze Resist", + "Pierce Resist", + "Daze Plus", + "Phys Def Down", + "Paralysis", + "Lightning Attack", + "Electric Plus", + "Back Atk Plus", + "First Attack Plus", + "Daze Up", + "Cast Quicken", // Unused + "Tension Swing", + "Daze Tension", + "Ether Weaken", // Unused + "Ether Def Up", + "Blaze Defence", + "Lock-On Resist", + "Confuse Resist", + "Critical Resist", // Unused + "Ether Protect", + "Slow", + "Bind", + "Ether Def Down", + "Chill Plus", + "Chill Attack", + "Auto-Atk Stealth", + "Arts Stealth", + "Talent Boost", + "Heat Sink", + "Ether Smash", // Unused + "Agility Up", + "Topple Resist", + "Good Footing", + "Arts Seal Resist", + "Accuracy Up", // Unused + "Haste", + "Topple Plus", + "Bleed Attack", + "Bleed Plus", + "Topple Up", + "Agility Down", + "Break", + "Quick Step", + "Fall Defence", + "Aerial Cloak", + "Agility Weaken", // Unused + "Muscle Up", + "Attack Stability", + "Attack Plus", + "Critical Up", + "Bleed Defence", + "Divine Protect", + "Physical Protect", + "Night Vision", + "Debuff Plus", + "Armour Power", // Unused + "Ether Down", + "Poison Plus", + "Poison Attack", + "Aggro Down", + "Earth Cloak", + "Muscle Waste", // Unused + "Unbeatable", + "Impurity" // Unused + }; + + // set gemID1 to JComboBox TableColumn gemID1Column = gemTable.getColumnModel().getColumn(0); - JTextField gemID1TextField = new JTextField(); - AbstractDocument doc = (AbstractDocument) gemID1TextField.getDocument(); - doc.setDocumentFilter(gui.uint11); - gemID1Column.setCellEditor(new DefaultCellEditor(gemID1TextField)); + JComboBox gemID1ComboBox = new JComboBox(gemNames); + gemID1Column.setCellEditor(new DefaultCellEditor(gemID1ComboBox)); - // set gemID2 to uint12 + // set gemID2 to JComboBox TableColumn gemID2Column = gemTable.getColumnModel().getColumn(1); - JTextField gemID2TextField = new JTextField(); - doc = (AbstractDocument) gemID2TextField.getDocument(); - doc.setDocumentFilter(gui.uint12); - gemID2Column.setCellEditor(new DefaultCellEditor(gemID2TextField)); + gemID2Column.setMinWidth(100); + JComboBox gemID2ComboBox = new JComboBox(gemNames); + gemID2Column.setCellEditor(new DefaultCellEditor(gemID2ComboBox)); // set rank to uint3 TableColumn gemRankColumn = gemTable.getColumnModel().getColumn(2); JTextField gemRankTextField = new JTextField(); - doc = (AbstractDocument) gemRankTextField.getDocument(); + AbstractDocument doc = (AbstractDocument) gemRankTextField.getDocument(); doc.setDocumentFilter(gui.uint3); gemRankColumn.setCellEditor(new DefaultCellEditor(gemRankTextField));