Resource Grand Exchange API for buying and selling items [BETA]

Discussion in 'Tutorials & Resources' started by Dibes, Jun 20, 2015.

  1. Dibes

    Joined:
    Nov 18, 2013
    Messages:
    117
    Likes Received:
    8
    So since there is no API for buying and selling items on the GE I decided today that I was going to make a basic functioning one.

    Version: 0.4
    Features:
    Haven't Started | In Progress | Done
    • Buy items from the GE
      • Buy X Amount for Y Price
      • Based on ID
      • Based on Name
        • TFW Dumb. Don't need item ID for this at all >.>.
      • Retrieve Items and money from GE
      • Fix Bugs
        • Input never gains focus to input X amount or Y price. Have you click input box
          • Needed Execution.delay after clicking the [...] (I tried Thread.sleep previously)
    • Sell Items on the GE
      • Sell X Amount for X Price
      • Based on ID
      • Based on Name
      • Retrieve money from GE
    If you want the source or would like to fork and push changes/additions press the button below!

    [​IMG]

    [​IMG]

    Basic Use of buying 2 items (As seen in the gif above):
    Code (Java):
    1. package com.dibes.bots.getest;
    2.  
    3. import com.dibes.bots.getest.GrandExchange.GrandExchangeComplete;
    4. import com.runemate.game.api.rs3.net.GrandExchange;
    5. import com.runemate.game.api.script.framework.LoopingScript;
    6.  
    7. public class GETest extends LoopingScript {
    8.     boolean boughtItem1;
    9.     boolean boughtItem2;
    10.  
    11.     @Overridepublic void onLoop() {
    12.         // Note: It seems to me this implementation is messy. Probably a better way to do it!
    13.         if (!boughtItem1 || !boughtItem2) {
    14.             if (!boughtItem1)
    15.                 // Buys 1 rune longsword at default price.
    16.                 boughtItem1 = GrandExchangeComplete.buyItem(1303);
    17.             if (boughtItem1 && !boughtItem2)
    18.                 // Buys 20 air runes at 20gp each
    19.                 boughtItem2 = GrandExchangeComplete.buyItem(556, 20, 20);
    20.         } else {
    21.             GrandExchangeComplete.retrieveItem(1303);
    22.             GrandExchangeComplete.retrieveItem(561);}
    23.     }
    24. }
     
    #1 Dibes, Jun 20, 2015
    Last edited: Jun 21, 2015
    Qosmiof2 likes this.
  2. Arbiter

    Arbiter Mod Automation

    Joined:
    Jul 26, 2013
    Messages:
    2,539
    Likes Received:
    1,056
    @Dibes thanks for the contribution! Hope to see your name in green soon. ;)

    @Cloud perhaps we could use this codebase to implement a version directly into our API.
     
  3. Dibes

    Joined:
    Nov 18, 2013
    Messages:
    117
    Likes Received:
    8
    Uhhh, this is a very rough version of the API haha. It needs a lot of reworking :). But I appreciate it!
    --- Double Post Merged, Jun 21, 2015, Original Post Date: Jun 20, 2015 ---
    Added a gif of it doing it's thing.. for fun!
    --- Double Post Merged, Jun 21, 2015 ---
    Added ability to select X amount of an item at X price. The use of the interface is now slightly buggy cause when I hit the [...] in the GE it doesn't immediately allow me to type the amount of items or price as expected. Had to do a workaround where I clicked the input box to give it any sort of number, seems like a possible bug @Cloud

    NVM Cloud, fixed the bug, sorry!
     
    #3 Dibes, Jun 21, 2015
    Last edited: Jun 21, 2015
  4. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
    Nice work! What do you mean @ name based not doable without Web?
     
  5. Dibes

    Joined:
    Nov 18, 2013
    Messages:
    117
    Likes Received:
    8
    Didn't see an easy way to convert the name of an item to it's ID without calling some sort of outside API. If there is, please let me know!! Thanks :)

    Also thanks to @SlashnHax I fixed the input bug. Just needed Execution.delay! haha
     
  6. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
    Why do you need to convert ID's to names?
    (Why are you even using ID's)
     
  7. Aidden

    Aidden The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,439
    Likes Received:
    701
    Because the GE database goes off the item's ID, not it's name.
     
  8. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
    GrandExchange.Item #getName() ?
    GrandExchange.Offer #getItemDefinition() #getName() ?
     
  9. Aidden

    Aidden The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,439
    Likes Received:
    701
  10. Hazard

    Joined:
    Apr 18, 2015
    Messages:
    394
    Likes Received:
    84
    How about creating a new SpriteItem(id) and doing #getDefinition #getName() ?
     
  11. SlashnHax

    SlashnHax The Chosen One

    Joined:
    Dec 10, 2014
    Messages:
    2,957
    Likes Received:
    864
    ItemDefinition.get(id) already exists
    --- Double Post Merged, Jun 21, 2015, Original Post Date: Jun 21, 2015 ---
    ItemDefinition.get(id), pretty sure i mentioned it on skype xD
     
  12. Dibes

    Joined:
    Nov 18, 2013
    Messages:
    117
    Likes Received:
    8
    That would probably work but SlashnHax made me realize I was being dumb and didn't even need the ID. Silly me!

    Doing that now ^.^. Thnx
    --- Double Post Merged, Jun 21, 2015 ---
    Added GE Buying by name and cleaned up the class!
     
    #12 Dibes, Jun 21, 2015
    Last edited: Jun 21, 2015
    badboykenzie likes this.
  13. badboykenzie

    Joined:
    Jul 9, 2015
    Messages:
    5
    Likes Received:
    0
    Keep up the good work this will be a wicked useful script bot! :p
     
  14. Qosmiof2

    Qosmiof2 Qosidog3 - I write bots not tragedies.

    Joined:
    Aug 5, 2014
    Messages:
    1,832
    Likes Received:
    507
  15. Aidden

    Aidden The better executive ;)

    Joined:
    Dec 3, 2013
    Messages:
    3,439
    Likes Received:
    701
    Pretty sure he's not making it into a bot, but rather creating the methods to interact with the ge and sharing it so other devs can use it
     
  16. Qosmiof2

    Qosmiof2 Qosidog3 - I write bots not tragedies.

    Joined:
    Aug 5, 2014
    Messages:
    1,832
    Likes Received:
    507
    xD
     
  17. Devphreak

    Joined:
    Dec 9, 2015
    Messages:
    145
    Likes Received:
    19
    Holy mother of goldfarming, using this you can make a bot thatll buy EG wines when running out of stock <3

    Verstuurd vanaf mijn SM-G900F met Tapatalk
     
  18. qverkk

    Joined:
    Sep 22, 2015
    Messages:
    843
    Likes Received:
    219
    @Dibes i would love to have that mouse flawlessness etc :( how can i make it?
     
  19. Qosmiof2

    Qosmiof2 Qosidog3 - I write bots not tragedies.

    Joined:
    Aug 5, 2014
    Messages:
    1,832
    Likes Received:
    507
    You need a beast pc and 50fps paint rendering
     
  20. Insomniac

    Joined:
    Jan 27, 2015
    Messages:
    1,547
    Likes Received:
    519
    Bruh, your gmail is visible.
     

Share This Page

Loading...