Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

Question Grounditem to array

Joined
Dec 20, 2016
Messages
30
How would I get an array from ground items I've tried:
GroundItem loot[] = GroundItems.newQuery().results().toArray();
GroundItem[] loot = GroundItems.newQuery().results().toArray();
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
How would I get an array from ground items I've tried:
GroundItem loot[] = GroundItems.newQuery().results().toArray();
GroundItem[] loot = GroundItems.newQuery().results().toArray();
I don't see why you want to anyways. But I think inside the toArray() put new GroundItem[size of query] or something
 
Joined
Dec 20, 2016
Messages
30
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..
 
Go check out new bots and give helpful feedback.
Joined
Jan 31, 2016
Messages
5,413
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..
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...
 
Hexis bots go brrr
Joined
Dec 9, 2016
Messages
4,054
Code:
LocatableEntityQueryResults<GroundItem> groundItems = GroundItems.newQuery().filter(o -> {
            ItemDefinition def = o.getDefinition();
            return def != null && def.isTradeable() && GrandExchange.lookup(def.getId()).getPrice() > 1000;
        }).results();

Try something like that?
 
I've been called a god before.
Joined
Aug 5, 2014
Messages
3,212
Code:
LocatableEntityQueryResults<GroundItem> groundItems = GroundItems.newQuery().filter(o -> {
            ItemDefinition def = o.getDefinition();
            return def != null && def.isTradeable() && GrandExchange.lookup(def.getId()).getPrice() > 1000;
        }).results();

Try something like that?
@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.
 
Hexis bots go brrr
Joined
Dec 9, 2016
Messages
4,054
@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.
Of course, caching values is extremely effective and should be used. I just wrote this real fast
 
Top