Merge remote-tracking branch 'origin/master'

This commit is contained in:
Justin
2021-11-23 20:18:48 +11:00
28 changed files with 160 additions and 115 deletions

View File

@@ -25,9 +25,9 @@
object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.8.2"
const val rlVersion = "1.8.3"
const val openosrsVersion = "4.15.2"
const val openosrsVersion = "4.15.3"
const val rsversion = 201
const val cacheversion = 165

View File

@@ -210,7 +210,7 @@ public class FlatStorage implements Storage
@Override
public void save(Store store) throws IOException
{
store.getIndexes().sort(Comparator.comparing(Index::getId));
store.getIndexes().sort(Comparator.comparingInt(Index::getId));
for (Index idx : store.getIndexes())
{
String file = idx.getId() + EXTENSION;
@@ -222,7 +222,7 @@ public class FlatStorage implements Storage
br.printf("crc=%d\n", idx.getCrc());
br.printf("named=%b\n", idx.isNamed());
idx.getArchives().sort(Comparator.comparing(Archive::getArchiveId));
idx.getArchives().sort(Comparator.comparingInt(Archive::getArchiveId));
for (Archive archive : idx.getArchives())
{
br.printf("id=%d\n", archive.getArchiveId());

View File

@@ -505,6 +505,8 @@ public class Instructions implements Opcodes
add(CHAT_SETMESSAGEFILTER, "chat_setmessagefilter");
add(CHAT_GETMESSAGEFILTER, "chat_getmessagefilter");
add(WRITECONSOLE, "writeconsole");
add(CHAT_GETHISTORYEX_BYTYPEANDLINE, "chat_gethistoryex_bytypeandline");
add(CHAT_GETHISTORYEX_BYUID, "chat_gethistoryex_byuid");
add(GETWINDOWMODE, "getwindowmode");
add(SETWINDOWMODE, "setwindowmode");
add(GETDEFAULTWINDOWMODE, "getdefaultwindowmode");

View File

@@ -497,6 +497,8 @@ public interface Opcodes
int CHAT_SETMESSAGEFILTER = 5021;
int CHAT_GETMESSAGEFILTER = 5022;
int WRITECONSOLE = 5023;
int CHAT_GETHISTORYEX_BYTYPEANDLINE = 5030;
int CHAT_GETHISTORYEX_BYUID = 5031;
int GETWINDOWMODE = 5306;
int SETWINDOWMODE = 5307;
int GETDEFAULTWINDOWMODE = 5308;

View File

@@ -1933,13 +1933,13 @@ public final class ItemID
public static final int RUNE_SPEARKP = 3175;
public static final int DRAGON_SPEARKP = 3176;
public static final int LEFTHANDED_BANANA = 3177;
public static final int MONKEY_BONES = 3179;
public static final int MONKEY_BONES_3180 = 3180;
public static final int MONKEY_BONES_3181 = 3181;
public static final int MONKEY_BONES_3182 = 3182;
public static final int MONKEY_BONES_3183 = 3183;
public static final int MONKEY_BONES_3185 = 3185;
public static final int MONKEY_BONES_3186 = 3186;
public static final int SMALL_NINJA_MONKEY_BONES = 3179;
public static final int MEDIUM_NINJA_MONKEY_BONES = 3180;
public static final int GORILLA_BONES = 3181;
public static final int BEARDED_GORILLA_BONES = 3182;
public static final int MONKEY_BONES = 3183;
public static final int SMALL_ZOMBIE_MONKEY_BONES = 3185;
public static final int LARGE_ZOMBIE_MONKEY_BONES = 3186;
public static final int BONES_3187 = 3187;
public static final int CLEANING_CLOTH = 3188;
public static final int BRONZE_HALBERD = 3190;

View File

@@ -65,13 +65,13 @@ public class RectangleUnion
boolean trace = log.isTraceEnabled();
// Sort all of the rectangles so they are ordered by their left edge
lefts.sort(Comparator.comparing(Rectangle::getX1));
lefts.sort(Comparator.comparingInt(Rectangle::getX1));
// Again, but for the right edge
// this should be relatively fast if the rectangles are similar sizes because timsort deals with partially
// presorted data well
List<Rectangle> rights = new ArrayList<>(lefts);
rights.sort(Comparator.comparing(Rectangle::getX2));
rights.sort(Comparator.comparingInt(Rectangle::getX2));
// ranges of our scan line with how many rectangles it is occluding
Segments segments = new Segments();

View File

@@ -100,7 +100,7 @@ public class EventBus
{
final ImmutableMultimap.Builder<Class<?>, Subscriber> builder = ImmutableMultimap.builder();
builder.putAll(subscribers);
builder.orderValuesBy(Comparator.comparing(Subscriber::getPriority).reversed()
builder.orderValuesBy(Comparator.comparingDouble(Subscriber::getPriority).reversed()
.thenComparing(s -> s.object.getClass().getName()));
for (Class<?> clazz = object.getClass(); clazz != null; clazz = clazz.getSuperclass())
@@ -168,7 +168,7 @@ public class EventBus
{
final ImmutableMultimap.Builder<Class<?>, Subscriber> builder = ImmutableMultimap.builder();
builder.putAll(subscribers);
builder.orderValuesBy(Comparator.comparing(Subscriber::getPriority).reversed()
builder.orderValuesBy(Comparator.comparingDouble(Subscriber::getPriority).reversed()
.thenComparing(s -> s.object.getClass().getName()));
Subscriber sub = new Subscriber(subFn, null, priority, (Consumer<Object>) subFn);

View File

@@ -546,8 +546,8 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
Widget[] containerChildren = itemContainer.getDynamicChildren();
// sort the child array as the items are not in the displayed order
Arrays.sort(containerChildren, Comparator.comparing(Widget::getOriginalY)
.thenComparing(Widget::getOriginalX));
Arrays.sort(containerChildren, Comparator.comparingInt(Widget::getOriginalY)
.thenComparingInt(Widget::getOriginalX));
for (Widget child : containerChildren)
{

View File

@@ -436,9 +436,9 @@ class WidgetInspector extends DevToolsFrame
parent = Stream.of(roots)
.filter(w -> w.getType() == WidgetType.LAYER && w.getContentType() == 0 && !w.isSelfHidden())
.sorted(Comparator.comparing((Widget w) -> w.getRelativeX() + w.getRelativeY())
.sorted(Comparator.comparingInt((Widget w) -> w.getRelativeX() + w.getRelativeY())
.reversed()
.thenComparing(Widget::getId)
.thenComparingInt(Widget::getId)
.reversed())
.findFirst().get();
x = 4;

View File

@@ -462,14 +462,14 @@ public class FishingPlugin extends Plugin
final LocalPoint cameraPoint = new LocalPoint(client.getCameraX(), client.getCameraY());
fishingSpots.sort(
Comparator.comparing(
Comparator.comparingInt(
// Negate to have the furthest first
(NPC npc) -> -npc.getLocalLocation().distanceTo(cameraPoint))
// Order by position
.thenComparing(NPC::getLocalLocation, Comparator.comparing(LocalPoint::getX)
.thenComparing(LocalPoint::getY))
.thenComparing(NPC::getLocalLocation, Comparator.comparingInt(LocalPoint::getX)
.thenComparingInt(LocalPoint::getY))
// And then by id
.thenComparing(NPC::getId)
.thenComparingInt(NPC::getId)
);
}
}

View File

@@ -72,7 +72,7 @@ public class SaradominBrew implements Effect
).toArray(StatChange[]::new));
changes.setPositivity(Stream.of(changes.getStatChanges())
.map(sc -> sc.getPositivity())
.max(Comparator.comparing(Enum::ordinal)).get());
.max(Comparator.naturalOrder()).get());
return changes;
}
}

View File

@@ -68,7 +68,9 @@ public class SuperRestore implements Effect
return calc.effect(client);
})
).toArray(StatChange[]::new));
changes.setPositivity(Stream.of(changes.getStatChanges()).map(sc -> sc.getPositivity()).max(Comparator.comparing(Enum::ordinal)).get());
changes.setPositivity(Stream.of(changes.getStatChanges())
.map(sc -> sc.getPositivity())
.max(Comparator.naturalOrder()).get());
return changes;
}

