ChatboxPerformancePlugin: Hook the cs2 to know when to rebuild

This commit is contained in:
Max Weber
2019-07-21 19:41:27 -06:00
parent 7a222bbb6f
commit bacc5ae6d0
3 changed files with 455 additions and 26 deletions

View File

@@ -26,12 +26,15 @@ package net.runelite.client.plugins.chatboxperformance;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.events.ClientTick;
import net.runelite.api.GameState;
import net.runelite.api.ScriptID;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.WidgetType;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetPositionMode;
import net.runelite.api.widgets.WidgetSizeMode;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -45,36 +48,35 @@ public class ChatboxPerformancePlugin extends Plugin
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Override
public void startUp()
{
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
}
}
@Override
public void shutDown()
{
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
}
}
@Subscribe
public void onClientTick(ClientTick event)
private void onScriptCallbackEvent(ScriptCallbackEvent ev)
{
if (!areWidgetsFixed())
if (!"chatboxBackgroundBuilt".equals(ev.getEventName()))
{
fixChatbox();
}
}
private boolean areWidgetsFixed()
{
Widget widget = client.getWidget(WidgetInfo.CHATBOX_TRANSPARENT_BACKGROUND);
if (widget == null)
{
return true;
return;
}
Widget[] widgets = widget.getChildren();
if (widgets != null && widgets.length > 0)
{
Widget last = widgets[widgets.length - 1];
return last != null && last.getOpacity() < 254;
}
return false;
}
private void fixChatbox()
{
fixDarkBackground();
fixWhiteLines(true);
fixWhiteLines(false);

View File

@@ -0,0 +1 @@
975C2E20F49CD83A72B6A7BA4CF34F9B476F26DCD2649B0CE79B3F93CBB892DD

View File

@@ -0,0 +1,426 @@
.id 923
.int_stack_count 0
.string_stack_count 0
.int_var_count 5
.string_var_count 0
; callback "chatboxBackgroundBuilt"
; used by the ChatboxPerformancePlugin to know when it needs to rebuild.
; Unmark the plugin as hidden and toggle it. The chatbox should change opacity
; slightly
iconst 10616834
cc_deleteall
iconst 0
istore 0
get_varc_int 41
iconst 1337
if_icmpeq LABEL8
jump LABEL24
LABEL8:
invoke 922
iconst 1
if_icmpeq LABEL12
jump LABEL15
LABEL12:
iconst 1
istore 0
jump LABEL24
LABEL15:
getwindowmode
iconst 1
if_icmpeq LABEL19
jump LABEL24
LABEL19:
iconst 0
set_varc_int 41
iconst 0
iconst 0
invoke 183
LABEL24:
iload 0
iconst 10616869
if_sethide
get_varbit 6374
iconst 1
if_icmpeq LABEL31
jump LABEL48
LABEL31:
getwindowmode
iconst 1
if_icmpne LABEL35
jump LABEL48
LABEL35:
iconst 1
iconst 0
iconst 2
iconst 0
iconst 10616890
if_setposition
iconst -1
iconst 0
iconst 0
iconst 0
iconst 10617391
if_setposition
jump LABEL60
LABEL48:
iconst 0
iconst 0
iconst 0
iconst 0
iconst 10616890
if_setposition
iconst 0
iconst 0
iconst 2
iconst 0
iconst 10617391
if_setposition
LABEL60:
iconst 10616870
cc_deleteall
iconst 10616888
cc_deleteall
iconst 0
istore 1
clientclock
get_varc_int 223
if_icmplt LABEL70
jump LABEL82
LABEL70:
invoke 900
iconst 1129
if_icmpne LABEL74
jump LABEL82
LABEL74:
iconst 1
istore 1
iconst 2155
get_varc_int 223
sconst "i"
iconst 10616870
if_setontimer
jump LABEL86
LABEL82:
iconst -1
sconst ""
iconst 10616870
if_setontimer
LABEL86:
invoke 921
iconst 0
if_icmpeq LABEL90
jump LABEL156
LABEL90:
iconst 1
iconst 10616870
if_setnoclickthrough
iload 1
iconst 0
if_icmpeq LABEL97
jump LABEL135
LABEL97:
iconst 10616870
iconst 5
iconst 0
cc_create
iconst 0
iconst 0
iconst 1
iconst 1
cc_setsize
iconst 0
iconst 0
iconst 1
iconst 1
cc_setposition
iconst 1017
cc_setgraphic
iconst 0
cc_settiling
iconst 0
cc_settrans
iconst 10616888
iconst 3
iconst 0
cc_create
iconst 0
iconst 1
iconst 1
iconst 0
cc_setsize
iconst 0
iconst 15
iconst 1
iconst 2
cc_setposition
iconst 8418912
cc_setcolour
iconst 1
cc_setfill
LABEL135:
iconst 10617391
iconst 792
iconst 789
iconst 790
iconst 791
iconst 773
iconst 788
iconst 0
invoke 838
invoke 2373
iconst 1
if_icmpeq LABEL148
jump LABEL152
LABEL148:
iconst 255
iconst 10616835
if_settrans
jump LABEL155
LABEL152:
iconst 0
iconst 10616835
if_settrans
LABEL155:
return
LABEL156:
iconst 16384
iconst 25
div
istore 2
iconst 16384
istore 3
get_varbit 2570
iconst 1
if_icmpeq LABEL166
jump LABEL170
LABEL166:
iconst 1
iconst 10616870
if_setnoclickthrough
jump LABEL176
LABEL170:
iconst 0
iconst 10616870
if_setnoclickthrough
iconst 1
iconst 10616870
2006
LABEL176:
iconst 0
istore 4
iload 1
iconst 0
if_icmpeq LABEL182
jump LABEL332
LABEL182:
invoke 1972
iconst 0
if_icmpeq LABEL186
jump LABEL266
LABEL186:
iload 4
iconst 20
if_icmplt LABEL190
jump LABEL265
LABEL190:
iconst 10616870
iconst 3
iload 4
cc_create
iconst 0
iload 3
iconst 1
iconst 2
cc_setsize
iconst 0
iconst 0
iconst 1
iconst 2
cc_setposition
iconst 0
cc_setcolour
iconst 1
cc_setfill
iconst 254
cc_settrans
iconst 10616888
iconst 3
iload 4
iconst 2
multiply
cc_create
iconst 10616888
iconst 3
iload 4
iconst 2
multiply
iconst 1
add
cc_create 1
iload 3
iconst 1
iconst 2
iconst 0
cc_setsize
iload 3
iconst 1
iconst 2
iconst 0
cc_setsize 1
iconst 0
iconst 0
iconst 0
iconst 0
cc_setposition
iconst 0
iconst 15
iconst 0
iconst 2
cc_setposition 1
iconst 16777215
cc_setcolour
iconst 16777215
cc_setcolour 1
iconst 1
cc_setfill
iconst 1
cc_setfill 1
iconst 251
cc_settrans
iconst 250
cc_settrans 1
iload 4
iconst 1
add
iload 3
iload 2
sub
istore 3
istore 4
jump LABEL186
LABEL265:
sconst "chatboxBackgroundBuilt"
runelite_callback
jump LABEL332
LABEL266:
iconst 10616870
iconst 3
iload 4
cc_create
iconst 0
iload 3
iconst 1
iconst 2
cc_setsize
iconst 0
iconst 0
iconst 1
iconst 2
cc_setposition
iconst 0
cc_setcolour
iconst 1
cc_setfill
iconst 225
cc_settrans
iconst 10616888
iconst 3
iload 4
iconst 2
multiply
cc_create
iconst 10616888
iconst 3
iload 4
iconst 2
multiply
iconst 1
add
cc_create 1
iload 3
iconst 1
iconst 2
iconst 0
cc_setsize
iload 3
iconst 1
iconst 2
iconst 0
cc_setsize 1
iconst 0
iconst 0
iconst 0
iconst 0
cc_setposition
iconst 0
iconst 15
iconst 0
iconst 2
cc_setposition 1
iconst 16777215
cc_setcolour
iconst 16777215
cc_setcolour 1
iconst 1
cc_setfill
iconst 1
cc_setfill 1
iconst 200
cc_settrans
iconst 130
cc_settrans 1
LABEL332:
iconst 10617391
iconst 1190
iconst 1187
iconst 1188
iconst 1189
iconst 1185
iconst 1186
iconst 1
invoke 838
iload 0
iconst 1
if_icmpeq LABEL345
jump LABEL349
LABEL345:
iconst 255
iconst 10616835
if_settrans
jump LABEL380
LABEL349:
invoke 1972
iconst 0
if_icmpeq LABEL353
jump LABEL357
LABEL353:
iconst 155
iconst 10616835
if_settrans
jump LABEL380
LABEL357:
iconst 255
iconst 10616835
if_settrans
iconst 10616834
iconst 3
iconst 0
cc_create
iconst 0
iconst 0
iconst 1
iconst 1
cc_setsize
iconst 0
iconst 0
iconst 1
iconst 1
cc_setposition
iconst 0
cc_setcolour
iconst 1
cc_setfill
iconst 225
cc_settrans
LABEL380:
return