Lets Do Java
08-23-2009, 11:34 PM
Well this all adds into my cheat client..
Ok, This one is a bit more difficult..
Classes modified - Gui.java/Cache folder
Difficulty 3/10 for noobs 1/10 for peepz
Go into Gui.java and with the rest of you're voids closer to the top of the file add;;;
private void checkIDs()
{
/*
File exist = new File((new StringBuilder()).append(findcachedir()).append("/all_IDs/").toString());
if(!exist.exists())
{
new Update("http://www.moparscape.org/cache/all_IDs.zip", "all_IDs.zip", findcachedir(), true, false);
}
*/
}
Add this with the rest of you're Jmenus/Buttons..
JMenu idMenu = new JMenu("ID Lists");
Search for something like this..
String[] mainButtons = new String[]
{
"New server", "Spawn Object", "Deltascape Fourms"
};
Under that add.
String[] idButtons = new String[]
{
"Item ID List", "Object ID List", "Npc ID List"
};
Search for something along the lines of this..
for (String name : extraButtons)
{
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-"))
extraMenu.addSeparator();
else
{
menuItem.addActionListener(this);
extraMenu.add(menuItem);
}
}
And add this..
for (String name : idButtons)
{
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-"))
idMenu.addSeparator();
else
{
menuItem.addActionListener(this);
idMenu.add(menuItem);
}
}
Search for this..
menuBar.add(
Below it add
menuBar.add(idMenu);
Go to the commands for you're commands in the gui.java file. and add these with them..
if(cmd.equalsIgnoreCase("Item ID List"))
{
if(isApplet)
{
checkIDs();
new Xml$((new StringBuilder()).append(findcachedir()).append("cache/XML/Items.xml").toString());
} else
{
new Xml$("cache/XML/Items.xml");
}
}
if(cmd.equals("Object ID List"))
{
if(isApplet)
{
new Xml$((new StringBuilder()).append("cache/XML/Objects.xml").toString());
} else
{
new Xml$("cache/XML/Objects.xml");
}
}
if(cmd.equals("Npc ID List"))
{
if(isApplet)
{
new Xml$((new StringBuilder()).append("cache/XML/NPCs.xml").toString());
} else
{
new Xml$("cache/XML/NPCs.xml");
}
}
}
Now make a new folder in you're main client files [All the java and class ones..]
Called Xml
//Credits to MITB
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.*;
public class Xml$
implements ActionListener, KeyListener
{
private String itemName[];
private String itemID[];
private String fileName;
private JTextArea namePanel;
private JTextArea idPanel;
private JTextArea searchPanel;
public Xml$(URL xmlURL)
{
itemName = new String[10000];
itemID = new String[10000];
try
{
URLConnection xmlConnect = xmlURL.openConnection();
xmlConnect.setRequestProperty("User-Agent", "Mozilla");
xmlConnect.connect();
readStream(xmlConnect.getInputStream());
}
catch(IOException e)
{
System.out.println((new StringBuilder()).append("Couldn't find the file ").append(fileName).toString());
}
initUI();
}
public Xml$(String fileName)
{
itemName = new String[10000];
itemID = new String[10000];
File file = new File(fileName);
this.fileName = file.getName();
try
{
FileInputStream fistream = new FileInputStream(file);
readStream(fistream);
}
catch(IOException e)
{
System.out.println((new StringBuilder()).append("Couldn't find the file ").append(fileName).toString());
}
initUI();
}
private void readStream(InputStream inputStream)
throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
int linenumber = 0;
String clientline[];
for(clientline = new String[30000]; (clientline[linenumber] = reader.readLine()) != null; linenumber++) { }
inputStream.close();
int y = 0;
for(int x = 0; x < clientline.length && clientline[x] != null; x++)
{
if(clientline[x].contains("name="))
{
String name = clientline[x].substring(clientline[x].indexOf("name=") + 6).replaceAll("\".*", "");
String id = clientline[x].substring(clientline[x].indexOf("type=") + 6).replaceAll("\".*", "");
itemName[y] = name;
itemID[y] = id;
y++;
}
}
}
private void initUI()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame(fileName);
frame.setDefaultCloseOperation(2);
frame.getContentPane().setLayout(new BorderLayout());
namePanel = new JTextArea();
namePanel.setEditable(false);
idPanel = new JTextArea();
idPanel.setEditable(false);
JPanel infoPane = new JPanel(new FlowLayout());
infoPane.add(namePanel);
infoPane.add(idPanel);
JScrollPane scroll = new JScrollPane(infoPane, 22, 31);
scroll.setPreferredSize(new Dimension(240, 503));
boolean foundOne = false;
String newLine = "\n";
for(int x = 0; x < itemName.length && itemName[x] != null; x++)
{
if(foundOne)
{
namePanel.append((new StringBuilder()).append(newLine).append(itemName[x]).toString());
idPanel.append((new StringBuilder()).append(newLine).append(itemID[x]).toString());
} else
{
foundOne = true;
namePanel.append(itemName[x]);
idPanel.append(itemID[x]);
}
}
JButton search = new JButton("Search");
search.addActionListener(this);
searchPanel = new JTextArea();
searchPanel.addKeyListener(this);
searchPanel.setLineWrap(false);
searchPanel.setRows(1);
searchPanel.setColumns(9);
JPanel searchPane = new JPanel(new FlowLayout());
searchPane.add(searchPanel);
searchPane.add(search);
frame.getContentPane().add(scroll, "Center");
frame.getContentPane().add(searchPane, "South");
frame.pack();
frame.setVisible(true);
searchPanel.requestFocus();
}
private void search()
{
String substring = searchPanel.getText();
namePanel.setText("");
idPanel.setText("");
boolean foundOne = false;
String newLine = "\n";
for(int x = 0; x < itemName.length && itemName[x] != null; x++)
{
if(!itemName[x].toLowerCase().contains(substring.toLowerCase()))
{
continue;
}
if(foundOne)
{
namePanel.append((new StringBuilder()).append(newLine).append(itemName[x]).toString());
idPanel.append((new StringBuilder()).append(newLine).append(itemID[x]).toString());
} else
{
foundOne = true;
namePanel.append(itemName[x]);
idPanel.append(itemID[x]);
}
}
if(namePanel.getText().equals(""))
{
namePanel.setText("No Results Found");
}
}
public void actionPerformed(ActionEvent evt)
{
search();
}
public void keyPressed(KeyEvent evt)
{
if(evt.getKeyCode() == 10)
{
search();
}
}
public void keyReleased(KeyEvent evt)
{
if(evt.getKeyCode() == 10)
{
searchPanel.setText(searchPanel.getText().replace("\n", ""));
}
}
public void keyTyped(KeyEvent keyevent)
{
}
}
Lastly: Download these and add them into you're cache folder
http://www.megaupload.com/?d=22OF6VOR
http://www.megaupload.com/?d=22OF6VOR
http://www.megaupload.com/?d=22OF6VOR
Now you're cache folder should look like this..
http://i40.tinypic.com/2m4u2qt.png
Thanks xD
Ok, This one is a bit more difficult..
Classes modified - Gui.java/Cache folder
Difficulty 3/10 for noobs 1/10 for peepz
Go into Gui.java and with the rest of you're voids closer to the top of the file add;;;
private void checkIDs()
{
/*
File exist = new File((new StringBuilder()).append(findcachedir()).append("/all_IDs/").toString());
if(!exist.exists())
{
new Update("http://www.moparscape.org/cache/all_IDs.zip", "all_IDs.zip", findcachedir(), true, false);
}
*/
}
Add this with the rest of you're Jmenus/Buttons..
JMenu idMenu = new JMenu("ID Lists");
Search for something like this..
String[] mainButtons = new String[]
{
"New server", "Spawn Object", "Deltascape Fourms"
};
Under that add.
String[] idButtons = new String[]
{
"Item ID List", "Object ID List", "Npc ID List"
};
Search for something along the lines of this..
for (String name : extraButtons)
{
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-"))
extraMenu.addSeparator();
else
{
menuItem.addActionListener(this);
extraMenu.add(menuItem);
}
}
And add this..
for (String name : idButtons)
{
JMenuItem menuItem = new JMenuItem(name);
if (name.equalsIgnoreCase("-"))
idMenu.addSeparator();
else
{
menuItem.addActionListener(this);
idMenu.add(menuItem);
}
}
Search for this..
menuBar.add(
Below it add
menuBar.add(idMenu);
Go to the commands for you're commands in the gui.java file. and add these with them..
if(cmd.equalsIgnoreCase("Item ID List"))
{
if(isApplet)
{
checkIDs();
new Xml$((new StringBuilder()).append(findcachedir()).append("cache/XML/Items.xml").toString());
} else
{
new Xml$("cache/XML/Items.xml");
}
}
if(cmd.equals("Object ID List"))
{
if(isApplet)
{
new Xml$((new StringBuilder()).append("cache/XML/Objects.xml").toString());
} else
{
new Xml$("cache/XML/Objects.xml");
}
}
if(cmd.equals("Npc ID List"))
{
if(isApplet)
{
new Xml$((new StringBuilder()).append("cache/XML/NPCs.xml").toString());
} else
{
new Xml$("cache/XML/NPCs.xml");
}
}
}
Now make a new folder in you're main client files [All the java and class ones..]
Called Xml
//Credits to MITB
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.URL;
import java.net.URLConnection;
import javax.swing.*;
public class Xml$
implements ActionListener, KeyListener
{
private String itemName[];
private String itemID[];
private String fileName;
private JTextArea namePanel;
private JTextArea idPanel;
private JTextArea searchPanel;
public Xml$(URL xmlURL)
{
itemName = new String[10000];
itemID = new String[10000];
try
{
URLConnection xmlConnect = xmlURL.openConnection();
xmlConnect.setRequestProperty("User-Agent", "Mozilla");
xmlConnect.connect();
readStream(xmlConnect.getInputStream());
}
catch(IOException e)
{
System.out.println((new StringBuilder()).append("Couldn't find the file ").append(fileName).toString());
}
initUI();
}
public Xml$(String fileName)
{
itemName = new String[10000];
itemID = new String[10000];
File file = new File(fileName);
this.fileName = file.getName();
try
{
FileInputStream fistream = new FileInputStream(file);
readStream(fistream);
}
catch(IOException e)
{
System.out.println((new StringBuilder()).append("Couldn't find the file ").append(fileName).toString());
}
initUI();
}
private void readStream(InputStream inputStream)
throws IOException
{
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
int linenumber = 0;
String clientline[];
for(clientline = new String[30000]; (clientline[linenumber] = reader.readLine()) != null; linenumber++) { }
inputStream.close();
int y = 0;
for(int x = 0; x < clientline.length && clientline[x] != null; x++)
{
if(clientline[x].contains("name="))
{
String name = clientline[x].substring(clientline[x].indexOf("name=") + 6).replaceAll("\".*", "");
String id = clientline[x].substring(clientline[x].indexOf("type=") + 6).replaceAll("\".*", "");
itemName[y] = name;
itemID[y] = id;
y++;
}
}
}
private void initUI()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame(fileName);
frame.setDefaultCloseOperation(2);
frame.getContentPane().setLayout(new BorderLayout());
namePanel = new JTextArea();
namePanel.setEditable(false);
idPanel = new JTextArea();
idPanel.setEditable(false);
JPanel infoPane = new JPanel(new FlowLayout());
infoPane.add(namePanel);
infoPane.add(idPanel);
JScrollPane scroll = new JScrollPane(infoPane, 22, 31);
scroll.setPreferredSize(new Dimension(240, 503));
boolean foundOne = false;
String newLine = "\n";
for(int x = 0; x < itemName.length && itemName[x] != null; x++)
{
if(foundOne)
{
namePanel.append((new StringBuilder()).append(newLine).append(itemName[x]).toString());
idPanel.append((new StringBuilder()).append(newLine).append(itemID[x]).toString());
} else
{
foundOne = true;
namePanel.append(itemName[x]);
idPanel.append(itemID[x]);
}
}
JButton search = new JButton("Search");
search.addActionListener(this);
searchPanel = new JTextArea();
searchPanel.addKeyListener(this);
searchPanel.setLineWrap(false);
searchPanel.setRows(1);
searchPanel.setColumns(9);
JPanel searchPane = new JPanel(new FlowLayout());
searchPane.add(searchPanel);
searchPane.add(search);
frame.getContentPane().add(scroll, "Center");
frame.getContentPane().add(searchPane, "South");
frame.pack();
frame.setVisible(true);
searchPanel.requestFocus();
}
private void search()
{
String substring = searchPanel.getText();
namePanel.setText("");
idPanel.setText("");
boolean foundOne = false;
String newLine = "\n";
for(int x = 0; x < itemName.length && itemName[x] != null; x++)
{
if(!itemName[x].toLowerCase().contains(substring.toLowerCase()))
{
continue;
}
if(foundOne)
{
namePanel.append((new StringBuilder()).append(newLine).append(itemName[x]).toString());
idPanel.append((new StringBuilder()).append(newLine).append(itemID[x]).toString());
} else
{
foundOne = true;
namePanel.append(itemName[x]);
idPanel.append(itemID[x]);
}
}
if(namePanel.getText().equals(""))
{
namePanel.setText("No Results Found");
}
}
public void actionPerformed(ActionEvent evt)
{
search();
}
public void keyPressed(KeyEvent evt)
{
if(evt.getKeyCode() == 10)
{
search();
}
}
public void keyReleased(KeyEvent evt)
{
if(evt.getKeyCode() == 10)
{
searchPanel.setText(searchPanel.getText().replace("\n", ""));
}
}
public void keyTyped(KeyEvent keyevent)
{
}
}
Lastly: Download these and add them into you're cache folder
http://www.megaupload.com/?d=22OF6VOR
http://www.megaupload.com/?d=22OF6VOR
http://www.megaupload.com/?d=22OF6VOR
Now you're cache folder should look like this..
http://i40.tinypic.com/2m4u2qt.png
Thanks xD