View File

@@ -61,7 +61,7 @@ public class CastleWarsBandage implements Effect
changes.setStatChanges(new StatChange[]{hitPoints, runEnergy});
changes.setPositivity(Stream.of(changes.getStatChanges())
.map(StatChange::getPositivity)
.max(Comparator.comparing(Enum::ordinal)).get());
.max(Comparator.naturalOrder()).get());
return changes;
}

View File

@@ -418,7 +418,7 @@ public class MusicPlugin extends Plugin
if (tracks == null)
{
tracks = Arrays.stream(musicList.getDynamicChildren())
.sorted(Comparator.comparing(Widget::getRelativeY))
.sorted(Comparator.comparingInt(Widget::getRelativeY))
.collect(Collectors.toList());
}

View File

@@ -336,7 +336,7 @@ public class QuestListPlugin extends Plugin
{
// Find all of the widgets that we care about, sorting by their Y value
quests = Arrays.stream(list.getDynamicChildren())
.sorted(Comparator.comparing(Widget::getRelativeY))
.sorted(Comparator.comparingInt(Widget::getRelativeY))
.filter(w -> !QUEST_HEADERS.contains(w.getText()))
.map(w -> new QuestWidget(w, Text.removeTags(w.getText()).toLowerCase()))
.collect(Collectors.toList());

View File

@@ -29,9 +29,11 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("timestamp")
@ConfigGroup(TimestampConfig.GROUP)
public interface TimestampConfig extends Config
{
String GROUP = "timestamp";
@ConfigItem(
keyName = "opaqueTimestamp",
name = "Timestamps (opaque)",

View File

@@ -38,11 +38,11 @@ import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.ScriptID;
import net.runelite.api.Varbits;
import net.runelite.api.events.ScriptPreFired;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.ColorUtil;
@@ -58,14 +58,15 @@ public class TimestampPlugin extends Plugin
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private TimestampConfig config;
@Getter
private SimpleDateFormat formatter;
private MessageNode currentlyBuildingMessage = null;
@Provides
public TimestampConfig provideConfig(final ConfigManager configManager)
{
@@ -87,9 +88,18 @@ public class TimestampPlugin extends Plugin
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (event.getGroup().equals("timestamp") && event.getKey().equals("format"))
if (event.getGroup().equals(TimestampConfig.GROUP))
{
updateFormatter();
switch (event.getKey())
{
case "format":
updateFormatter();
break;
case "opaqueTimestamp":
case "transparentTimestamp":
clientThread.invokeLater(() -> client.runScript(ScriptID.SPLITPM_CHANGED));
break;
}
}
}
@@ -102,51 +112,18 @@ public class TimestampPlugin extends Plugin
}
int uid = client.getIntStack()[client.getIntStackSize() - 1];
currentlyBuildingMessage = client.getMessages().get(uid);
}
final MessageNode messageNode = client.getMessages().get(uid);
assert messageNode != null : "chat message build for unknown message";
@Subscribe
private void onScriptPreFired(ScriptPreFired ev)
{
int numStringArgs;
int messagePrefixArg = 0;
switch (ev.getScriptId())
{
case ScriptID.CHATBOX_BUILD_LINE_WITHOUT_USER:
numStringArgs = 1;
break;
case ScriptID.CHATBOX_BUILD_LINE_WITH_USER:
numStringArgs = 2;
break;
case ScriptID.CHATBOX_BUILD_LINE_WITH_CLAN:
numStringArgs = 3;
break;
default:
return;
}
if (currentlyBuildingMessage == null)
{
return;
}
MessageNode messageNode = currentlyBuildingMessage;
currentlyBuildingMessage = null;
String[] stringStack = client.getStringStack();
int stringArgStart = client.getStringStackSize() - numStringArgs;
String timestamp = generateTimestamp(messageNode.getTimestamp(), ZoneId.systemDefault()) + " ";
String timestamp = generateTimestamp(messageNode.getTimestamp(), ZoneId.systemDefault());
Color timestampColour = getTimestampColour();
if (timestampColour != null)
{
timestamp = ColorUtil.wrapWithColorTag(timestamp, timestampColour);
}
String segment = stringStack[stringArgStart + messagePrefixArg];
segment = timestamp + segment;
stringStack[stringArgStart + messagePrefixArg] = segment;
client.getStringStack()[client.getStringStackSize() - 1] = timestamp;
}
private Color getTimestampColour()

View File

@@ -282,7 +282,7 @@ public class ContainableFrame extends JFrame
{
return Arrays.stream(GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices())
.map(GraphicsDevice::getDefaultConfiguration)
.max(Comparator.comparing(config ->
.max(Comparator.comparingInt(config ->
{
Rectangle intersection = config.getBounds().intersection(getBounds());
return intersection.width * intersection.height;

View File

@@ -3126,15 +3126,6 @@
3157,
3159
],
"monkey bones": [
3179,
3180,
3181,
3182,
3183,
3185,
3186
],
"barrel bomb": [
3218,
3219

View File

@@ -343,9 +343,9 @@ LABEL319:
jump LABEL1598
LABEL323:
iload 10
5031
chat_gethistoryex_byuid
istore 21
sstore 18
sstore 18 ; timestamp
istore 15
sstore 15
sstore 14
@@ -390,9 +390,11 @@ LABEL341:
jump LABEL1594
LABEL355:
iload 10 ; message uid
sload 18 ; message timestamp
sconst "chatMessageBuilding"
runelite_callback
pop_int ; pop uid
sstore 18 ; message timestamp
iload 11
switch
1: LABEL358

View File

@@ -381,9 +381,9 @@ LABEL344:
jump LABEL566
LABEL350:
iload 12
5031
chat_gethistoryex_byuid
istore 15
sstore 2
sstore 2 ; timestamp
istore 14
sstore 0
sstore 3
@@ -413,9 +413,11 @@ CHAT_FILTER:
jump LABEL562
LABEL368:
iload 12 ; message uid
sload 2 ; message timestamp
sconst "chatMessageBuilding"
runelite_callback
pop_int
pop_int
sstore 2 ; message timestamp
iload 18
switch
3: LABEL371

View File

@@ -1 +1 @@
B5F4C856AEC94322FC7E2981920A8982FE331A300DD36FA0872840B7FA5A4C01
030CB9830EAD6F61CFC5ED1CA60AE3434900998EFB8237E9C750321775312072

View File

@@ -122,7 +122,7 @@ LABEL89:
LABEL96:
clientclock
set_varc_int 384
invoke 2357
invoke 1445
iconst 1
if_icmpeq LABEL102
jump LABEL106
@@ -172,7 +172,7 @@ LABEL131:
LABEL138:
clientclock
set_varc_int 384
invoke 2357
invoke 1445
iconst 1
if_icmpeq LABEL144
jump LABEL148
@@ -217,15 +217,15 @@ LABEL169:
jump LABEL180
LABEL176:
iconst 1
iconst 39387174
iconst 39387162
if_sethide
jump LABEL235
LABEL180:
iconst 0
iconst 39387174
iconst 39387162
if_sethide
iconst 1
iconst 39387174
iconst 39387162
2308
get_varbit 6255
switch
@@ -235,38 +235,38 @@ LABEL180:
jump LABEL213
LABEL189:
iconst 1718
iconst 39387176
iconst 39387181
if_setgraphic
iconst 1
sconst "Toggle single-tap mode"
iconst 39387174
iconst 39387162
if_setop
jump LABEL220
LABEL197:
iconst 1717
iconst 39387176
iconst 39387181
if_setgraphic
iconst 1
sconst "Toggle tap-to-drop mode"
iconst 39387174
iconst 39387162
if_setop
jump LABEL220
LABEL205:
iconst 1716
iconst 39387176
iconst 39387181
if_setgraphic
iconst 1
sconst "Show Keyboard"
iconst 39387174
iconst 39387162
if_setop
jump LABEL220
LABEL213:
iconst 1715
iconst 39387176
iconst 39387181
if_setgraphic
iconst 1
sconst ""
iconst 39387174
iconst 39387162
if_setop
LABEL220:
get_varbit 6255
@@ -280,18 +280,18 @@ LABEL224:
jump LABEL232
LABEL228:
iconst 155
iconst 39387176
iconst 39387181
if_settrans
jump LABEL235
LABEL232:
iconst 0
iconst 39387176
iconst 39387181
if_settrans
LABEL235:
invoke 2581
get_varbit 6254
invoke 633
iconst 39387165
iconst 39387173
if_sethide
invoke 2526
pop_int

View File

@@ -1 +1 @@
1BB0517CD647510451A0AF5FC160252892F4C3627BED106FEDEE44E62027A2D4
CAF61FF2A3131623A421CCCC68914587A69044768DEB79432DA8A85937283F7B

View File

@@ -221,7 +221,7 @@ LABEL183:
if_icmpeq LABEL189
jump LABEL417
LABEL189:
invoke 2357
invoke 1445
iconst 1
if_icmpeq LABEL193
jump LABEL267

View File

@@ -282,6 +282,9 @@ public abstract class RSClientMixin implements RSClient
@Inject
public long lastNanoTime;
@Inject
public long delayNanoTime;
@Inject
private List<String> outdatedScripts = new ArrayList<>();
@@ -2445,6 +2448,30 @@ public abstract class RSClientMixin implements RSClient
{
posToCameraAngle(client.getMapAngle(), client.getCameraPitch());
}
else
{
delayNanoTime = 0L;
}
}
@Inject
public void setUnlockedFpsTarget(int var1)
{
if (var1 <= 0)
{
delayNanoTime = 0L;
}
else
{
delayNanoTime = 1000000000L / (long) var1;
}
}
@Inject
@Override
public long getUnlockedFpsTarget()
{
return delayNanoTime;
}
@Inject

View File

@@ -25,6 +25,7 @@
package net.runelite.mixins;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
@@ -37,6 +38,9 @@ public abstract class RSNanoClockMixin implements RSNanoClock
@Shadow("client")
private static RSClient client;
@Inject
private long tmpNanoTime;
@Copy("wait")
@Replace("wait")
public int copy$wait(int cycleDurationMillis, int var2)
@@ -49,16 +53,42 @@ public abstract class RSNanoClockMixin implements RSNanoClock
{
long nanoTime = System.nanoTime();
if (nanoTime < getLastTimeNano())
if (nanoTime >= getLastTimeNano() && nanoTime >= tmpNanoTime)
{
setLastTimeNano(nanoTime);
long cycleDuration;
long diff;
return 1;
}
else
{
long cycleDuration = (long) cycleDurationMillis * 1000000L;
long diff = nanoTime - getLastTimeNano();
if (client.getUnlockedFpsTarget() > 0L)
{
cycleDuration = nanoTime - tmpNanoTime;
diff = client.getUnlockedFpsTarget() - cycleDuration;
diff /= 1000000L;
if (diff > 0L)
{
try
{
if (diff % 10L == 0L)
{
Thread.sleep(diff - 1L);
Thread.sleep(1L);
}
else
{
Thread.sleep(diff);
}
}
catch (InterruptedException var22)
{
}
nanoTime = System.nanoTime();
}
}
tmpNanoTime = nanoTime;
cycleDuration = (long) cycleDurationMillis * 1000000L;
diff = nanoTime - getLastTimeNano();
int cycles = (int) (diff / cycleDuration);
@@ -71,6 +101,12 @@ public abstract class RSNanoClockMixin implements RSNanoClock
return cycles;
}
else
{
setLastTimeNano(tmpNanoTime = nanoTime);
return 1;
}
}
}
}

View File

@@ -1477,6 +1477,8 @@ public interface RSClient extends RSGameEngine, Client
boolean isUnlockedFps();
long getUnlockedFpsTarget();
void posToCameraAngle(int var0, int var1);
@Import("objectSounds")