Added initial version
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
package com.editor;
|
||||
|
||||
import com.editor.Main;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class Console extends JFrame {
|
||||
private static final long serialVersionUID = -4693540915136770583L;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem jMenuItem1;
|
||||
private JMenuItem jMenuItem2;
|
||||
private JScrollPane jScrollPane1;
|
||||
public static JTextArea output;
|
||||
|
||||
public Console() {
|
||||
this.setTitle("Console");
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(0);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.initComponents();
|
||||
Main.log("Console", "Console Started.");
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.jScrollPane1 = new JScrollPane();
|
||||
output = new JTextArea();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.jMenuItem1 = new JMenuItem();
|
||||
this.jMenuItem2 = new JMenuItem();
|
||||
this.setDefaultCloseOperation(3);
|
||||
output.setEditable(false);
|
||||
output.setColumns(20);
|
||||
output.setLineWrap(true);
|
||||
output.setRows(5);
|
||||
this.jScrollPane1.setViewportView(output);
|
||||
this.jMenu1.setText("File");
|
||||
this.jMenuItem1.setText("Close Console");
|
||||
this.jMenuItem1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
Console.this.jMenuItem1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.jMenuItem1);
|
||||
this.jMenuItem2.setText("Exit Program");
|
||||
this.jMenuItem2.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
Console.this.jMenuItem2ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.jMenuItem2);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jScrollPane1, -1, 618, 32767));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jScrollPane1, -1, 240, 32767));
|
||||
this.pack();
|
||||
}
|
||||
|
||||
private void jMenuItem2ActionPerformed(ActionEvent evt) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private void jMenuItem1ActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new Console()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void updateTextArea(final String text) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
Console.output.append(text);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void redirectSystemStreams() {
|
||||
OutputStream out = new OutputStream() {
|
||||
public void write(int b) throws IOException {
|
||||
Console.updateTextArea(String.valueOf((char)b));
|
||||
}
|
||||
|
||||
public void write(byte[] b, int off, int len) throws IOException {
|
||||
Console.updateTextArea(new String(b, off, len));
|
||||
}
|
||||
|
||||
public void write(byte[] b) throws IOException {
|
||||
this.write(b, 0, b.length);
|
||||
}
|
||||
};
|
||||
System.setOut(new PrintStream(out, true));
|
||||
System.setErr(new PrintStream(out, true));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.editor;
|
||||
|
||||
import com.editor.Console;
|
||||
import com.editor.ToolSelection;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
Console.redirectSystemStreams();
|
||||
(new Console()).setVisible(true);
|
||||
(new ToolSelection()).setVisible(true);
|
||||
log("Main", "Frosty's Cache Editor");
|
||||
log("Main", "Edited to support the #562 revision by Jens.");
|
||||
}
|
||||
|
||||
public static void log(String className, String message) {
|
||||
System.out.println("[" + className + "]: " + message);
|
||||
printDebug(className, message);
|
||||
}
|
||||
|
||||
private static void printDebug(String className, String message) {
|
||||
File f = new File(System.getProperty("user.home") + "/FCE/logs/");
|
||||
File f1 = new File(System.getProperty("user.home") + "/FCE/logs/" + 2 + 5 + 1 + 11 + ".txt");
|
||||
f.mkdirs();
|
||||
|
||||
try {
|
||||
f1.createNewFile();
|
||||
} catch (IOException var10) {
|
||||
log("Main", "Could not create log file.");
|
||||
}
|
||||
|
||||
String strFilePath = System.getProperty("user.home") + "/FCE/logs/" + 2 + 5 + 1 + 11 + ".txt";
|
||||
|
||||
try {
|
||||
FileOutputStream var9 = new FileOutputStream(strFilePath, true);
|
||||
String strContent = new Date() + ": [" + className + "]: " + message;
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
var9.write(strContent.getBytes());
|
||||
var9.write(lineSep.getBytes());
|
||||
} catch (FileNotFoundException var8) {
|
||||
log("Main", "FileNotFoundException : " + var8);
|
||||
} catch (IOException var91) {
|
||||
log("Main", "IOException : " + var91);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
package com.editor;
|
||||
|
||||
import com.editor.Main;
|
||||
import com.editor.item.ItemDefDump;
|
||||
import com.editor.item.ItemSelection;
|
||||
import com.editor.model.MultiModelPacker;
|
||||
import com.editor.model.UniModelDumper;
|
||||
import com.editor.npc.NPCDefDump;
|
||||
import com.editor.npc.NPCSelection;
|
||||
import com.editor.object.ObjectSelection;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ToolSelection extends JFrame {
|
||||
private static final long serialVersionUID = 2024943190858205332L;
|
||||
private String cache;
|
||||
private JLabel jLabel1;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem loadCacheButton;
|
||||
private JMenuItem exitButton;
|
||||
private JComboBox selectionBox;
|
||||
private JButton submitButton;
|
||||
|
||||
public ToolSelection() {
|
||||
this.setTitle("Tool Selection");
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(3);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.initComponents();
|
||||
Main.log("Main", "ToolSelection Started");
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.jLabel1 = new JLabel();
|
||||
this.selectionBox = new JComboBox();
|
||||
this.submitButton = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.loadCacheButton = new JMenuItem();
|
||||
this.exitButton = new JMenuItem();
|
||||
this.setDefaultCloseOperation(3);
|
||||
this.jLabel1.setText("Select Your Editor:");
|
||||
this.selectionBox.setModel(new DefaultComboBoxModel(new String[]{"Items", "NPCs", "Objects", "ItemDefDump", "NPCDefDump", "MultiModelPacker", "MultiItemPacker", "MultiNPCPacker", "UniModelDumper"}));
|
||||
this.submitButton.setText("Submit");
|
||||
this.submitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ToolSelection.this.submitButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.setText("File");
|
||||
this.loadCacheButton.setText("Load Cache");
|
||||
this.loadCacheButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ToolSelection.this.jMenuItem1ActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.loadCacheButton);
|
||||
this.exitButton.setText("Exit Program");
|
||||
this.exitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ToolSelection.this.exitButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exitButton);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(77, 77, 77).addGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.submitButton).addComponent(this.selectionBox, -2, -1, -2)).addContainerGap(-1, 32767)).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addContainerGap(62, 32767).addComponent(this.jLabel1).addGap(58, 58, 58)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap(50, 32767).addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.selectionBox, -2, -1, -2).addGap(44, 44, 44).addComponent(this.submitButton).addGap(38, 38, 38)));
|
||||
this.pack();
|
||||
}
|
||||
|
||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
||||
if(this.selectionBox.getSelectedIndex() == 0) {
|
||||
try {
|
||||
(new ItemSelection(this.cache)).setVisible(true);
|
||||
Main.log("ToolSelection", "ItemSelection Started");
|
||||
} catch (IOException var4) {
|
||||
Main.log("ToolSelection", "No Cache Set!");
|
||||
}
|
||||
} else if(this.selectionBox.getSelectedIndex() == 1) {
|
||||
try {
|
||||
(new NPCSelection(this.cache)).setVisible(true);
|
||||
Main.log("ToolSelection", "NPCSelection Started");
|
||||
} catch (IOException var3) {
|
||||
Main.log("ToolSelection", "No Cache Set!");
|
||||
}
|
||||
} else if(this.selectionBox.getSelectedIndex() == 2) {
|
||||
try {
|
||||
(new ObjectSelection(this.cache)).setVisible(true);
|
||||
Main.log("ToolSelection", "ObjectSelection Started");
|
||||
} catch (IOException var2) {
|
||||
Main.log("ToolSelection", "No Cache Set!");
|
||||
}
|
||||
} else if(this.selectionBox.getSelectedIndex() == 3) {
|
||||
Main.log("ToolSelection", "Item Def Dumping Started");
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ItemDefDump.editorDump(ToolSelection.this.cache);
|
||||
}
|
||||
});
|
||||
} else if(this.selectionBox.getSelectedIndex() == 4) {
|
||||
Main.log("ToolSelection", "NPC Def Dumping Started");
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
NPCDefDump.editorDump(ToolSelection.this.cache);
|
||||
}
|
||||
});
|
||||
} else if(this.selectionBox.getSelectedIndex() == 5) {
|
||||
Main.log("ToolSelection", "MultiModelPacker Started");
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new MultiModelPacker(ToolSelection.this.cache);
|
||||
}
|
||||
});
|
||||
} else if(this.selectionBox.getSelectedIndex() == 6) {
|
||||
Main.log("ToolSelection", "MultiNPCPacker is not working at the moment.");
|
||||
} else if(this.selectionBox.getSelectedIndex() == 8) {
|
||||
Main.log("ToolSelection", "UniModelDumper Started");
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
new UniModelDumper(ToolSelection.this.cache);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
Main.log("ToolSelection", "No Tool Selected!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void jMenuItem1ActionPerformed(ActionEvent evt) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setFileSelectionMode(1);
|
||||
if(evt.getSource() == this.loadCacheButton) {
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
if(returnVal == 0) {
|
||||
File file = fc.getSelectedFile();
|
||||
this.cache = file.getPath() + "/";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void exitButtonActionPerformed(ActionEvent evt) {
|
||||
JDialog.setDefaultLookAndFeelDecorated(true);
|
||||
int response = JOptionPane.showConfirmDialog((Component)null, "Do you want to continue?", "Confirm", 0, 3);
|
||||
if(response == 0) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new ToolSelection()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.editor;
|
||||
|
||||
import com.alex.store.Store;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class Utils {
|
||||
public static byte[] getBytesFromFile(File file) throws IOException {
|
||||
FileInputStream is = new FileInputStream(file);
|
||||
long length = file.length();
|
||||
if(length > 2147483647L) {
|
||||
;
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[(int)length];
|
||||
int offset = 0;
|
||||
|
||||
int numRead1;
|
||||
for(boolean numRead = false; offset < bytes.length && (numRead1 = is.read(bytes, offset, bytes.length - offset)) >= 0; offset += numRead1) {
|
||||
;
|
||||
}
|
||||
|
||||
if(offset < bytes.length) {
|
||||
throw new IOException("Could not completely read file " + file.getName());
|
||||
} else {
|
||||
is.close();
|
||||
return bytes;
|
||||
}
|
||||
}
|
||||
|
||||
public static int packCustomModel(Store cache, byte[] data) {
|
||||
int archiveId = cache.getIndexes()[7].getLastArchiveId() + 1;
|
||||
if(cache.getIndexes()[7].putFile(archiveId, 0, data)) {
|
||||
return archiveId;
|
||||
} else {
|
||||
System.out.println("Failed packing model " + archiveId);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int packCustomModel(Store cache, byte[] data, int modelId) {
|
||||
if(cache.getIndexes()[7].putFile(modelId, 0, data)) {
|
||||
return modelId;
|
||||
} else {
|
||||
System.out.println("Failed packing model " + modelId);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,418 @@
|
||||
package com.editor.item;
|
||||
|
||||
import com.alex.loaders.items.ItemDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
import com.editor.Main;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class ItemDefDump {
|
||||
private static ItemDefinitions defs;
|
||||
private static Store STORE;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
STORE = new Store("C:/Users/yvonne å christer/Dropbox/FCE/ItemDefDump/");
|
||||
} catch (IOException var2) {
|
||||
System.out.println("Cannot find cache location");
|
||||
}
|
||||
|
||||
int id;
|
||||
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
|
||||
defs = ItemDefinitions.getItemDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("ItemDefDump", "Dumping Item " + defs.id);
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
|
||||
defs = ItemDefinitions.getItemDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("ItemDefDump", "Dumping Item " + defs.id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void editorDump(String cache) {
|
||||
try {
|
||||
STORE = new Store(cache);
|
||||
} catch (IOException var2) {
|
||||
Main.log("ItemDefDump", "Cannot find cache location");
|
||||
}
|
||||
|
||||
int id;
|
||||
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
|
||||
defs = ItemDefinitions.getItemDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("ItemDefDump", "Dumping Item " + defs.id);
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
|
||||
defs = ItemDefinitions.getItemDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("ItemDefDump", "Dumping Item " + defs.id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void dump() {
|
||||
File f = new File(System.getProperty("user.home") + "/FCE/items/");
|
||||
f.mkdirs();
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
BufferedWriter writer = null;
|
||||
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.home") + "/FCE/items/" + defs.id + ".txt"), "utf-8"));
|
||||
writer.write("name = " + defs.getName());
|
||||
writer.write(lineSep);
|
||||
writer.write("value = " + defs.getValue());
|
||||
writer.write(lineSep);
|
||||
writer.write("team id = " + defs.getTeamId());
|
||||
writer.write(lineSep);
|
||||
writer.write("members only = " + String.valueOf(defs.isMembersOnly()));
|
||||
writer.write(lineSep);
|
||||
writer.write("equip slot = " + defs.getEquipSlot());
|
||||
writer.write(lineSep);
|
||||
writer.write("equip type = " + defs.getEquipType());
|
||||
writer.write(lineSep);
|
||||
writer.write("stack ids = " + getStackIDs());
|
||||
writer.write(lineSep);
|
||||
writer.write("stack amounts = " + getStackAmts());
|
||||
writer.write(lineSep);
|
||||
writer.write("stackable = " + defs.getStackable());
|
||||
writer.write(lineSep);
|
||||
writer.write("inv model zoom = " + defs.getInvModelZoom());
|
||||
writer.write(lineSep);
|
||||
writer.write("model rotation 1 = " + defs.getModelRotation1());
|
||||
writer.write(lineSep);
|
||||
writer.write("model rotation 2 = " + defs.getModelRotation2());
|
||||
writer.write(lineSep);
|
||||
writer.write("model offset 1 = " + defs.getModelOffset1());
|
||||
writer.write(lineSep);
|
||||
writer.write("model offset 2 = " + defs.getModelOffset2());
|
||||
writer.write(lineSep);
|
||||
writer.write("inv model id = " + defs.getInvModelId());
|
||||
writer.write(lineSep);
|
||||
writer.write("male equip model id 1 = " + defs.getMaleEquipModelId1());
|
||||
writer.write(lineSep);
|
||||
writer.write("female equip model id 1 = " + defs.getFemaleEquipModelId1());
|
||||
writer.write(lineSep);
|
||||
writer.write("male equip model id 2 = " + defs.getMaleEquipModelId2());
|
||||
writer.write(lineSep);
|
||||
writer.write("female equip model id 2 = " + defs.getFemaleEquipModelId2());
|
||||
writer.write(lineSep);
|
||||
writer.write("male equip model id 3 = " + defs.getMaleEquipModelId3());
|
||||
writer.write(lineSep);
|
||||
writer.write("female equip model id 3 = " + defs.getFemaleEquipModelId3());
|
||||
writer.write(lineSep);
|
||||
writer.write("inventory options = " + getInventoryOpts());
|
||||
writer.write(lineSep);
|
||||
writer.write("ground options = " + getGroundOpts());
|
||||
writer.write(lineSep);
|
||||
writer.write("changed model colors = " + getChangedModelColors());
|
||||
writer.write(lineSep);
|
||||
writer.write("changed texture colors = " + getChangedTextureColors());
|
||||
writer.write(lineSep);
|
||||
writer.write("switch note item id = " + defs.switchNoteItemId);
|
||||
writer.write(lineSep);
|
||||
writer.write("noted item id = " + defs.notedItemId);
|
||||
writer.write(lineSep);
|
||||
writer.write("unnoted = " + String.valueOf(defs.isUnnoted()));
|
||||
writer.write(lineSep);
|
||||
writer.write("switch lend item id = " + defs.getSwitchLendItemId());
|
||||
writer.write(lineSep);
|
||||
writer.write("lended item id = " + defs.getLendedItemId());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray1 = " + getUnknownArray1());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray2 = " + getUnknownArray2());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray3 = " + getUnknownArray3());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray4 = " + getUnknownArray4());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray5 = " + getUnknownArray5());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownArray6 = " + getUnknownArray6());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt1 = " + defs.unknownInt1);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt2 = " + defs.unknownInt2);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt3 = " + defs.unknownInt3);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt4 = " + defs.unknownInt4);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt5 = " + defs.unknownInt5);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt6 = " + defs.unknownInt6);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt7 = " + defs.unknownInt7);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt8 = " + defs.unknownInt8);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt9 = " + defs.unknownInt9);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt10 = " + defs.unknownInt10);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt11 = " + defs.unknownInt11);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt12 = " + defs.unknownInt12);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt13 = " + defs.unknownInt13);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt14 = " + defs.unknownInt14);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt15 = " + defs.unknownInt15);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt16 = " + defs.unknownInt16);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt17 = " + defs.unknownInt17);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt18 = " + defs.unknownInt18);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt19 = " + defs.unknownInt19);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt20 = " + defs.unknownInt20);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt21 = " + defs.unknownInt21);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt22 = " + defs.unknownInt22);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownInt23 = " + defs.unknownInt23);
|
||||
writer.write(lineSep);
|
||||
writer.write("Clientscripts");
|
||||
writer.write(lineSep);
|
||||
if(defs.clientScriptData != null) {
|
||||
Iterator var14 = defs.clientScriptData.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
int key = ((Integer)var14.next()).intValue();
|
||||
Object value = defs.clientScriptData.get(Integer.valueOf(key));
|
||||
writer.write("KEY: " + key + ", VALUE: " + value);
|
||||
writer.write(lineSep);
|
||||
}
|
||||
}
|
||||
} catch (IOException var141) {
|
||||
Main.log("ItemEditor", "Failed to export Item Defs to .txt");
|
||||
} finally {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception var13) {
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getInventoryOpts() {
|
||||
String text = "";
|
||||
String[] arr$ = defs.getInventoryOptions();
|
||||
int len$ = arr$.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
String option = arr$[i$];
|
||||
text = text + (option == null?"null":option) + ";";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getGroundOpts() {
|
||||
String text = "";
|
||||
String[] arr$ = defs.getGroundOptions();
|
||||
int len$ = arr$.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
String option = arr$[i$];
|
||||
text = text + (option == null?"null":option) + ";";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getChangedModelColors() {
|
||||
String text = "";
|
||||
if(defs.originalModelColors != null) {
|
||||
for(int i = 0; i < defs.originalModelColors.length; ++i) {
|
||||
text = text + defs.originalModelColors[i] + "=" + defs.modifiedModelColors[i] + ";";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getChangedTextureColors() {
|
||||
String text = "";
|
||||
if(defs.originalTextureColors != null) {
|
||||
for(int i = 0; i < defs.originalTextureColors.length; ++i) {
|
||||
text = text + defs.originalTextureColors[i] + "=" + defs.modifiedTextureColors[i] + ";";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getStackIDs() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.getStackIds();
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getClientScripts() {
|
||||
String text = "";
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
if(defs.clientScriptData != null) {
|
||||
for(Iterator i$ = defs.clientScriptData.keySet().iterator(); i$.hasNext(); text = text + lineSep) {
|
||||
int key = ((Integer)i$.next()).intValue();
|
||||
Object value = defs.clientScriptData.get(Integer.valueOf(key));
|
||||
text = text + "KEY: " + key + ", VALUE: " + value;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getStackAmts() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.getStackAmounts();
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray1() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
byte[] e = defs.unknownArray1;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
byte index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray2() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray2;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray3() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
byte[] e = defs.unknownArray3;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
byte index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray4() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray4;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray5() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray5;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray6() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
byte[] e = defs.unknownArray6;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
byte index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,57 @@
|
||||
package com.editor.item;
|
||||
|
||||
import com.alex.loaders.items.ItemDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ItemListDumper {
|
||||
private static Store STORE;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
|
||||
new ItemListDumper();
|
||||
} catch (IOException var2) {
|
||||
var2.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public ItemListDumper() throws IOException {
|
||||
File file = new File("C:/Users/Travis/Documents/781 ItemList.txt");
|
||||
if(file.exists()) {
|
||||
file.delete();
|
||||
} else {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.append("//Version = 781\n");
|
||||
writer.flush();
|
||||
|
||||
for(int id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
|
||||
ItemDefinitions def = ItemDefinitions.getItemDefinition(STORE, id);
|
||||
if(!def.getName().equals("null")) {
|
||||
writer.append(id + " - " + def.getName());
|
||||
writer.newLine();
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
|
||||
public static int convertInt(String str) {
|
||||
try {
|
||||
int var2 = Integer.parseInt(str);
|
||||
return var2;
|
||||
} catch (NumberFormatException var21) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
package com.editor.item;
|
||||
|
||||
import com.alex.loaders.items.ItemDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
import com.editor.Main;
|
||||
import com.editor.item.ItemEditor;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ItemSelection extends JFrame {
|
||||
private static final long serialVersionUID = -3059309913196024742L;
|
||||
public static Store STORE;
|
||||
private JButton addButton;
|
||||
private JButton duplicateButton;
|
||||
private JButton editButton;
|
||||
private DefaultListModel itemsListmodel;
|
||||
private JList itemsList;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem exitButton;
|
||||
private JButton deleteButton;
|
||||
|
||||
public ItemSelection(String cache) throws IOException {
|
||||
STORE = new Store(cache);
|
||||
this.setTitle("Item Selection");
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
public ItemSelection() {
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.editButton = new JButton();
|
||||
this.addButton = new JButton();
|
||||
this.duplicateButton = new JButton();
|
||||
this.deleteButton = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.exitButton = new JMenuItem();
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.itemsListmodel = new DefaultListModel();
|
||||
this.itemsList = new JList(this.itemsListmodel);
|
||||
this.itemsList.setSelectionMode(1);
|
||||
this.itemsList.setLayoutOrientation(0);
|
||||
this.itemsList.setVisibleRowCount(-1);
|
||||
JScrollPane jScrollPane1 = new JScrollPane(this.itemsList);
|
||||
this.editButton.setText("Edit");
|
||||
this.editButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
new ItemEditor(ItemSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.addButton.setText("Add New");
|
||||
this.addButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ItemDefinitions defs = new ItemDefinitions(ItemSelection.STORE, ItemSelection.this.getNewItemID(), false);
|
||||
if(defs != null && defs.id != -1) {
|
||||
new ItemEditor(ItemSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.duplicateButton.setText("Duplicate");
|
||||
this.duplicateButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
defs = (ItemDefinitions)defs.clone();
|
||||
if(defs != null) {
|
||||
defs.id = ItemSelection.this.getNewItemID();
|
||||
if(defs.id != -1) {
|
||||
new ItemEditor(ItemSelection.this, defs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.deleteButton.setText("Delete");
|
||||
this.deleteButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ItemDefinitions defs = (ItemDefinitions)ItemSelection.this.itemsList.getSelectedValue();
|
||||
JFrame frame = new JFrame();
|
||||
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete item " + defs.id);
|
||||
if(result == 0) {
|
||||
if(defs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
|
||||
ItemSelection.this.removeItemDefs(defs);
|
||||
Main.log("ItemSelection", "Item " + defs.id + " removed.");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.jMenu1.setText("File");
|
||||
this.exitButton.setText("Close");
|
||||
this.exitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ItemSelection.this.exitButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exitButton);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
|
||||
this.pack();
|
||||
this.addAllItems();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
STORE = new Store("cache/", false);
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new ItemSelection()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void exitButtonActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public int getNewItemID() {
|
||||
try {
|
||||
JFrame var3 = new JFrame();
|
||||
String parent1 = JOptionPane.showInputDialog(var3, "Enter new Item ID:");
|
||||
return Integer.parseInt(parent1.toString());
|
||||
} catch (Exception var31) {
|
||||
JFrame parent = new JFrame();
|
||||
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
|
||||
Main.log("ItemSelection", "Non-valid character entered for new Item ID");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllItems() {
|
||||
int id;
|
||||
if(Utils.getItemDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE) - 22314; ++id) {
|
||||
this.addItemDefs(ItemDefinitions.getItemDefinition(STORE, id));
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getItemDefinitionsSize(STORE); ++id) {
|
||||
this.addItemDefs(ItemDefinitions.getItemDefinition(STORE, id));
|
||||
}
|
||||
}
|
||||
|
||||
Main.log("ItemSelection", "All Items Loaded");
|
||||
}
|
||||
|
||||
public void addItemDefs(final ItemDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ItemSelection.this.itemsListmodel.addElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateItemDefs(final ItemDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
int index = ItemSelection.this.itemsListmodel.indexOf(defs);
|
||||
if(index == -1) {
|
||||
ItemSelection.this.itemsListmodel.addElement(defs);
|
||||
} else {
|
||||
ItemSelection.this.itemsListmodel.setElementAt(defs, index);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeItemDefs(final ItemDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ItemSelection.this.itemsListmodel.removeElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.editor.model;
|
||||
|
||||
import com.alex.store.Index;
|
||||
import com.alex.store.Store;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ModelDumper {
|
||||
private static Store STORE;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
try {
|
||||
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
|
||||
} catch (Exception var4) {
|
||||
;
|
||||
}
|
||||
|
||||
Index index = STORE.getIndexes()[7];
|
||||
System.out.println(index.getLastArchiveId());
|
||||
|
||||
for(int i = 0; i < index.getLastArchiveId(); ++i) {
|
||||
byte[] data = index.getFile(i);
|
||||
if(data != null) {
|
||||
writeFile(data, "C:/Users/Travis/Documents/781 Models/" + i + ".dat");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void writeFile(byte[] data, String fileName) throws IOException {
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
out.write(data);
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
package com.editor.model;
|
||||
|
||||
import com.alex.store.Store;
|
||||
import com.editor.Main;
|
||||
import com.editor.Utils;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import javax.swing.UIManager.LookAndFeelInfo;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class MultiModelPacker extends JFrame {
|
||||
private static final long serialVersionUID = -1984870962939167633L;
|
||||
private static Store STORE;
|
||||
private JMenuItem exit;
|
||||
private JLabel jLabel1;
|
||||
private JLabel jLabel2;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem modelDir;
|
||||
private JTextField modelDirField;
|
||||
private JCheckBox sameId;
|
||||
private JButton submit;
|
||||
|
||||
public MultiModelPacker() {
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
public MultiModelPacker(String cache) {
|
||||
try {
|
||||
STORE = new Store(cache);
|
||||
} catch (Exception var3) {
|
||||
Main.log("MultiModelPacker", "Cannot find cache directory");
|
||||
}
|
||||
|
||||
this.initComponents();
|
||||
this.setResizable(false);
|
||||
this.setTitle("MultiModelPacker");
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.jLabel1 = new JLabel();
|
||||
this.jLabel2 = new JLabel();
|
||||
this.modelDirField = new JTextField();
|
||||
this.sameId = new JCheckBox();
|
||||
this.submit = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.modelDir = new JMenuItem();
|
||||
this.exit = new JMenuItem();
|
||||
this.setDefaultCloseOperation(3);
|
||||
this.jLabel1.setText("Multiple Model Packer");
|
||||
this.jLabel2.setText("Models Directory");
|
||||
this.sameId.setText("Keep Same ID");
|
||||
this.sameId.setToolTipText("Keeps same ID as named");
|
||||
this.submit.setText("Submit");
|
||||
this.submit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
MultiModelPacker.this.submitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.setText("File");
|
||||
this.modelDir.setText("Choose Model Dir");
|
||||
this.modelDir.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
MultiModelPacker.this.modelDirActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.modelDir);
|
||||
this.exit.setText("Exit");
|
||||
this.exit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
MultiModelPacker.this.exitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exit);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.modelDirField).addContainerGap()).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED, 4, -2).addComponent(this.jLabel2)).addComponent(this.sameId))).addGroup(layout.createSequentialGroup().addGap(77, 77, 77).addComponent(this.jLabel1)).addGroup(layout.createSequentialGroup().addGap(101, 101, 101).addComponent(this.submit))).addGap(0, 76, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.jLabel2).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelDirField, -2, -1, -2).addGap(18, 18, 18).addComponent(this.sameId).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.submit).addContainerGap(20, 32767)));
|
||||
this.pack();
|
||||
}
|
||||
|
||||
private void submitActionPerformed(ActionEvent evt) {
|
||||
String directory = this.modelDirField.getText();
|
||||
boolean keepID = this.sameId.isSelected();
|
||||
String fileName;
|
||||
if(keepID) {
|
||||
fileName = "";
|
||||
String var12 = "";
|
||||
File var13 = new File(directory);
|
||||
File[] var14 = var13.listFiles();
|
||||
|
||||
for(int var10 = 0; var10 < var14.length; ++var10) {
|
||||
if(var14[var10].isFile()) {
|
||||
System.out.println(var14[var10]);
|
||||
fileName = var14[var10].getName();
|
||||
var12 = var14[var10].getName().replace(".dat", "");
|
||||
|
||||
try {
|
||||
Main.log("MultiModelPacker", "The model ID of " + fileName + " is: " + Utils.packCustomModel(STORE, Utils.getBytesFromFile(var14[var10]), Integer.parseInt(var12)));
|
||||
} catch (IOException var11) {
|
||||
Main.log("MultiModelPacker", "There was an error packing the model.");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
fileName = "";
|
||||
File var121 = new File(directory);
|
||||
File[] var131 = var121.listFiles();
|
||||
|
||||
for(int var141 = 0; var141 < var131.length; ++var141) {
|
||||
if(var131[var141].isFile()) {
|
||||
fileName = var131[var141].getName();
|
||||
|
||||
try {
|
||||
Main.log("MultiModelPacker", "The model ID of " + fileName + " is: " + Utils.packCustomModel(STORE, Utils.getBytesFromFile(var131[var141])));
|
||||
} catch (IOException var101) {
|
||||
Main.log("MultiModelPacker", "There was an error packing the model.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void modelDirActionPerformed(ActionEvent evt) {
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setFileSelectionMode(1);
|
||||
if(evt.getSource() == this.modelDir) {
|
||||
int returnVal = fc.showOpenDialog(this);
|
||||
if(returnVal == 0) {
|
||||
File file = fc.getSelectedFile();
|
||||
this.modelDirField.setText(file.getPath() + "/");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void exitActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
LookAndFeelInfo[] var8 = UIManager.getInstalledLookAndFeels();
|
||||
int len$ = var8.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
LookAndFeelInfo info = var8[i$];
|
||||
if("Nimbus".equals(info.getName())) {
|
||||
UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException var5) {
|
||||
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var5);
|
||||
} catch (InstantiationException var6) {
|
||||
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var6);
|
||||
} catch (IllegalAccessException var7) {
|
||||
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var7);
|
||||
} catch (UnsupportedLookAndFeelException var81) {
|
||||
Logger.getLogger(MultiModelPacker.class.getName()).log(Level.SEVERE, (String)null, var81);
|
||||
}
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new MultiModelPacker()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.editor.model;
|
||||
|
||||
import com.alex.store.Index;
|
||||
import com.alex.store.Store;
|
||||
import com.editor.Main;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import javax.swing.UIManager.LookAndFeelInfo;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class UniModelDumper extends JFrame {
|
||||
private static final long serialVersionUID = 433437706015594462L;
|
||||
private static Store STORE;
|
||||
private JMenu exit;
|
||||
private JLabel jLabel1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem jMenuItem1;
|
||||
private JTextField modelID;
|
||||
private JButton submit;
|
||||
|
||||
public UniModelDumper() {
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
public UniModelDumper(String cache) {
|
||||
try {
|
||||
STORE = new Store(cache);
|
||||
} catch (Exception var3) {
|
||||
Main.log("UniModelDumper", "Cannot find cache directory");
|
||||
}
|
||||
|
||||
this.initComponents();
|
||||
this.setResizable(false);
|
||||
this.setTitle("UniModelDumper");
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.jLabel1 = new JLabel();
|
||||
this.modelID = new JTextField();
|
||||
this.submit = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.exit = new JMenu();
|
||||
this.jMenuItem1 = new JMenuItem();
|
||||
this.setDefaultCloseOperation(3);
|
||||
this.jLabel1.setText("Model ID To Dump:");
|
||||
this.submit.setText("Submit");
|
||||
this.submit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
UniModelDumper.this.submitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.exit.setText("File");
|
||||
this.exit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
UniModelDumper.this.exitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenuItem1.setText("Exit");
|
||||
this.exit.add(this.jMenuItem1);
|
||||
this.jMenuBar1.add(this.exit);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(10, 10, 10).addComponent(this.modelID, -2, 100, -2)).addComponent(this.jLabel1))).addGroup(layout.createSequentialGroup().addGap(32, 32, 32).addComponent(this.submit))).addContainerGap(22, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel1).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelID, -2, -1, -2).addGap(33, 33, 33).addComponent(this.submit).addContainerGap(20, 32767)));
|
||||
this.pack();
|
||||
}
|
||||
|
||||
private void exitActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
private void submitActionPerformed(ActionEvent evt) {
|
||||
File f = new File(System.getProperty("user.home") + "/FCE/models/");
|
||||
f.mkdirs();
|
||||
Index index = STORE.getIndexes()[7];
|
||||
int modelId = Integer.parseInt(this.modelID.getText());
|
||||
|
||||
try {
|
||||
byte[] var6 = index.getFile(modelId);
|
||||
writeFile(var6, System.getProperty("user.home") + "/FCE/models/" + modelId + ".dat");
|
||||
Main.log("UniModelDumper", "Dumped Model ID: " + modelId + " to: " + System.getProperty("user.home") + "/FCE/models/" + modelId + ".dat");
|
||||
} catch (IOException var61) {
|
||||
Main.log("UniModelDumper", "Cannot Dump Model");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void writeFile(byte[] data, String fileName) throws IOException {
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
out.write(data);
|
||||
out.close();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
LookAndFeelInfo[] var8 = UIManager.getInstalledLookAndFeels();
|
||||
int len$ = var8.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
LookAndFeelInfo info = var8[i$];
|
||||
if("Nimbus".equals(info.getName())) {
|
||||
UIManager.setLookAndFeel(info.getClassName());
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException var5) {
|
||||
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var5);
|
||||
} catch (InstantiationException var6) {
|
||||
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var6);
|
||||
} catch (IllegalAccessException var7) {
|
||||
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var7);
|
||||
} catch (UnsupportedLookAndFeelException var81) {
|
||||
Logger.getLogger(UniModelDumper.class.getName()).log(Level.SEVERE, (String)null, var81);
|
||||
}
|
||||
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new UniModelDumper()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,361 @@
|
||||
package com.editor.npc;
|
||||
|
||||
import com.alex.loaders.npcs.NPCDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
import com.editor.Main;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
public class NPCDefDump {
|
||||
private static NPCDefinitions defs;
|
||||
private static Store STORE;
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
|
||||
} catch (IOException var2) {
|
||||
System.out.println("Cannot find cache location");
|
||||
}
|
||||
|
||||
int id;
|
||||
if(Utils.getNPCDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 18433; ++id) {
|
||||
defs = NPCDefinitions.getNPCDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE); ++id) {
|
||||
defs = NPCDefinitions.getNPCDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void editorDump(String cache) {
|
||||
try {
|
||||
STORE = new Store(cache);
|
||||
} catch (IOException var2) {
|
||||
Main.log("NPCDefDump", "Cannot find cache location");
|
||||
}
|
||||
|
||||
int id;
|
||||
if(Utils.getNPCDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 15615; ++id) {
|
||||
defs = NPCDefinitions.getNPCDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getNPCDefinitionsSize(STORE); ++id) {
|
||||
defs = NPCDefinitions.getNPCDefinition(STORE, id);
|
||||
dump();
|
||||
Main.log("NPCDefDump", "Dumping NPC " + defs.id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static void dump() {
|
||||
File f = new File(System.getProperty("user.home") + "/FCE/npcs/");
|
||||
f.mkdirs();
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
BufferedWriter writer = null;
|
||||
|
||||
try {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(System.getProperty("user.home") + "/FCE/npcs/" + defs.id + ".txt"), "utf-8"));
|
||||
writer.write("name = " + defs.getName());
|
||||
writer.write(lineSep);
|
||||
writer.write("combat level = " + defs.getCombatLevel());
|
||||
writer.write(lineSep);
|
||||
writer.write("isVisibleOnMap = " + defs.isVisibleOnMap);
|
||||
writer.write(lineSep);
|
||||
writer.write("height = " + defs.npcHeight);
|
||||
writer.write(lineSep);
|
||||
writer.write("width = " + defs.npcWidth);
|
||||
writer.write(lineSep);
|
||||
writer.write("walk mask = " + defs.walkMask);
|
||||
writer.write(lineSep);
|
||||
writer.write("respawn direction = " + defs.respawnDirection);
|
||||
writer.write(lineSep);
|
||||
writer.write("render emote = " + defs.renderEmote);
|
||||
writer.write(lineSep);
|
||||
writer.write("model ids = " + getModelIds());
|
||||
writer.write(lineSep);
|
||||
writer.write("chat head model ids = " + getChatHeads());
|
||||
writer.write(lineSep);
|
||||
writer.write("options = " + getOpts());
|
||||
writer.write(lineSep);
|
||||
writer.write("model colors = " + getChangedModelColors());
|
||||
writer.write(lineSep);
|
||||
writer.write("texture colors = " + getChangedTextureColors());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown array1 = " + getUnknownArray1());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown array2 = " + getUnknownArray2());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown array3 = " + getUnknownArray3());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown array4 = " + getUnknownArray4());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown array5 = " + getUnknownArray5());
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean1 = " + defs.unknownBoolean1);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknwonBoolean2 = " + defs.unknownBoolean2);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean3 = " + defs.unknownBoolean3);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean4 = " + defs.unknownBoolean5);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean5 = " + defs.unknownBoolean4);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean6 = " + defs.unknownBoolean6);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknownBoolean7 = " + defs.unknownBoolean7);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int1 = " + defs.unknownInt1);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int2 = " + defs.unknownInt2);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int3 = " + defs.unknownInt3);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int4 = " + defs.unknownInt4);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int5 = " + defs.unknownInt5);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int6 = " + defs.unknownInt6);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int7 = " + defs.unknownInt7);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int8 = " + defs.unknownInt8);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int9 = " + defs.unknownInt9);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int10 = " + defs.unknownInt10);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int11 = " + defs.unknownInt11);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int12 = " + defs.unknownInt12);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int13 = " + defs.unknownInt13);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int14 = " + defs.unknownInt14);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int15 = " + defs.unknownInt15);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int16 = " + defs.unknownInt16);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int17 = " + defs.unknownInt17);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int18 = " + defs.unknownInt18);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int19 = " + defs.unknownInt19);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int20 = " + defs.unknownInt20);
|
||||
writer.write(lineSep);
|
||||
writer.write("unknown int21 = " + defs.unknownInt21);
|
||||
writer.write(lineSep);
|
||||
writer.write("Clientscripts");
|
||||
writer.write(lineSep);
|
||||
if(defs.clientScriptData != null) {
|
||||
Iterator var14 = defs.clientScriptData.keySet().iterator();
|
||||
|
||||
while(var14.hasNext()) {
|
||||
int key = ((Integer)var14.next()).intValue();
|
||||
Object value = defs.clientScriptData.get(Integer.valueOf(key));
|
||||
writer.write("KEY: " + key + ", VALUE: " + value);
|
||||
writer.write(lineSep);
|
||||
}
|
||||
}
|
||||
} catch (IOException var141) {
|
||||
Main.log("NPCDefDump", "Failed to export NPC Defs to .txt");
|
||||
} finally {
|
||||
try {
|
||||
writer.close();
|
||||
} catch (Exception var13) {
|
||||
;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static String getClientScripts() {
|
||||
String text = "";
|
||||
String lineSep = System.getProperty("line.separator");
|
||||
if(defs.clientScriptData != null) {
|
||||
for(Iterator i$ = defs.clientScriptData.keySet().iterator(); i$.hasNext(); text = text + lineSep) {
|
||||
int key = ((Integer)i$.next()).intValue();
|
||||
Object value = defs.clientScriptData.get(Integer.valueOf(key));
|
||||
text = text + "KEY: " + key + ", VALUE: " + value;
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getModelIds() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.modelIds;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getOpts() {
|
||||
String text = "";
|
||||
String[] arr$ = defs.getOptions();
|
||||
int len$ = arr$.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
String option = arr$[i$];
|
||||
text = text + (option == null?"null":option) + ";";
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getChangedModelColors() {
|
||||
String text = "";
|
||||
if(defs.originalModelColors != null) {
|
||||
for(int i = 0; i < defs.originalModelColors.length; ++i) {
|
||||
text = text + defs.originalModelColors[i] + "=" + defs.modifiedModelColors[i] + ";";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getChangedTextureColors() {
|
||||
String text = "";
|
||||
if(defs.originalTextureColors != null) {
|
||||
for(int i = 0; i < defs.originalTextureColors.length; ++i) {
|
||||
text = text + defs.originalTextureColors[i] + "=" + defs.modifiedTextureColors[i] + ";";
|
||||
}
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getChatHeads() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.npcChatHeads;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int id = e[i$];
|
||||
text = text + id + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray1() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
byte[] e = defs.unknownArray1;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
byte index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray2() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray2;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray3() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray3[0];
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray4() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray4;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String getUnknownArray5() {
|
||||
String text = "";
|
||||
|
||||
try {
|
||||
int[] e = defs.unknownArray5;
|
||||
int len$ = e.length;
|
||||
|
||||
for(int i$ = 0; i$ < len$; ++i$) {
|
||||
int index = e[i$];
|
||||
text = text + index + ";";
|
||||
}
|
||||
} catch (Exception var5) {
|
||||
;
|
||||
}
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,38 @@
|
||||
package com.editor.npc;
|
||||
|
||||
import com.alex.loaders.npcs.NPCDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
|
||||
public class NPCListDumper {
|
||||
private static Store STORE;
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
STORE = new Store("C:/Users/Travis/Documents/rscd/data/");
|
||||
File file = new File("C:/Users/Travis/Documents/781 NPCList.txt");
|
||||
if(file.exists()) {
|
||||
file.delete();
|
||||
} else {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.append("//Version = 781\n");
|
||||
writer.flush();
|
||||
|
||||
for(int id = 0; id < Utils.getNPCDefinitionsSize(STORE) - 18433; ++id) {
|
||||
NPCDefinitions def = NPCDefinitions.getNPCDefinition(STORE, id);
|
||||
writer.append(id + " - " + def.name);
|
||||
writer.newLine();
|
||||
System.out.println(id + " - " + def.name);
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.editor.npc;
|
||||
|
||||
import com.alex.loaders.npcs.NPCDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.alex.utils.Utils;
|
||||
import com.editor.Main;
|
||||
import com.editor.npc.NPCEditor;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
public class NPCSelection extends JFrame {
|
||||
private static final long serialVersionUID = -3068337441331467664L;
|
||||
public static Store STORE;
|
||||
private JButton addButton;
|
||||
private JButton duplicateButton;
|
||||
private JButton editButton;
|
||||
private DefaultListModel npcsListmodel;
|
||||
private JList npcsList;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem exitButton;
|
||||
private JButton deleteButton;
|
||||
|
||||
public NPCSelection(String cache) throws IOException {
|
||||
STORE = new Store(cache);
|
||||
this.setTitle("NPC Selection");
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
public NPCSelection() {
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.editButton = new JButton();
|
||||
this.addButton = new JButton();
|
||||
this.duplicateButton = new JButton();
|
||||
this.deleteButton = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.exitButton = new JMenuItem();
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.npcsListmodel = new DefaultListModel();
|
||||
this.npcsList = new JList(this.npcsListmodel);
|
||||
this.npcsList.setSelectionMode(1);
|
||||
this.npcsList.setLayoutOrientation(0);
|
||||
this.npcsList.setVisibleRowCount(-1);
|
||||
JScrollPane jScrollPane1 = new JScrollPane(this.npcsList);
|
||||
this.editButton.setText("Edit");
|
||||
this.editButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
new NPCEditor(NPCSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.addButton.setText("Add New");
|
||||
this.addButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPCDefinitions defs = new NPCDefinitions(NPCSelection.STORE, NPCSelection.this.getNewNPCID(), false);
|
||||
if(defs != null && defs.id != -1) {
|
||||
new NPCEditor(NPCSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.duplicateButton.setText("Duplicate");
|
||||
this.duplicateButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
defs = (NPCDefinitions)defs.clone();
|
||||
if(defs != null) {
|
||||
defs.id = NPCSelection.this.getNewNPCID();
|
||||
if(defs.id != -1) {
|
||||
new NPCEditor(NPCSelection.this, defs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.deleteButton.setText("Delete");
|
||||
this.deleteButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
NPCDefinitions defs = (NPCDefinitions)NPCSelection.this.npcsList.getSelectedValue();
|
||||
JFrame frame = new JFrame();
|
||||
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete item " + defs.id);
|
||||
if(result == 0) {
|
||||
if(defs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
NPCSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
|
||||
NPCSelection.this.removeNPCDefs(defs);
|
||||
Main.log("ItemSelection", "Item " + defs.id + " removed.");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.jMenu1.setText("File");
|
||||
this.exitButton.setText("Close");
|
||||
this.exitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
NPCSelection.this.exitButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exitButton);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
|
||||
this.pack();
|
||||
this.addAllNPCs();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
STORE = new Store("cache/", false);
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new NPCSelection()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void exitButtonActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public int getNewNPCID() {
|
||||
try {
|
||||
JFrame var3 = new JFrame();
|
||||
String parent1 = JOptionPane.showInputDialog(var3, "Enter new NPC ID:");
|
||||
return Integer.parseInt(parent1.toString());
|
||||
} catch (Exception var31) {
|
||||
JFrame parent = new JFrame();
|
||||
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
|
||||
Main.log("NPCSelection", "Non-valid character entered for new NPC ID");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllNPCs() {
|
||||
for(int id = 0; id < Utils.getNPCDefinitionsSize(STORE)/* - 15615*/; ++id) {
|
||||
this.addNPCDefs(NPCDefinitions.getNPCDefinition(STORE, id));
|
||||
}
|
||||
|
||||
Main.log("NPCSelection", "All NPCs Loaded");
|
||||
}
|
||||
|
||||
public void addNPCDefs(final NPCDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
NPCSelection.this.npcsListmodel.addElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateNPCDefs(final NPCDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
int index = NPCSelection.this.npcsListmodel.indexOf(defs);
|
||||
if(index == -1) {
|
||||
NPCSelection.this.npcsListmodel.addElement(defs);
|
||||
} else {
|
||||
NPCSelection.this.npcsListmodel.setElementAt(defs, index);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeNPCDefs(final NPCDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
NPCSelection.this.npcsListmodel.removeElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,457 @@
|
||||
package com.editor.object;
|
||||
|
||||
import com.alex.loaders.objects.ObjectDefinitions;
|
||||
import com.editor.Main;
|
||||
import com.editor.object.ObjectSelection;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ObjectEditor extends JFrame {
|
||||
private ObjectDefinitions defs;
|
||||
private ObjectSelection os;
|
||||
private JTextField ModelOffset1;
|
||||
private JTextField ModelRot2;
|
||||
private JMenuItem addModelMenuBtn;
|
||||
private JTextField array1;
|
||||
private JTextField array2;
|
||||
private JTextField array3;
|
||||
private JTextField array4;
|
||||
private JTextField array5;
|
||||
private JTextField array6;
|
||||
private JTextField csk1;
|
||||
private JTextField csk2;
|
||||
private JTextField csk3;
|
||||
private JTextField csk4;
|
||||
private JTextField csk5;
|
||||
private JTextField csk6;
|
||||
private JTextField csk7;
|
||||
private JTextField csv1;
|
||||
private JTextField csv2;
|
||||
private JTextField csv3;
|
||||
private JTextField csv4;
|
||||
private JTextField csv5;
|
||||
private JTextField csv6;
|
||||
private JTextField csv7;
|
||||
private JLabel currentViewLabel;
|
||||
private JTextField equipSlot;
|
||||
private JTextField equipType;
|
||||
private JMenuItem exitMenuBtn;
|
||||
private JMenuItem exportMenuBtn;
|
||||
private JTextField femaleEquip1;
|
||||
private JTextField femaleEquip2;
|
||||
private JTextField femaleEquip3;
|
||||
private JTextField groundOptions;
|
||||
private JTextField int1;
|
||||
private JTextField int10;
|
||||
private JTextField int11;
|
||||
private JTextField int12;
|
||||
private JTextField int13;
|
||||
private JTextField int14;
|
||||
private JTextField int15;
|
||||
private JTextField int16;
|
||||
private JTextField int17;
|
||||
private JTextField int18;
|
||||
private JTextField int19;
|
||||
private JTextField int2;
|
||||
private JTextField int20;
|
||||
private JTextField int21;
|
||||
private JTextField int22;
|
||||
private JTextField int23;
|
||||
private JTextField int3;
|
||||
private JTextField int4;
|
||||
private JTextField int5;
|
||||
private JTextField int6;
|
||||
private JTextField int7;
|
||||
private JTextField int8;
|
||||
private JTextField int9;
|
||||
private JTextField invModel;
|
||||
private JTextField invModelZoom;
|
||||
private JTextField invOptions;
|
||||
private JTextField objectName;
|
||||
private JLabel jLabel1;
|
||||
private JLabel jLabel10;
|
||||
private JLabel jLabel11;
|
||||
private JLabel jLabel12;
|
||||
private JLabel jLabel13;
|
||||
private JLabel jLabel14;
|
||||
private JLabel jLabel15;
|
||||
private JLabel jLabel16;
|
||||
private JLabel jLabel17;
|
||||
private JLabel jLabel18;
|
||||
private JLabel jLabel19;
|
||||
private JLabel jLabel2;
|
||||
private JLabel jLabel20;
|
||||
private JLabel jLabel21;
|
||||
private JLabel jLabel22;
|
||||
private JLabel jLabel23;
|
||||
private JLabel jLabel24;
|
||||
private JLabel jLabel25;
|
||||
private JLabel jLabel26;
|
||||
private JLabel jLabel27;
|
||||
private JLabel jLabel28;
|
||||
private JLabel jLabel29;
|
||||
private JLabel jLabel3;
|
||||
private JLabel jLabel30;
|
||||
private JLabel jLabel31;
|
||||
private JLabel jLabel32;
|
||||
private JLabel jLabel33;
|
||||
private JLabel jLabel34;
|
||||
private JLabel jLabel35;
|
||||
private JLabel jLabel36;
|
||||
private JLabel jLabel37;
|
||||
private JLabel jLabel38;
|
||||
private JLabel jLabel39;
|
||||
private JLabel jLabel4;
|
||||
private JLabel jLabel40;
|
||||
private JLabel jLabel41;
|
||||
private JLabel jLabel42;
|
||||
private JLabel jLabel43;
|
||||
private JLabel jLabel44;
|
||||
private JLabel jLabel45;
|
||||
private JLabel jLabel46;
|
||||
private JLabel jLabel47;
|
||||
private JLabel jLabel48;
|
||||
private JLabel jLabel49;
|
||||
private JLabel jLabel5;
|
||||
private JLabel jLabel50;
|
||||
private JLabel jLabel51;
|
||||
private JLabel jLabel52;
|
||||
private JLabel jLabel53;
|
||||
private JLabel jLabel54;
|
||||
private JLabel jLabel55;
|
||||
private JLabel jLabel56;
|
||||
private JLabel jLabel57;
|
||||
private JLabel jLabel58;
|
||||
private JLabel jLabel59;
|
||||
private JLabel jLabel6;
|
||||
private JLabel jLabel60;
|
||||
private JLabel jLabel61;
|
||||
private JLabel jLabel7;
|
||||
private JLabel jLabel8;
|
||||
private JLabel jLabel9;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JPanel jPanel1;
|
||||
private JPanel jPanel2;
|
||||
private JPanel jPanel3;
|
||||
private JPanel jPanel5;
|
||||
private JPanel jPanel6;
|
||||
private JPanel jPanel7;
|
||||
private JScrollPane jScrollPane1;
|
||||
private JTabbedPane jTabbedPane1;
|
||||
private JTextField lend;
|
||||
private JTextField maleEquip1;
|
||||
private JTextField maleEquip2;
|
||||
private JTextField maleEquip3;
|
||||
private JCheckBox membersOnly;
|
||||
private JTextField modelColors;
|
||||
private JTextField modelOffset2;
|
||||
private JTextField modelRot1;
|
||||
private JTextField note;
|
||||
private JMenuItem reloadMenuBtn;
|
||||
private JMenuItem saveMenuBtn;
|
||||
private JTextField stackAmts;
|
||||
private JTextField stackIDs;
|
||||
private JTextField stackable;
|
||||
public JTextField switchLend;
|
||||
public JTextField switchNote;
|
||||
public JTextField sizeY;
|
||||
public JTextField textureColors;
|
||||
public JCheckBox unnoted;
|
||||
public JTextField sizeX;
|
||||
|
||||
|
||||
public ObjectEditor(ObjectSelection os, ObjectDefinitions defs) {
|
||||
this.defs = defs;
|
||||
this.os = os;
|
||||
this.initComponents();
|
||||
this.setResizable(false);
|
||||
this.setTitle("Object Editor");
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.setVisible(true);
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.jTabbedPane1 = new JTabbedPane();
|
||||
this.jPanel1 = new JPanel();
|
||||
this.jLabel1 = new JLabel();
|
||||
this.objectName = new JTextField();
|
||||
this.jLabel2 = new JLabel();
|
||||
this.sizeX = new JTextField();
|
||||
this.sizeY = new JTextField();
|
||||
this.jLabel3 = new JLabel();
|
||||
this.membersOnly = new JCheckBox();
|
||||
this.jLabel20 = new JLabel();
|
||||
this.equipSlot = new JTextField();
|
||||
this.jLabel21 = new JLabel();
|
||||
this.equipType = new JTextField();
|
||||
this.jLabel22 = new JLabel();
|
||||
this.stackIDs = new JTextField();
|
||||
this.jLabel23 = new JLabel();
|
||||
this.stackAmts = new JTextField();
|
||||
this.jLabel24 = new JLabel();
|
||||
this.stackable = new JTextField();
|
||||
this.jLabel58 = new JLabel();
|
||||
this.switchNote = new JTextField();
|
||||
this.jLabel59 = new JLabel();
|
||||
this.note = new JTextField();
|
||||
this.unnoted = new JCheckBox();
|
||||
this.jLabel60 = new JLabel();
|
||||
this.jLabel61 = new JLabel();
|
||||
this.switchLend = new JTextField();
|
||||
this.lend = new JTextField();
|
||||
this.jPanel2 = new JPanel();
|
||||
this.jLabel4 = new JLabel();
|
||||
this.invModelZoom = new JTextField();
|
||||
this.jLabel5 = new JLabel();
|
||||
this.modelRot1 = new JTextField();
|
||||
this.jLabel6 = new JLabel();
|
||||
this.ModelRot2 = new JTextField();
|
||||
this.jLabel7 = new JLabel();
|
||||
this.ModelOffset1 = new JTextField();
|
||||
this.jLabel8 = new JLabel();
|
||||
this.modelOffset2 = new JTextField();
|
||||
this.jLabel9 = new JLabel();
|
||||
this.invModel = new JTextField();
|
||||
this.jLabel10 = new JLabel();
|
||||
this.maleEquip1 = new JTextField();
|
||||
this.jLabel11 = new JLabel();
|
||||
this.femaleEquip1 = new JTextField();
|
||||
this.jLabel12 = new JLabel();
|
||||
this.maleEquip2 = new JTextField();
|
||||
this.jLabel13 = new JLabel();
|
||||
this.femaleEquip2 = new JTextField();
|
||||
this.jLabel14 = new JLabel();
|
||||
this.maleEquip3 = new JTextField();
|
||||
this.jLabel15 = new JLabel();
|
||||
this.femaleEquip3 = new JTextField();
|
||||
this.jPanel3 = new JPanel();
|
||||
this.jLabel16 = new JLabel();
|
||||
this.invOptions = new JTextField();
|
||||
this.jLabel17 = new JLabel();
|
||||
this.groundOptions = new JTextField();
|
||||
this.jLabel18 = new JLabel();
|
||||
this.modelColors = new JTextField();
|
||||
this.jLabel19 = new JLabel();
|
||||
this.textureColors = new JTextField();
|
||||
this.jPanel5 = new JPanel();
|
||||
this.jLabel25 = new JLabel();
|
||||
this.array1 = new JTextField();
|
||||
this.jLabel27 = new JLabel();
|
||||
this.jLabel28 = new JLabel();
|
||||
this.jLabel29 = new JLabel();
|
||||
this.jLabel30 = new JLabel();
|
||||
this.jLabel31 = new JLabel();
|
||||
this.array2 = new JTextField();
|
||||
this.array3 = new JTextField();
|
||||
this.array4 = new JTextField();
|
||||
this.array5 = new JTextField();
|
||||
this.array6 = new JTextField();
|
||||
this.jLabel32 = new JLabel();
|
||||
this.int1 = new JTextField();
|
||||
this.int2 = new JTextField();
|
||||
this.jLabel33 = new JLabel();
|
||||
this.jLabel34 = new JLabel();
|
||||
this.int3 = new JTextField();
|
||||
this.jLabel35 = new JLabel();
|
||||
this.int4 = new JTextField();
|
||||
this.jLabel36 = new JLabel();
|
||||
this.int5 = new JTextField();
|
||||
this.jLabel37 = new JLabel();
|
||||
this.int6 = new JTextField();
|
||||
this.jLabel38 = new JLabel();
|
||||
this.int7 = new JTextField();
|
||||
this.jLabel39 = new JLabel();
|
||||
this.int8 = new JTextField();
|
||||
this.jLabel40 = new JLabel();
|
||||
this.int9 = new JTextField();
|
||||
this.jLabel41 = new JLabel();
|
||||
this.int10 = new JTextField();
|
||||
this.jLabel42 = new JLabel();
|
||||
this.int11 = new JTextField();
|
||||
this.jLabel43 = new JLabel();
|
||||
this.int12 = new JTextField();
|
||||
this.jLabel44 = new JLabel();
|
||||
this.int13 = new JTextField();
|
||||
this.jLabel45 = new JLabel();
|
||||
this.int14 = new JTextField();
|
||||
this.jPanel6 = new JPanel();
|
||||
this.jLabel46 = new JLabel();
|
||||
this.int15 = new JTextField();
|
||||
this.jLabel47 = new JLabel();
|
||||
this.int16 = new JTextField();
|
||||
this.jLabel48 = new JLabel();
|
||||
this.int17 = new JTextField();
|
||||
this.jLabel49 = new JLabel();
|
||||
this.int18 = new JTextField();
|
||||
this.jLabel50 = new JLabel();
|
||||
this.int19 = new JTextField();
|
||||
this.jLabel51 = new JLabel();
|
||||
this.int20 = new JTextField();
|
||||
this.jLabel52 = new JLabel();
|
||||
this.int21 = new JTextField();
|
||||
this.jLabel53 = new JLabel();
|
||||
this.int22 = new JTextField();
|
||||
this.jLabel54 = new JLabel();
|
||||
this.int23 = new JTextField();
|
||||
this.jPanel7 = new JPanel();
|
||||
this.jScrollPane1 = new JScrollPane();
|
||||
this.jLabel26 = new JLabel();
|
||||
this.jLabel55 = new JLabel();
|
||||
this.jLabel56 = new JLabel();
|
||||
this.jLabel57 = new JLabel();
|
||||
this.csk1 = new JTextField();
|
||||
this.csk2 = new JTextField();
|
||||
this.csk3 = new JTextField();
|
||||
this.csk4 = new JTextField();
|
||||
this.csk5 = new JTextField();
|
||||
this.csk6 = new JTextField();
|
||||
this.csk7 = new JTextField();
|
||||
this.csv1 = new JTextField();
|
||||
this.csv2 = new JTextField();
|
||||
this.csv3 = new JTextField();
|
||||
this.csv4 = new JTextField();
|
||||
this.csv5 = new JTextField();
|
||||
this.csv6 = new JTextField();
|
||||
this.csv7 = new JTextField();
|
||||
this.currentViewLabel = new JLabel();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.reloadMenuBtn = new JMenuItem();
|
||||
this.saveMenuBtn = new JMenuItem();
|
||||
this.addModelMenuBtn = new JMenuItem();
|
||||
this.exportMenuBtn = new JMenuItem();
|
||||
this.exitMenuBtn = new JMenuItem();
|
||||
this.setDefaultCloseOperation(3);
|
||||
this.jLabel1.setText("Name");
|
||||
this.objectName.setText("" + this.defs.name);
|
||||
this.jLabel2.setText("Size X");
|
||||
this.sizeX.setText("" + this.defs.sizeX);
|
||||
this.sizeY.setText("" + this.defs.sizeY);
|
||||
this.jLabel3.setText("Size Y");
|
||||
this.membersOnly.setSelected(true);
|
||||
this.membersOnly.setText("Projectile Clipped");
|
||||
this.jLabel20.setText("Animation");
|
||||
this.equipSlot.setText("");
|
||||
this.jLabel21.setText("Equip Type");
|
||||
this.equipType.setText("");
|
||||
this.jLabel22.setText("ConfigFileID");
|
||||
this.stackIDs.setText("");
|
||||
this.jLabel23.setText("ConfigID");
|
||||
this.stackAmts.setText("");
|
||||
this.jLabel24.setText("Clip Type");
|
||||
this.stackable.setText("");
|
||||
this.jLabel58.setText("Switch Note Item ID");
|
||||
this.switchNote.setText("");
|
||||
this.jLabel59.setText("Noted Item ID");
|
||||
this.note.setText("");
|
||||
this.unnoted.setSelected(true);
|
||||
this.unnoted.setText("Unnoted");
|
||||
this.jLabel60.setText("Switch Lend Item ID");
|
||||
this.jLabel61.setText("Lent Item ID");
|
||||
this.switchLend.setText("");
|
||||
this.lend.setText("");
|
||||
GroupLayout jPanel1Layout = new GroupLayout(this.jPanel1);
|
||||
this.jPanel1.setLayout(jPanel1Layout);
|
||||
jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.unnoted).addComponent(this.membersOnly).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel20).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.equipSlot, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel1).addGap(18, 18, 18).addComponent(this.objectName, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel2).addComponent(this.jLabel3)).addGap(18, 18, 18).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.sizeY, -2, 100, -2).addComponent(this.sizeX, -2, 100, -2))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel24).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.stackable, -2, 100, -2))).addGap(126, 126, 126).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.stackAmts, -2, 300, -2).addComponent(this.stackIDs, -2, 300, -2).addComponent(this.jLabel22).addComponent(this.jLabel23))).addGroup(jPanel1Layout.createSequentialGroup().addComponent(this.jLabel21).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.equipType, -2, 100, -2)).addGroup(jPanel1Layout.createSequentialGroup().addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel58).addComponent(this.jLabel59)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING, false).addComponent(this.switchNote, -1, 100, 32767).addComponent(this.note)).addGap(18, 18, 18).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel60).addComponent(this.jLabel61)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING, false).addComponent(this.switchLend, -1, 100, 32767).addComponent(this.lend)))).addContainerGap(36, 32767)));
|
||||
jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createSequentialGroup().addContainerGap().addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel1).addComponent(this.objectName, -2, -1, -2).addComponent(this.jLabel22)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.sizeX, -2, -1, -2).addComponent(this.jLabel2)).addComponent(this.stackIDs, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.sizeY, -2, -1, -2).addComponent(this.jLabel3).addComponent(this.jLabel23)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING).addComponent(this.stackAmts, -2, -1, -2).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel24).addComponent(this.stackable, -2, -1, -2))).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.membersOnly).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel20).addComponent(this.equipSlot, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel21).addComponent(this.equipType, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel58).addComponent(this.switchNote, -2, -1, -2).addComponent(this.jLabel60).addComponent(this.switchLend, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel59).addComponent(this.note, -2, -1, -2).addComponent(this.jLabel61).addComponent(this.lend, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.unnoted).addContainerGap(13, 32767)));
|
||||
this.jTabbedPane1.addTab("General", this.jPanel1);
|
||||
this.jLabel4.setText("Inventory Model Zoom");
|
||||
this.invModelZoom.setText("");
|
||||
this.jLabel5.setText("Model Rotation 1");
|
||||
this.modelRot1.setText("");
|
||||
this.jLabel6.setText("Model Rotation 2");
|
||||
this.ModelRot2.setText("");
|
||||
this.jLabel7.setText("Model Offset 1");
|
||||
this.ModelOffset1.setText("");
|
||||
this.jLabel8.setText("Model Offset 2");
|
||||
this.modelOffset2.setText("");
|
||||
this.jLabel9.setText("Inventory Model");
|
||||
this.invModel.setText("");
|
||||
this.jLabel10.setText("Male Equip 1");
|
||||
this.maleEquip1.setText("");
|
||||
this.jLabel11.setText("Female Equip 1");
|
||||
this.femaleEquip1.setText("");
|
||||
this.jLabel12.setText("Male Equip 2");
|
||||
this.maleEquip2.setText("");
|
||||
this.jLabel13.setText("Female Equip 2");
|
||||
this.femaleEquip2.setText("");
|
||||
this.jLabel14.setText("Male Equip 3");
|
||||
this.maleEquip3.setText("");
|
||||
this.jLabel15.setText("Female Equip 3");
|
||||
this.femaleEquip3.setText("");
|
||||
GroupLayout jPanel2Layout = new GroupLayout(this.jPanel2);
|
||||
this.jPanel2.setLayout(jPanel2Layout);
|
||||
jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING, false).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel7).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.ModelOffset1, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel4).addComponent(this.jLabel5).addComponent(this.jLabel6)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.ModelRot2, -2, 100, -2).addComponent(this.modelRot1, -2, 100, -2).addComponent(this.invModelZoom, -2, 100, -2))).addGroup(Alignment.TRAILING, jPanel2Layout.createSequentialGroup().addComponent(this.jLabel8).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.modelOffset2, -2, 100, -2))).addGap(114, 114, 114).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel15).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.femaleEquip3, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel9).addComponent(this.jLabel10)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.maleEquip1, -2, 100, -2).addComponent(this.invModel, -2, 100, -2))).addGroup(jPanel2Layout.createSequentialGroup().addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel11).addComponent(this.jLabel12)).addPreferredGap(ComponentPlacement.UNRELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.maleEquip2, -2, 100, -2).addComponent(this.femaleEquip1, -2, 100, -2))).addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING, false).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel14).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.maleEquip3, -2, 100, -2)).addGroup(jPanel2Layout.createSequentialGroup().addComponent(this.jLabel13).addPreferredGap(ComponentPlacement.UNRELATED).addComponent(this.femaleEquip2, -2, 100, -2)))).addContainerGap(103, 32767)));
|
||||
jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel4).addComponent(this.invModelZoom, -2, -1, -2).addComponent(this.jLabel9).addComponent(this.invModel, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel5).addComponent(this.modelRot1, -2, -1, -2).addComponent(this.jLabel10).addComponent(this.maleEquip1, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel6).addComponent(this.ModelRot2, -2, -1, -2).addComponent(this.jLabel11).addComponent(this.femaleEquip1, -2, -1, -2)).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel2Layout.createSequentialGroup().addGap(9, 9, 9).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel7).addComponent(this.ModelOffset1, -2, -1, -2).addComponent(this.jLabel12)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.TRAILING).addComponent(this.jLabel8).addComponent(this.modelOffset2, -2, -1, -2).addGroup(Alignment.LEADING, jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel13).addComponent(this.femaleEquip2, -2, -1, -2)))).addGroup(jPanel2Layout.createSequentialGroup().addPreferredGap(ComponentPlacement.RELATED).addComponent(this.maleEquip2, -2, -1, -2))).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.BASELINE).addComponent(this.jLabel14).addComponent(this.maleEquip3, -2, -1, -2)).addPreferredGap(ComponentPlacement.RELATED).addGroup(jPanel2Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel15).addComponent(this.femaleEquip3, -2, -1, -2)).addContainerGap(82, 32767)));
|
||||
this.jTabbedPane1.addTab("Model", this.jPanel2);
|
||||
this.jLabel16.setText("Inventory Options");
|
||||
this.invOptions.setText("riggg");
|
||||
this.jLabel17.setText("Ground Options");
|
||||
this.groundOptions.setText("44");
|
||||
this.jLabel18.setText("Model Colors");
|
||||
this.modelColors.setText("1");
|
||||
this.jLabel19.setText("Texture Colors");
|
||||
this.textureColors.setText("2");
|
||||
GroupLayout jPanel3Layout = new GroupLayout(this.jPanel3);
|
||||
this.jPanel3.setLayout(jPanel3Layout);
|
||||
jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addComponent(this.jLabel16).addComponent(this.invOptions, -2, 300, -2).addComponent(this.jLabel17).addComponent(this.groundOptions, -2, 300, -2).addComponent(this.jLabel18).addComponent(this.modelColors, -2, 300, -2).addComponent(this.jLabel19).addComponent(this.textureColors, -2, 300, -2)).addContainerGap(312, 32767)));
|
||||
jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(Alignment.LEADING).addGroup(jPanel3Layout.createSequentialGroup().addContainerGap().addComponent(this.jLabel16).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.invOptions, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel17).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.groundOptions, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel18).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.modelColors, -2, -1, -2).addGap(18, 18, 18).addComponent(this.jLabel19).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.textureColors, -2, -1, -2).addContainerGap(47, 32767)));
|
||||
this.jTabbedPane1.addTab("Options", this.jPanel3);
|
||||
this.currentViewLabel.setText("Currently Viewing Definitions of Object: " + this.defs.id + " - " + defs.name);
|
||||
this.jMenu1.setText("File");
|
||||
this.reloadMenuBtn.setText("Reload");
|
||||
this.reloadMenuBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ObjectEditor.this.reloadMenuBtnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.reloadMenuBtn);
|
||||
this.saveMenuBtn.setText("Save");
|
||||
this.saveMenuBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ObjectEditor.this.saveMenuBtnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.saveMenuBtn);
|
||||
this.exitMenuBtn.setText("Exit");
|
||||
this.exitMenuBtn.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ObjectEditor.this.exitMenuBtnActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exitMenuBtn);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addComponent(this.jTabbedPane1).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(this.currentViewLabel).addContainerGap(-1, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(Alignment.TRAILING, layout.createSequentialGroup().addGap(0, 11, 32767).addComponent(this.currentViewLabel).addPreferredGap(ComponentPlacement.RELATED).addComponent(this.jTabbedPane1, -2, 300, -2)));
|
||||
this.pack();
|
||||
}
|
||||
|
||||
private void save() {
|
||||
try {
|
||||
this.defs.setName(this.objectName.getText().toString());
|
||||
} catch (Exception var201) {
|
||||
Main.log("ObjectEditor", "Cannot save. Please check for mistypes.");
|
||||
}
|
||||
}
|
||||
|
||||
private void saveMenuBtnActionPerformed(ActionEvent evt) {
|
||||
this.save();
|
||||
}
|
||||
|
||||
private void reloadMenuBtnActionPerformed(ActionEvent evt) {
|
||||
this.objectName.setText(this.defs.getName());
|
||||
this.sizeX.setText("" + this.defs.sizeX);
|
||||
}
|
||||
|
||||
private void exitMenuBtnActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.editor.object;
|
||||
|
||||
import com.alex.loaders.objects.ObjectDefinitions;
|
||||
import com.alex.store.Store;
|
||||
import com.editor.Main;
|
||||
import com.editor.object.ObjectEditor;
|
||||
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
public class ObjectSelection extends JFrame {
|
||||
private static final long serialVersionUID = -3068337441331467664L;
|
||||
public static Store STORE;
|
||||
private JButton addButton;
|
||||
private JButton duplicateButton;
|
||||
private JButton editButton;
|
||||
private DefaultListModel objectsListmodel;
|
||||
private JList objectsList;
|
||||
private JMenu jMenu1;
|
||||
private JMenuBar jMenuBar1;
|
||||
private JMenuItem exitButton;
|
||||
private JButton deleteButton;
|
||||
|
||||
public ObjectSelection(String cache) throws IOException {
|
||||
STORE = new Store(cache);
|
||||
this.setTitle("Object Selection");
|
||||
this.setResizable(false);
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.setLocationRelativeTo((Component)null);
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
public ObjectSelection() {
|
||||
this.initComponents();
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
this.editButton = new JButton();
|
||||
this.addButton = new JButton();
|
||||
this.duplicateButton = new JButton();
|
||||
this.deleteButton = new JButton();
|
||||
this.jMenuBar1 = new JMenuBar();
|
||||
this.jMenu1 = new JMenu();
|
||||
this.exitButton = new JMenuItem();
|
||||
this.setDefaultCloseOperation(1);
|
||||
this.objectsListmodel = new DefaultListModel();
|
||||
this.objectsList = new JList(this.objectsListmodel);
|
||||
this.objectsList.setSelectionMode(1);
|
||||
this.objectsList.setLayoutOrientation(0);
|
||||
this.objectsList.setVisibleRowCount(-1);
|
||||
JScrollPane jScrollPane1 = new JScrollPane(this.objectsList);
|
||||
this.editButton.setText("Edit");
|
||||
this.editButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
new ObjectEditor(ObjectSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.addButton.setText("Add New");
|
||||
this.addButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ObjectDefinitions defs = new ObjectDefinitions(ObjectSelection.STORE, ObjectSelection.this.getNewObjectID(), false);
|
||||
if(defs != null && defs.id != -1) {
|
||||
new ObjectEditor(ObjectSelection.this, defs);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.duplicateButton.setText("Duplicate");
|
||||
this.duplicateButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
|
||||
if(defs != null) {
|
||||
// defs = (ObjectDefinitions)defs.clone();
|
||||
if(defs != null) {
|
||||
defs.id = ObjectSelection.this.getNewObjectID();
|
||||
if(defs.id != -1) {
|
||||
new ObjectEditor(ObjectSelection.this, defs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.deleteButton.setText("Delete");
|
||||
this.deleteButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ObjectDefinitions defs = (ObjectDefinitions)ObjectSelection.this.objectsList.getSelectedValue();
|
||||
JFrame frame = new JFrame();
|
||||
int result = JOptionPane.showConfirmDialog(frame, "Do you really want to delete Object " + defs.id);
|
||||
if(result == 0) {
|
||||
if(defs == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectSelection.STORE.getIndexes()[19].removeFile(defs.getArchiveId(), defs.getFileId());
|
||||
ObjectSelection.this.removeObjectDefs(defs);
|
||||
Main.log("ObjectSelection", "Object " + defs.id + " removed.");
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.jMenu1.setText("File");
|
||||
this.exitButton.setText("Close");
|
||||
this.exitButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent evt) {
|
||||
ObjectSelection.this.exitButtonActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
this.jMenu1.add(this.exitButton);
|
||||
this.jMenuBar1.add(this.jMenu1);
|
||||
this.setJMenuBar(this.jMenuBar1);
|
||||
GroupLayout layout = new GroupLayout(this.getContentPane());
|
||||
this.getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(Alignment.LEADING, false).addComponent(jScrollPane1, -2, 200, -2).addGroup(layout.createSequentialGroup().addComponent(this.editButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.addButton))).addGap(0, 0, 32767)).addGroup(layout.createSequentialGroup().addComponent(this.duplicateButton).addPreferredGap(ComponentPlacement.RELATED, -1, 32767).addComponent(this.deleteButton))).addContainerGap(-1, 32767)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(jScrollPane1, -2, 279, -2).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.editButton).addComponent(this.addButton)).addPreferredGap(ComponentPlacement.RELATED).addGroup(layout.createParallelGroup(Alignment.BASELINE).addComponent(this.duplicateButton).addComponent(this.deleteButton)).addContainerGap(-1, 32767)));
|
||||
this.pack();
|
||||
this.addAllObjects();
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
STORE = new Store("cache/", false);
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
(new ObjectSelection()).setVisible(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void exitButtonActionPerformed(ActionEvent evt) {
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
public int getNewObjectID() {
|
||||
try {
|
||||
JFrame var3 = new JFrame();
|
||||
String parent1 = JOptionPane.showInputDialog(var3, "Enter new Object ID:");
|
||||
return Integer.parseInt(parent1.toString());
|
||||
} catch (Exception var31) {
|
||||
JFrame parent = new JFrame();
|
||||
JOptionPane.showMessageDialog(parent, "Please enter a valid integer!");
|
||||
Main.log("ObjectSelection", "Non-valid character entered for new Object ID");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public void addAllObjects() {
|
||||
for(int id = 36770; id < /*Utils.getObjectDefinitionsSize(STORE)*/36773; ++id) {
|
||||
addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
|
||||
}
|
||||
|
||||
Main.log("ObjectSelection", "All Objects Loaded");
|
||||
}
|
||||
|
||||
/*public void addAllObjects() {
|
||||
int id;
|
||||
if(Utils.getObjectDefinitionsSize(STORE) > 30000) {
|
||||
for(id = 0; id < Utils.getObjectDefinitionsSize(STORE) - 22314; ++id) {
|
||||
this.addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
|
||||
}
|
||||
} else {
|
||||
for(id = 0; id < Utils.getObjectDefinitionsSize(STORE); ++id) {
|
||||
this.addObjectDefs(ObjectDefinitions.getObjectDefinition(STORE, id));
|
||||
}
|
||||
}
|
||||
|
||||
Main.log("ObjectSelection", "All Objects Loaded");
|
||||
}*/
|
||||
|
||||
public void addObjectDefs(final ObjectDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ObjectSelection.this.objectsListmodel.addElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void updateObjectDefs(final ObjectDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
int index = ObjectSelection.this.objectsListmodel.indexOf(defs);
|
||||
if(index == -1) {
|
||||
ObjectSelection.this.objectsListmodel.addElement(defs);
|
||||
} else {
|
||||
ObjectSelection.this.objectsListmodel.setElementAt(defs, index);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void removeObjectDefs(final ObjectDefinitions defs) {
|
||||
EventQueue.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
ObjectSelection.this.objectsListmodel.removeElement(defs);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user