combat level plugin: use script events for attack level range hook
This commit is contained in:
@@ -274,4 +274,10 @@ public final class ScriptID
|
||||
*/
|
||||
@ScriptArguments(integer = 16)
|
||||
public static final int BANKMAIN_SEARCH_REFRESH = 283;
|
||||
|
||||
/**
|
||||
* Called to update the PVP widget (wilderness level/protection)
|
||||
*/
|
||||
@ScriptArguments(integer = 3)
|
||||
public static final int PVP_WIDGET_BUILDER = 388;
|
||||
}
|
||||
|
||||
@@ -33,16 +33,17 @@ import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.ScriptPostFired;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
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.ui.overlay.OverlayManager;
|
||||
@@ -162,10 +163,9 @@ public class CombatLevelPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
public void onScriptPostFired(ScriptPostFired scriptPostFired)
|
||||
{
|
||||
if (config.wildernessAttackLevelRange()
|
||||
&& "wildernessWidgetTextSet".equals(event.getEventName()))
|
||||
if (scriptPostFired.getScriptId() == ScriptID.PVP_WIDGET_BUILDER && config.wildernessAttackLevelRange())
|
||||
{
|
||||
appendAttackLevelRangeText();
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
1DC252B93DF0D948329C4EAD151FA9406A17D3CF2C5C3EC0317BF4DCD1B3811A
|
||||
@@ -1,125 +0,0 @@
|
||||
.id 388
|
||||
.int_stack_count 1
|
||||
.string_stack_count 0
|
||||
.int_var_count 3
|
||||
.string_var_count 0
|
||||
invoke 384
|
||||
istore 1
|
||||
invoke 1138
|
||||
istore 2
|
||||
iload 2
|
||||
iconst 1
|
||||
if_icmpeq LABEL8
|
||||
jump LABEL80
|
||||
LABEL8:
|
||||
get_varp 1676
|
||||
iconst 4
|
||||
if_icmpgt LABEL12
|
||||
jump LABEL31
|
||||
LABEL12:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL16
|
||||
jump LABEL27
|
||||
LABEL16:
|
||||
get_varbit 5954
|
||||
iconst 1
|
||||
if_icmpeq LABEL20
|
||||
jump LABEL27
|
||||
LABEL20:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL30
|
||||
LABEL27:
|
||||
sconst "Deadman"
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL30:
|
||||
jump LABEL79
|
||||
LABEL31:
|
||||
get_varbit 4965
|
||||
iconst 0
|
||||
if_icmpgt LABEL35
|
||||
jump LABEL45
|
||||
LABEL35:
|
||||
sconst "Protection"
|
||||
iload 0
|
||||
if_settext
|
||||
iconst 0
|
||||
iconst 13
|
||||
iconst 1
|
||||
iconst 2
|
||||
iload 0
|
||||
if_setposition
|
||||
jump LABEL79
|
||||
LABEL45:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL49
|
||||
jump LABEL60
|
||||
LABEL49:
|
||||
get_varbit 5954
|
||||
iconst 1
|
||||
if_icmpeq LABEL53
|
||||
jump LABEL60
|
||||
LABEL53:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL60:
|
||||
get_varc_int 78
|
||||
iconst 1
|
||||
if_icmpeq LABEL64
|
||||
jump LABEL68
|
||||
LABEL64:
|
||||
sconst "Guarded"
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL68:
|
||||
get_varc_int 78
|
||||
iconst 2
|
||||
if_icmpeq LABEL72
|
||||
jump LABEL76
|
||||
LABEL72:
|
||||
sconst "No PvP"
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL79
|
||||
LABEL76:
|
||||
sconst "Deadman"
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL79:
|
||||
jump LABEL94
|
||||
LABEL80:
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpgt LABEL84
|
||||
jump LABEL91
|
||||
LABEL84:
|
||||
sconst "Level: "
|
||||
iload 1
|
||||
tostring
|
||||
join_string 2
|
||||
iload 0
|
||||
if_settext
|
||||
jump LABEL94
|
||||
LABEL91:
|
||||
sconst ""
|
||||
iload 0
|
||||
if_settext
|
||||
LABEL94:
|
||||
iload 1
|
||||
invoke 387
|
||||
sconst "wildernessWidgetTextSet" ; set callback name
|
||||
runelite_callback ; invoke callback
|
||||
return
|
||||
Reference in New Issue
Block a user