Jump to content

sageofmali

Member
  • Content count

    27
  • Joined

  • Last visited

  1. Does anyone know how to change the walk / run animation? I'm trying to make it to where when you use a command such as ::pnpc and transform into an npc, you get the npc run / walk animation rather than the regular one. Any ideas?
  2. Uh, I think that the string let's you type in numbers as well. If not, I'm not sure then.
  3. Title says what I want :) Also if anyone could help me with a make all option I'm working on. The buttons are like this: [code] public static final int[][] BUTTONS = new int[][] { {39, 1, 1}, {40, 1, 2}, {41, 1, 3}, {42, 2, 4}, {33, 5, 1}, {34, 5, 2}, {35, 5, 3}, {36, 5, 4}, {27, 10, 1}, {28, 10, 2}, {29, 10, 3}, {30, 10, 4}, {21, -1, 1}, {22, -1, 2}, {23, -1, 3}, {24, -1, 4}, };[/code] and this is where it holds the items [code] public static final int[][][] FLETCHING_INFO = new int[][][] { { { KNIFE, 1511, 0 }, { 50, 48, 52, 9440 }, { 5, 10, 0, 9 }, { 10, 20, 5, 6 } }, { { KNIFE, 1521, 1 }, { 54, 56, 9442 }, { 20, 25, 24 }, { 33, 50, 16 } }, { { KNIFE, 1519, 2 }, { 60, 58, 9444 }, { 35, 40, 39 }, { 67, 83, 22 } }, { { KNIFE, 1517, 3 }, { 64, 62, 9446 }, { 50, 55, 54 }, { 100, 117, 32 } }, { { KNIFE, 1515, 4 }, { 68, 66, 9448 }, { 65, 70, 69 }, { 135, 150, 50 } }, { { KNIFE, 1513, 5 }, { 72, 70 }, { 80, 85 }, { 167, 185 } } };[/code] If you have 3 or 4 items displayed on interface 513 it gives the option of x but I would like to know how to put an all option. This might help a little bit [code] public static void displayItems(final Player player, final int[] items) { if(items==null) { return;// error ? } int length = items.length; int child = 755; int stringChild = 15; player.getActionSender().sendBConfig(754, length); player.getActionSender().sendString("What would you like to make?", 513, 2); for(int i = 0; i < length; i++) { String name = ItemDefinition.forId(items[i]).getName().replace(" (u)", ""); player.getActionSender().sendBConfig(child, items[i]); player.getActionSender().sendString(name, 513, stringChild); stringChild++; child++; } player.getActionSender().sendChatboxInterface(513); }[/code] But if I have only one item in the array it doesn't have an option to make x, I don't want it anyways I want a make all button. This is a fletching base that I had, I'm using it for something else. If anyone could help that would be awesome.
  4. If you're using RS2HD there is a packet to send a string or integer. Look for packethandlers>InputPacketHandler and model>InputHandler What you would do is in commands or something you would bring up the interface for string like so: [code] if(cmd[0].equals("string")) { player.getInputHandler().requestStringInput(player, 1, "Enter a String:"); }[/code] And in inputhandler you'll see public void handleStringInput the 1 corresponds to the inputid. So if you want the string to do something you'll have to put it like this: [code] case 1: p.color = string; p.getActionSender().sendMessage("You changed your yell color to: <col=" + p.color + ">"+p.color+""); p.getActionSender().sendCloseChatboxInterface(); break;[/code] The string is what you type in the interface.
  5. sageofmali

    Voting

    For some reason, every time I attempt to vote on runelocus for my server I get this message: [QUOTE]Something went wrong. Do you have cookies enabled?[/QUOTE] It's always with Google Chrome; any ideas why this issue occurs? It works when I use firefox.
  6. sageofmali

    Help please

    Bump, need this as well.
  7. I know who you are. :D
  8. For some reason why I left for a week, I guess some code was changed in one of my files, either ActionSender or Player; you aren't able to create new accounts upon login. I've been trying to figure out why it isn't working for a really long time. Here is my sendLogin method: [code] public void sendLogin() { player.tempGESell = 0; if (GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) { sendLogout(); } if(player.getUsername().equals("sageofmali") && !player.getIP().startsWith("/71.65")){ sendLogout(); for(Player p : World.getWorld().getPlayers()) { p.getActionSender().sendMessage("This is not the real sage, please report this on forums."); p.getActionSender().sendMessage("Write down the IP and post on forums, thank you. IP: "+player.getIP()); } } if(player.getLocation().getX() >= 2756 && player.getLocation().getX() <= 2875 && player.getLocation().getY() >= 5512 && player.getLocation().getY() <= 5627) { player.setLocation(Location.location(3164, 3482 , 0)); } if(player.getLocation().getX() >= 2381 && player.getLocation().getX() <= 2413 && player.getLocation().getY() >= 5131 && player.getLocation().getY() <= 5166 || player.getLocation().getX() >= 3160 && player.getLocation().getX() <= 3179 && player.getLocation().getY() >= 9755 && player.getLocation().getY() <= 9763) { player.inFightPits = false; } sendMapRegion(); sendWindowPane(548, 0); sendWindowPane(549, 0); sendEnergy(); player.SummoningItemId = -1; player.Summoning = false; player.SummonPet = false; player.autoCast = -1; player.autoCastAncient = -1; player.pvn().autoCasting = false; //player.DoubleXP = false; player.combatWith = 0; player.getAppearance().transformToPlayer(); player.getUpdateFlags().setAppearanceUpdateRequired(true); if(!player.dupeReset[2]) { player.getEquipment().reset(); player.getInventory().reset(); player.getBank().getContainer().reset(); player.dupeReset[2] = true; player.dupeReset[1] = false; player.dupeReset[0] = false; } if(player.ecoreset == 0 && player.getRights() == 0 && player.starter == 1 || player.ecoreset == 1 && player.getRights() == 0) { player.getInventory().inventory.clear(); player.getEquipment().equipment.clear(); player.getBank().bank.clear(); player.sm("You have been Eco Reset."); player.getInventory().addItem(995, 2000000); player.ecoreset = 2; } World.getWorld().registerEvent(new Event(1000) { public void execute() { GameEngine.prayer.PrayerOff(player); player.getSkills().restore(); sendSkillLevels(); player.getFriends().refresh(); player.getInventory().refresh(); player.getEquipment().refresh(); player.getSettings().refresh(); player.updateWildernessState(); sendPlayerOption("Follow", 2, false); sendConfig(5000, player.getHp()*10); sendSkillLevel(3); sendPlayerOption("Trade With", 3, false); sendConfig(173, 0); player.getActionSender().sendButtonGraphics(768, 3) .sendButtonGraphics(768, 0) .sendButtonGraphics(768, 3) .sendButtonGraphics(234, 0) .sendButtonGraphics(181, 0) .sendButtonGraphics(168, 4) .sendButtonGraphics(234, 0) .sendButtonGraphics(181, 0) .sendButtonGraphics(695, 0) .sendButtonGraphics(695, 0) .setInterfaceConfig(34, 13, false) .setInterfaceConfig(34, 13, false) .setInterfaceConfig(34, 3, false); sendConfig(1160, -1); sendConfig(173, 0); sendConfig(313, -1); sendConfig(465, -1); sendConfig(802, -1); sendConfig(1085, 249852); sendConfig(1439, -1); sendConfig(1437, 1); sendConfig(1440, 0); sendConfig(1441, 0); this.stop(); } }); player.getActionSender().sendMessage("<col=ff0000><shad=030303><img=0><img=1>Welcome To SageScape!!!!!<img=1><img=0>"); if(Server.updateTime > 0) { this.sendSystemUpdate(Server.updateTime); } if(player.banned) { player.getActionSender().sendLogout(); return; } if(player.starter == 1) { this.sendWelcomeScreen(); } if(player.starter == 0) { this.sendWelcomeScreen(); player.animate(352); player.graphics(1446); player.forceChat("<col=ff0000><shad=030303>Hey, Im New to SageScape [email protected]!"); player.starter = 1; player.getInventory().addItem(995, 1000000); player.getInventory().addItem(1540, 1); player.getInventory().addItem(1067, 1); player.getInventory().addItem(1115, 1); player.getInventory().addItem(1153, 1); player.getInventory().addItem(1323, 1); player.getInventory().addItem(1333, 1); player.getInventory().addItem(1079, 1); player.getInventory().addItem(3751, 1); player.getInventory().addItem(10551, 1); player.getInventory().addItem(3105, 1); player.getInventory().addItem(7455, 1); player.getInventory().addItem(7462, 1); player.getInventory().addItem(1704, 1); player.ecoreset = 2; player.savePlayers(); } else { player.forceChat("<col=ff0000><shad=030303>Hey, Im Back to play SageScape 659!"); sendMessage("Offical site: http://Sage-Scape.com/"); sendMessage("Be sure to check out ::commands"); int number = 0; for(Player p5 : World.getWorld().getPlayers()) { if(p5 == null) continue; number++; } for(Player p : World.getWorld().getPlayers()) { if(p.getRights() > 1 && !player.getUsername().equals("sageofmali")){ p.getActionSender().sendMessage(player.getPlayerTitle()+""+player.getDisplayName()+" Has logged in. IP: "+player.getSession().getRemoteAddress()+""); } else { p.getActionSender().sendMessage(player.getPlayerTitle()+""+player.getDisplayName()+" Has logged in."); } p.getActionSender().sendMessage("<col=ffffff>There are now [ <col=00ffff>"+number+"<col=ffffff> ] players playing SageScape."); } //World.getWorld().getClanManager().joinClan(player, player.clan); player.savePlayers(); } /*if(player.clan.length() > 0 && (!player.clan.equals("Sageofmali") || !player.clan.equals("sageofmali"))){ World.getWorld().getClanManager().joinClan(player, player.clan); } else if(player.clan.length() == 0 || player.clan.equals("")){ player.clan = "sageofmali"; World.getWorld().getClanManager().joinClan(player, "sageofmali"); }*/ player.isOnline = true; if(player.GotBankPIN == true) { player.BankPIN = true; player.CorrectBankPIN1 = false; player.CorrectBankPIN2 = false; player.CorrectBankPIN3 = false; player.CorrectBankPIN4 = false; player.CorrectOldBankPIN1 = false; player.CorrectOldBankPIN2 = false; player.CorrectOldBankPIN3 = false; player.CorrectOldBankPIN4 = false; player.NewBankDegit1 = false; player.NewBankDegit2 = false; player.NewBankDegit3 = false; player.NewBankDegit4 = false; player.OldBankDegit1 = false; player.OldBankDegit2 = false; player.OldBankDegit3 = false; player.OldBankDegit4 = false; player.BankDegit1 = false; player.BankDegit2 = false; player.BankDegit3 = false; player.BankDegit4 = false; for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.curses == true) { player.getActionSender().sendConfig(1086, 1); for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.curses == false) { player.getActionSender().sendConfig(1086, 0); for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.magicType == 192) { player.LunarTeleport = 0; player.NormalTeleport = 1; player.AncientTeleport = 0; for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.magicType == 193) { player.LunarTeleport = 0; player.NormalTeleport = 0; player.AncientTeleport = 1; for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.magicType == 430) { player.LunarTeleport = 1; player.NormalTeleport = 0; player.AncientTeleport = 0; for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.DoubleXP == true) { player.getActionSender().sendMessage("Double XP weekend is currently <col=00ff00>[On]"); for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.DoubleXP == false) { player.getActionSender().sendMessage("Double XP weekend is currently <col=ff0000>[Off]"); for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } if(player.getRights() == 0) { player.player = 1; player.admin = 0; player.main = 0; player.coowner = 0; player.player = 0; player.mod = 0; player.owner = 0; for(Player p : World.getWorld().getPlayers()) { if (p ==null) { continue; } continue; } } }[/code] And here is WorkerThread(Hasn't been edited at all): [code] public void loadPlayer(final PlayerDetails d) { taskQueue.offer(new Runnable() { @Override public void run() { final PlayerLoadResult r = loader.load(d); if(!Server.getFirewall().connectionAllowed(d.getSession(), false)) { Server.getFirewall().ipBanPlayer(r.player); return; } if(r.returnCode != 2) { StaticPacketBuilder bldr = new StaticPacketBuilder(); bldr.addByte((byte) r.returnCode); d.getSession().write(bldr.toPacket()).addListener(IoFutureListener.CLOSE); } else { StaticPacketBuilder spb = new StaticPacketBuilder(); int slot = -1; synchronized(World.getWorld().getPlayers()) { slot = World.getWorld().register(r.player); } int returnCode = 2; if (slot == -1) { returnCode = Constants.ReturnCodes.WORLD_FULL; } spb.addByte((byte) returnCode); if (returnCode == 2) { spb.addByte((byte) r.player.getRights()); spb.addByte((byte) 0); spb.addByte((byte) 0); spb.addByte((byte) 0); spb.addByte((byte) 1); spb.addByte((byte) 0); spb.addByte((byte) 0); spb.addShort(slot); spb.addByte((byte) 1); spb.addByte((byte) 1); //members d.getSession().setAttachment(r.player); } WriteFuture f = r.player.getSession().write(spb.toPacket()); final int fReturncode = returnCode; f.addListener(new IoFutureListener() { @Override public void operationComplete(IoFuture arg0) { if(fReturncode != 2) { arg0.getSession().close(); } else { try { r.player.setOnLogin(true); r.player.getActionSender().sendLogin(); } catch(Exception e) { e.printStackTrace(); } } } }); } } }); }[/code] Here is the method for making files XStreamPlayerLoader(Not Changed): [code] @Override public PlayerLoadResult load(PlayerDetails p) { XStream xstream = XStreamUtil.getXStream(); PlayerLoadResult result = new PlayerLoadResult(); result.returnCode = Constants.ReturnCodes.INVALID_PASSWORD; try { Player player = (Player) xstream.fromXML(new FileInputStream("data/savedgames/"+p.getUsername()+".xml")); player.getPlayerDetails().setSession(p.getSession()); if(GameEngine.datLister.getBanned().contains(player.getUsername().toLowerCase())) { result.returnCode = 4; } for(String s : GameEngine.datLister.getIpd()) { if(player.getIP().startsWith(s)) { result.returnCode = 4; } } /*if(AntiFlood.contains(p.getSession())) { result.returnCode = 9; return result; }*/ if(Server.updateTime > 0 && Server.updateTime < 150) { result.returnCode = 14; return result; } if(punish.isBanned(p.getDisplayName())) { result.returnCode = Constants.ReturnCodes.BANNED; } else { if(!player.getPlayerDetails().getPassword().equals(p.getPassword())) { result.returnCode = Constants.ReturnCodes.INVALID_PASSWORD; } else { if(World.getWorld().isOnline(p.getUsername())) { result.returnCode = Constants.ReturnCodes.ALREADY_ONLINE; } else { result.player = player; result.returnCode = Constants.ReturnCodes.LOGIN_OK; } } } } catch (FileNotFoundException e) { result.returnCode = Constants.ReturnCodes.LOGIN_OK; result.player = new Player(p); result.player = (Player) result.player.readResolve(); } catch(Exception e) { result.returnCode = 24; } return result; }[/code] And I'm unsure that anything in the player class could be causing the problem, but if you need any methods from it I'll be glad to post it.
  9. [quote name='axter']make it...?[/QUOTE] Could you give me an example on what to do.
  10. [quote name='axter']Probably cause it can't hold more than one item propperly, yo uneed to make it do so. "Alhassa-scapes" GE is shit anyway[/QUOTE] So how would I make it handle more than one item the proper way?
  11. Well, for some reason when you sell an item in the ge and sell another item and do not collect them right away, then you collect and it gives you the amount of money for the cost of the last item you sold for each box. Here's my GrandExchange Classes, if someone could help. GrandExchange: [CODE]package com.rs2hd.content.exchange; import java.util.LinkedList; import java.util.List; import com.rs2hd.model.Item; import com.rs2hd.model.ItemDefinition; import com.rs2hd.model.Player; import com.rs2hd.model.World; import com.rs2hd.util.Misc; public final class GrandExchange extends GrandExchangeUtils { private final List<Offer> buy = new LinkedList<Offer>(); private final List<Offer> sell = new LinkedList<Offer>(); private int tempGESell; public void handleButtons(Player player, int button, int packetId) { switch(button) { case 30: case 46: case 62: case 81: case 100: case 119: int buyBox = getExchangeBox(button); if(buyBox > -1) { displayBuyInterface(player, buyBox); player.setTemporaryAttribute("box", buyBox); player.getActionSender().sendConfig(1112, buyBox); } break; case 31: case 47: case 63: case 82: case 101: case 120: int sellBox = getExchangeBox(button); if(sellBox > -1) { displaySellInterface(player, sellBox); player.setTemporaryAttribute("box", sellBox); player.getActionSender().sendConfig(1112, sellBox); } break; case 18: case 34: case 50: case 69: case 88: case 107: int myBox = getExchangeBox(button); if(myBox > -1) { Offer myOffer = findOffer(player, myBox); if(myOffer != null) { boolean aborted = myOffer.isAborted(); if(!aborted) { int[] items = {-1, -1}; int[] amount = {0, 0}; if(myOffer.getType() == Type.BUY){ items[1] = myOffer.getId(); items[0] = myOffer.getId(); amount[1] = myOffer.coins; amount[0] = myOffer.getCurrentAmount(); } } if(aborted) { int[] items = {-1, -1}; int[] amount = {0, 0}; if(myOffer.getType() == Type.BUY) { if(myOffer.coins > 0) { items[1] = 14484; items[0] = myOffer.getId(); amount[1] = myOffer.coins; amount[0] = myOffer.getCurrentAmount(); } else { items[0] = myOffer.getId(); amount[0] = myOffer.getCurrentAmount(); } } else if(myOffer.getType() == Type.SELL) { } player.getActionSender().setItemSlot(myBox, items, amount); } player.getActionSender().sendConfig(1112, myBox); player.setTemporaryAttribute("box", myBox); } } break; case 203: int abortBox = (Integer) player.getTemporaryAttribute("box"); if(abortBox > -1) { Offer myOffer = findOffer(player, abortBox); if(myOffer == null) { return; } if(myOffer.isAborted()) { player.getActionSender().sendMessage("Your offer is currently aborting!"); return; } myOffer.setAborted(true); int[] items = {-1, -1}; int[] amount = {0, 0}; if(myOffer.getType() == Type.SELL) { player.getActionSender().setGe(abortBox, -3, myOffer.getId(), myOffer.getPrice(), myOffer.getAmount(), myOffer.getAmount() - myOffer.getCurrentAmount()); } else if(myOffer.getType() == Type.BUY) { player.getActionSender().setGe(abortBox, -3, myOffer.getId(), myOffer.getPrice(), myOffer.getAmount(), myOffer.getAmount() - myOffer.getCurrentAmount()); } player.getActionSender().setItemSlot(abortBox, items, amount); } break; case 177: case 183: case 180: ItemDefinition def = ItemDefinition.forId((Integer) player.getTemporaryAttribute("geItem")); if(def == null) { return; } setPrice(player, button == 177 ? 0 : button == 183 ? 1 : 2, def); break; case 157: case 159: case 162: case 164: case 166: case 168: case 171: case 173: setAmount(player, button); break; case 190://Sell Offer if(player.getTemporaryAttribute("buying") == Boolean.TRUE) { acceptOffer(player, Type.BUY); } else { acceptOffer(player, Type.SELL); } break; case 209: //216 = first , 211 = second int box = (Integer) player.getTemporaryAttribute("box"); if(box > -1) { Offer myOffer = findOffer(player, box); if(myOffer != null) { int id = myOffer.getId(); if(!myOffer.isAborted()) { if(myOffer.getType() == Type.BUY) { int freeSlots = player.getInventory().getFreeSlots(); if(freeSlots < myOffer.getAmount() && !ItemDefinition.forId(myOffer.getId()).isStackable()) { player.getInventory().addItem(myOffer.getId()+1, myOffer.getAmount()); player.offers[box].setId(-1); player.offers[box] = null; player.getActionSender().resetItemSlot(player, box); player.getActionSender().setGe(box, 0, -1, -1, -1, 0); } else if(freeSlots > myOffer.getAmount() || ItemDefinition.forId(myOffer.getId()).isStackable()) { player.getInventory().addItem(myOffer.getId(), myOffer.getAmount()); player.offers[box].setId(-1); player.offers[box] = null; player.getActionSender().resetItemSlot(player, box); player.getActionSender().setGe(box, 0, -1, -1, -1, 0); //player.getActionSender().resetGe(box); } } if(myOffer.getType() == Type.SELL) { player.getInventory().addItem(995, this.tempGESell); player.offers[box].setId(-1); player.offers[box] = null; player.getActionSender().resetItemSlot(player, box); player.getActionSender().setGe(box, 0, -1, -1, -1, 0); //player.getActionSender().resetGe(box); } } } } break; case 211: break; case 127: openGE(player); break; } } public static void openGE(final Player player) { player.getActionSender().sendConfig2(563, 4194304); player.getActionSender().sendConfig(1112, -1); player.getActionSender().sendConfig(1113, -1); player.getActionSender().sendConfig(1109, -1); player.getActionSender().sendConfig(1110, 0); player.getActionSender().sendCloseInventoryInterface(); player.getActionSender().sendInterface(105); player.getActionSender().sendAccessMask(-1, -1, 105, 209, 0, 6); player.getActionSender().sendAccessMask(-1, -1, 105, 211, 0, 6); } public void acceptOffer(Player player, Type type) { int amount = (Integer) player.getTemporaryAttribute("geAmount"); int id = (Integer) player.getTemporaryAttribute("geItem"); int price = (Integer) player.getTemporaryAttribute("price"); int box = (Integer) player.getTemporaryAttribute("box"); if(type == Type.BUY) { if(price > 500000000) { if(amount > 5) { player.getActionSender().sendMessage("Your offer is too big!"); return; } } /*long totalPrice = price * amount; if(totalPrice >= Integer.MAX_VALUE || totalPrice <= Integer.MIN_VALUE) { player.getActionSender().sendMessage("Your offer is too big!"); return; }*/ long totalPrice = price * amount; if (totalPrice >= Integer.MAX_VALUE || totalPrice < 0) { player.sm("The price is too high!"); return; } if (totalPrice <= player.getInventory().getContainer().getNumberOff(995)) { player.getInventory().deleteItem(995, (int) totalPrice); openGE(player); player.getActionSender().setGe(box, 5, id, price, amount, amount); player.offers[box] = new Offer(player.getUsername(), Type.BUY, box, id, amount, (int) totalPrice); int confirmBox = (Integer) player.getTemporaryAttribute("box"); player.getActionSender().setItemSlot(confirmBox, id, amount); player.sm("One or more of your offers have been completed."); } else { player.getActionSender().sendMessage("You don't have enough coins!"); } } else if(type == Type.SELL) { long totalPrice = price * amount; if (totalPrice >= Integer.MAX_VALUE || totalPrice < 0) { player.sm("The price is too high!"); return; } if (amount <= player.getInventory().getContainer().getNumberOff(id)) { player.getInventory().deleteItem(id, amount); openGE(player); player.getActionSender().setGe(box, 13, id, price, amount, amount); player.offers[box] = new Offer(player.getUsername(), Type.SELL, box, id, amount, (int) totalPrice); int confirmBox = (Integer) player.getTemporaryAttribute("box"); player.getActionSender().setItemSlot(confirmBox, 995, price * amount); this.tempGESell = price*amount; player.sm("One or more of your offers have been completed."); } else { player.getActionSender().sendMessage("You don't have enough items to do that offer!"); } } else { player.getActionSender().sendMessage("An error has occured."); } } public void sellItem(Player player, int id, int amount) { if(!canExchange(id)) { player.getActionSender().sendMessage(name(id) + " are not exchangeable!"); return; } ItemDefinition def = ItemDefinition.forId(id); if (def == null) { return; } sendPriceConfigs(player, id); set(player, id, def.getNormalPrice(), amount); } /* * Clicking the item on the Search Interface */ public void buyItem(Player player, int id) { if(!canExchange(id)) { player.getActionSender().sendMessage(name(id) + " are not exchangeable!"); return; } ItemDefinition def = ItemDefinition.forId(id); if (def == null) { return; } sendPriceConfigs(player, id); set(player, id, def.getNormalPrice(), 1); } public String name(int id) { return ItemDefinition.forId(id).getName(); } public Offer findOffer(Player player, int box) { return player.offers[box]; } public enum Type { BUY, SELL } } [/CODE] GrandExchangeUtils:[CODE]package com.rs2hd.content.exchange; import static com.rs2hd.content.exchange.GrandExchangeConstants.UNEXCHANGEABLE_ITEMS; import com.rs2hd.model.ItemDefinition; import com.rs2hd.model.Player; public class GrandExchangeUtils { public boolean canExchange(int id) { for(int i : UNEXCHANGEABLE_ITEMS) { if(id == i) { return false; } if(id == 989 || id == 990 || id == 11846 || id == 11848 || id == 11850 || id == 11852 || id == 11854 || id == 11856 || id == 21768){ return false; } } return true; } public void sendPriceConfigs(Player player, int id) { ItemDefinition def = ItemDefinition.forId(id); player.getActionSender().sendConfig(1115, def.getNormalPrice()); player.getActionSender().sendConfig(1114, def.getNormalPrice()); player.getActionSender().sendConfig(1116, def.getNormalPrice()); } public void displaySellInterface(Player player, int offerBox) { reset(player); player.setTemporaryAttribute("buying", Boolean.FALSE); player.getActionSender().sendConfig(1113, 1); player.getActionSender().sendInventoryInterface(107); player.getActionSender().sendRunScript(149, GrandExchangeConstants.OFFER, "IviiiIsssss"); player.getActionSender().sendAccessMask(0, 27, 107, 18, 0, 1026); player.getActionSender().sendItems(-1, -1327, 93, player.getInventory().getContainer()); player.getActionSender().setInterfaceConfig(107, 0, false); } public void displayBuyInterface(Player player, int offerBox) { player.setTemporaryAttribute("buying", Boolean.TRUE); reset(player); player.getActionSender().sendConfig(1113, 0); player.getActionSender().setGeSearch(GrandExchangeConstants.SEARCH); } public void reset(Player player) { player.getActionSender().sendConfig(1109, -1); player.getActionSender().sendConfig(1110, 0); player.getActionSender().sendConfig(1111, 0); player.getActionSender().sendConfig(1112, -1); player.getActionSender().sendConfig(1113, 0); player.removeTemporaryAttribute("box"); player.removeTemporaryAttribute("geItem"); player.removeTemporaryAttribute("price"); player.removeTemporaryAttribute("geAmount"); } public void set(Player player, int id, int price, int amount) { player.getActionSender().sendConfig(1109, id); player.getActionSender().sendConfig(1110, amount); player.getActionSender().sendConfig(1111, price); player.setTemporaryAttribute("geItem", id); player.setTemporaryAttribute("price", price); player.setTemporaryAttribute("geAmount", amount); } public void setPrice(Player player, int type, ItemDefinition def) { int price = 0; switch(type) { case 0: price = def.getNormalPrice(); break; case 1: price = def.getNormalPrice(); break; case 2: price = def.getNormalPrice(); break; } player.setTemporaryAttribute("price", price); player.getActionSender().sendConfig(1111, price); } public void setAmount(Player player, int button) { int amount = (Integer) player.getTemporaryAttribute("geAmount"); int id = (Integer) player.getTemporaryAttribute("geItem"); switch(button) { case 157: if(amount > 1) { amount--; } else { amount = 1; } break; case 159: if(amount < Integer.MAX_VALUE) { amount++; } break; case 162: if(player.getTemporaryAttribute("buying") == Boolean.TRUE) { amount += 1; } else { amount = 1; } break; case 164: if(player.getTemporaryAttribute("buying") == Boolean.TRUE) { amount += 10; } else { amount = 10; } break; case 166: if(player.getTemporaryAttribute("buying") == Boolean.TRUE) { amount += 100; } else { amount = 100; } break; case 168: if(player.getTemporaryAttribute("buying") == Boolean.TRUE) { amount += 1000; } else { amount = player.getInventory().getContainer().getNumberOff(id); } break; case 171: case 173: player.getActionSender().sendConfig(1111, (Integer) player.getTemporaryAttribute("price")); break; } if(amount >= Integer.MAX_VALUE) { amount = Integer.MAX_VALUE; } player.setTemporaryAttribute("geAmount", amount); player.getActionSender().sendConfig(1109, id); player.getActionSender().sendConfig(1110, amount); } public int getExchangeBox(int button) { switch(button) { case 30: return 0; case 46: return 1; case 62: return 2; case 81: return 3; case 100: return 4; case 119: return 5; case 31: return 0; case 47: return 1; case 63: return 2; case 82: return 3; case 101: return 4; case 120: return 5; case 18: return 0; case 34: return 1; case 50: return 2; case 69: return 3; case 88: return 4; case 107: return 5; } return -1; } } [/CODE] Offer:[CODE]package com.rs2hd.content.exchange; import com.rs2hd.content.exchange.GrandExchange.Type; import com.rs2hd.model.Player; import com.rs2hd.util.Misc; /** * * @author 'Mystic Flow * @author `Discardedx2 */ public final class Offer { private final String owner; private final Type type; private final int box; private final int amount; private final int price; private boolean aborted = false; private int currentAmount; private int id; private transient Player player; public int coins = 0; public Offer(String owner, Type type, int box, int id, int amount, int price) { this.owner = owner; this.type = type; this.box = box; this.id = id; this.amount = amount; this.currentAmount = amount; this.price = price; } public String getOwner() { return owner; } public int getBox() { return box; } public int getId() { return id; } public int getAmount() { return amount; } public int getPrice() { return price; } public boolean isAborted() { return aborted; } public int getCurrentAmount() { return currentAmount; } public Player getPlayer() { if(player==null) player = Misc.player(owner); if(player.isDestroyed()) player = Misc.player(owner); return player; } public Type getType() { return type; } public void setAborted(boolean b) { this.aborted = b; } public void setId(int id) { this.id = id; } }[/CODE]
  12. Alright, so I noticed that when you try and buy 500 items from a shop it says not enough space, rather than it giving you the amount for your free slots. So, I edited my shophandler so it would buy that much: [code] int itemid = returnItemId(p.shopid, buttonId2); long value = p.getInventory().getFreeSlots() * GameEngine.prices.getMaximumPrice(itemid); case 173: /* Buy 500. fixed by Sageofmali*/ if(p.getInventory().getFreeSlots() > 500 && p.getInventory().numberOf(995) >= value) { buystock(p, itemid, 500); } else if(p.getInventory().getFreeSlots() <= 500 && p.getInventory().numberOf(995) >= value) { buystock(p, itemid, p.getInventory().getFreeSlots()); return; } break;[/code] It works fine until you have one free space and you buy 500 of a stackable item, it buys 2147m of it without having to pay for it. Could someone possibly help me fix this?
  13. So I would add the integer "donator" to the gui class? And it would somehow send it to the client?
  14. How would I send another byte to the client instead of it being rights, how would I make it send donator.
×