1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Question Grounditem to array

Discussion in 'Developer Support' started by Guffe, Nov 19, 2017.

  1. Guffe

    Joined:
    Dec 20, 2016
    Messages:
    30
    Likes Received:
    5
    How would I get an array from ground items I've tried:
    GroundItem loot[] = GroundItems.newQuery().results().toArray();
    GroundItem[] loot = GroundItems.newQuery().results().toArray();
     
  2. awesome123man

    awesome123man Go check out new bots and give helpful feedback.

    Joined:
    Jan 31, 2016
    Messages:
    5,413
    Likes Received:
    1,662
    I don't see why you want to anyways. But I think inside the toArray() put new GroundItem[size of query] or something
     
  3. Guffe

    Joined:
    Dec 20, 2016
    Messages:
    30
    Likes Received:
    5
    Trying to figure out, how I can see grounditems value, then pick up if over like 1k. But can't seem to figure it out..
     
  4. awesome123man

    awesome123man Go check out new bots and give helpful feedback.

    Joined:
    Jan 31, 2016
    Messages:
    5,413
    Likes Received:
    1,662
    Well you can use the .filter() method.
    Inside of that just check if the quantity is a certain amount, and am So filtering the names you want...
     
  5. Guffe

    Joined:
    Dec 20, 2016
    Messages:
    30
    Likes Received:
    5
    I don't understand this... :(
     
  6. Swych

    Joined:
    Dec 9, 2016
    Messages:
    3,057
    Likes Received:
    1,032
    Code (Text):
    1. LocatableEntityQueryResults<GroundItem> groundItems = GroundItems.newQuery().filter(o -> {
    2.             ItemDefinition def = o.getDefinition();
    3.             return def != null && def.isTradeable() && GrandExchange.lookup(def.getId()).getPrice() > 1000;
    4.         }).results();
    Try something like that?
     
    awesome123man likes this.
  7. Qosmiof2

    Qosmiof2 I've been called a god before.

    Joined:
    Aug 5, 2014
    Messages:
    3,212
    Likes Received:
    924
    @OP if you'll do something like this (that contains for example GrandExchange.lookup) make sure to store values for further usage to avoid external lookups.
     
    Swych likes this.
  8. Swych

    Joined:
    Dec 9, 2016
    Messages:
    3,057
    Likes Received:
    1,032
    Of course, caching values is extremely effective and should be used. I just wrote this real fast
     
    Qosmiof2 likes this.
  9. Qosmiof2

    Qosmiof2 I've been called a god before.

    Joined:
    Aug 5, 2014
    Messages:
    3,212
    Likes Received:
    924
    i said @OP at the beggining :p
     
    Swych likes this.
  10. Guffe

    Joined:
    Dec 20, 2016
    Messages:
    30
    Likes Received:
    5
    Thank you guys I'm gonna try this
     

Share This Page

Loading...