use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method cachedNPCsChanged.
@FieldHook("cachedNPCs")
@Inject
public static void cachedNPCsChanged(int idx) {
RSNPC[] cachedNPCs = client.getCachedNPCs();
if (idx < 0 || idx >= cachedNPCs.length) {
return;
}
RSNPC npc = cachedNPCs[idx];
if (npc != null) {
npc.setIndex(idx);
}
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method settingsChanged.
@FieldHook("clientVarps")
@Inject
public static void settingsChanged(int idx) {
VarbitChanged varbitChanged = new VarbitChanged();
eventBus.post(varbitChanged);
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method getMenuEntries.
@Inject
@Override
public MenuEntry[] getMenuEntries() {
int count = getMenuOptionCount();
String[] menuOptions = getMenuOptions();
String[] menuTargets = getMenuTargets();
int[] menuIdentifiers = getMenuIdentifiers();
int[] menuTypes = getMenuTypes();
int[] params0 = getMenuActionParams0();
int[] params1 = getMenuActionParams1();
MenuEntry[] entries = new MenuEntry[count];
for (int i = 0; i < count; ++i) {
MenuEntry entry = entries[i] = new MenuEntry();
entry.setOption(menuOptions[i]);
entry.setTarget(menuTargets[i]);
entry.setIdentifier(menuIdentifiers[i]);
entry.setType(menuTypes[i]);
entry.setParam0(params0[i]);
entry.setParam1(params1[i]);
}
return entries;
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method getSkillExperience.
/**
* Returns the local player's current experience in the specified
* {@link Skill}.
*
* @param skill the {@link Skill} to retrieve the experience for
* @return the local player's current experience in the specified
* {@link Skill}, or -1 if the {@link Skill} isn't valid
*/
@Inject
@Override
public int getSkillExperience(Skill skill) {
int[] experiences = getSkillExperiences();
if (skill == Skill.OVERALL) {
int totalExperience = 0;
for (int experience : experiences) {
totalExperience += experience;
}
return totalExperience;
}
int idx = skill.ordinal();
// to hold something else that's not reported it'll save us from an ArrayIndexOutOfBoundsException.
if (idx >= experiences.length) {
return -1;
}
return experiences[idx];
}
use of net.runelite.api.mixins.Inject in project runelite by runelite.
the class RSClientMixin method getLocalDestinationLocation.
@Inject
@Override
@Nullable
public LocalPoint getLocalDestinationLocation() {
int regionX = getDestinationX();
int regionY = getDestinationY();
if (regionX != 0 && regionY != 0) {
return LocalPoint.fromRegion(regionX, regionY);
}
return null;
}
Aggregations