project: bringup api - thank you blue!
This commit is contained in:
@@ -77,6 +77,7 @@ import net.runelite.api.Skill;
|
||||
import net.runelite.api.SpritePixels;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.VarbitComposition;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.WidgetNode;
|
||||
import net.runelite.api.WorldType;
|
||||
@@ -106,6 +107,7 @@ import net.runelite.api.events.UsernameChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.VolumeChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.WorldChanged;
|
||||
import net.runelite.api.hooks.Callbacks;
|
||||
import net.runelite.api.hooks.DrawCallbacks;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
@@ -140,6 +142,7 @@ import net.runelite.rs.api.RSTile;
|
||||
import net.runelite.rs.api.RSTileItem;
|
||||
import net.runelite.rs.api.RSUsername;
|
||||
import net.runelite.rs.api.RSWidget;
|
||||
import net.runelite.rs.api.RSWorld;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@Mixin(RSClient.class)
|
||||
@@ -2071,12 +2074,38 @@ public abstract class RSClientMixin implements RSClient
|
||||
if (!outdatedScripts.contains(outdatedScript))
|
||||
outdatedScripts.add(outdatedScript);
|
||||
}
|
||||
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public List<String> getOutdatedScripts()
|
||||
{
|
||||
return this.outdatedScripts;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@MethodHook(value = "changeWorld", end = true)
|
||||
public static void postChangeWorld(RSWorld world)
|
||||
{
|
||||
client.getCallbacks().post(new WorldChanged());
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void queueChangedVarp(int varp)
|
||||
{
|
||||
assert client.isClientThread() : "queueChangedVarp must be called on client thread";
|
||||
|
||||
int[] changedVarps = client.getChangedVarps();
|
||||
int changedVarpCount = client.getChangedVarpCount();
|
||||
changedVarps[changedVarpCount & 31] = varp;
|
||||
client.setChangedVarpCount(changedVarpCount + 1);
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public VarbitComposition getVarbit(int id)
|
||||
{
|
||||
return getVarbitDefinition(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -288,18 +288,10 @@ public abstract class RSPlayerMixin implements RSPlayer
|
||||
friended = client.getFriendManager().isFriended(getRsName(), false);
|
||||
}
|
||||
|
||||
@Copy("read")
|
||||
@Replace("read")
|
||||
@SuppressWarnings("InfiniteRecursion")
|
||||
public void copy$read(RSBuffer buffer)
|
||||
@Inject
|
||||
@MethodHook(value = "read", end = true)
|
||||
void postRead(RSBuffer var1)
|
||||
{
|
||||
final long appearanceHash = getPlayerComposition() == null ? 0 : getPlayerComposition().getHash();
|
||||
|
||||
this.copy$read(buffer);
|
||||
|
||||
if (client.isComparingAppearance() && getPlayerComposition().getHash() != appearanceHash)
|
||||
{
|
||||
client.getCallbacks().post(new PlayerChanged(this));
|
||||
}
|
||||
client.getCallbacks().post(new PlayerChanged(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,28 +57,19 @@ public abstract class VarbitMixin implements RSClient
|
||||
@Override
|
||||
public RSVarbitComposition getVarbitDefinition(int id)
|
||||
{
|
||||
assert isClientThread();
|
||||
assert client.isClientThread() : "getVarbitDefinition must be called on client thread";
|
||||
|
||||
RSVarbitComposition varbit;
|
||||
varbit = varbitCache.getIfPresent(id);
|
||||
if (varbit != null)
|
||||
RSVarbitComposition varbit = varbitCache.getIfPresent(id);
|
||||
|
||||
if (varbit == null)
|
||||
{
|
||||
return varbit;
|
||||
}
|
||||
varbit = (RSVarbitComposition) getVarbitCache().get(id);
|
||||
if (varbit != null && !(varbit.getIndex() == 0 && varbit.getMostSignificantBit() == 0 && varbit.getLeastSignificantBit() == 0))
|
||||
{
|
||||
return varbit;
|
||||
client.getLogger().trace("Cache miss for varbit {}", id);
|
||||
client.rs$getVarbit(id); // preload varbit
|
||||
varbit = (RSVarbitComposition) getVarbitCache().get(id);
|
||||
varbitCache.put(id, varbit);
|
||||
}
|
||||
|
||||
byte[] fileData = getIndexConfig().getConfigData(VARBITS_GROUP, id);
|
||||
if (fileData == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
varbit = newVarbitDefinition();
|
||||
varbit.decode(newBuffer(fileData));
|
||||
return varbit;
|
||||
return varbit.getIndex() == 0 && varbit.getLeastSignificantBit() == 0 && varbit.getMostSignificantBit() == 0 ? null : varbit;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@@ -90,7 +81,7 @@ public abstract class VarbitMixin implements RSClient
|
||||
RSVarbitComposition v = getVarbitDefinition(varbitId);
|
||||
if (v == null)
|
||||
{
|
||||
throw new IndexOutOfBoundsException(String.format("Varbit %d does not exist!", varbitId)); // oob for "backwards compatibility lol"
|
||||
throw new IndexOutOfBoundsException("Varbit " + varbitId + " does not exist!"); // oob for "backwards compatibility lol"
|
||||
}
|
||||
|
||||
int value = varps[v.getIndex()];
|
||||
|
||||
Reference in New Issue
Block a user