interfacestyles: add ability to always stack resizable stones

This commit is contained in:
Ron Young
2019-10-07 10:19:49 -05:00
parent a663770563
commit 88c2736e8b
3 changed files with 30 additions and 1 deletions

View File

@@ -72,4 +72,14 @@ public interface InterfaceStylesConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "alwaysStack",
name = "Always stack bottom bar",
description = "Always stack the bottom bar in resizable"
)
default boolean alwaysStack()
{
return false;
}
}

View File

@@ -40,6 +40,7 @@ import net.runelite.api.events.ClientTick;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.PostHealthBar;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
@@ -106,6 +107,17 @@ public class InterfaceStylesPlugin extends Plugin
}
}
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if ("forceStackStones".equals(event.getEventName()) && config.alwaysStack())
{
int[] intStack = client.getIntStack();
int intStackSize = client.getIntStackSize();
intStack[intStackSize - 1] = 1;
}
}
@Subscribe
public void onClientTick(ClientTick event)
{

View File

@@ -3,6 +3,9 @@
.string_stack_count 0
.int_var_count 5
.string_var_count 0
; callback "forceStackStones"
; Used by the InterfaceStylesPlugin to enable it's Always stack bottom bar option
; Toggle the option when you have the bottom line top level interface on and your screen is large enough for the stones to be in a single line
iconst 0
istore 2
iconst 0
@@ -36,7 +39,11 @@ LABEL9:
sub
iconst 429
if_icmplt LABEL29
jump LABEL49
iconst 0 ; should resizable stones be forced to stack
sconst "forceStackStones" ; push event name
runelite_callback ; invoke callback
iconst 0 ; if 0 is returned, continue normal layout
if_icmpeq LABEL49
LABEL29:
iconst 0
iload 3