Welcome!

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

Sign up now!

Resolved Shop API(s) broken

Joined
Jan 31, 2015
Messages
116
straight TL;DR'd version:

Shop api seems to be broken. Shop.Buy(int id, int quantity); doesn't work. Also cannot retrieve any item from a shop with Shop. api.

Code:
System.out.println(Shop.getItems().asList().toString());
prints out only [ ] when shop is open (Interface ID 1265)

5a228a5342.png


@Cloud
 
Joined
Dec 24, 2014
Messages
81
I think it's just that shop... I know you're writing that for me, but I've been messing around trying to get one working, too... I was just modding another private script I had written by Ozzy.. This is from his script (not the same shop)
Code:
package scripts.HarpoonBuyer.Tasks;

import com.runemate.game.api.hybrid.entities.Npc;
import com.runemate.game.api.hybrid.local.Camera;
import com.runemate.game.api.hybrid.local.hud.Menu;
import com.runemate.game.api.hybrid.local.hud.interfaces.InterfaceComponent;
import com.runemate.game.api.hybrid.local.hud.interfaces.Interfaces;
import com.runemate.game.api.hybrid.local.hud.interfaces.Inventory;
import com.runemate.game.api.hybrid.location.Area;
import com.runemate.game.api.hybrid.location.Coordinate;
import com.runemate.game.api.hybrid.queries.InterfaceComponentQueryBuilder;
import com.runemate.game.api.hybrid.queries.NpcQueryBuilder;
import com.runemate.game.api.hybrid.queries.results.InterfaceComponentQueryResults;
import com.runemate.game.api.hybrid.queries.results.LocatableEntityQueryResults;
import com.runemate.game.api.hybrid.region.Npcs;
import com.runemate.game.api.hybrid.region.Players;
import com.runemate.game.api.script.Execution;
import com.runemate.game.api.script.framework.task.Task;

public class Purchase extends Task {

    public static Area shopArea = new Area.Polygonal(new Coordinate(3010, 3230, 0), new Coordinate(3018, 3230, 0), new Coordinate(3018, 3223, 0), new Coordinate(3010, 3220, 0));
    private NpcQueryBuilder shopKeeperQuery = Npcs.newQuery().within(shopArea).names("Gerrant");
    private InterfaceComponentQueryBuilder shopInterfaceQuery = Interfaces.newQuery().texts("Gerrant's Fishy Business");

    public boolean validate() {
        return !Inventory.isFull() && shopArea.contains(Players.getLocal()) ;
    }

    @Override
    public void execute() {

        System.out.println("Purchasing ACTIVE");

        InterfaceComponentQueryResults validShopInterfaces = shopInterfaceQuery.results();
        if (!validShopInterfaces.isEmpty()) {
            InterfaceComponentQueryResults validHarpoonInterfaces = Interfaces.newQuery().names("Harpoon").results();
            if (!validHarpoonInterfaces.isEmpty()) {
                InterfaceComponent harpoonInterface = (InterfaceComponent)validHarpoonInterfaces.first();
                if (harpoonInterface != null) {
                    int inventoryCount = Inventory.getQuantity();
                    if (harpoonInterface.interact("Buy All")) {
                        Execution.delayUntil(() -> Inventory.getQuantity() > inventoryCount, 1200, 1600);
                        if (Menu.isOpen()) {
                            Menu.close();
                        }
                    }
                }
            }

        } else {
            LocatableEntityQueryResults<Npc> validShopKeepers = shopKeeperQuery.results();
            if (!validShopKeepers.isEmpty()) {
                Npc shopKeeper = validShopKeepers.first();
                if (shopKeeper != null && shopKeeper.isValid()) {
                    if (shopKeeper.isVisible()) {
                        if (shopKeeper.interact("Trade")) {
                            Execution.delayUntil(() -> !shopInterfaceQuery.results().isEmpty(), 1200, 1600);
                        }
                    } else {
                        Camera.turnTo(shopKeeper);
                    }
                }
            }
        }

    }


}
 
Joined
Jan 31, 2015
Messages
116
Well, i'm going to investigate a bit more.

Edit:

Nope, all shops broken to me
 
Last edited:
Joined
Dec 24, 2014
Messages
81
That works for the shop it's made for, but I tried to edit the whole script to do what you're trying and it doesn't work...

Well, i'm going to investigate a bit more.
I hope you get it figured out... I still want it... Even if I get it working, it'd be nice to have 2 different scripts to do the same thing in different ways... Bot 2 accounts at the same time and no shared patterns...
If u can't get it working and ever want to give up, though, it's cool...lol
 
Last edited:
Top