|
Hey,
I decided to release this to r-s, since I learned a lot from everyone here.
Please Note: This is a base and there are bugs which need to be fixed. This also requires SQL WITH remote sql connection or a SQL server on your host computer.
Let's do client sided first:
Spoiler for RSInterface.java:
Spoiler for Client.java:
Now Server Sided:
First make GrandExchange.java
Change the HOST, DB NAME, DB USERBAME, DB PASS to your host, database name, database user, and the password respectively.Code:package server.model.players; import java.sql.*; import server.model.players.Client; import server.util.*; public class GrandExchange { /** * Author: TheElite * Msn: PM ME FOR MSN (NOT EVERYONE IS GETTING IT :) ) */ public GrandExchange (Client c) { } public static Connection con = null; public static Statement stm; private static boolean check = true; public static void createConnection() { // is the connection made? yes i can add to ge and sell but cant collect try { Class.forName("com.mysql.jdbc.Driver").newInstance(); con = DriverManager.getConnection("jdbc:mysql://HOST/DB NAME", "DB USERNAME", "DB PASS"); stm = con.createStatement(); Misc.println("Grand Exchange Connected"); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static boolean checkBeforeBuy(final Client c, final int itemid, final int itemamt, final int itemprice){ try { Statement statement = con.createStatement(); String query = "SELECT * FROM sell"; ResultSet rs = query(query); if(rs.next()){ int listedid = Integer.parseInt(rs.getString("itemid")); int listedamt = Integer.parseInt(rs.getString("amount")); int listedprice = Integer.parseInt(rs.getString("price")); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ if(itemid == listedid && itemprice >= listedprice){ return true;//&& itemamt <= listedamt } else{//means no buyer return false; } }else return false; } catch (Exception sqlEx) { sqlEx.printStackTrace(); } return false; } public static boolean checkBeforeSell(final Client c, final int itemid, final int itemamt, final int itemprice){ try { Statement statement = con.createStatement(); String query = "SELECT * FROM buy"; ResultSet rs = query(query); if (rs.next()){ int listedid = Integer.parseInt(rs.getString("itemid")); int listedamt = Integer.parseInt(rs.getString("amount")); int listedprice = Integer.parseInt(rs.getString("price")); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ if(itemid == listedid && itemprice <= listedprice){ return true;// && itemamt >= listedamt } else{//means no buyer return false; } } else return false; } catch (Exception sqlEx) { sqlEx.printStackTrace(); } return true; } public void run() { while(true) { try { if(con == null) createConnection(); else ping(); Thread.sleep(10000);//10 seconds } catch (Exception e) { e.printStackTrace(); } } } public static void ping(){ try { String query = "SELECT * FROM buy WHERE itemid = 'null'"; query(query); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static void process(Client c, int id, int amt, int price, String bos){ if(bos.equals("sell")){ if(c.getItems().playerHasItem(id, amt)){ boolean sell = checkBeforeSell(c,id, amt, price);; //checkBeforeSell(c,id, amt, price); if (sell == true){ sellWithBuyer(c, id, amt, price); c.sendMessage("Sell and true/buyer"); } else{ sellNoBuyer(c, id, amt, price); c.sendMessage("Sell and false/nobuyer"); } } else{ c.sendMessage("You don't have itemid: " + id + " Amt: " + amt); } } else if(bos.equals("buy")){ int temp = amt* price; if(c.getItems().playerHasItem(995, temp)){ boolean checkbuy = checkBeforeBuy(c, id, amt, price); //checkBeforeBuy(c, id, amt, price); if (checkbuy == true){ buyWithBuyer(c, id, amt, price); c.sendMessage("Buy and true/buyer"); } else{ buyNoBuyer(c, id, amt, price); c.sendMessage("Buy and false/nobuyer"); } }else { c.sendMessage("You don't have " + temp + " coins"); } } } /**public static void checkBeforeBuy(final Client c, final int itemid, final int itemamt, final int itemprice){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM sell"; ResultSet rs = query(query); int listedid = Integer.parseInt(rs.getString("itemid")); int listedamt = Integer.parseInt(rs.getString("amount")); int listedprice = Integer.parseInt(rs.getString("price")); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ /**if(itemid == listedid && itemamt <= listedamt && itemprice >= listedprice){ check = true; } else{//means no buyer check = false; } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); }**/ public static void buyNoBuyer(final Client c, final int id, final int amt, final int price){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { if(c.getItems().playerHasItem(id, amt)){ query("INSERT INTO `buy` (`itemid`, `amount`, `price`, `bought`, `username`) VALUES ('"+id+"', '"+amt+"', '"+price+"', '', '"+c.playerName+"');"); int temp = price * amt; c.getItems().deleteItem(995, temp); c.sendMessage("Successfully added to the Grand Exchange Buy List"); //INSERT INTO `gedb`.`buy` (`itemid`, `amount`, `price`, `bought`, `username`) VALUES ('1', '1', '1', '', 'saad'); }else{ c.sendMessage("You dont have id: " + id + " Amt: " + amt); } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } public static void buyWithBuyer(final Client c, final int buyingid, final int buyingamt, final int buyingprice){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM sell"; ResultSet rs = query(query); while (rs.next()){ int sellingid = Integer.parseInt(rs.getString("itemid")); int sellingamt = Integer.parseInt(rs.getString("amount")); int sellingprice = Integer.parseInt(rs.getString("price")); String player2 = rs.getString("username"); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ int temp = buyingprice * buyingamt; if(c.getItems().playerHasItem(995, temp)){ c.getItems().deleteItem(995, temp); }else{ c.sendMessage("@dre@You dont have enough money!"); return; } if(sellingid != buyingid){ c.sendMessage("Error. Please Report to staff"); return; } if(sellingamt <= buyingamt){ int amtleft = (buyingamt - sellingamt); if(sellingprice == buyingprice){ writeCollect(c.playerName, buyingid, sellingamt); writeCollect(player2, 995, sellingprice * sellingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); if(amtleft != 0) buyNoBuyer(c, sellingid, amtleft, buyingprice); } else if(sellingprice <= buyingprice){//buying for 50m, selling for 25 int tempprice = (buyingprice - sellingprice); writeCollect(c.playerName, buyingid, sellingamt); writeCollect(player2, 995, (sellingprice * sellingamt) + (tempprice * sellingamt)); writeCollect(player2, 995, tempprice * sellingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); if(amtleft != 0) buyNoBuyer(c, sellingid, amtleft, buyingprice); } removeFromGESell(player2, sellingid, sellingamt, sellingprice); } else if (sellingamt > buyingamt){ int amtleft = (sellingamt - buyingamt); if(sellingprice == buyingprice){ writeCollect(c.playerName, buyingid, buyingamt); writeCollect(player2, 995, sellingprice * buyingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); writeCollect(player2, sellingid, amtleft); } else if(sellingprice <= buyingprice){//buying for 50m, selling for 25 int tempprice = (buyingprice - sellingprice); writeCollect(c.playerName, buyingid, buyingamt); writeCollect(player2, 995, sellingprice * buyingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); writeCollect(player2, sellingid, amtleft); writeCollect(player2, 995, tempprice * sellingamt); } removeFromGESell(player2, sellingid, sellingamt, sellingprice); } /*else if(sellingprice <= buyingprice){ int moneytobuyer = (buyingprice - sellingprice); if(sellingamt == buyingamt){ writeCollect(c.playerName, buyingid, buyingamt); writeCollect(player2, 995, moneytobuyer * buyingamt); writeCollect(c.playerName, 995, moneytobuyer * buyingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); } else if (sellingamt < buyingamt){ int amtleft = (buyingamt - sellingamt); writeCollect(c.playerName, buyingid, buyingamt); writeCollect(c.playerName, 995, moneytobuyer * sellingamt); writeCollect(player2, 995, buyingprice * sellingamt); removeFromGEBuy(c.playerName, sellingid, sellingamt, sellingprice); buyNoBuyer(c, sellingid, amtleft, buyingprice); } removeFromGESell(player2, sellingid, sellingamt, sellingprice); }*/ } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } public static void removeFromGESell(final String username, final int id, final int amt, final int price){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { query("DELETE FROM `sell` WHERE `username` = '"+ username + "' AND `itemid` = '"+id+"' AND `amount` = '"+amt+"' AND `price` = '"+price+"'"); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } /**public static void checkBeforeSell(final Client c, final int itemid, final int itemamt, final int itemprice){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM buy"; ResultSet rs = query(query); int listedid = Integer.parseInt(rs.getString("itemid")); int listedamt = Integer.parseInt(rs.getString("amount")); int listedprice = Integer.parseInt(rs.getString("price")); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ /**if(itemid == listedid && itemamt >= listedamt && itemprice <= listedprice){ check = true; } else{//means no buyer check = false; } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); }**/ public static void sellWithBuyer(final Client c, final int sellingid, final int sellingamt, final int sellingprice){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM buy"; ResultSet rs = query(query); while(rs.next()){ int buyingid = Integer.parseInt(rs.getString("itemid")); int buyingamt = Integer.parseInt(rs.getString("amount")); int buyingprice = Integer.parseInt(rs.getString("price")); String player2 = rs.getString("username"); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ if(c.getItems().playerHasItem(sellingid, sellingamt)){ c.getItems().deleteItem(sellingid, sellingamt); }else{ c.sendMessage("You dont have id: " + sellingid + " Amt: " + sellingamt); return; } if(sellingid != buyingid){ c.sendMessage("Error. Please Report to staff"); return; } if(sellingamt >= buyingamt){//selling 100 but buyer wants 50 int amtleft = (sellingamt - buyingamt); if(sellingprice == buyingprice){ writeCollect(player2, buyingid, buyingamt); writeCollect(c.playerName, 995, buyingprice * buyingamt); removeFromGESell(c.playerName, sellingid, sellingamt, sellingprice); sellNoBuyer(c, sellingid, amtleft, sellingprice); } else if(sellingprice <= buyingprice){//buying for 50m, selling for 25 int tempprice = (buyingprice - sellingprice); writeCollect(player2, buyingid, buyingamt); writeCollect(c.playerName, 995, tempprice * buyingamt); writeCollect(c.playerName, 995, buyingprice * buyingamt); removeFromGESell(c.playerName, sellingid, sellingamt, sellingprice); sellNoBuyer(c, sellingid, amtleft, sellingprice); } removeFromGEBuy(player2, buyingid, buyingamt, buyingprice); }else if (sellingamt < buyingamt){ int amtleft = (buyingamt - sellingamt); if(sellingprice == buyingprice){ writeCollect(player2, buyingid, sellingamt); writeCollect(c.playerName, 995, buyingprice * sellingamt); removeFromGESell(c.playerName, sellingid, sellingamt, sellingprice); removeFromGEBuy(player2, buyingid, buyingamt, buyingprice); } else if(sellingprice <= buyingprice){//buying for 50m, selling for 25 int tempprice = (buyingprice - sellingprice); writeCollect(player2, buyingid, sellingamt); writeCollect(c.playerName, 995, (tempprice * sellingamt) + (buyingprice * sellingamt)); removeFromGESell(c.playerName, sellingid, sellingamt, sellingprice); removeFromGEBuy(player2, buyingid, buyingamt, buyingprice); writeCollect(player2, buyingid, amtleft); } } } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } public static void sellNoBuyer(final Client c, final int id, final int amt, final int price){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { if(c.getItems().playerHasItem(id, amt)){ query("INSERT INTO `sell` (`itemid`, `amount`, `price`, `sold`, `username`) VALUES ('"+id+"', '"+amt+"', '"+price+"', '', '"+c.playerName+"');"); c.getItems().deleteItem(id, amt); c.sendMessage("Successfully added to the Grand Exchange Sell list"); //INSERT INTO `gedb`.`buy` (`itemid`, `amount`, `price`, `bought`, `username`) VALUES ('1', '1', '1', '', 'saad'); }else{ c.sendMessage("You dont have id: " + id + " Amt: " + amt); } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } public static void removeFromGEBuy(final String username, final int id, final int amt, final int price){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { query("DELETE FROM `buy` WHERE `username` = '"+ username + "' AND `itemid` = '"+id+"' AND `amount` = '"+amt+"' AND `price` = '"+price+"'"); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } public static void writeCollect(final String username, final int id, final int amt){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { query("INSERT INTO `collections` (`itemid`, `amount`, `collected`, `username`) VALUES ('"+id+"', '"+amt+"', '', '"+username+"');"); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); } /**public static void getCollect(final Client c, final String Username){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM collections WHERE username = '"+ Username + "'"; ResultSet rs = query(query); while (rs.next()){ int id = Integer.parseInt(rs.getString("itemid")); int amt = Integer.parseInt(rs.getString("amount")); String name = rs.getString("username"); //int listedprice = Integer.parseInt(rs.getString("price")); if(name.equalsIgnoreCase(Username)){ c.getItems().addItem(id, amt); c.SaveGame(); c.sendMessage("Successfully collected GE Items."); query("DELETE FROM `collections` WHERE username = '"+ Username + "' AND `itemid` = '"+id+"' AND `amount` = '"+amt+"'"); }else{ c.sendMessage("@dre@You have nothing to collect!"); } } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); }**/ public static void getCollect(final Client c, final String Username){ try { String query = "SELECT * FROM collections"; ResultSet rs = query(query); while(rs.next()){ int id = Integer.parseInt(rs.getString("itemid")); int amt = Integer.parseInt(rs.getString("amount")); String name = rs.getString("username"); if(name.equalsIgnoreCase(Username)){ c.getItems().addItem(id, amt); c.sendMessage("<shad=65280>Successfully collected GE Items."); query("DELETE FROM `collections` WHERE username = '"+ Username + "' AND `itemid` = '"+id+"' AND `amount` = '"+amt+"'"); }else{ c.sendMessage("<shad=16711680>You have nothing to collect!"); } } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static void cancelBuy(final Client c, final int id){ try { String query = "SELECT * FROM buy"; ResultSet rs = query(query); while(rs.next()){ int itemid = Integer.parseInt(rs.getString("itemid")); int itemamt = Integer.parseInt(rs.getString("amount")); int itemprice = Integer.parseInt(rs.getString("price")); String name = rs.getString("username"); if(name.equalsIgnoreCase(c.playerName) && id == itemid){ c.getItems().addItem(995, (itemamt * itemprice)); removeFromGEBuy(c.playerName, itemid, itemamt, itemprice); c.sendMessage("<shad=65280>Successfully removed from GE."); }else{ c.sendMessage("<shad=16711680>You are not buying that Item!"); } } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static void cancelSell(final Client c, final int id){ try { String query = "SELECT * FROM sell"; ResultSet rs = query(query); while(rs.next()){ int itemid = Integer.parseInt(rs.getString("itemid")); int itemamt = Integer.parseInt(rs.getString("amount")); int itemprice = Integer.parseInt(rs.getString("price")); String name = rs.getString("username"); if(name.equalsIgnoreCase(c.playerName) && id == itemid){ c.getItems().addItem(itemid, itemamt); removeFromGESell(c.playerName, itemid, itemamt, itemprice); c.sendMessage("<shad=65280>Successfully removed from GE."); }else{ c.sendMessage("<shad=16711680>You are not selling that Item!"); } } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static void writeInterfaceBuy(final Client c, final String Username){ try { String query = "SELECT * FROM buy"; ResultSet rs = query(query); int line = 13592; while(rs.next()){ int price = Integer.parseInt(rs.getString("price")); int id = Integer.parseInt(rs.getString("itemid")); int amt = Integer.parseInt(rs.getString("amount")); String name = rs.getString("username"); if(name.equalsIgnoreCase(Username)){ c.getPA().sendFrame126("You are buying Item ID: " + id + " Amt: " + amt + " Total Price: " + price, line); line++; } else { c.getPA().sendFrame126("You are buying nothing", line); } } c.getPA().showInterface(13585); c.flushOutStream(); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } public static void writeInterfaceSell(final Client c, final String Username){ try { String query = "SELECT * FROM sell"; ResultSet rs = query(query); int line = 8147; while(rs.next()){ int price = Integer.parseInt(rs.getString("price")); int id = Integer.parseInt(rs.getString("itemid")); int amt = Integer.parseInt(rs.getString("amount")); String name = rs.getString("username"); if(name.equalsIgnoreCase(Username)){ c.getPA().sendFrame126("You are selling Item ID: " + id + " Amt: " + amt + " Total Price: " + price, line); } line++; } c.getPA().showInterface(8134); c.flushOutStream(); } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } /*public static void getCollect1(final Client c, final String Username){ if(con == null){ if(stm != null){ try { stm = con.createStatement(); } catch(Exception e){ con = null; stm = null; //put a sendmessage here telling them to relog in 30 seconds return; } } else { //put a sendmessage here telling them to relog in 30 seconds } } new Thread(){ @Override public void run() { try { String query = "SELECT * FROM collections WHERE username = '"+c.playerName+"'"; ResultSet rs = query(query); /**while(rs.next()){ if (rs != null && rs.next()) { int id = Integer.parseInt(rs.getString("itemid")); int amt = Integer.parseInt(rs.getString("amount")); String name = rs.getString("username"); //int listedprice = Integer.parseInt(rs.getString("price")); /**Buying 100 arrows at 10m....selling 50 arrows at 5m each**/ /*if(name.equalsIgnoreCase(Username)){ c.getItems().addItem(id, amt); c.sendMessage("Successfully collected GE Items."); query("DELETE FROM `collections` WHERE username = '"+ Username + "' AND `itemid` = '"+id+"' AND `amount` = '"+amt+"'"); }else{ c.sendMessage("@dre@You have nothing to collect!"); } } else{ c.sendMessage("@dre@You have nothing to collect!"); } } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } } }.start(); }*/ public static ResultSet query(String s) throws SQLException {//heres error try { if (s.toLowerCase().startsWith("select")) { if(stm == null) { createConnection(); } ResultSet rs = stm.executeQuery(s); return rs; } else { if(stm == null) { createConnection(); } stm.executeUpdate(s); } return null; } catch (Exception e) { e.printStackTrace(); con = null; stm = null; } return null; } public synchronized static void destroyConnection() { try { stm.close(); con.close(); } catch (Exception e) { //e.printStackTrace(); } } }
Now In Clicking Buttons.java under:
ADD:Code:switch(actionButtonID)
In player.java declare:Code:/*Grand Exchange*/ case 61037://buy c.getPA().updateGE(); c.getPA().showInterface(15751); break; case 61038://sell c.getPA().updateGE(); c.getPA().showInterface(15951); break; case 61138: case 62082: c.tempamt += 1; c.getPA().updateGE(); break; case 61139: case 62083: c.tempamt += 5; c.getPA().updateGE(); break; case 61140: case 62084: c.tempamt += 25; c.getPA().updateGE(); break; case 61145: case 62089: c.tempamt += 1; c.getPA().updateGE(); break; case 61143: case 62087: c.tempamt -= 1; c.getPA().updateGE(); break; case 61146: case 62090: c.tempprice += 1; c.getPA().updateGE(); break; case 61144: case 62088: c.tempprice -= 1; c.getPA().updateGE(); break; case 62100: case 61156: c.tempamt = 0; c.tempid = 0; c.tempprice = 0; c.getPA().showInterface(15651); c.getPA().updateGE(); break; case 61153: case 62097: c.tempamt = 0; c.tempid = 0; c.tempprice = 0; c.getPA().closeAllWindows(); c.getPA().updateGE(); break; case 61137: c.getPA().updateGE(); GrandExchange.createConnection(); GrandExchange.process(c, c.tempid, c.tempamt, c.tempprice, "buy"); c.tempamt = 0; c.tempid = 0; c.tempprice = 0; c.getPA().showInterface(15651); c.getPA().updateGE(); break; case 62081: c.getPA().updateGE(); GrandExchange.createConnection(); GrandExchange.process(c, c.tempid, c.tempamt, c.tempprice, "sell"); c.tempamt = 0; c.tempid = 0; c.tempprice = 0; c.getPA().showInterface(15651); c.getPA().updateGE(); break; case 61047: GrandExchange.createConnection(); GrandExchange.writeInterfaceSell(c, c.playerName); break; case 61051: c.getPA().showInterface(16351); break; case 61055: GrandExchange.createConnection(); GrandExchange.getCollect(c, c.playerName); break; case 61029: GrandExchange.createConnection(); GrandExchange.writeInterfaceBuy(c, c.playerName); break; case 61043: c.getPA().showInterface(16151); break; case 63234: case 63034: c.getPA().closeAllWindows(); c.tempid = 0; break; case 63028: GrandExchange.createConnection(); GrandExchange.cancelBuy(c, c.tempid); c.getPA().showInterface(15651); break; case 63228: GrandExchange.createConnection(); GrandExchange.cancelSell(c, c.tempid); c.getPA().showInterface(15651); break;
In playersave.java:Code:public int tempid, tempamt, tempprice;
AndCode:} else if(token.equals("tempid")) { p.tempid = Integer.parseInt(token2); } else if(token.equals("tempamt")) { p.tempamt = Integer.parseInt(token2); } else if(token.equals("tempprice")) { p.tempprice = Integer.parseInt(token2); }
In the mysql database import:Code:characterfile.newLine(); characterfile.write("tempid=", 0, 7); characterfile.write(Integer.toString(p.tempid), 0, Integer.toString(p.tempid).length()); characterfile.newLine(); characterfile.newLine(); characterfile.write("tempamt=", 0, 8); characterfile.write(Integer.toString(p.tempamt), 0, Integer.toString(p.tempamt).length()); characterfile.newLine(); characterfile.newLine(); characterfile.write("tempprice=", 0, 10); characterfile.write(Integer.toString(p.tempprice), 0, Integer.toString(p.tempprice).length()); characterfile.newLine();
Download sql @ UppIT
EDIT: I forrgot the updatege mehtod.
In playerAsisstant.java add:
If you want media:Code:public void updateGE(){ int amtxprice = c.tempprice * c.tempamt; c.getPA().sendFrame126("", 15781); c.getPA().sendFrame126("", 15782); c.getPA().sendFrame126("", 15783); c.getPA().sendFrame126("", 15784); c.getPA().sendFrame126("", 16359); c.getPA().sendFrame126("Item ID: " + c.tempid, 16359); c.getPA().sendFrame126("Amt: " + c.tempamt, 15781); c.getPA().sendFrame126("Price: " + c.tempprice, 15782); c.getPA().sendFrame126("Total: " + amtxprice, 15783); c.getPA().sendFrame126("" + c.tempid, 15784); c.getPA().sendFrame126("", 15981); c.getPA().sendFrame126("", 15982); c.getPA().sendFrame126("", 15983); c.getPA().sendFrame126("", 15984); c.getPA().sendFrame126("", 16159); c.getPA().sendFrame126("Item ID: " + c.tempid, 16159); c.getPA().sendFrame126("Amt: " + c.tempamt, 15981); c.getPA().sendFrame126("Price: " + c.tempprice, 15982); c.getPA().sendFrame126("Total: " + amtxprice, 15983); c.getPA().sendFrame126("" + c.tempid, 15984); }
Credits:
-All3n for his promt input tut.
-All3n for some sprites
-Jagex for sprites
-That one person who dumped sprites
-1776 for helping me with some errors
-Martin for his auto donation system (this is based off that).
-Me for making interfaces and the whole g.e base
Nice release bro.
Won't use but good job
Won't use but looks nice ;] Should add a preview vid or pics.
Also good to see my tut is actually being put to good use.
Very nice
Ill try this out.
nice release!! good job
hmmm i get this errors...(client sided..)
am i suppose to already have those interfaces?
Code:Java\RSInterface.java:5957: error: cannot find symbol addHoverButton1(16156, "Interfaces/clanCreation/SPRITE", 5, 129, 61, "Confirm Cancel", 16157, 1); ^ symbol: method addHoverButton1(int,String,int,int,int,String,int,int) location: class RSInterface Java\RSInterface.java:5984: error: cannot find symbol addHoverButton1(16356, "Interfaces/clanCreation/SPRITE", 5, 129, 61, "Confirm Cancel", 16357, 1); ^ symbol: method addHoverButton1(int,String,int,int,int,String,int,int) location: class RSInterface Note: Java\client.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 2 errors Press any key to continue . . .
Thanks everyone
Oh Nice release.
Missing a few methods, but nice
Bravo dude
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |