Search in sources :

Example 36 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method getNpcs.

@Inject
@Override
public List<NPC> getNpcs() {
    int validNpcIndexes = getNpcIndexesCount();
    int[] npcIndexes = getNpcIndices();
    NPC[] cachedNpcs = getCachedNPCs();
    List<NPC> npcs = new ArrayList<NPC>(validNpcIndexes);
    for (int i = 0; i < validNpcIndexes; ++i) {
        npcs.add(cachedNpcs[npcIndexes[i]]);
    }
    return npcs;
}
Also used : RSNPC(net.runelite.rs.api.RSNPC) NPC(net.runelite.api.NPC) ArrayList(java.util.ArrayList) LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point) Inject(net.runelite.api.mixins.Inject)

Example 37 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method getWidget.

@Inject
@Override
public Widget getWidget(WidgetInfo widget) {
    int groupId = widget.getGroupId();
    int childId = widget.getChildId();
    return getWidget(groupId, childId);
}
Also used : LocalPoint(net.runelite.api.coords.LocalPoint) Point(net.runelite.api.Point) Inject(net.runelite.api.mixins.Inject)

Example 38 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method gameStateChanged.

@FieldHook("gameState")
@Inject
public static void gameStateChanged(int idx) {
    GameStateChanged gameStateChange = new GameStateChanged();
    gameStateChange.setGameState(client.getGameState());
    eventBus.post(gameStateChange);
}
Also used : GameStateChanged(net.runelite.api.events.GameStateChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Example 39 with Inject

use of net.runelite.api.mixins.Inject 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 40 with Inject

use of net.runelite.api.mixins.Inject in project runelite by runelite.

the class RSClientMixin method boostedSkillLevelsChanged.

@FieldHook("boostedSkillLevels")
@Inject
public static void boostedSkillLevelsChanged(int idx) {
    Skill[] skills = Skill.values();
    if (idx >= 0 && idx < skills.length - 1) {
        Skill updatedSkill = skills[idx];
        BoostedLevelChanged boostedLevelChanged = new BoostedLevelChanged();
        boostedLevelChanged.setSkill(updatedSkill);
        eventBus.post(boostedLevelChanged);
    }
}
Also used : Skill(net.runelite.api.Skill) BoostedLevelChanged(net.runelite.api.events.BoostedLevelChanged) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Aggregations

Inject (net.runelite.api.mixins.Inject)57 Point (net.runelite.api.Point)20 FieldHook (net.runelite.api.mixins.FieldHook)20 ArrayList (java.util.ArrayList)14 LocalPoint (net.runelite.api.coords.LocalPoint)10 RSWidget (net.runelite.rs.api.RSWidget)6 Vertex (net.runelite.api.model.Vertex)5 Widget (net.runelite.api.widgets.Widget)5 Node (net.runelite.api.Node)4 RSNode (net.runelite.rs.api.RSNode)4 WidgetNode (net.runelite.api.WidgetNode)3 Triangle (net.runelite.api.model.Triangle)3 Polygon (java.awt.Polygon)2 MenuEntry (net.runelite.api.MenuEntry)2 Model (net.runelite.api.Model)2 NPC (net.runelite.api.NPC)2 Player (net.runelite.api.Player)2 Skill (net.runelite.api.Skill)2 WidgetItem (net.runelite.api.widgets.WidgetItem)2 RSCombatInfoList (net.runelite.rs.api.RSCombatInfoList)2