Search in sources :

Example 1 with GrandExchangeOffer

use of net.runelite.api.GrandExchangeOffer in project runelite by runelite.

the class RSClientMixin method onGrandExchangeOffersChanged.

@Inject
@FieldHook("grandExchangeOffers")
public static void onGrandExchangeOffersChanged(int idx) {
    if (idx == -1) {
        return;
    }
    GrandExchangeOffer internalOffer = client.getGrandExchangeOffers()[idx];
    if (internalOffer == null) {
        return;
    }
    GrandExchangeOfferChanged offerChangedEvent = new GrandExchangeOfferChanged();
    offerChangedEvent.setOffer(internalOffer);
    offerChangedEvent.setSlot(idx);
    eventBus.post(offerChangedEvent);
}
Also used : GrandExchangeOffer(net.runelite.api.GrandExchangeOffer) GrandExchangeOfferChanged(net.runelite.api.events.GrandExchangeOfferChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 2 with GrandExchangeOffer

use of net.runelite.api.GrandExchangeOffer in project runelite by runelite.

the class GrandExchangePlugin method onGrandExchangeOfferChanged.

@Subscribe
public void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent) {
    GrandExchangeOffer offer = offerEvent.getOffer();
    ItemComposition offerItem = itemManager.getItemComposition(offer.getItemId());
    boolean shouldStack = offerItem.isStackable() || offer.getTotalQuantity() > 1;
    BufferedImage itemImage = itemManager.getImage(offer.getItemId(), offer.getTotalQuantity(), shouldStack);
    SwingUtilities.invokeLater(() -> panel.updateOffer(offerItem, itemImage, offerEvent.getOffer(), offerEvent.getSlot()));
}
Also used : GrandExchangeOffer(net.runelite.api.GrandExchangeOffer) ItemComposition(net.runelite.api.ItemComposition) BufferedImage(java.awt.image.BufferedImage) Subscribe(com.google.common.eventbus.Subscribe)

Aggregations

GrandExchangeOffer (net.runelite.api.GrandExchangeOffer)2 Subscribe (com.google.common.eventbus.Subscribe)1 BufferedImage (java.awt.image.BufferedImage)1 ItemComposition (net.runelite.api.ItemComposition)1 GrandExchangeOfferChanged (net.runelite.api.events.GrandExchangeOfferChanged)1 FieldHook (net.runelite.api.mixins.FieldHook)1 Inject (net.runelite.api.mixins.Inject)1