Jump to content

Search the Community

Showing results for tags 'grand'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 69 results

  1. Slabagel

    Grand exchange

    Hello, I am trying to add GE and it has went good until I tried it in game and after you search an item and click on the item you want it doesnt put it in the buy screen. It just stays the same like nothing happened. Anyone know why this would be happening or how to fix it? I am not getting any errors
  2. [B]Video:[/B] [url=http://www.youtube.com/watch?v=417Eo6zJ_Yc]Grand Exchange Show off[/url] For the client sided part rip it from this or use the client: [url=http://www.runelocus.com/forums/showthread.php?91095-Project-Exile-The-Full-Release]Project-Exile Release[/url] But be aware there are loads of things to rip from the client.. Server: Create a folder named "GrandExchange" in "Data", and in that folder create 2 folders, one named "Buyers", and one named "Sellers" Then add these classes: [CODE] package com.exile.game.players.grandexchange; import com.exile.Constants; import com.exile.Server; import com.exile.event.CycleEvent; import com.exile.event.CycleEventContainer; import com.exile.event.CycleEventHandler; import com.exile.game.items.Item; import com.exile.game.items.ItemDefinition; import com.exile.game.players.Player; import com.exile.game.players.PlayerSave; import com.exile.util.Misc; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; /** * * [MENTION=52317]auth[/MENTION]or Alex(TheLife) */ public class GrandExchange { /** * Static integers */ public static int offers = 100000, totalOffers = 0; /** * []Integers */ public int Slots[] = new int[7]; public int SlotType[] = new int[7]; /** * Integers */ public int selectedItemId = 0, selectedAmount = 0, selectedPrice = 0, selectedSlot = 0, itemRecieved = 0, itemAmountRecieved = 0, firstItemStacked, secondItemStacked; /** * Static booleans */ public static boolean loading = false; /** * Booleans */ public boolean toHigh = false, recievedMessage = false, stillSearching = false; /** * Sellers */ public static Sellers sellers[] = new Sellers[offers]; /** * Buyers */ public static Buyers buyers[] = new Buyers[offers]; /** * Initializing Player c */ private Player c; /** * Setting c */ public GrandExchange (Player c) { this.c = c; } /** * Setting it for Server.java */ public GrandExchange() { } /** * Send update to player */ public void sendUniversal(String name) { for (int i = 0; i < Constants.MAX_PLAYERS; i++) { if (Server.playerHandler.players[i] != null) { if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) { Player c2 = (Player)Server.playerHandler.players[i]; if(c2.GE().recievedMessage != true) { c2.sendMessage("One or more of your Grand Exchange offers have been updated."); } c2.GE().recievedMessage = true; if(c2.interfaceIdOpen == 54700 || c2.interfaceIdOpen == 53700) { final Player c3 = c2; CycleEventHandler.getInstance().addEvent(c, new CycleEvent() { public void execute(CycleEventContainer container) { container.stop(); } [MENTION=15855]Over[/MENTION]ride public void stop() { c3.GE().openCollect(c3.GE().selectedSlot, false); } }, 1); } else if(c2.interfaceIdOpen == 24500) { final Player c3 = c2; CycleEventHandler.getInstance().addEvent(c, new CycleEvent() { public void execute(CycleEventContainer container) { container.stop(); } [MENTION=15855]Over[/MENTION]ride public void stop() { c3.GE().openGrandExchange(false); } }, 1); } else { c2.GE().openGrandExchange(false); } } } } } /** * Send if it has updated */ public void sendUpdate(String name) { boolean rM = false; for(int i = 0; i < offers; i++) { if(sellers[i] != null && sellers[i].owner.equalsIgnoreCase(name)) { if(sellers[i].updated == true) rM = true; } else if(buyers[i] != null && buyers[i].owner.equalsIgnoreCase(name)) { if(buyers[i].updated == true) rM = true; } } if(rM == true) { c.sendMessage("You have items from the Grand Exchange waiting in your collection box."); } } /** * Load Sellers */ public void loadSellers() { BufferedReader File = null; boolean found = false; for(int i = 0; i < offers; i++) { found = false; try { File = new BufferedReader(new FileReader("./Data/GrandExchange/Sellers/"+i+".txt")); try { File.close(); } catch(IOException o) { } found = true; } catch(FileNotFoundException e) { found = false; continue; } if(found == true) { totalOffers++; Sellers s = new Sellers(i); sellers[i] = s; loadOffer(s.id, "Sell"); } } } /** * Load Buyers */ public void loadBuyers() { BufferedReader File = null; boolean found = false; for(int i = 0; i < offers; i++) { found = false; try { File = new BufferedReader(new FileReader("./Data/GrandExchange/Buyers/"+i+".txt")); try { File.close(); } catch(IOException o) { } found = true; } catch(FileNotFoundException e) { found = false; continue; } if(found == true) { totalOffers++; Buyers b = new Buyers(i); buyers[i] = b; loadOffer(b.id, "Buy"); } } } /** * Makes a new offer */ public int newOffer(String type, int itemId, int amount, int updatedAmount, int price, int percentage, String owner, boolean completed, int slot) { if(loading == true) { return -1; } int id = -1; if(type == "Sell") { for (int a = 1; a < offers; a++) { if (sellers[a] == null) { id = a; break; } } if(id == -1) { c.sendMessage("To many offers, please try again later."); return id; } Sellers s = new Sellers(id); s.itemId = itemId; s.amount = amount; s.updatedAmount = updatedAmount; s.price = price; s.percentage = percentage; s.owner = owner; s.slot = slot; s.updated = false; Slots[slot] = id; SlotType[slot] = 1; sellers[id] = s; saveOffer(id, type); } else if(type == "Buy") { for (int a = 1; a < offers; a++) { if (buyers[a] == null) { id = a; break; } } if(id == -1) { c.sendMessage("To many offers, please try again later."); return id; } Buyers b = new Buyers(id); b.itemId = itemId; b.amount = amount; b.updatedAmount = updatedAmount; b.price = price; b.percentage = percentage; b.owner = owner; b.slot = slot; b.updated = false; Slots[slot] = id; SlotType[slot] = 2; buyers[id] = b; saveOffer(id, type); } return id; } /** * Check for items */ public int firstItemStacked(int itemId) { firstItemStacked = 0; if(ItemDefinition.forId(itemId+1). itemIsNote) { itemId++; } for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] == itemId+1) firstItemStacked = c.playerItemsN[i]; } return itemId; } public int secondItemStacked(int itemId) { secondItemStacked = 0; for (int i = 0; i < c.playerItems.length; i++) { if (c.playerItems[i] == itemId+1) secondItemStacked++; } return itemId; } public boolean removeGrandExchangeItems(int selectedA, int firstItemId, int secondItemId, int firstItemA, int secondItemA, long total) { if(total < selectedA) { c.sendMessage("You don't have that many."); return false; } if(selectedA <= 0) { return false; } if(total <= 0) { return false; } if(selectedA >= secondItemA) { if (c.getItems().playerHasItem(secondItemId, secondItemA)) { c.getItems().deleteItem2(secondItemId, secondItemA); selectedA -= secondItemA; } } if(selectedA <= secondItemA) { if (c.getItems().playerHasItem(secondItemId, selectedA)) { c.getItems().deleteItem2(secondItemId, selectedA); selectedA = 0; } } if(selectedA >= firstItemA) { if (c.getItems().playerHasItem(firstItemId, firstItemA)) { c.getItems().deleteItem2(firstItemId, firstItemA); selectedA -= firstItemA; } } if(selectedA <= firstItemA) { if (c.getItems().playerHasItem(firstItemId, selectedA)) { c.getItems().deleteItem2(firstItemId, selectedA); selectedA = 0; } } if(selectedA > 0) { return false; } return true; } /** * Sell items method */ public void sellItems() { int x = selectedAmount; int y = firstItemStacked(selectedItemId); int z = secondItemStacked(selectedItemId); long l = firstItemStacked; long g = secondItemStacked; long o = l+g; if(removeGrandExchangeItems(x, y, z, firstItemStacked, secondItemStacked, o)) { final int s = selectedSlot; int b = selectedSlot; int i = newOffer("Sell", selectedItemId, selectedAmount, selectedAmount, selectedPrice, 0, c.playerName, false, b); //c.getItems().deleteItem2(selectedItemId, selectedAmount); if(i == -1) { c.getItems().addItem(selectedItemId, selectedAmount); c.sendMessage("To many offers, please try again later."); return; } openGrandExchange(true); c.sendConfig(4, b, 1, -1); c.sendConfig(5, b, 1, -1); int k = b*2; k += 24565; c.getPA().sendFrame34(selectedItemId, 0, k, selectedAmount); sellItems(i, c.playerName); CycleEventHandler.getInstance().addEvent(c, new CycleEvent() { public void execute(CycleEventContainer container) { container.stop(); } [MENTION=15855]Over[/MENTION]ride public void stop() { c.sendConfig(5, s, 3, -1); } }, 2); PlayerSave.saveGame(c); } } /** * Buy items method */ public void buyItems() { if (c.getItems().playerHasItem(995, selectedAmount*selectedPrice)) { final int s = selectedSlot; int b = selectedSlot; c.getItems().deleteItem2(995, selectedAmount*selectedPrice); int i = newOffer("Buy", selectedItemId, selectedAmount, selectedAmount, selectedPrice, 0, c.playerName, false, b); if(i == -1) { c.getItems().addItem(selectedItemId, selectedAmount); c.sendMessage("To many offers, please try again later."); return; } openGrandExchange(true); c.sendConfig(4, b, 1, -1); c.sendConfig(5, b, 2, -1); int k = b*2; k += 24565; c.getPA().sendFrame34(selectedItemId, 0, k, selectedAmount); buyItems(i, c.playerName); CycleEventHandler.getInstance().addEvent(c, new CycleEvent() { public void execute(CycleEventContainer container) { container.stop(); } [MENTION=15855]Over[/MENTION]ride public void stop() { c.sendConfig(5, s, 4, -1); } }, 2); PlayerSave.saveGame(c); } else { c.sendMessage("You don't have enough coins."); } } /** * Part of item selling */ public void sellItems(int s, String name) { for (int b = 1; b < offers; b++) { if (buyers[b] != null && sellers[s] != null) { if (buyers[b].itemId == sellers[s].itemId) { if(sellers[s].updatedAmount >= 1) { if(sellers[s].price <= buyers[b].price) { if (!sellers[s].completed && !buyers[b].completed) { if (!sellers[s].aborted && !buyers[b].aborted) { stillSearching = true; boolean done = false; done = false; if(done != true && sellers[s].updatedAmount > buyers[b].updatedAmount) { sellers[s].updatedAmount -= buyers[b].updatedAmount; sellers[s].percentage += buyers[b].updatedAmount; sellers[s].itemOneAmount += buyers[b].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); sellers[s].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += buyers[b].updatedAmount; buyers[b].total += buyers[b].updatedAmount; buyers[b].totalGp += buyers[b].updatedAmount*sellers[s].price; int sa = buyers[b].updatedAmount*sellers[s].price; int ba = buyers[b].updatedAmount*buyers[b].price; buyers[b].itemTwoAmount += ba-sa; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); buyers[b].percentage = buyers[b].amount; buyers[b].updatedAmount = 0; buyers[b].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(s, "Sell"); saveOffer(b, "Buy"); done = true; } if(done != true && sellers[s].updatedAmount == buyers[b].updatedAmount) { sellers[s].percentage = sellers[s].amount; buyers[b].percentage = buyers[b].amount; sellers[s].itemOneAmount += buyers[b].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += sellers[s].updatedAmount; sellers[s].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].total += buyers[b].updatedAmount; buyers[b].totalGp += buyers[b].updatedAmount*sellers[s].price; int sa = sellers[s].updatedAmount*sellers[s].price; int ba = buyers[b].updatedAmount*buyers[b].price; buyers[b].itemTwoAmount += ba-sa; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); sellers[s].updatedAmount = 0; buyers[b].updatedAmount = 0; buyers[b].completed = true; sellers[s].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(b, "Buy"); saveOffer(s, "Sell"); done = true; } if(done != true && buyers[b].updatedAmount > sellers[s].updatedAmount) { buyers[b].percentage += sellers[s].updatedAmount; sellers[s].percentage = sellers[s].amount; sellers[s].itemOneAmount += sellers[s].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += sellers[s].updatedAmount; int sa = buyers[b].price-sellers[s].price; int ba = sa*sellers[s].updatedAmount; buyers[b].itemTwoAmount += ba; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); sellers[s].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].total += buyers[b].updatedAmount; buyers[b].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].updatedAmount -= sellers[s].updatedAmount; sellers[s].updatedAmount = 0; sellers[s].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(b, "Buy"); saveOffer(s, "Sell"); done = true; } stillSearching = false; } } } } } } } } /** * Part of item buying */ public void buyItems(int b, String name) { for (int s = 1; s < offers; s++) { if (sellers[s] != null && buyers[b] != null) { if (sellers[s].itemId == buyers[b].itemId) { if(buyers[b].updatedAmount >= 1) { if(buyers[b].price >= sellers[s].price) { if (!sellers[s].completed && !buyers[b].completed) { if (!sellers[s].aborted && !buyers[b].aborted) { stillSearching = true; boolean done = false; done = false; if(done != true && buyers[b].updatedAmount > sellers[s].updatedAmount) { buyers[b].percentage += sellers[s].updatedAmount; sellers[s].percentage = sellers[s].amount; buyers[b].updatedAmount -= sellers[s].updatedAmount; sellers[s].itemOneAmount += sellers[s].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += sellers[s].updatedAmount; int sa = buyers[b].price-sellers[s].price; int ba = sa*sellers[s].updatedAmount; buyers[b].itemTwoAmount += ba; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); sellers[s].total += sellers[s].updatedAmount; sellers[s].totalGp += sellers[s].updatedAmount*sellers[s].price; buyers[b].total += sellers[s].updatedAmount; buyers[b].totalGp += sellers[s].updatedAmount*sellers[s].price; sellers[s].updatedAmount = 0; sellers[s].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(s, "Sell"); saveOffer(b, "Buy"); done = true; } if(done != true && buyers[b].updatedAmount == sellers[s].updatedAmount) { sellers[s].percentage = sellers[s].amount; buyers[b].percentage = buyers[b].amount; sellers[s].itemOneAmount += buyers[b].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += sellers[s].updatedAmount; int sa = sellers[s].updatedAmount*sellers[s].price; int ba = buyers[b].updatedAmount*buyers[b].price; buyers[b].itemTwoAmount += ba-sa; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); sellers[s].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].updatedAmount = 0; sellers[s].updatedAmount = 0; buyers[b].completed = true; sellers[s].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(b, "Buy"); saveOffer(s, "Sell"); done = true; } if(done != true && sellers[s].updatedAmount > buyers[b].updatedAmount) { sellers[s].percentage += buyers[b].updatedAmount; buyers[b].percentage = buyers[b].amount; sellers[s].itemOneAmount += buyers[b].updatedAmount*sellers[s].price; sellers[s].itemOne = getMoneyStackId(sellers[s].itemOneAmount); buyers[b].itemOne = buyers[b].itemId; buyers[b].itemOneAmount += buyers[b].updatedAmount; int sa = buyers[b].updatedAmount*sellers[s].price; int ba = buyers[b].updatedAmount*buyers[b].price; buyers[b].itemTwoAmount += ba-sa; buyers[b].itemTwo = getMoneyStackId(buyers[b].itemTwoAmount); sellers[s].total += buyers[b].updatedAmount; sellers[s].totalGp += buyers[b].updatedAmount*sellers[s].price; buyers[b].total += buyers[b].updatedAmount; buyers[b].totalGp += buyers[b].updatedAmount*sellers[s].price; sellers[s].updatedAmount -= buyers[b].updatedAmount; buyers[b].updatedAmount = 0; buyers[b].completed = true; buyers[b].updated = true; sellers[s].updated = true; sendUniversal(sellers[s].owner); sendUniversal(buyers[b].owner); saveOffer(b, "Buy"); saveOffer(s, "Sell"); done = true; } stillSearching = false; } } } } } } } } /** * Gets the item id of the money stack */ public int getMoneyStackId(int amount) { if(amount == 1) { return 995; } else if(amount == 2) { return 996; } else if(amount == 3) { return 997; } else if(amount == 4) { return 998; } else if(amount >= 5 && amount <= 24) { return 999; } else if(amount >= 25 && amount <= 99) { return 1000; } else if(amount >= 100 && amount <= 249) { return 1001; } else if(amount >= 250 && amount <= 999) { return 1002; } else if(amount >= 1000 && amount <= 9999) { return 1003; } else if(amount >= 10000) { return 1004; } return 995; } /** * M or K */ private static String intToKOrMil(int j) { if(j < 0x186a0) return String.valueOf(j); if(j < 0x989680) return j / 1000 + "K"; else return j / 0xf4240 + "M"; } /** * Save offers */ public void saveOffer(int id, String type) { BufferedWriter grandExchange = null; BufferedReader File = null; BufferedWriter fileW = null; if(type == "Sell") { try { try { File = new BufferedReader(new FileReader("./Data/GrandExchange/Sellers/"+id+".txt")); try { File.close(); } catch(IOException o) { } } catch(FileNotFoundException e) { try { fileW = new BufferedWriter(new FileWriter("./Data/GrandExchange/Sellers/"+id+".txt")); try { fileW.close(); } catch(IOException o) { } } catch(IOException a) { } } grandExchange = new BufferedWriter(new FileWriter("./Data/GrandExchange/Sellers/"+id+".txt")); grandExchange.write(Integer.toString(sellers[id].itemId), 0, Integer.toString(sellers[id].itemId).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].amount), 0, Integer.toString(sellers[id].amount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].updatedAmount), 0, Integer.toString(sellers[id].updatedAmount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].price), 0, Integer.toString(sellers[id].price).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].percentage), 0, Integer.toString(sellers[id].percentage).length()); grandExchange.newLine(); grandExchange.write(sellers[id].owner, 0, sellers[id].owner.length()); grandExchange.newLine(); if(sellers[id].completed == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].slot), 0, Integer.toString(sellers[id].slot).length()); grandExchange.newLine(); if(sellers[id].updated == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].itemOne), 0, Integer.toString(sellers[id].itemOne).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].itemTwo), 0, Integer.toString(sellers[id].itemTwo).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].itemOneAmount), 0, Integer.toString(sellers[id].itemOneAmount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].itemTwoAmount), 0, Integer.toString(sellers[id].itemTwoAmount).length()); grandExchange.newLine(); if(sellers[id].aborted == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].total), 0, Integer.toString(sellers[id].total).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(sellers[id].totalGp), 0, Integer.toString(sellers[id].totalGp).length()); grandExchange.close(); } catch (IOException ioexception) { } } else if(type == "Buy") { try { try { File = new BufferedReader(new FileReader("./Data/GrandExchange/Buyers/"+id+".txt")); try { File.close(); } catch(IOException o) { } } catch(FileNotFoundException e) { try { fileW = new BufferedWriter(new FileWriter("./Data/GrandExchange/Buyers/"+id+".txt")); try { fileW.close(); } catch(IOException o) { } } catch(IOException a) { } } grandExchange = new BufferedWriter(new FileWriter("./Data/GrandExchange/Buyers/"+id+".txt")); grandExchange.write(Integer.toString(buyers[id].itemId), 0, Integer.toString(buyers[id].itemId).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].amount), 0, Integer.toString(buyers[id].amount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].updatedAmount), 0, Integer.toString(buyers[id].updatedAmount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].price), 0, Integer.toString(buyers[id].price).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].percentage), 0, Integer.toString(buyers[id].percentage).length()); grandExchange.newLine(); grandExchange.write(buyers[id].owner, 0, buyers[id].owner.length()); grandExchange.newLine(); if(buyers[id].completed == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].slot), 0, Integer.toString(buyers[id].slot).length()); grandExchange.newLine(); if(buyers[id].updated == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].itemOne), 0, Integer.toString(buyers[id].itemOne).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].itemTwo), 0, Integer.toString(buyers[id].itemTwo).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].itemOneAmount), 0, Integer.toString(buyers[id].itemOneAmount).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].itemTwoAmount), 0, Integer.toString(buyers[id].itemTwoAmount).length()); grandExchange.newLine(); if(buyers[id].aborted == true) { grandExchange.write("1", 0, 1); } else { grandExchange.write("0", 0, 1); } grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].total), 0, Integer.toString(buyers[id].total).length()); grandExchange.newLine(); grandExchange.write(Integer.toString(buyers[id].totalGp), 0, Integer.toString(buyers[id].totalGp).length()); grandExchange.close(); } catch (IOException ioexception) { } } } /** * Load offer */ public void loadOffer(int id, String type) { String s = ""; int i = 1; try { BufferedReader bufferedreader = null; if(type == "Sell") { bufferedreader = new BufferedReader(new FileReader( "./Data/GrandExchange/Sellers/"+id+".txt")); } else { bufferedreader = new BufferedReader(new FileReader( "./Data/GrandExchange/Buyers/"+id+".txt")); } for (String s1 = bufferedreader.readLine(); s1 != null; s1 = bufferedreader .readLine()) { s1 = s1.trim(); if(type == "Sell") { if(i == 1) { sellers[id].itemId = Integer.parseInt(s1); } else if(i == 2) { sellers[id].amount = Integer.parseInt(s1); } else if(i == 3) { sellers[id].updatedAmount = Integer.parseInt(s1); } else if(i == 4) { sellers[id].price = Integer.parseInt(s1); } else if(i == 5) { sellers[id].percentage = Integer.parseInt(s1); } else if(i == 6) { sellers[id].owner = s1; } else if(i == 7) { int bol = Integer.parseInt(s1); if(bol == 1) sellers[id].completed = true; else sellers[id].completed = false; } else if(i == 8) { sellers[id].slot = Integer.parseInt(s1); } else if(i == 9) { int bol = Integer.parseInt(s1); if(bol == 1) sellers[id].updated = true; else sellers[id].updated = false; } else if(i == 10) { sellers[id].itemOne = Integer.parseInt(s1); } else if(i == 11) { sellers[id].itemTwo = Integer.parseInt(s1); } else if(i == 12) { sellers[id].itemOneAmount = Integer.parseInt(s1); } else if(i == 13) { sellers[id].itemTwoAmount = Integer.parseInt(s1); } else if(i == 14) { int bol = Integer.parseInt(s1); if(bol == 1) sellers[id].aborted = true; else sellers[id].aborted = false; } else if(i == 15) { sellers[id].total = Integer.parseInt(s1); } else if(i == 16) { sellers[id].totalGp = Integer.parseInt(s1); } } else { if(i == 1) { buyers[id].itemId = Integer.parseInt(s1); } else if(i == 2) { buyers[id].amount = Integer.parseInt(s1); } else if(i == 3) { buyers[id].updatedAmount = Integer.parseInt(s1); } else if(i == 4) { buyers[id].price = Integer.parseInt(s1); } else if(i == 5) { buyers[id].percentage = Integer.parseInt(s1); } else if(i == 6) { buyers[id].owner = s1; } else if(i == 7) { int bol = Integer.parseInt(s1); if(bol == 1) buyers[id].completed = true; else buyers[id].completed = false; } else if(i == 8) { buyers[id].slot = Integer.parseInt(s1); } else if(i == 9) { int bol = Integer.parseInt(s1); if(bol == 1) buyers[id].updated = true; else buyers[id].updated = false; } else if(i == 10) { buyers[id].itemOne = Integer.parseInt(s1); } else if(i == 11) { buyers[id].itemTwo = Integer.parseInt(s1); } else if(i == 12) { buyers[id].itemOneAmount = Integer.parseInt(s1); } else if(i == 13) { buyers[id].itemTwoAmount = Integer.parseInt(s1); } else if(i == 14) { int bol = Integer.parseInt(s1); if(bol == 1) buyers[id].aborted = true; else buyers[id].aborted = false; } else if(i == 15) { buyers[id].total = Integer.parseInt(s1); } else if(i == 16) { buyers[id].totalGp = Integer.parseInt(s1); } } i++; } bufferedreader.close(); } catch (Exception exception) { exception.printStackTrace(); } } /** * Updates percentage bar */ public void updateBar(String color, String type, int i, int slot, Player c2) { if(color == "Red") { c2.sendConfig(3, slot, 1, -1); c2.sendConfig(2, slot, 100, -1); } if(color == "Green") { double p; int col; if(type == "Sell" && sellers[i] != null) { p = ((double)sellers[i].percentage / sellers[i].amount) * 100; col = (int)p; c2.sendConfig(3, slot, 2, -1); c2.sendConfig(1, slot, 2, -1); c2.sendConfig(2, slot, col, -1); } else if(type == "Buy" && buyers[i] != null) { p = ((double)buyers[i].percentage / buyers[i].amount) * 100; col = (int)p; c2.sendConfig(3, slot, 2, -1); c2.sendConfig(1, slot, 2, -1); c2.sendConfig(2, slot, col, -1); } } } /** * Button click */ public void buttonClick(int buttonId) { switch(buttonId) { case 95185: selectedSlot = 1; openInterface("Buy"); break; case 95191: selectedSlot = 1; openInterface("Sell"); break; case 95203: selectedSlot = 2; openInterface("Buy"); break; case 95206: selectedSlot = 2; openInterface("Sell"); break; case 95194: selectedSlot = 3; openInterface("Buy"); break; case 95209: selectedSlot = 3; openInterface("Sell"); break; case 95188: selectedSlot = 4; openInterface("Buy"); break; case 95212: selectedSlot = 4; openInterface("Sell"); break; case 95197: selectedSlot = 5; openInterface("Buy"); break; case 95215: selectedSlot = 5; openInterface("Sell"); break; case 95200: selectedSlot = 6; openInterface("Buy"); break; case 95218: selectedSlot = 6; openInterface("Sell"); break; case 96078: c.sendConfig(6, -1, -1, -1); break; case 96174: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } completeOffer("Sell"); break; case 96074: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } completeOffer("Buy"); break; case 96082: case 96182: c.getPA().showInterface(24500); break; case 96030: case 96130: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } if(selectedAmount != 0) { selectedAmount--; updateGE(selectedItemId, selectedPrice); } break; case 96034: case 96134: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } if(selectedAmount != 2147483647) { selectedAmount++; updateGE(selectedItemId, selectedPrice); } break; case 96038: case 96138: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } if(selectedAmount != 2147483647) { selectedAmount++; updateGE(selectedItemId, selectedPrice); } break; case 96042: case 96142: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } long a = selectedAmount; long total = a+10; if(total < 2147483647) { selectedAmount += 10; updateGE(selectedItemId, selectedPrice); } else { selectedAmount = 2147483647; updateGE(selectedItemId, selectedPrice); } break; case 96046: case 96146: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } long l = selectedAmount; long t = l+100; if(t < 2147483647) { selectedAmount += 100; updateGE(selectedItemId, selectedPrice); } else { selectedAmount = 2147483647; updateGE(selectedItemId, selectedPrice); } break; case 96050: case 96150: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } long h = selectedAmount; long d = h+1000; if(d < 2147483647) { selectedAmount += 1000; updateGE(selectedItemId, selectedPrice); } else { selectedAmount = 2147483647; updateGE(selectedItemId, selectedPrice); } break; case 96058: case 96158: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } if(selectedPrice != 1) { selectedPrice *= 0.95; updateGE(selectedItemId, selectedPrice); if(selectedPrice < 1) { selectedPrice = 1; updateGE(selectedItemId, selectedPrice); } } break; case 96070: case 96170: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } long k = selectedPrice; k *= 1.05; if(k <= 2147483647) { selectedPrice *= 1.05; if(selectedPrice < 21) selectedPrice++; updateGE(selectedItemId, selectedPrice); } else { selectedPrice = 2147483647; updateGE(selectedItemId, selectedPrice); } break; case 96062: case 96162: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } selectedPrice = c.getShops().getItemShopValue(selectedItemId); updateGE(selectedItemId, selectedPrice); break; case 96086: case 96186: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } selectedPrice--; if(selectedPrice == 0) selectedPrice = 1; updateGE(selectedItemId, selectedPrice); break; case 96089: case 96189: if(selectedItemId == 0) { c.sendMessage("You must choose an item first."); return; } if(selectedPrice != 2147483647) { selectedPrice++; updateGE(selectedItemId, selectedPrice); } else { selectedPrice = 2147483647; } break; case 95223: selectedSlot = 1; openCollect(selectedSlot, true); break; case 95227: selectedSlot = 2; openCollect(selectedSlot, true); break; case 95231: selectedSlot = 3; openCollect(selectedSlot, true); break; case 95235: selectedSlot = 4; openCollect(selectedSlot, true); break; case 95239: selectedSlot = 5; openCollect(selectedSlot, true); break; case 95243: selectedSlot = 6; openCollect(selectedSlot, true); break; case 213230: case 209254: openGrandExchange(true); break; case 95221: abortOffer(1, true); break; case 95225: abortOffer(2, true); break; case 95229: abortOffer(3, true); break; case 95233: abortOffer(4, true); break; case 95237: abortOffer(5, true); break; case 95241: abortOffer(6, true); break; case 214016: case 210040: abortOffer(selectedSlot, true); openCollect(selectedSlot, false); break; } } /** * Complete offer */ public void completeOffer(String type) { if(Slots[selectedSlot] > 0) { return; } if(toHigh) { c.sendMessage("The offer you made has to high of a price."); return; } if(selectedAmount == 0) { c.sendMessage("You must buy more than one."); return; } if(type == "Sell") { sellItems(); } else if(type == "Buy") { buyItems(); } } /** * Update Grand Exchange */ public void updateGE(int id, int price) { if(price == 0) { price = 1; selectedPrice = 1; } c.getPA().sendFrame126(Misc.format(price)+" gp", 24672); c.getPA().sendFrame126(Misc.format(price)+" gp", 24772); long p = price; long s = selectedAmount; long total = s*p; if(total <= 2147483647) { c.getPA().sendFrame126(Misc.format(price*selectedAmount)+" gp", 24673); c.getPA().sendFrame126(Misc.format(price*selectedAmount)+" gp", 24773); toHigh = false; } else { c.getPA().sendFrame126("Too high!", 24673); c.getPA().sendFrame126("Too high!", 24773); toHigh = true; } c.getPA().sendFrame126(Misc.format(selectedAmount)+"", 24671); c.getPA().sendFrame126(Misc.format(selectedAmount)+"", 24771); c.getPA().sendFrame126(Misc.format(c.getShops().getItemShopValue(id))+"", 24682); c.getPA().sendFrame126(Misc.format(c.getShops().getItemShopValue(id))+"", 24782); if(id > 0) { c.getPA().sendFrame126(""+c.getItems().getItemName(id), 24669); c.getPA().sendFrame126("It's a "+c.getItems().getItemName(id), 24670); c.getPA().sendFrame126(""+c.getItems().getItemName(id), 24769); c.getPA().sendFrame126("It's a "+c.getItems().getItemName(id), 24770); c.getPA().sendFrame34(id, 0, 24780, 1); c.getPA().sendFrame34(id, 0, 24680, 1); } else { c.getPA().sendFrame34(-1, 0, 24780, 1); c.getPA().sendFrame34(-1, 0, 24680, 1); } } /** * Open the collection interface */ public void openCollect(int id, boolean open) { if(sellers[Slots[id]] != null && sellers[Slots[id]].owner.equalsIgnoreCase(c.playerName) && SlotType[id] == 1) { long p = sellers[Slots[id]].price; long a = sellers[Slots[id]].amount; long total = a*p; if(total <= 2147483647) { c.getPA().sendFrame126(Misc.format(sellers[Slots[id]].amount)+"", 54771); c.getPA().sendFrame126(Misc.format(sellers[Slots[id]].price)+" gp", 54772); c.getPA().sendFrame126(Misc.format(sellers[Slots[id]].price*sellers[Slots[id]].amount)+" gp", 54773); if(sellers[Slots[id]].itemId > 0) { c.getPA().sendFrame34(sellers[Slots[id]].itemId, 0, 54780, 1); } else { return; } if(sellers[Slots[id]].itemOne > 0 && sellers[Slots[id]].itemOneAmount > 0) { c.getPA().sendFrame34(sellers[Slots[id]].itemOne, 0, 54781, 1); if(sellers[Slots[id]].itemOneAmount > 1) { c.getPA().sendFrame126(intToKOrMil(sellers[Slots[id]].itemOneAmount)+"", 54784); } else { c.getPA().sendFrame126("", 54784); } } else { c.getPA().sendFrame34(-1, 0, 54781, 1); c.getPA().sendFrame126("", 54784); } if(sellers[Slots[id]].itemTwo > 0 && sellers[Slots[id]].itemTwoAmount > 0) { c.getPA().sendFrame34(sellers[Slots[id]].itemTwo, 0, 54782, 1); if(sellers[Slots[id]].itemTwoAmount > 1) { c.getPA().sendFrame126(intToKOrMil(sellers[Slots[id]].itemTwoAmount)+"", 54785); } else { c.getPA().sendFrame126("", 54785); } } else { c.getPA().sendFrame34(-1, 0, 54782, 1); c.getPA().sendFrame126("", 54785); } c.getPA().sendFrame126("@[email protected] sold a total of @[email protected]"+sellers[Slots[id]].total, 54788); c.getPA().sendFrame126("@[email protected] a total price of @[email protected]"+sellers[Slots[id]].totalGp+"@[email protected] gp.", 54789); c.getPA().sendFrame126(Misc.format(c.getShops().getItemShopValue(sellers[Slots[id]].itemId))+"", 54787); c.getPA().sendFrame126(""+c.getItems().getItemName(sellers[Slots[id]].itemId), 53769); c.getPA().sendFrame126("It's a "+c.getItems().getItemName(sellers[Slots[id]].itemId), 53770); c.sendConfig(4, selectedSlot, 2, -1); if(open) { c.getPA().showInterface(54700); } } else { } } else if(buyers[Slots[id]] != null && buyers[Slots[id]].owner.equalsIgnoreCase(c.playerName) && SlotType[id] == 2) { long p = buyers[Slots[id]].price; long a = buyers[Slots[id]].amount; long total = a*p; if(total <= 2147483647) { c.getPA().sendFrame126(Misc.format(buyers[Slots[id]].amount)+"", 53771); c.getPA().sendFrame126(Misc.format(buyers[Slots[id]].price)+" gp", 53772); c.getPA().sendFrame126(Misc.format(buyers[Slots[id]].price*buyers[Slots[id]].amount)+" gp", 53773); if(buyers[Slots[id]].itemId > 0) { c.getPA().sendFrame34(buyers[Slots[id]].itemId, 0, 53780, 1); } else { return; } if(buyers[Slots[id]].itemOne > 0 && buyers[Slots[id]].itemOneAmount > 0) { c.getPA().sendFrame34(buyers[Slots[id]].itemOne, 0, 53781, 1); c.getPA().sendFrame126(buyers[Slots[id]].itemOneAmount+"", 53784); if(buyers[Slots[id]].itemOneAmount > 1) { c.getPA().sendFrame126(intToKOrMil(buyers[Slots[id]].itemOneAmount)+"", 53784); } else { c.getPA().sendFrame126("", 53784); } } else { c.getPA().sendFrame34(-1, 0, 53781, 1); c.getPA().sendFrame126("", 53784); } if(buyers[Slots[id]].itemTwo > 0 && buyers[Slots[id]].itemTwoAmount > 0) { c.getPA().sendFrame34(buyers[Slots[id]].itemTwo, 0, 53782, 1); if(buyers[Slots[id]].itemTwoAmount > 1) { c.getPA().sendFrame126(intToKOrMil(buyers[Slots[id]].itemTwoAmount)+"", 53785); } else { c.getPA().sendFrame126("", 53785); } } else { c.getPA().sendFrame34(-1, 0, 53782, 1); c.getPA().sendFrame126("", 53785); } c.getPA().sendFrame126("@[email protected] bought a total of @[email protected]"+buyers[Slots[id]].total, 53788); c.getPA().sendFrame126("@[email protected] a total price of @[email protected]"+buyers[Slots[id]].totalGp+"@[email protected] gp.", 53789); c.getPA().sendFrame126(Misc.format(c.getShops().getItemShopValue(buyers[Slots[id]].itemId))+"", 53787); c.getPA().sendFrame126(""+c.getItems().getItemName(buyers[Slots[id]].itemId), 54769); c.getPA().sendFrame126("It's a "+c.getItems().getItemName(buyers[Slots[id]].itemId), 54770); c.sendConfig(4, selectedSlot, 2, -1); if(open) { c.getPA().showInterface(53700); } } else { } } } /** * Open main Grand Exchange interface */ public void openGrandExchange(boolean open) { for(int i = 1; i < Slots.length; i++) { if(Slots[i] != 0) { if(sellers[Slots[i]] != null && sellers[Slots[i]].owner.equalsIgnoreCase(c.playerName) && sellers[Slots[i]].slot == i) { if(sellers[Slots[i]].completed) { c.sendConfig(5, i, 5, -1); } else { c.sendConfig(5, i, 3, -1); } int k = i*2; k += 24565; c.getPA().sendFrame34(sellers[Slots[i]].itemId, 0, k, sellers[Slots[i]].amount); c.getPA().sendFrame126(""+c.getItems().getItemName(sellers[Slots[i]].itemId)+"", 32000+i); c.getPA().sendFrame126(Misc.format(sellers[Slots[i]].price)+" gp", 33000+i); if(sellers[Slots[i]].amount != 1) { c.getPA().sendFrame126(""+intToKOrMil(sellers[Slots[i]].amount), 33100+i); } else { c.getPA().sendFrame126("", 33100+i); } if(sellers[Slots[i]].aborted) { updateBar("Red", "Sell", Slots[i], i, c); } else { updateBar("Green", "Sell", Slots[i], i, c); } } else if(buyers[Slots[i]] != null && buyers[Slots[i]].owner.equalsIgnoreCase(c.playerName) && buyers[Slots[i]].slot == i) { if(buyers[Slots[i]].completed) { c.sendConfig(5, i, 6, -1); } else { c.sendConfig(5, i, 4, -1); } int k = i*2; k += 24565; c.getPA().sendFrame34(buyers[Slots[i]].itemId, 0, k, buyers[Slots[i]].amount); c.getPA().sendFrame126(""+c.getItems().getItemName(buyers[Slots[i]].itemId)+"", 32000+i); c.getPA().sendFrame126(Misc.format(buyers[Slots[i]].price)+" gp", 33000+i); if(buyers[Slots[i]].amount != 1) { c.getPA().sendFrame126(""+intToKOrMil(buyers[Slots[i]].amount), 33100+i); } else { c.getPA().sendFrame126("", 33100+i); } if(buyers[Slots[i]].aborted) { updateBar("Red", "Buy", Slots[i], i, c); } else { updateBar("Green", "Buy", Slots[i], i, c); } } } else { c.sendConfig(4, i, 3, -1); int k = i*2; k += 24565; c.getPA().sendFrame34(-1, 0, k, 1); c.getPA().sendFrame126("", 33000+i); c.getPA().sendFrame126("", 32000+i); c.getPA().sendFrame126("", 33100+i); } } if(open) { c.getPA().showInterface(24500); recievedMessage = false; } } /** * Open Buy or Sell interface */ public void openInterface(String type) { if(Slots[selectedSlot] > 0) { return; } selectedItemId = 0; selectedAmount = 0; selectedPrice = 0; updateGE(-1, 1); c.getPA().sendFrame126("Choose an item to exchange", 24669); c.getPA().sendFrame126("Click the icon to the left to search for items.", 24670); c.getPA().sendFrame126("Choose an item to exchange", 24769); c.getPA().sendFrame126("Select an item from your invertory to sell.", 24770); c.getPA().sendFrame126("N/A", 24682); c.getPA().sendFrame126("N/A", 24782); c.sendConfig(4, selectedSlot, 2, -1); if(type == "Sell") { c.getPA().showInterface(24700); } else if(type == "Buy") { c.getPA().showInterface(24600); } } /** * Item collecting */ public void collectItem(int i, String type) { int itemId = 0; if(type == "Sell") { if(i == 1) { if(sellers[Slots[selectedSlot]] == null) { return; } itemId = sellers[Slots[selectedSlot]].itemOne; if(ItemDefinition.forId(itemId). itemIsNote) itemId -= 1; if(c.getItems().freeSlots() == 0) { c.sendMessage("You don't have enough inventory space."); return; } if(itemId >= 996 && itemId <= 1004) { itemId = 995; } if(sellers[Slots[selectedSlot]].itemOneAmount <= 0) { return; } if(c.getItems().freeSlots() > 0 && !ItemDefinition.forId(itemId). itemStackable) { c.getItems().addItem(itemId, sellers[Slots[selectedSlot]].itemOneAmount); sellers[Slots[selectedSlot]].itemOneAmount = 0; } if(c.getItems().freeSlots() > 0 && !ItemDefinition.forId(itemId). itemStackable) { if(ItemDefinition.forId(itemId+1). itemIsNote) { itemId += 1; } else { return; } c.getItems().addItem(itemId, sellers[Slots[selectedSlot]].itemOneAmount); sellers[Slots[selectedSlot]].itemOneAmount = 0; } boolean save = true; if(sellers[Slots[selectedSlot]].itemOneAmount == 0 && sellers[Slots[selectedSlot]].itemTwoAmount == 0 && sellers[Slots[selectedSlot]].updatedAmount != 0) { sellers[Slots[selectedSlot]].updated = false; } if(sellers[Slots[selectedSlot]].itemOneAmount == 0 && sellers[Slots[selectedSlot]].itemTwoAmount == 0 && sellers[Slots[selectedSlot]].updatedAmount == 0) { deleteFile("Data/GrandExchange/Sellers/"+Slots[selectedSlot]+""); sellers[Slots[selectedSlot]].itemId = 0; sellers[Slots[selectedSlot]].amount = 0; sellers[Slots[selectedSlot]].updatedAmount = 0; sellers[Slots[selectedSlot]].price = 0; sellers[Slots[selectedSlot]].percentage = 0; sellers[Slots[selectedSlot]].slot = 0; sellers[Slots[selectedSlot]].itemOne = 0; sellers[Slots[selectedSlot]].itemTwo = 0; sellers[Slots[selectedSlot]].itemOneAmount = 0; sellers[Slots[selectedSlot]].itemTwoAmount = 0; sellers[Slots[selectedSlot]].total = 0; sellers[Slots[selectedSlot]].totalGp = 0; sellers[Slots[selectedSlot]].aborted = false; sellers[Slots[selectedSlot]].completed = false; sellers[Slots[selectedSlot]].updated = false; sellers[Slots[selectedSlot]].owner = ""; sellers[Slots[selectedSlot]] = null; Slots[selectedSlot] = 0; SlotType[selectedSlot] = 0; openGrandExchange(true); save = false; } if(save) { saveOffer(Slots[selectedSlot], "Sell"); } recievedMessage = false; PlayerSave.saveGame(c); openCollect(selectedSlot, false); } if(i == 2) { if(sellers[Slots[selectedSlot]] == null) { return; } itemId = sellers[Slots[selectedSlot]].itemTwo; if(ItemDefinition.forId(itemId). itemIsNote) itemId -= 1; if(c.getItems().freeSlots() == 0) { c.sendMessage("You don't have enough inventory space."); return; } if(itemId >= 996 && itemId <= 1004) { itemId = 995; } if(sellers[Slots[selectedSlot]].itemTwoAmount <= 0) { return; } if(c.getItems().freeSlots() > 0 && ItemDefinition.forId(itemId). itemStackable) { c.getItems().addItem(itemId, sellers[Slots[selectedSlot]].itemTwoAmount); sellers[Slots[selectedSlot]].itemTwoAmount = 0; } if(c.getItems().freeSlots() > 0 && !ItemDefinition.forId(itemId). itemStackable) { if(ItemDefinition.forId(itemId+1). itemIsNote) { itemId += 1; } else { return; } c.getItems().addItem(itemId, sellers[Slots[selectedSlot]].itemTwoAmount); sellers[Slots[selectedSlot]].itemTwoAmount = 0; } boolean save = true; if(sellers[Slots[selectedSlot]].itemOneAmount == 0 && sellers[Slots[selectedSlot]].itemTwoAmount == 0 && sellers[Slots[selectedSlot]].updatedAmount != 0) { sellers[Slots[selectedSlot]].updated = false; } if(sellers[Slots[selectedSlot]].itemOneAmount == 0 && sellers[Slots[selectedSlot]].itemTwoAmount == 0 && sellers[Slots[selectedSlot]].updatedAmount == 0) { deleteFile("Data/GrandExchange/Sellers/"+Slots[selectedSlot]+""); sellers[Slots[selectedSlot]].id = 0; sellers[Slots[selectedSlot]].itemId = 0; sellers[Slots[selectedSlot]].amount = 0; sellers[Slots[selectedSlot]].updatedAmount = 0; sellers[Slots[selectedSlot]].price = 0; sellers[Slots[selectedSlot]].percentage = 0; sellers[Slots[selectedSlot]].slot = 0; sellers[Slots[selectedSlot]].total = 0; sellers[Slots[selectedSlot]].totalGp = 0; sellers[Slots[selectedSlot]].itemOne = 0; sellers[Slots[selectedSlot]].itemTwo = 0; sellers[Slots[selectedSlot]].itemOneAmount = 0; sellers[Slots[selectedSlot]].itemTwoAmount = 0; sellers[Slots[selectedSlot]].aborted = false; sellers[Slots[selectedSlot]].completed = false; sellers[Slots[selectedSlot]].updated = false; sellers[Slots[selectedSlot]].owner = ""; sellers[Slots[selectedSlot]] = null; Slots[selectedSlot] = 0; SlotType[selectedSlot] = 0; openGrandExchange(true); save = false; } if(save) { saveOffer(Slots[selectedSlot], "Sell"); } recievedMessage = false; PlayerSave.saveGame(c); openCollect(selectedSlot, false); } } if(type == "Buy") { if(i == 1) { if(buyers[Slots[selectedSlot]] == null) { return; } itemId = buyers[Slots[selectedSlot]].itemOne; if(ItemDefinition.forId(itemId). itemIsNote) itemId -= 1; if(c.getItems().freeSlots() == 0) { c.sendMessage("You don't have enough inventory space."); return; } if(itemId >= 996 && itemId <= 1004) { itemId = 995; } if(buyers[Slots[selectedSlot]].itemOneAmount <= 0) { return; } if(c.getItems().freeSlots() > 0 && ItemDefinition.forId(itemId). itemStackable) { c.getItems().addItem(itemId, buyers[Slots[selectedSlot]].itemOneAmount); buyers[Slots[selectedSlot]].itemOneAmount = 0; } if(c.getItems().freeSlots() > 0 && !ItemDefinition.forId(itemId). itemStackable) { if(ItemDefinition.forId(itemId+1). itemIsNote) { itemId += 1; } else { return; } c.getItems().addItem(itemId, buyers[Slots[selectedSlot]].itemOneAmount); buyers[Slots[selectedSlot]].itemOneAmount = 0; } boolean save = true; if(buyers[Slots[selectedSlot]].itemOneAmount == 0 && buyers[Slots[selectedSlot]].itemTwoAmount == 0 && buyers[Slots[selectedSlot]].updatedAmount != 0) { buyers[Slots[selectedSlot]].updated = false; } if(buyers[Slots[selectedSlot]].itemOneAmount == 0 && buyers[Slots[selectedSlot]].itemTwoAmount == 0 && buyers[Slots[selectedSlot]].updatedAmount == 0) { deleteFile("Data/GrandExchange/Buyers/"+Slots[selectedSlot]+""); buyers[Slots[selectedSlot]].id = 0; buyers[Slots[selectedSlot]].itemId = 0; buyers[Slots[selectedSlot]].amount = 0; buyers[Slots[selectedSlot]].updatedAmount = 0; buyers[Slots[selectedSlot]].price = 0; buyers[Slots[selectedSlot]].percentage = 0; buyers[Slots[selectedSlot]].slot = 0; buyers[Slots[selectedSlot]].itemOne = 0; buyers[Slots[selectedSlot]].itemTwo = 0; buyers[Slots[selectedSlot]].itemOneAmount = 0; buyers[Slots[selectedSlot]].itemTwoAmount = 0; buyers[Slots[selectedSlot]].total = 0; buyers[Slots[selectedSlot]].totalGp = 0; buyers[Slots[selectedSlot]].aborted = false; buyers[Slots[selectedSlot]].completed = false; buyers[Slots[selectedSlot]].updated = false; buyers[Slots[selectedSlot]].owner = ""; buyers[Slots[selectedSlot]] = null; Slots[selectedSlot] = 0; SlotType[selectedSlot] = 0; openGrandExchange(true); save = false; } if(save) { saveOffer(Slots[selectedSlot], "Buy"); } recievedMessage = false; PlayerSave.saveGame(c); openCollect(selectedSlot, false); } if(i == 2) { if(buyers[Slots[selectedSlot]] == null) { return; } itemId = buyers[Slots[selectedSlot]].itemTwo; if(ItemDefinition.forId(itemId). itemIsNote) itemId -= 1; if(c.getItems().freeSlots() == 0) { c.sendMessage("You don't have enough inventory space."); return; } if(itemId >= 996 && itemId <= 1004) { itemId = 995; } if(buyers[Slots[selectedSlot]].itemTwoAmount <= 0) { return; } if(c.getItems().freeSlots() > 0 && ItemDefinition.forId(itemId). itemStackable) { c.getItems().addItem(itemId, buyers[Slots[selectedSlot]].itemTwoAmount); buyers[Slots[selectedSlot]].itemTwoAmount = 0; } if(c.getItems().freeSlots() > 0 && !ItemDefinition.forId(itemId). itemStackable) { if(ItemDefinition.forId(itemId+1). itemIsNote) { itemId += 1; } else { return; } c.getItems().addItem(itemId, buyers[Slots[selectedSlot]].itemTwoAmount); buyers[Slots[selectedSlot]].itemTwoAmount = 0; } boolean save = true; if(buyers[Slots[selectedSlot]].itemOneAmount == 0 && buyers[Slots[selectedSlot]].itemTwoAmount == 0 && buyers[Slots[selectedSlot]].updatedAmount != 0) { buyers[Slots[selectedSlot]].updated = false; } if(buyers[Slots[selectedSlot]].itemOneAmount == 0 && buyers[Slots[selectedSlot]].itemTwoAmount == 0 && buyers[Slots[selectedSlot]].updatedAmount == 0) { deleteFile("Data/GrandExchange/Buyers/"+Slots[selectedSlot]+""); buyers[Slots[selectedSlot]].id = 0; buyers[Slots[selectedSlot]].itemId = 0; buyers[Slots[selectedSlot]].amount = 0; buyers[Slots[selectedSlot]].updatedAmount = 0; buyers[Slots[selectedSlot]].price = 0; buyers[Slots[selectedSlot]].percentage = 0; buyers[Slots[selectedSlot]].slot = 0; buyers[Slots[selectedSlot]].itemOne = 0; buyers[Slots[selectedSlot]].itemTwo = 0; buyers[Slots[selectedSlot]].itemOneAmount = 0; buyers[Slots[selectedSlot]].itemTwoAmount = 0; buyers[Slots[selectedSlot]].total = 0; buyers[Slots[selectedSlot]].totalGp = 0; buyers[Slots[selectedSlot]].aborted = false; buyers[Slots[selectedSlot]].completed = false; buyers[Slots[selectedSlot]].updated = false; buyers[Slots[selectedSlot]].owner = ""; buyers[Slots[selectedSlot]] = null; Slots[selectedSlot] = 0; SlotType[selectedSlot] = 0; openGrandExchange(true); save = false; } if(save) { saveOffer(Slots[selectedSlot], "Buy"); } recievedMessage = false; PlayerSave.saveGame(c); openCollect(selectedSlot, false); } } } /** * Abort a offer */ public void abortOffer(int offer, boolean send) { if(sellers[Slots[offer]] != null && SlotType[offer] == 1) { if(sellers[Slots[offer]].completed == true) { c.sendMessage("Your offer is already completed!"); return; } if(sellers[Slots[offer]].updatedAmount <= 0) { return; } if(send) { c.sendMessage("Abort request acknowledged. Please be aware that your offer may have already been"); c.sendMessage("completed."); } if(stillSearching) { abortOffer(offer, false); return; } if(sellers[Slots[offer]].itemOneAmount == 0) { sellers[Slots[offer]].itemOne = sellers[Slots[offer]].itemId; sellers[Slots[offer]].itemOneAmount = sellers[Slots[offer]].updatedAmount; sellers[Slots[offer]].updatedAmount = 0; sellers[Slots[offer]].aborted = true; } else { sellers[Slots[offer]].itemTwo = sellers[Slots[offer]].itemId; sellers[Slots[offer]].itemTwoAmount = sellers[Slots[offer]].updatedAmount; sellers[Slots[offer]].updatedAmount = 0; sellers[Slots[offer]].aborted = true; } sellers[Slots[offer]].updated = true; saveOffer(Slots[offer], "Sell"); openGrandExchange(false); } else if(buyers[Slots[offer]] != null && SlotType[offer] == 2) { if(buyers[Slots[offer]].completed == true) { c.sendMessage("Your offer is already completed!"); return; } if(buyers[Slots[offer]].updatedAmount <= 0) { return; } if(send) { c.sendMessage("Abort request acknowledged. Please be aware that your offer may have already been"); c.sendMessage("completed."); } if(stillSearching) { abortOffer(offer, false); return; } if(buyers[Slots[offer]].itemOneAmount == 0) { buyers[Slots[offer]].itemOneAmount = buyers[Slots[offer]].updatedAmount*buyers[Slots[offer]].price; buyers[Slots[offer]].itemOne = getMoneyStackId(buyers[Slots[offer]].itemOneAmount); buyers[Slots[offer]].updatedAmount = 0; buyers[Slots[offer]].aborted = true; } else { buyers[Slots[offer]].itemTwoAmount = buyers[Slots[offer]].updatedAmount*buyers[Slots[offer]].price; buyers[Slots[offer]].itemOne = getMoneyStackId(buyers[Slots[offer]].itemOneAmount); buyers[Slots[offer]].updatedAmount = 0; buyers[Slots[offer]].aborted = true; } buyers[Slots[offer]].updated = true; saveOffer(Slots[offer], "Buy"); openGrandExchange(false); } } /** * Delete a file */ public void deleteFile(String FileName) { String fileName = ""+FileName+".txt"; File f = new File(fileName); if (!f.exists()) throw new IllegalArgumentException("Delete: no such file or directory: " + fileName); if (!f.canWrite()) throw new IllegalArgumentException("Delete: write protected: "+ fileName); if (f.isDirectory()) { String[] files = f.list(); if (files.length > 0) throw new IllegalArgumentException("Delete: directory not empty: " + fileName); } boolean success = f.delete(); if (!success) throw new IllegalArgumentException("Delete: deletion failed"); } } [/CODE] [CODE] package com.exile.game.players.grandexchange; /** [MENTION=52317]auth[/MENTION]or Alex(TheLife) */ public class Sellers { /** * Integers */ public int id, itemId, amount, updatedAmount, price, percentage, slot, itemOne, itemTwo, itemOneAmount, itemTwoAmount, total, totalGp; /** * Booleans */ public boolean aborted = false, completed = false, updated = false; /** * Strings */ public String owner; /** * New offer */ public Sellers(int Id) { id = Id; } } [/CODE] [CODE]package com.exile.game.players.grandexchange; /** [MENTION=52317]auth[/MENTION]or Alex(TheLife) */ public class Buyers { /** * Integers */ public int id, itemId, amount, updatedAmount, price, percentage, slot, itemOne, itemTwo, itemOneAmount, itemTwoAmount, total, totalGp; /** * Booleans */ public boolean aborted = false, completed = false, updated = false; /** * Strings */ public String owner; /** * New offer */ public Buyers(int Id) { id = Id; } }[/CODE] Commands.java: [CODE]if(playerCommand.startsWith("[A]")) { String ge = playerCommand.substring(3); int GE = Integer.parseInt(ge); c.GE().selectedItemId = GE; c.GE().selectedPrice = c.getShops().getItemShopValue(GE); if(c.getShops().getItemShopValue(GE) == 0) { c.GE().selectedPrice = 1; } c.GE().updateGE(c.GE().selectedItemId, c.GE().selectedPrice); } if(playerCommand.startsWith("[L]")) { boolean canUpdate = true; if(c.GE().selectedItemId == 0) { c.sendMessage("You must choose an item first."); canUpdate = false; } String ge = playerCommand.substring(3); int GE = Integer.parseInt(ge); if(canUpdate) { c.GE().selectedAmount = GE; c.GE().updateGE(c.GE().selectedItemId, c.GE().selectedPrice); } } if(playerCommand.startsWith("[E]")) { boolean canUpdate = true; if(c.GE().selectedItemId == 0) { c.sendMessage("You must choose an item first."); canUpdate = false; } String ge = playerCommand.substring(3); int GE = Integer.parseInt(ge); if(canUpdate) { c.GE().selectedPrice = GE; c.GE().updateGE(c.GE().selectedItemId, c.GE().selectedPrice); } } if(playerCommand.startsWith("[BS1]")) { c.GE().collectItem(1, "Sell"); } if(playerCommand.startsWith("[BS2]")) { c.GE().collectItem(2, "Sell"); } if(playerCommand.startsWith("[BB1]")) { c.GE().collectItem(1, "Buy"); } if(playerCommand.startsWith("[BB2]")) { c.GE().collectItem(2, "Buy"); }[/CODE] Clickingbuttons.java: [CODE] case 95185: case 95191: case 95203: case 95206: case 95194: case 95209: case 95188: case 95212: case 95197: case 95215: case 95200: case 95218: case 96078: case 96174: case 96074: case 96082: case 96182: case 96030: case 96130: case 96034: case 96134: case 96038: case 96138: case 96042: case 96142: case 96046: case 96146: case 96050: case 96150: case 96058: case 96158: case 96070: case 96170: case 96062: case 96162: case 96086: case 96186: case 96089: case 96189: case 95223: case 95227: case 95231: case 95235: case 95239: case 95243: case 213230: case 209254: case 95221: case 95225: case 95229: case 95233: case 95237: case 95241: case 214016: case 210040: c.GE().buttonClick(actionButtonId); break; case 93196: c.getPA().closeAllWindows(); break;[/CODE] Client.java in initialize: [CODE]GE().sendUpdate(playerName);[/CODE] [CODE]public void sendConfig(int x, int y, int z, int i) { getOutStream().createFrameVarSize(166); getOutStream().writeByte(x);// readUnsignedByte getOutStream().writeByte(y);// readUnsignedByte getOutStream().writeByte(-1);// readUnsignedByte getOutStream().writeByte(z);// readUnsignedByte getOutStream().writeByte(i);// readUnsignedByte getOutStream().endFrameVarSize(); }[/CODE] [CODE]public GrandExchange GE() { return GE; }[/CODE] [CODE]public GrandExchange GE() { return GE; }[/CODE] Server.java: [CODE]public static GrandExchange GE = new GrandExchange();[/CODE] [CODE]GrandExchange.loading = true; GE.loadSellers(); GE.loadBuyers(); GrandExchange.loading = false; System.out.println("Total offers loaded " + GE.totalOffers);[/CODE] Credits: TheLife Enjoy - releasing this for people to add the server sided part to add to my Project-Exile release as we removed it a while ago for some reason. Thank the thread if you like it.
  3. [CENTER][URL="http://rune-inception.com"][IMG]http://i.imgur.com/ESVsXoU.jpg[/IMG][/URL] [B][SIZE=5][COLOR="#00FFFF"]VIDEO COMING SOON![/COLOR][/SIZE][/B] [URL="http://rune-inception.com"][IMG]http://i.imgur.com/Jg9c13b.jpg[/IMG][/URL] [SIZE=4][COLOR="#00FF00"]Just released! Be one of the first to join and play the amazing RsPs Adventure![/COLOR] [/SIZE] [IMG]http://i.imgur.com/PhGbGay.png[/IMG] [URL="http://rune-inception.com"][IMG]http://i.imgur.com/FSPIxYx.jpg[/IMG][/URL] [SIZE=1]Credits ~ Matrix Team (Core framework, was used for the beginning of the server) ~ bobismyname (for the source base) ~ If im missing you, please let me know[/SIZE][/CENTER]
  4. [video=youtube;7oFmRN0oadI]https://www.youtube.com/watch?v=7oFmRN0oadI[/video] I think this will make GTA V a bit more unique.
  5. wtfkid

    Grand Exchange help

    how to add Grand Exchange with 317 i use Insanity any help please ?
  6. The dupe is when we press 100+ or 1000+ and accept it dupe.. Video: [url]http://www.youtube.com/watch?v=bukBFYbm6gc[/url] Tell me if you want my skype to help me !
  7. how do i get grand exchange working on chronicscape all the grandexchange.java files are there but no grand exchange clerks or that ?
  8. jens19963

    Grand Exchange

    when i try to buy stuffs nothing happends [url]http://prntscr.com/5y31c4[/url] and when i try to sell stuffs i get error and the item i try to sell does not appear in this box [url]http://prntscr.com/5y31pc[/url] error [CODE]ERROR! THREAD NAME: New I/O server worker #1-1 java.lang.NullPointerException at com.rs.content.exchange.ExchangeHandler.sendSellItem(ExchangeHandler. java:567) at com.rs.net.decoders.handlers.ButtonHandler.handleButtons(ButtonHandle r.java:2391) at com.rs.net.decoders.WorldPacketsDecoder.processPackets(WorldPacketsDe coder.java:1292) at com.rs.net.decoders.WorldPacketsDecoder.decode(WorldPacketsDecoder.ja va:298) at com.rs.net.ServerChannelHandler.messageReceived(ServerChannelHandler. java:98) at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleCha nnelHandler.java:100) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultCh annelPipeline.java:564) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultCh annelPipeline.java:559) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:27 4) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:26 1) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:351) at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioW orker.java:282) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:202) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnabl e.java:108) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProof Worker.java:44) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor. java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor .java:615) at java.lang.Thread.run(Thread.java:744)[/CODE] exchangehandler.java [CODE]package com.rs.content.exchange; import java.io.IOException; import com.rs.cache.loaders.ItemDefinitions; import com.rs.utils.FileUtilities; import com.rs.content.exchange.ItemOffer.OfferType; import com.rs.utils.EconomyPrices; import com.rs.game.item.Item; import com.rs.game.player.Player; import com.rs.game.player.content.ItemConstants; import com.rs.utils.ItemExamines; import com.rs.utils.Utils; public class ExchangeHandler { public static boolean handleButtons(final Player player, final int interfaceId, final int buttonId) { final ItemOffer offer; switch(interfaceId) { case 105: switch(buttonId) { /* * Selling Button Ids */ case 32: case 48: case 64: case 83: case 102: case 121: player.offerType = OfferType.SELL; player.setGESlot(getSlot(buttonId)); resetInterfaceConfigs(player); player.getPackets().sendConfig(1113, 1); player.getInterfaceManager().sendInventoryInterface(107); final Object[] params = new Object[]{ "", "", "", "", "Offer", -1, 0, 7, 4, 93, 7012370 }; player.getPackets().sendRunScript(149, params); player.getPackets().sendItems(93, player.getInventory().getItems()); player.getPackets().sendHideIComponent(107, 0, false); player.getPackets().sendIComponentSettings(107, 18, 0, 27, 1026); int slot2 = getSlot(buttonId); player.getPackets().sendConfig(1112, slot2); player.getPackets().sendHideIComponent(105, 196, true); return true; /* * Buying Button Ids */ case 31: case 47: case 63: case 82: case 101: case 120: player.getTemporaryAttributtes().put("grand_exchange_buying", true); resetInterfaceConfigs(player); searchScript(player); player.offerType = OfferType.BUY; player.setGESlot(getSlot(buttonId)); return true; case 190: searchScript(player); return true; case 186: offer = player.getGeOffers()[player.getGESlot()]; try { for (String lines : FileUtilities.readFile("./data/items/grand_exchange/unbuyables.txt")) { String[] data = lines.split(" "); Item item = new Item(offer.getId()); if (item.getDefinitions().getName().toLowerCase().contains(Utils.getCompleted(data, 0))) { player.getDialogueManager().startDialogue("SimpleMessage", "You can only buy or sell " + item.getDefinitions().getName() + "s with other players."); return true; } } } catch (IOException e) { e.printStackTrace(); } if (offer.getPrice() * offer.getAmount() > Integer.MAX_VALUE || offer.getPrice() * offer.getAmount() == Integer.MAX_VALUE || offer.getPrice() * offer.getAmount() >= Integer.MAX_VALUE || offer.getPrice() * offer.getAmount() < 0) { player.getPackets().sendGameMessage("The price of the item is too high!"); return true; } if (offer.getPrice() == 400000000 || offer.getPrice() >= 100000000 && offer.getAmount() == 0) { player.finish(); player.getPackets().sendGameMessage("What are you trying to do?"); player.forceLogout(); } if (offer.getPrice() == 0 || offer.getAmount() == 0 || offer.getPrice() * offer.getAmount() == 0) { player.getPackets().sendGameMessage("Invalid amount."); return true; } int coins = player.getInventory().getItems().getNumberOf(995); if (coins < offer.getAmount() * offer.getPrice() && offer.getType() == OfferType.BUY) { player.getPackets().sendGameMessage("You do not have enough coins to purchase this item."); return true; } if (offer.getType() == OfferType.SELL && offer.getAmount() > player.getInventory().getItems().getNumberOf(offer.getId())) { player.getPackets().sendGameMessage("You do not have enough of that item to sell."); return true; } if (offer.getType() == OfferType.BUY) { player.getInventory().deleteItem(new Item(995, offer.getPrice() * offer.getAmount())); if (player.getInventory().getFreeSlots() < offer.getAmount() && ItemDefinitions.getItemDefinitions(offer.getId()).getCertId() != -1) { offer.setId(ItemDefinitions.getItemDefinitions(offer.getId()).getCertId()); } player.getInventory().addItem(offer.getId(), offer.getAmount()); } else { player.getInventory().deleteItem(new Item(offer.getId(), offer.getAmount())); player.getInventory().addItem(new Item(995, offer.getPrice() * offer.getAmount())); } mainInterface(player); if (!GrandExchange.getOffers().contains(offer)) GrandExchange.getOffers().add(offer); player.getPackets().sendGameMessage("One or more of your Grand Exchange offers have been completed."); return true; case 128: resetInterfaceConfigs(player); if (player.offerType.equals(OfferType.SELL)) player.getInterfaceManager().sendInventory(); else player.getPackets().sendRunScript(573); return true; case 157: case 160: offer = player.getGeOffers()[player.getGESlot()]; offer.increase(); player.getPackets().sendConfig(1110, offer.getAmount()); return true; case 155: offer = player.getGeOffers()[player.getGESlot()]; offer.decrease(); player.getPackets().sendConfig(1110, offer.getAmount()); return true; case 162: offer = player.getGeOffers()[player.getGESlot()]; offer.increase(10); player.getPackets().sendConfig(1110, offer.getAmount()); return true; case 164: offer = player.getGeOffers()[player.getGESlot()]; offer.increase(100); player.getPackets().sendConfig(1110, offer.getAmount()); return true; //case 166: //offer = player.getGeOffers()[player.getGESlot()]; //if (offer.getType() == OfferType.BUY) { // offer.increase(1000); //} else { // offer.setAmount(player.getInventory().getItems().getNumberOf(offer.getId())); //} //player.getPackets().sendConfig(1110, offer.getAmount()); //break; case 168: offer = player.getGeOffers()[player.getGESlot()]; player.getPackets().sendRunScript(108, new Object[] { "How many would you like to buy?" }); player.getTemporaryAttributtes().put("grand_exchange_offer", offer); return true; case 181: case 175: case 177: case 179: case 169: case 171: player.getPackets().sendGameMessage("You need not to change the price; you recieve the item all the time."); return true; default: System.err.println("UNHANDLED GE BUTTON - " + buttonId); } return true; } return false; } /** * Show the Main InterfacePacket. * * [MENTION=75098]Para[/MENTION]m player * The Owner. */ public static void mainInterface(Player player) { player.getPackets().sendConfig(563, 4194304); player.getPackets().sendConfig(1112, -1); player.getPackets().sendConfig(1113, -1); player.getPackets().sendConfig(1109, -1); player.getPackets().sendConfig(1110, 0); player.getInterfaceManager().sendInterface(105); } /** * Resets the Configurations of the InterfacePacket. * * [MENTION=75098]Para[/MENTION]m player * The Owner. */ private static void resetInterfaceConfigs(Player player) { player.getPackets().sendConfig2(1109, -1); player.getPackets().sendConfig2(1110, 0); player.getPackets().sendConfig2(1111, 0); player.getPackets().sendConfig2(1112, -1); player.getPackets().sendConfig2(1113, 0); } /** * Show the Search InterfacePacket. * * [MENTION=75098]Para[/MENTION]m player * The Owner. */ private static void searchScript(Player player) { player.getPackets().sendConfig(1109, -1); player.getPackets().sendConfig(1112, 0); player.getPackets().sendConfig(1113, 0); player.getPackets().sendConfig1(1241, 16750848); player.getPackets().sendConfig1(1242, 15439903); player.getPackets().sendConfig1(741, -1); player.getPackets().sendConfig1(743, -1); player.getPackets().sendConfig1(744, 0); player.getPackets().sendInterface(true, 752, 7, 389); player.getPackets().sendRunScript(570, new Object[] { "Grand Exchange Item Search" }); // player.getIOSession().write(new ConfigPacket(player, 1109, -1)); // player.getIOSession().write(new ConfigPacket(player, 1112, 0)); // player.getIOSession().write(new ConfigPacket(player, 1113, 0)); // player.getIOSession().write(new CS2Config(player, 1241, 16750848)); // player.getIOSession().write(new CS2Config(player, 1242, 15439903)); // player.getIOSession().write(new CS2Config(player, 741, -1)); // player.getIOSession().write(new CS2Config(player, 743, -1)); // player.getIOSession().write(new CS2Config(player, 744, 0)); // player.getIOSession().write(new InterfacePacket(player, 752, 7, 389, false)); // player.getIOSession().write(new CS2Script(player, 570, "s", new Object[] { "Grand Exchange Item Search" })); } /** * Gets the Box Slot id by switching the buttons,<br> * </br> Also helps you to figure the box slot configuration value. * * [MENTION=75098]Para[/MENTION]m buttonId * [MENTION=184045]return[/MENTION] Slot id. */ private static int getSlot(int buttonId) { switch (buttonId) { case 31: case 32: case 19: return 0; case 47: case 35: case 48: return 1; case 63: case 51: case 64: return 2; case 82: case 83: case 70: return 3; case 101: case 102: case 89: return 4; case 120: case 108: case 121: return 5; default: return -1; } } public void sendBuyItem(Player player, int id) { String name = ItemDefinitions.getItemDefinitions(id).getName() .toLowerCase(); if (name.contains("partyhat")|| name.contains("disk of") || name.equalsIgnoreCase("pumpkin") || name.contains("santa hat") || name.contains("easter egg") || name.contains("h'ween")|| name.contains("christmas cracker") || id == 995) { player.getDialogueManager().startDialogue("SimpleMessage","That item is not tradeable."); return; } ItemDefinitions def = ItemDefinitions.getItemDefinitions(id); if (def == null) { return; } player.getInterfaceManager().closeInventoryInterface(); player.getPackets().sendConfig(1111, EconomyPrices.getPrice(id)); player.getPackets().sendConfig(1115, EconomyPrices.getPrice(id)); player.getPackets().sendConfig(1114, EconomyPrices.getPrice(id)); player.getPackets().sendConfig(1116, EconomyPrices.getPrice(id)); player.getPackets().sendConfig(1109, def.id); player.getPackets().sendConfig(1110, 1); player.getPackets().sendConfig(1111, EconomyPrices.getPrice(id)); player.getGeOffers()[player.getGESlot()] = new ItemOffer(player, id, ItemOffer.OfferType.BUY, player.getGESlot()); } public static void sendSellItem(Player player, int itemId, int slot, int componentId) { switch(componentId) { case 18: if (player.getInventory().containsItem(itemId, 1)) { if (!ItemConstants.isTradeable(new Item(itemId)) || itemId == 995 || ItemDefinitions.getItemDefinitions(itemId).getGEPrice() == 0) { player.getPackets().sendGameMessage("You cannot sell this item to the grand exchange."); return; } final ItemOffer offer = new ItemOffer(player, itemId, player.offerType, (Integer) player.getGESlot()); offer.setPrice((int) (offer.getPrice() * 0.75)); player.getGeOffers()[offer.getSlot()] = offer; offer.getOwner().getPackets().sendConfig(1109, offer.getId()); offer.getOwner().getPackets().sendConfig(1110, 1); offer.getOwner().getPackets().sendConfig( 1114, offer.getPrice()); offer.getOwner().getPackets().sendConfig( 1115, offer.getDefinitions().getValue() / 3); offer.getOwner().getPackets().sendConfig(1116, offer.getDefinitions().getValue() / 4); offer.getOwner().getPackets().sendConfig(1111, offer.getPrice()); offer.getOwner().getPackets().sendIComponentText(105, 143, ItemExamines.getExamine(new Item(itemId))); } return; } } }[/CODE]
  9. Contains mostly everything. You'll need to edit the class to fit your game engine/game. GrandExchange.java [CODE]package org.elixrr.game.grandexchange; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Serializable; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import org.elixrr.cache.loaders.ItemDefinitions; import org.elixrr.engine.executor.Execution; import org.elixrr.engine.executor.ExecutorFactory; import org.elixrr.game.eco.Economy; import org.elixrr.game.item.Item; import org.elixrr.game.player.Player; import org.elixrr.utils.Utils; /** * * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public class GrandExchange implements Serializable { /** * The serial ID */ private static final long serialVersionUID = 6661090314047292812L; /** The player instance */ private Player player; /** * Opens the grand exchange interface */ public void open() { player.getPackets().sendConfig(1112, -1); player.getPackets().sendConfig(1113, -1); player.getPackets().sendConfig(1109, -1); player.getPackets().sendConfig(1110, 0); player.getInterfaceManager().closeInventoryInterface(); player.getInterfaceManager().sendInterface(105); } /** * Handles interface buttons * * @param componentId * The component ID */ public void handleButtons(int interfaceId, int slotId, int componentId, int packetId) { player.lock(2); switch (interfaceId) { case 105: switch (componentId) { case 19: case 35: case 51: case 70: case 89: case 108: int myBox = getBoxForComponent(componentId); if (myBox > -1) { player.addGEAttribute("box", myBox); if (packetId == 67) { abort(myBox, player.getGEAttribute("buying").equals( Boolean.FALSE)); return; } openCollectionInterface(myBox, (player.getGEAttribute("buying") .equals(Boolean.FALSE))); } break; case 31: case 47: case 63: case 82: case 101: case 120: int buyBox = getBoxForComponent(componentId); if (buyBox > -1) { displayBuyInterface(buyBox); player.getPackets().sendConfig(1112, buyBox); player.addGEAttribute("box", buyBox); } break; case 32: case 48: case 64: case 83: case 102: case 121: int sellBox = getBoxForComponent(componentId); if (sellBox > -1) { displaySellInterface(sellBox); player.addGEAttribute("box", sellBox); player.getPackets().sendConfig(1112, sellBox); } break; case 155: case 157: case 160: case 162: case 164: case 166: setAmount(componentId); break; case 186: boolean buying = (boolean) player.getGEAttribute("buying"); if (!buying) { player.removeGEAttribute("awaitingSellConfirm"); } acceptOffer(buying); break; case 190: int box = (Integer) player.getGEAttribute("box"); if (box > -1) { displayBuyInterface(box); } break; case 128: boolean buying1 = (boolean) player.getGEAttribute("buying"); try { if (!buying1 && player.getGEAttribute("awaitingSellConfirm") != null) { player.getInventory().addItem( (Item) player .getGEAttribute("awaitingSellConfirm")); player.removeGEAttribute("awaitingSellConfirm"); } open(); } catch (NullPointerException e) { } break; case 200: abort((Integer) player.getGEAttribute("box"), player .getGEAttribute("buying").equals(Boolean.FALSE)); break; } break; case 107: if ((Boolean) player.getGEAttribute("buying").equals(Boolean.TRUE)) return; sellItem(player.getInventory().getItem(slotId).getId(), player .getInventory().getItem(slotId).getAmount()); break; } } /** * Accepts a GE offer * * @param buying * If the offer is a buying offer */ public void acceptOffer(final boolean buying) { player.getInterfaceManager().closeChatBoxInterface(); final int box = (Integer) player.getGEAttribute("box"); final int itemId = (Integer) player.getGEAttribute("item"); final int amount = (Integer) player.getGEAttribute("amount"); final int price = (Integer) player.getGEAttribute("price"); try { if (player.getGEAttribute("notEnough") != null) { player.out("You do not have enough of this item to sell " + Utils.formatTypicalInteger((int) player .getGEAttribute("notEnough")) + " of it."); return; } } catch (NullPointerException e) { } if (buying) { if (player.getMoneyInPouch() < price * amount && player.getInventory().getNumerOf(995) < price * amount) { player.out("You do not have enough gold peice" + (price == 1 ? "" : "s") + " to purchase " + (amount > 1 ? "these items." : "this item.")); return; } if (player.getMoneyInPouch() >= price * amount) { player.getMoneyPouch().buyWith(price * amount); } else { player.getInventory().deleteItem(995, price * amount); } player.getPackets().setGe(player, box, 1, itemId, price, amount, 0); ExecutorFactory.schedule(new Execution() { @Override public void run() { int tr = Utils.random(amount); player.getPackets().setGe(player, box, tr >= amount ? 5 : 3, itemId, price, amount, tr >= amount ? amount : tr); player.offer[box] = new Offer(player, box, price, itemId, amount, GrandExchangeOfferType.SELLING_PROGRESS .getOpcode(), GrandExchangeType.BUYING, Calendar.getInstance().getTime()); player.offer[box].setAmountTransacted(tr); player.offer[box].accept(); } }, 4); } else { if (player.getGEAttribute("note") != null) { player.getInventory().deleteItem( ((int) player.getGEAttribute("note")), amount); } else { player.getInventory().deleteItem(itemId, amount); } player.getPackets().setGe(player, box, 9, itemId, price, amount, 0); ExecutorFactory.schedule(new Execution() { @Override public void run() { int t = Utils.random(amount); player.getPackets().setGe(player, box, t >= amount ? 13 : 12, itemId, price, amount, t); player.offer[box] = new Offer(player, box, price, itemId, amount, GrandExchangeOfferType.SUBMITTING_BUY_OFFER .getOpcode(), GrandExchangeType.SELLING, Calendar.getInstance().getTime()); player.offer[box].setAmountTransacted(t); player.offer[box].accept(); } }, 4); } open(); } /** * Sends the collection interface * * @param slot * The GE slot */ public void openCollectionInterface(final int slot, final boolean selling) { player.getPackets().sendConfig(1112, slot); player.getPackets().sendItemOnIComponent(105, 143, player.offer[slot].getId(), 1); player.getInterfaceManager().closeChatBoxInterface(); ExecutorFactory.submit(new Execution() { @Override public void run() { int priceOffset = (Utils.random(Economy .getItemPrice(player.offer[slot].getId()) / 3) * player.offer[slot] .getAmount()); if (player.offer[slot].getAmountTransacted() != 0) player.getPackets().sendItemOnIComponent( 105, 206, selling ? 995 : player.offer[slot].getId(), selling ? Economy.getItemPrice(player.offer[slot] .getId()) : player.offer[slot] .getAmountTransacted()); if (!selling) player.getPackets().sendItemOnIComponent(105, 208, 995, priceOffset); } }); } /** * Causes an item to abort * * @param slot * The slot to abort */ public void abort(final int slot, final boolean selling) { player.getInterfaceManager().closeChatBoxInterface(); if (player.offer[slot].getAmountTransacted() >= player.offer[slot] .getAmount()) return; player.getPackets().setGe(player, slot, -3, player.offer[slot].getId(), player.offer[slot].getPrice(), player.offer[slot].getAmount(), player.offer[slot].getAmountTransacted()); ExecutorFactory.submit(new Execution() { @Override public void run() { player.getPackets().sendItemOnIComponent( 105, 206, selling ? 995 : player.offer[slot].getId(), !selling ? player.offer[slot].getAmount() - player.offer[slot].getAmountTransacted() : Economy.getItemPrice(player.offer[slot] .getId())); if (!selling) player.getPackets() .sendItemOnIComponent( 105, 208, 995, Economy.getItemPrice(player.offer[slot] .getId()) * (player.offer[slot].getAmount() - player.offer[slot] .getAmountTransacted())); player.offer[slot].needsMoneyCollected(); player.offer[slot].abort(); } }); player.out("Abort request acknowledged. Please be aware that your offer may have already been completed."); } /** * Processes the GE for this player */ public void process() { try { for (int i = 0; i < player.offer.length; i++) { if (player.offer[i] == null || player.offer[i].isAborted() || !player.offer[i].wasAccepted() || !player.offer[i].waitingCollection() || player.offer[i].getAmountTransacted() == player.offer[i] .getAmount()) continue; final int id = player.offer[i].getId(); final int amount = player.offer[i].getAmount(); final int price = player.offer[i].getPrice(); final int transacted = player.offer[i].getAmountTransacted(); final int box = i; final boolean selling = player.getGEAttribute("buying").equals( Boolean.FALSE); if (player.offer[i].getAmountTransacted() >= player.offer[i] .getAmount() || amount == 1) { ExecutorFactory.submit(new Execution() { @Override public void run() { player.getPackets().setGe(player, box, 5, id, price, amount, amount); player.offer[box].needsCollected(); return; } }); } if (Utils.random(23) == 6) { final int t = Utils.random(amount); if (t < amount || transacted != amount) { ExecutorFactory.submit(new Execution() { @Override public void run() { player.getPackets().setGe(player, box, 3, id, price, amount, transacted + t); player.offer[box] .setAmountTransacted(player.offer[box] .getAmountTransacted() + t); ExecutorFactory.submit(new Execution() { @Override public void run() { player.getPackets() .sendItemOnIComponent( 105, 206, selling ? 995 : player.offer[box] .getId(), selling ? Economy .getItemPrice(player.offer[box] .getId()) : player.offer[box] .getAmountTransacted()); } }); } }); } else if (t >= amount || player.offer[i].getAmountTransacted() >= amount) { ExecutorFactory.submit(new Execution() { @Override public void run() { player.getPackets().setGe(player, box, 5, id, price, amount, amount); player.offer[box].needsCollected(); } }); } } } } catch (Exception e) { /* Empty */ } } /** * Creates an offer record * * @param offer * The offer to record */ public void createRecord(Offer offer) { final ArrayList<String> lines = new ArrayList<>(); try { BufferedReader reader = new BufferedReader(new FileReader( "Grand Exchange/" + player.getDisplayName())); String line1 = reader.readLine(); if (line1 != null) { lines.add(line1); String line = ""; while ((line = reader.readLine()) != null) lines.add(line); } reader.close(); BufferedWriter writer = new BufferedWriter(new FileWriter( "Grand Exchage/" + player.getDisplayName())); for (String s : lines) writer.write(s); writer.write(offer.toString()); writer.close(); } catch (IOException e) { e.printStackTrace(); } } /** * Returns the offer * * @param file * The file * @param date * The date * @return The corresponding offer */ @SuppressWarnings("unused") public Offer getOffer(File file, Date date) {// FIXME date search try { BufferedReader reader = new BufferedReader(new FileReader(file)); String[] line = reader.readLine().replace("x", " ").split(" "); int amount = Integer.parseInt(line[1]); Item item = Item.getItem(line[2]); // TODO finish this lolol. reader.close(); return null; } catch (IOException e) { e.printStackTrace(); } return null; } /** * Sets an offer * * @param box * The box * @param offer * The offer to set */ public void setOffer(int box, Offer offer) { this.player.offer[box] = offer; } /** * Sells a GE item * * @param id * The item id * @param amount * The item amount */ public void sellItem(int id, int amount) { player.getInterfaceManager().closeChatBoxInterface(); if (!canExchange(new Item(id))) { player.getDialogueManager().startDialogue("SimpleMessage", "That item is not tradeable."); return; } ItemDefinitions def = ItemDefinitions.getItemDefinitions(id); if (def == null) throw new NullPointerException("Nulled item definitions: " + id); if (def.isNoted()) { player.addGEAttribute("note", def.getId()); id = def.getId() - 1; player.getInterfaceManager().closeInventoryInterface(); sendPrice(id); setItem(def.getId() - 1, Economy.getItemPrice(id), player .getInventory().getItems().getNumberOf(def.getId())); player.addGEAttribute("itemAmount", player.getInventory() .getItems().getNumberOf(def.getId())); player.getInventory().deleteItem(id, amount); player.addGEAttribute("awaitingSellConfirm", new Item(id, amount)); } else { amount = player.getInventory().getItems().getNumberOf(id); player.getInterfaceManager().closeInventoryInterface(); sendPrice(id); setItem(id, Economy.getItemPrice(id), player.getInventory() .getItems().getNumberOf(def.getId())); player.getInventory().deleteItem(id, amount); player.addGEAttribute("itemAmount", amount); /* * Prevents losing the item after walking away or closing the * interface somehow */ player.addGEAttribute("awaitingSellConfirm", new Item(id, amount)); } } /** * Buys an item * * @param id * The item id */ public void buyItem(int id) { String name = ItemDefinitions.getItemDefinitions(id).getName() .toLowerCase(); if (!canExchange(new Item(id)) || name.contains("partyhat") || name.contains("disk of") || name.equalsIgnoreCase("pumpkin") || name.contains("santa hat") || name.contains("easter egg") || name.contains("h'ween") || name.contains("christmas cracker")) { player.getDialogueManager().startDialogue("SimpleMessage", "That item is not tradeable."); return; } ItemDefinitions def = ItemDefinitions.getItemDefinitions(id); if (def == null) { return; } player.getInterfaceManager().closeInventoryInterface(); sendPrice(id); setItem(id, Economy.getItemPrice(id), 1); final int box = (Integer) player.getGEAttribute("box"); final int price = (Integer) player.getGEAttribute("price"); player.offer[box] = new Offer(player, box, price, id, 1, GrandExchangeOfferType.SELLING_PROGRESS.getOpcode(), GrandExchangeType.BUYING, Calendar.getInstance().getTime()); } /** * Sends the items * * @param items * The items to send * @param box * The box */ public void sendItems(Item[] items, int box) { int key = getComponentForBox(box); player.getPackets().sendItems(key, items); } /** * If a player can exchange a certain item * * @param item * The item to exchange * @return If the item is exchangable */ public boolean canExchange(Item item) { if (item.getDefinitions().containsOption("Check-charges") || item.getDefinitions().containsOption("Check-state")) return false; if (item.getDefinitions().containsOption("Bind") || item.getDefinitions().containsOption("Destroy") || item.getDefinitions().containsOption("Change-colour") || item.getDefinitions().containsOption("Customize")) return false; switch (item.getId()) { case 995: return false; default: return true; } } /** * Returns the offer of a corresponding box * * @param box * The box * @return The offer */ public Offer getOffer(int box) { try { return player.offer[box]; } catch (NullPointerException e) { } return null; } /** * Returns the offers * * @return The offers */ public Offer[] getOffers() { return player.offer; } /** * Displays the default buy interface * * @param box * The offer box */ public void displayBuyInterface(int box) { player.addGEAttribute("buying", Boolean.TRUE); Object[] o = new Object[] { "Grand Exchange Item Search" }; player.getPackets().sendConfig(1113, 0); player.getPackets().setGeSearch(o); } /** * Displays the default sell interface * * @param player * The player * @param offerBox * The offer box */ public void displaySellInterface(int offerBox) { reset(); player.addGEAttribute("buying", Boolean.FALSE); player.getPackets().sendConfig(1113, 1); player.getInterfaceManager().sendInventoryInterface(107); player.getPackets().sendItems(93, player.getInventory().getItems()); player.getPackets().sendUnlockIComponentOptionSlots(107, 0, 0, 27, 0); player.getPackets().sendInterSetItemsOptionsScript(107, 0, 93, 4, 7, "Offer"); player.getInterfaceManager().closeChatBoxInterface(); player.getPackets().sendHideIComponent(105, 196, true); } /** * Sets the item constants * * @param id * The ID * @param price * The price * @param amount * The amount */ public void setItem(int id, int price, int amount) { player.getPackets().sendConfig(1109, id); player.getPackets().sendConfig(1110, amount); player.getPackets().sendConfig(1111, price); player.addGEAttribute("item", id); player.addGEAttribute("price", price); player.addGEAttribute("amount", amount); } /** * Sends the price settings for an item * * @param id * The item id */ public void sendPrice(int id) { player.getPackets().sendConfig(1111, Economy.getItemPrice(id)); player.getPackets().sendConfig(1115, Economy.getItemPrice(id)); player.getPackets().sendConfig(1114, Economy.getItemPrice(id)); player.getPackets().sendConfig(1116, Economy.getItemPrice(id)); } /** * Resets the GE boxes */ public void reset() { player.getPackets().sendConfig(1109, -1); player.getPackets().sendConfig(1110, 0); player.getPackets().sendConfig(1111, 0); player.getPackets().sendConfig(1112, -1); player.getPackets().sendConfig(1113, 0); player.removeGEAttribute("box"); player.removeGEAttribute("item"); player.removeGEAttribute("price"); player.removeGEAttribute("amount"); } /** * Sets the item amount * * @param button * The button that's being clicked */ public void setAmount(int button) { int amount = (Integer) player.getGEAttribute("amount"); int itemId = (Integer) player.getGEAttribute("item"); ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId); boolean buying = (Boolean) player.getGEAttribute("buying"); switch (button) { case 155: if (amount > 1) { amount--; } else { amount = 1; } break; case 157: if (amount < Integer.MAX_VALUE) { amount++; } else { amount = 1; } break; case 160: if (buying) { if (player.getInventory().getNumerOf(itemId) <= amount && !buying) { return; } amount += 1; } else { amount = 1; } break; case 162: if (buying) { amount += 10; } else { if (player.getInventory().getNumerOf(itemId) > 10) { amount = (int) player.getGEAttribute("amount"); } else { amount = 10; } } break; case 164: if (buying) { amount += 100; } else { if (defs.isNoted()) { if (player.getInventory().getItems() .getNumberOf(defs.getCertId()) <= 100) { amount = (int) player.getGEAttribute("amount"); } else { amount = 100; } } else if (player.getInventory().getItems().getNumberOf(itemId) <= 100) { amount = (int) player.getGEAttribute("amount"); } else { amount = 100; } } break; case 166: if (buying) { amount += 1000; } else { amount = (int) player.getGEAttribute("amount"); } break; } player.addGEAttribute("amount", amount); player.getPackets().sendConfig(1110, amount); } /** * Returns the button corresponding to a box * * @param box * The box * @return The corresponding button ID */ public int getComponentForBox(int box) { switch (box) { case 0: return 523; case 1: return 524; case 2: return 525; case 3: return 526; case 4: return 527; case 5: return 528; } return -1; } /** * Returns the box corresponding to the button * * @param button * The button being clicked * @return The box */ public int getBoxForComponent(int button) { switch (button) { case 19: case 31: case 32: return 0; case 35: case 48: case 47: return 1; case 51: case 63: case 64: return 2; case 70: case 82: case 83: return 3; case 89: case 101: case 102: return 4; case 108: case 120: case 121: return 5; } return -1; } /** * Sets the player * * @param player * The player to set */ public void setPlayer(Player player) { this.player = player; } } [/CODE] GrandExchangeOfferType.java [CODE]package org.elixrr.game.grandexchange; /** * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public enum GrandExchangeOfferType { /** * If the offer was aborted */ ABORTED(-3), /** * If the GE expected a reset */ RESET_GE(0), /** * Resets after buy */ RESET_AFTER_BUY(8), /** * Resets after sell */ RESET_AFTER_SELL(16), /** * Submitting a buy offer */ SUBMITTING_BUY_OFFER(1), /** * Buying progress 1 */ BUYING_PROGRESS(2), /** * Buying progress 2 */ BUYING_PROGRESS_2(3), /** * Buying progress 3 */ BUYING_PROGRESS_3(4), /** * Finished buying an item */ FINISHED_BUYING(5), /** * Buying progress 5 */ BUYING_PROGRESS_5(6), /** * Buying progress 7 */ BUYING_PROGRESS_6(7), /** * Submitting a selling offer */ SUBMIT_SELL_OFFER(9), /** * Selling progress 1 */ SELLING_PROGRESS(10), /** * Selling progress 2 */ SELLING_PROGRESS_2(11), /** * Selling progress 3 */ SELLING_PROGRESS_3(13), /** * Selling progress 4 */ SELLING_PROGRESS_4(14), /** * Selling progress 5 */ SELLING_PROGRESS_5(15), /** * Finished selling an item */ FINISHED_SELLING(13); /** * The opcode */ private int opcode; /** * Constructs the GE offer type * * @param opcode * The opcode */ GrandExchangeOfferType(int opcode) { this.opcode = opcode; } /** * Returns the opcode * * @return The opcode; */ public int getOpcode() { return opcode; } } [/CODE] GrandExchangeType.java [CODE]package org.elixrr.game.grandexchange; /** * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public enum GrandExchangeType { /** * If the type is buying */ BUYING, /** * If the type is selling */ SELLING, /** * If the type is aborted */ ABORTED, /** * If the item is done buying/selling */ AWAITING_REMOVAL; } [/CODE] Offer.java [CODE]package org.elixrr.game.grandexchange; import java.io.Serializable; import java.util.Date; import org.elixrr.cache.loaders.ItemDefinitions; import org.elixrr.game.player.Player; /** * * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public final class Offer implements Serializable { /** * The serial ID */ private static final long serialVersionUID = 8872511602665689138L; /** * The owner of this offer */ private Player owner; /** * The price */ private int price; /** * The item ID */ private int id; /** * The item amount */ private int amount; /** * The creation date */ private Date date; /** * The progress */ private int progress; /** * If the player has yet to collected price offset */ private boolean needsMoneyCollected; /** * The item box */ private int box; /** * The amount sold/bought */ private int amountTransacted; /** * The player instance */ private transient Player player; /** * The type of exchange */ private GrandExchangeType type; /** * If the offer is aborted */ private boolean aborted; /** * If the offer was accepted or not */ private boolean accepted; /** * If this offer needs to be collected */ private boolean needsCollected = false; /** * Constructs the offer * * @param Owner * The owner of this offer * @param box * The box corresponding to the offer * @param price * The price * @param id * The item id * @param amount * The amount * @param progress * The progress * @param buying * If it's buying or selling */ public Offer(Player owner, int box, int price, int id, int amount, int progress, GrandExchangeType type, Date date) { this.owner = owner; this.box = box; this.price = price; this.id = id; this.amount = amount; this.type = type; this.progress = progress; } /** * Returns the owner of this offer * * @return The owner */ public Player getOwner() { return owner; } /** * Returns the price of this offer * * @return The price */ public int getPrice() { return price; } /** * Returns the item ID of this offer * * @return The id */ public int getId() { return id; } /** * Returns the creation date * * @return The creation date */ public Date getDate() { return date; } /** * Returns the item amount of this offer * * @return The amount */ public int getAmount() { return amount; } /** * Returns the box of this offer * * @return The box */ public int getBox() { return box; } /** * Returns the type of exchange * * @return The exchange type */ public GrandExchangeType getExchangeType() { return type; } /** * Returns the owner * * @return The owner */ public Player getPlayer() { if (player == null) { player = owner; } return player; } /** * Sets the ID of the iten * * @param id * The id to set */ public void setId(int id) { this.id = id; } @Override public String toString() { ItemDefinitions def = ItemDefinitions.getItemDefinitions(id); return "[" + date + "]:Transacting: " + amount + "x" + def.getName() + ", Progress ID: " + progress + ", Amount Transacted: " + amountTransacted + ""; } /** * Returns the progress of the item * * @return The progress */ public int getProgress() { return progress; } /** * Increases the progress of the item * * @param amount * The amount to increase */ public void increaseProgress(int amount) { progress += amount; } /** * Sets the amount transacted * * @param amount * The amount to set */ public void setAmountTransacted(int amount) { amountTransacted = amount; } /** * Checks if this offer is aborted * * @return If it's aborted */ public boolean isAborted() { return aborted; } /** * Causes this offer to abort */ public void abort() { aborted = true; } /** * * @return The amount sold/bought */ public int getAmountTransacted() { return amountTransacted; } /** * If this offer was acceped * * @return accepted */ public boolean wasAccepted() { return accepted; } /** * Accepts this offer */ public void accept() { accepted = true; } /** * Sets needs collected to true */ public void needsCollected() { needsCollected = true; } /** * If this offer needs collected * * @return If this offer needs collected */ public boolean waitingCollection() { return needsCollected; } /** * Sets needs money collected to true */ public void needsMoneyCollected() { needsMoneyCollected = true; } /** * If the player collected their money * * @return True if so; false otherwise */ public boolean moneyCollected() { return needsMoneyCollected; } } [/CODE] [COLOR="#FF0000"]Add this check to your walk protocol, logout, and login methods:[/COLOR] [CODE]if (!player.hasStarted() || !player.clientHasLoadedMapRegion() || player.isDead()) return; try { if (player.getGEAttribute("awaitingSellConfirm") != null) { player.getInventory() .addItem( (Item) player .getGEAttribute("awaitingSellConfirm")); player.removeGEAttribute("awaitingSellConfirm"); } } catch (Exception e) { }[/CODE] Declare the default offers in the player class [CODE]public transient Offer[] offer = new Offer[6];[/CODE] [COLOR="#FF0000"]Extra[/COLOR]: Item set [CODE]package org.elixrr.game.grandexchange; import org.elixrr.game.player.Player; /** * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public class GrandExchangeItemSet { /** * Adds the set to a player's inventory * * @param player * The player * @param set * The set to add */ public GrandExchangeItemSet(Player player, GEItemSet set) { if (player.getInventory().isFull(1)) { player.getBank().addItem(set.getSetID(), 1, true); player.out("Your set has added to your bank."); return; } player.getInventory().addItem(set.getSetID(), 1); } /** * * @author Taylor Moon * * @version Elixrr 2 | update 3 */ public enum GEItemSet { NULL(0, new int[] {}); /** * The ID of the item set */ private int id; /** * The ID of the containing item */ private int[] itemId; /** * Constructs the item set * * @param id * The ID of the set * @param itemId * the ID of the item */ GEItemSet(int id, int[] itemId) { this.id = id; } /** * Returns the set ID * * @return The ID of this set */ public int getSetID() { return id; } /** * Returns an array of the items inside * * @return The items inside the set */ public int[] getItemsInside() { return itemId; } } } [/CODE] [B][COLOR="#FF0000"]Lacks:[/COLOR][/B] [LIST] [*]A "player influenced" economy. (Pretty much finished but not implemented in the Process method) [*]Collection box access masks (For button clicking on the collection box) Get the unlock from Matrix2 client. [*]Probably minor bugs to fix ;o [/LIST]
  10. i open grand exchange and press sell item icon but when i try to sell anything nothing happends how can i fix this?
  11. This project is abandoned So yeah... I suppose this is to keep me busy while I wait on my laptop. A 'small' project. A legitimate economy. Framework: Independent because the Grand Exchange is in no way depending on RSPS code. Communication between Grand Exchange and the world(s) in question happens via a defined protocol socket Customizable behavior for the economy Integrated database (Apache Derby) Possibly JSON for website-related integration (I don't know about this yet, it'll be big enough as is) Side-note: Please inform me if using Derby is a good idea. Maybe [MENTION=1045]Emily[/MENTION] can tell me :)? Maybe you do not see the point of this, so here's a scenario. >> Consider an RSPS called economyscape; they have 10 worlds running on different servers and ofcourse have a global grand exchange. Now, you could run a central MySQL database and then seperate instances of Grand Exchanges in each local server OR you could make a central Grand Exchange that processes all transactions and maintains the economy for all these worlds simply with a few methods that communicate with the GE server with a custom defined protocol. << Ofcourse the GE server needs to be secure against false transactions (not issued by the world in question) but I am not going to focus on that for now. I have some things in mind but I first want to make sure I can actually make this. If someone feels like they can help with MySQL queries, feel free as I'm not a particular MySQL guru. I'm not considering this a serious project, it's more like a thing to do when I'm bored so don't be mad if I don't finish this. Anyways, I will post updates soon :} Changelog: (date = dd/mm) 24/08 - created database model (see reference #1) 23/08 - started project [/CODE]
  12. [B]No one needed this so I removed it :) [/B][quote name='_Jordan']I'm not one to usually be very mean, but this is very very horrible code.[/QUOTE] [quote name='Hope']If you're going to release something (especially for new learners), you should do it the right way. This is one of the reasons the RSPS community has terrible programmers.[/QUOTE]
  13. I need help with my GrandExchange, im using Eriwien 2 source, Whenever i want to buy a item, it doesnt load but.. when i sell a item thatt is the same as the buy item. I get the item aswell as the money from sell item. so its a economic system i guess, how can i delete tht so everyone can buy anything whenever they want? thx in advance. another little prob is character saving, i got both character and characterbackup folders, but il look later into tht.. want this prob solved ;/ [ATTACH]10357[/ATTACH] GE Files: [B]OFFER.JAVA[/B] [CODE]package com.ew.game.player.content.grandExchange; import com.ew.cache.loaders.ClientScriptMap; import com.ew.cache.loaders.ItemDefinitions; import com.ew.game.item.Item; import com.ew.game.item.ItemsContainer; import com.ew.game.player.Player; import com.ew.utils.EconomyPrices; import com.ew.utils.Utils; public class Offer extends Item { private static final long serialVersionUID = -4065899425889989474L; public static final String SELL = null; public Offer(int id, int ammount, int price, boolean buy) { super(id, ammount); this.price = price; buying = buy; receivedItems = new ItemsContainer<Item>(2, true); } private transient Player owner; private transient int slot; private int price; // price per item selling or buying private int totalPriceSoFar; // total profit received so far or spent private int totalAmmountSoFar; // amt of items sold or bought private ItemsContainer<Item> receivedItems; private boolean canceled; private boolean buying; [MENTION=19271]supp[/MENTION]ressWarnings("unused") private long data; public void link(int slot, Player owner) { this.slot = slot; this.owner = owner; this.data = Utils.currentTimeMillis(); } public void unlink() { owner = null; } public void update() { if (owner == null) return; owner.getPackets().sendGrandExchangeOffer(this); sendItems(); } public void sendItems() { if (owner == null) return; owner.getPackets().sendItems(ClientScriptMap.getMap(1079).getIntValue(slot), receivedItems); } public int getPrice() { return price; } public boolean forceRemove() { return isCompleted() && !hasItemsWaiting(); } protected boolean isCompleted() { return canceled || totalAmmountSoFar >= getAmount(); } public int getPercentage() { return totalAmmountSoFar * getAmount() / 100; } public int getTotalAmmountSoFar() { return totalAmmountSoFar; } public int getTotalPriceSoFar() { return totalPriceSoFar; } public int getSlot() { return slot; } public int getStage() { if (forceRemove()) return 0; if (isCompleted()) return buying ? 5 : 13; return buying ? 2 : 10; } public boolean isBuying() { return buying; } // TODO canceling message public boolean cancel() { if (isCompleted()) return false; canceled = true; if (buying) receivedItems.add(new Item(995, (getAmount() - totalAmmountSoFar) * price)); else receivedItems.add(new Item(getId(), getAmount() - totalAmmountSoFar)); update(); return true; } public void sendUpdateWarning() { if (owner == null) return; owner.getPackets().sendGameMessage("One or more of your Grand Exchange offers have been updated."); owner.getPackets().sendMusicEffect(284); update(); } public boolean isOfferTooHigh(Offer fromOffer) { int left = getAmount() - totalAmmountSoFar; int leftFrom = fromOffer.getAmount() - fromOffer.totalAmmountSoFar; int exchangeAmt = left > leftFrom ? leftFrom : left; int totalPrice = exchangeAmt * fromOffer.price; int amtCoins = receivedItems.getNumberOf(995); if (buying) { if (fromOffer.receivedItems.getNumberOf(995) + totalPrice <= 0) return true; int leftcoins = exchangeAmt * price - totalPrice; if (leftcoins > 0 && amtCoins + leftcoins <= 0) return true; } else { if (amtCoins + totalPrice <= 0) return true; } return false; } private int[] items = { 14484, 1048 }; public void updateOffer(Offer fromOffer) { int left = getAmount() - totalAmmountSoFar; int leftFrom = fromOffer.getAmount() - fromOffer.totalAmmountSoFar; int exchangeAmt = left > leftFrom ? leftFrom : left; int totalPrice = exchangeAmt * fromOffer.price; if (buying) { int leftcoins = exchangeAmt * price - totalPrice; if (leftcoins > 0) { receivedItems.add(new Item(995, leftcoins)); } for (int i : items) { if (totalPrice < EconomyPrices.getPrice(i)) { owner.getPackets().sendGameMessage("You can't buy default set items for lower than their origional value!"); return; } receivedItems.add(buying ? new Item(getId(), exchangeAmt) : new Item(getId(), exchangeAmt)); } receivedItems.add(buying ? new Item(getId(), exchangeAmt) : new Item(getId(), exchangeAmt)); fromOffer.receivedItems.add(new Item(995, totalPrice)); } else { fromOffer.receivedItems.add(new Item(getId(), exchangeAmt)); receivedItems.add(new Item(995, totalPrice)); } totalAmmountSoFar += exchangeAmt; fromOffer.totalAmmountSoFar += exchangeAmt; totalPriceSoFar += totalPrice; fromOffer.totalPriceSoFar += totalPrice; fromOffer.sendUpdateWarning(); } public boolean collectItems(int slot, int option) { if (owner == null) return false; int freeSlots = owner.getInventory().getFreeSlots(); if (freeSlots == 0) { owner.getPackets().sendGameMessage("Not enough space in your inventory."); return false; } Item item = receivedItems.get(slot); if (item == null) return false; ItemDefinitions defs = item.getDefinitions(); if (!defs.isStackable() && option == (item.getAmount() == 1 ? 0 : 1)) { Item add = new Item(item.getId(), item.getAmount() > freeSlots ? freeSlots : item.getAmount()); owner.getInventory().addItemMoneyPouch(add); receivedItems.remove(add); } else { owner.getInventory().addItemMoneyPouch(new Item(defs.certId != -1 ? defs.certId : item.getId(), item.getAmount())); receivedItems.remove(item); } update(); return true; } public boolean hasItemsWaiting() { return receivedItems.getFreeSlots() != 2; } public Object getType() { // TODO Auto-generated method stub return null; } public void increase(int i) { // TODO Auto-generated method stub } } [/CODE] [B]GRANDEXCHANGE.JAVA [/B] [CODE]package com.ew.game.player.content.grandExchange; import java.math.BigInteger; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import com.ew.cache.loaders.ItemDefinitions; import com.ew.game.player.Player; import com.ew.utils.EconomyPrices; import com.ew.utils.SerializableFilesManager; import com.ew.utils.Utils; public class GrandExchange { private static final Object LOCK = new Object(); // offer uid private static HashMap<Long, Offer> OFFERS; private static ArrayList<OfferHistory> OFFERS_TRACK; private static HashMap<Integer, Integer> PRICES; private static boolean edited; public static void init() { OFFERS = SerializableFilesManager.loadGEOffers(); OFFERS_TRACK = SerializableFilesManager.loadGEHistory(); PRICES = SerializableFilesManager.loadGEPrices(); } public static void reset(boolean track, boolean price) { if(track) OFFERS_TRACK.clear(); if(price) PRICES.clear(); recalcPrices(); } public static void recalcPrices() { ArrayList<OfferHistory> track = new ArrayList<OfferHistory>(OFFERS_TRACK); HashMap<Integer, BigInteger> averagePrice = new HashMap<Integer, BigInteger>(); HashMap<Integer, BigInteger> averageQuantity = new HashMap<Integer, BigInteger>(); for (OfferHistory o : track) { BigInteger price = averagePrice.get(o.getId()); if (price != null) { BigInteger quantity = averageQuantity.get(o.getId()); averagePrice.put(o.getId(), price.add(BigInteger.valueOf(o.getPrice()))); averageQuantity.put(o.getId(), quantity.add(BigInteger.valueOf(o.getQuantity()))); } else { averagePrice.put(o.getId(), BigInteger.valueOf(o.getPrice())); averageQuantity.put(o.getId(), BigInteger.valueOf(o.getQuantity())); } } for (int id : averagePrice.keySet()) { BigInteger price = averagePrice.get(id); BigInteger quantity = averageQuantity.get(id); long oldPrice = getPrice(id); long newPrice = price.divide(quantity).longValue(); long min = (long) ((double) oldPrice * 0.8D) - 100; long max = (long) ((double) oldPrice * 1.2D) + 100; if (newPrice < min) newPrice = min; else if (newPrice > max) newPrice = max; if (newPrice < 1) newPrice = 1; else if (newPrice > Integer.MAX_VALUE) newPrice = Integer.MAX_VALUE; PRICES.put(id, (int) newPrice); } savePrices(); } private static void savePrices() { SerializableFilesManager.saveGEPrices(PRICES); } public static final void save() { if (!edited) return; SerializableFilesManager.saveGEOffers(OFFERS); SerializableFilesManager.saveGEHistory(OFFERS_TRACK); edited = false; } public static void linkOffers(Player player) { boolean itemsWaiting = false; for (int slot = 0; slot < player.getGEManager().getOfferUIds().length; slot++) { Offer offer = getOffer(player, slot); if (offer == null) continue; offer.link(slot, player); offer.update(); if (!itemsWaiting && offer.hasItemsWaiting()) { itemsWaiting = true; player.getPackets().sendGameMessage("You have items from the Grand Exchange waiting in your collection box."); } } } public static Offer getOffer(Player player, int slot) { synchronized (LOCK) { long uid = player.getGEManager().getOfferUIds()[slot]; if (uid == 0) return null; Offer offer = OFFERS.get(uid); if (offer == null) { player.getGEManager().getOfferUIds()[slot] = 0; // offer // disapeared // within time return null; } return offer; } } public static void sendOffer(Player player, int slot, int itemId, int amount, int price, boolean buy) { synchronized (LOCK) { Offer offer = new Offer(itemId, amount, price, buy); player.getGEManager().getOfferUIds()[slot] = createOffer(offer); offer.link(slot, player); findBuyerSeller(offer); } } public static void abortOffer(Player player, int slot) { synchronized (LOCK) { Offer offer = getOffer(player, slot); if (offer == null) return; edited = true; if (offer.cancel() && offer.forceRemove()) deleteOffer(player, slot); // shouldnt here happen anyway } } public static void collectItems(Player player, int slot, int invSlot, int option) { synchronized (LOCK) { Offer offer = getOffer(player, slot); if (offer == null) return; edited = true; if (offer.collectItems(invSlot, option) && offer.forceRemove()) { deleteOffer(player, slot); // should happen after none left and // offer completed if (offer.getTotalAmmountSoFar() != 0) { OfferHistory o = new OfferHistory(offer.getId(), offer.getTotalAmmountSoFar(), offer.getTotalPriceSoFar(), offer.isBuying()); OFFERS_TRACK.add(o); player.getGEManager().addOfferHistory(o); } } } } private static void deleteOffer(Player player, int slot) { player.getGEManager().cancelOffer(); // sends back to original screen if // seeing an offer OFFERS.remove(player.getGEManager().getOfferUIds()[slot]); player.getGEManager().getOfferUIds()[slot] = 0; } private static void findBuyerSeller(Offer offer) { while (!offer.isCompleted()) { Offer bestOffer = null; for (Offer o : OFFERS.values()) { if (o.isBuying() == offer.isBuying() || o.getId() != offer.getId() || o.isCompleted() || (offer.isBuying() && o.getPrice() > offer.getPrice()) || (!offer.isBuying() && o.getPrice() < offer.getPrice()) || offer.isOfferTooHigh(o)) continue; if (bestOffer == null || (offer.isBuying() && o.getPrice() < bestOffer.getPrice()) || (!offer.isBuying() && o.getPrice() > bestOffer.getPrice())) bestOffer = o; } if (bestOffer == null) break; offer.updateOffer(bestOffer); } offer.update(); } private static long createOffer(Offer offer) { edited = true; long uid = getUId(); OFFERS.put(uid, offer); return uid; } private static long getUId() { while (true) { long uid = Utils.RANDOM.nextLong(); if (OFFERS.containsKey(uid)) continue; return uid; } } public static int getPrice(int itemId) { ItemDefinitions defs = ItemDefinitions.getItemDefinitions(itemId); if (defs.isNoted()) itemId = defs.getCertId(); else if (defs.isLended()) itemId = defs.getLendId(); Integer price = PRICES.get(itemId); return price != null && price != 0 ? price : EconomyPrices.getPrice(itemId); } // in order not to keep player saved on memory in offers after player leaves // <.< public static void unlinkOffers(Player player) { for (int slot = 0; slot < player.getGEManager().getOfferUIds().length; slot++) { Offer offer = getOffer(player, slot); if (offer == null) continue; offer.unlink(); } } public static List<OfferHistory> getHistory() { return OFFERS_TRACK; } public static void load() { // TODO Auto-generated method stub } } [/CODE] [B] HISTORY.JAVA [/B] [CODE]package com.ew.game.player.content.grandExchange; import java.io.Serializable; public class OfferHistory implements Serializable { private static final long serialVersionUID = 7322642705393018764L; private int id, quantity, price; private boolean bought; public OfferHistory(int id, int quantity, int price, boolean bought) { this.id = id; this.quantity = quantity; this.price = price; this.bought = bought; } public int getId() { return id; } public int getQuantity() { return quantity; } public int getPrice() { return price; } public boolean isBought() { return bought; } } [/CODE]
  14. Having a problem when trying to open the grand exchange. I have tried adding it many times, but always end up with the same error when trying to open it. Error: Code: [code]ERROR! THREAD NAME: New I/O worker #1 java.lang.NullPointerException at com.rs.game.player.GrandExchangeManager.openGrandExchange(GrandExchangeManager.java:70) at com.rs.game.player.content.Commands.processAdminCommand(Commands.java:142) at com.rs.game.player.content.Commands.processCommand(Commands.java:76) at com.rs.net.decoders.WorldPacketsDecoder.processPackets(WorldPacketsDecoder.java:1505) at com.rs.net.decoders.WorldPacketsDecoder.decode(WorldPacketsDecoder.java:268) at com.rs.net.ServerChannelHandler.messageReceived(ServerChannelHandler.java:98) at org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:95) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:563) at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:558) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:268) at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:255) at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:91) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.processSelectedKeys(AbstractNioWorker.java:373) at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:247) at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:35) at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102) at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)[/code] The opening method: Code: [code] public void openGrandExchange() { player.getInterfaceManager().sendInterface(105); player.getPackets().sendUnlockIComponentOptionSlots(105, 206, -1, 0, 0, 1); player.getPackets().sendUnlockIComponentOptionSlots(105, 208, -1, 0, 0, 1); cancelOffer(); player.setCloseInterfacesEvent(new Runnable() { @Override public void run() { if (getType() == 0) player.getPackets().sendRunScript(571); player.getInterfaceManager().removeInterface(752, 7); } }); }[/code] Need help asap.
  15. Wobblum

    Grand Exchange

    How do I add an item to the search list on the grand exchange? For example, when going to buy a Korasi at the GE it does not appear on the list of items when you search it. But it is defined both server and client sided. A reply is appreciated! You can also add me on Skype: whiteboy.kobe
  16. [video=youtube;5h8fQtVrRvo]http://www.youtube.com/watch?v=5h8fQtVrRvo&feature=youtu.be[/video] Let me know what you think, I don;t know of any servers with something like this.. Oh and for those of you that want to know how the prices work, it is through MySQL PHP Admin [IMG]http://gyazo.com/4c23fd4cfb73b677369f80322cd192f6.png[/IMG] Thanks :)
  17. Hello When i try to add my grandexchange then i compile and all is running good but when i login into game and Trying to selling Something On grand exchange then i click Confrim and is not works.. Thats what i see On my run Server.cmd after i click Confrim Pastebin link [url]http://pastebin.com/rzq6pLrV[/url] Selling Option Is work! Only the Buying one dosent work And here is the line 414 [url]http://pastebin.com/dVzSbgVW[/url]
  18. [B]Hello guys i am having a problem, i have Grand exchange into my server and when you buy an item you have to wait for someone to sell it for it to work. Here is what my selling says. [IMG]http://i.imgur.com/y4wQswg.png[/IMG] I have tried a lot of items in game and i just ran out of idea. I really need help thanks. I have another problem to, when you logout or restart the server the item you bought is gone in Grand Exchange and it takes the cash. Anyone have an answer for that? Thank you guys sooo much! Thanks, cya :D[/B]
  19. Selling 100% grand exchange, Contact me via skype: "zachpowney" Sincerely, Zach
  20. fix it, some things in a method where in the wrong order
  21. I need 1 big help with this. When you go to sell something it equips the item and closes all of the screens. Look at my video Problem. [url]http://tinypic.com/player.php?v=1zwkco8&s=5[/url] [CODE] public void sellItems() { int x = selectedAmount; int y = firstItemStacked(selectedItemId); int z = secondItemStacked(selectedItemId); long l = firstItemStacked; long g = secondItemStacked; long o = l+g; if(removeGrandExchangeItems(x, y, z, firstItemStacked, secondItemStacked, o)) { final int s = selectedSlot; int b = selectedSlot; int i = newOffer("Sell", selectedItemId, selectedAmount, selectedAmount, selectedPrice, 0, c.playerName, false, b); c.getItems().deleteItem2(selectedItemId, selectedAmount); if(i == -1) { c.getItems().addItem(selectedItemId, selectedAmount); c.sendMessage("To many offers, please try again later."); return; } openGrandExchange(true); c.sendConfig(4, b, 1, -1); c.sendConfig(5, b, 1, -1); int k = b*2; k += 24565; c.getPA().sendFrame34(selectedItemId, 0, k, selectedAmount); sellItems(i, c.playerName); CycleEventHandler.getInstance().addEvent(c, new CycleEvent() { public void execute(CycleEventContainer container) { container.stop(); } @Override public void stop() { c.sendConfig(5, s, 3, -1); } }, 2); PlayerSave.saveGame(c); } }[/CODE]
  22. Never really showed this off since most people don't have player-player grand exchange. [IMG]http://i.imgur.com/zOAjLyn.png[/IMG] [IMG]http://i.imgur.com/hzVxmDu.png[/IMG] [IMG]http://i.imgur.com/PuCsfEY.png[/IMG] [IMG]http://i.imgur.com/1jV9wKQ.png[/IMG] [IMG]http://i.imgur.com/CRRBZtH.png[/IMG] [LIST] [*]Rune Knives are auto-buy items so they are not sold to the players. [*]Armadyl godswords aren't auto-buy items, so they are sold player-player. [/LIST] [IMG]http://i.imgur.com/UQ9nSCr.png[/IMG] [IMG]http://i.imgur.com/Pflbews.png[/IMG] [IMG]http://i.imgur.com/gig2WGS.png[/IMG] [IMG]http://i.imgur.com/fzBbpsc.png[/IMG] [IMG]http://i.imgur.com/7GvLtbK.png[/IMG] [IMG]http://i.imgur.com/xuR91q5.png[/IMG]
  23. hello I would like the grand exchange clerk talk make so as, for example, banker who says good day how may i help you then you have the options acess my banking account please and then he opens the bank what I want is at the grand exchange clerk good day how may i help you than options open my grand exchange collect my grand exchange I've been but just how can I get to Grandex interface grand ex to open you open grand exchange click he actually goes to Grandex screen sorry for my bad english I love to hear how it should
  24. Followed this tutorial: [url]http://www.runelocus.com/forums/showthread.php?91194-Grand-Exchange-Release-PI[/url] Error: src\com\exile\game\players\Player.java:912: error: cannot find symbol GE().sendUpdate(playerName); ^ symbol: method sendUpdate(String) location: class GrandExchange src\com\exile\GameEngine.java:74: error: constructor GrandExchange in class Gran dExchange cannot be applied to given types; public static GrandExchange GE = new GrandExchange(); ^ required: Player found: no arguments reason: actual and formal argument lists differ in length src\com\exile\GameEngine.java:158: error: cannot find symbol GE.loadSellers(); ^ symbol: method loadSellers() location: variable GE of type GrandExchange src\com\exile\GameEngine.java:159: error: cannot find symbol GE.loadBuyers(); ^ symbol: method loadBuyers() location: variable GE of type GrandExchange src\com\exile\game\players\packets\ClickingButtons.java:237: error: cannot find symbol p.GE().buttonClick(buttonId); ^ symbol: method buttonClick(int) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:74: error: cannot find sym bol c.GE().updateGE(c.GE().selectedItemId, c.GE().se lectedPrice); ^ symbol: method updateGE(int,int) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:86: error: cannot find sym bol c.GE().updateGE(c.GE().selectedItemId, c .GE().selectedPrice); ^ symbol: method updateGE(int,int) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:100: error: cannot find sy mbol c.GE().updateGE(c.GE().selectedItemId, c .GE().selectedPrice); ^ symbol: method updateGE(int,int) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:104: error: cannot find sy mbol c.GE().collectItem(1, "Sell"); ^ symbol: method collectItem(int,String) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:107: error: cannot find sy mbol c.GE().collectItem(2, "Sell"); ^ symbol: method collectItem(int,String) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:110: error: cannot find sy mbol c.GE().collectItem(1, "Buy"); ^ symbol: method collectItem(int,String) location: class GrandExchange src\com\exile\game\players\commands\NormalPlayer.java:113: error: cannot find sy mbol c.GE().collectItem(2, "Buy"); ^ symbol: method collectItem(int,String) location: class GrandExchange Note: src\com\exile\EconomyReset.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: src\com\exile\mananger\Manager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 12 errors Press any key to continue . . .
  25. On RuneScape's download page they are dumping all there GE images. Enjoy here: [url]http://www.runescape.com/downloads.ws[/url]
×