Rework specbar plugin (#347)
This commit is contained in:
@@ -1,13 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Lucas <https://github.com/Lucwousin>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
package net.runelite.client.plugins.specbar;
|
package net.runelite.client.plugins.specbar;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
|
||||||
import net.runelite.api.events.WidgetHiddenChanged;
|
|
||||||
import net.runelite.api.widgets.Widget;
|
|
||||||
import net.runelite.api.widgets.WidgetID;
|
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -37,38 +56,15 @@ public class SpecBarPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
private void onWidgetHiddenChanged(WidgetHiddenChanged event)
|
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||||
{
|
{
|
||||||
if (WidgetInfo.TO_GROUP(event.getWidget().getId()) == WidgetID.COMBAT_GROUP_ID)
|
if (!"drawSpecbarAnyway".equals(event.getEventName()))
|
||||||
{
|
{
|
||||||
hideSpecBar();
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Subscribe
|
|
||||||
private void onGameStateChanged(GameStateChanged event)
|
|
||||||
{
|
|
||||||
if (event.getGameState().equals(GameState.LOGGING_IN))
|
|
||||||
{
|
|
||||||
hideSpecBar();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
int[] iStack = client.getIntStack();
|
||||||
|
int iStackSize = client.getIntStackSize();
|
||||||
/**
|
iStack[iStackSize - 1] = 1;
|
||||||
* Displays the special attack bar
|
|
||||||
*/
|
|
||||||
private void hideSpecBar()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Widget specBar = client.getWidget(WidgetInfo.COMBAT_SPECIAL_ATTACK);
|
|
||||||
specBar.setHidden(false);
|
|
||||||
specBar.revalidate();
|
|
||||||
}
|
|
||||||
catch (NullPointerException e)
|
|
||||||
{
|
|
||||||
// Stops the nulls that occur before the spec bar is loaded by player equipping a spec wep
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
1
runelite-client/src/main/scripts/SpecbarRedraw.hash
Normal file
1
runelite-client/src/main/scripts/SpecbarRedraw.hash
Normal file
@@ -0,0 +1 @@
|
|||||||
|
C470C1ADE28D2C7AD0340EEBFA75A0BA1600C5187BBF2DCE8066BA17BECB2D3B
|
||||||
234
runelite-client/src/main/scripts/SpecbarRedraw.rs2asm
Normal file
234
runelite-client/src/main/scripts/SpecbarRedraw.rs2asm
Normal file
@@ -0,0 +1,234 @@
|
|||||||
|
.id 187
|
||||||
|
.int_stack_count 1
|
||||||
|
.string_stack_count 0
|
||||||
|
.int_var_count 5
|
||||||
|
.string_var_count 1
|
||||||
|
iconst 0
|
||||||
|
istore 1
|
||||||
|
map_members
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL9
|
||||||
|
get_varbit 5314
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL9
|
||||||
|
jump LABEL17
|
||||||
|
LABEL9:
|
||||||
|
iconst 111
|
||||||
|
iconst 105
|
||||||
|
iconst 906
|
||||||
|
iconst 94
|
||||||
|
iconst 3
|
||||||
|
inv_getobj
|
||||||
|
enum
|
||||||
|
istore 1
|
||||||
|
LABEL17:
|
||||||
|
iload 1
|
||||||
|
iconst 0
|
||||||
|
if_icmple LABEL21
|
||||||
|
jump LABEL25
|
||||||
|
LABEL21:
|
||||||
|
iconst 1 ; What we compare the boolean with
|
||||||
|
iconst 0 ; Boolean
|
||||||
|
sconst "drawSpecbarAnyway"
|
||||||
|
runelite_callback
|
||||||
|
if_icmpeq LABEL25
|
||||||
|
iconst 1
|
||||||
|
iconst 38862882
|
||||||
|
if_sethide
|
||||||
|
return
|
||||||
|
LABEL25:
|
||||||
|
iconst 0
|
||||||
|
istore 2
|
||||||
|
iconst 38862882
|
||||||
|
if_gethide
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL32
|
||||||
|
jump LABEL34
|
||||||
|
LABEL32:
|
||||||
|
iconst 1
|
||||||
|
istore 2
|
||||||
|
LABEL34:
|
||||||
|
iconst 0
|
||||||
|
iconst 38862882
|
||||||
|
if_sethide
|
||||||
|
get_varp 301
|
||||||
|
iconst 0
|
||||||
|
if_icmpgt LABEL41
|
||||||
|
jump LABEL45
|
||||||
|
LABEL41:
|
||||||
|
iconst 16776960
|
||||||
|
iconst 38862887
|
||||||
|
if_setcolour
|
||||||
|
jump LABEL48
|
||||||
|
LABEL45:
|
||||||
|
iconst 16
|
||||||
|
iconst 38862887
|
||||||
|
if_setcolour
|
||||||
|
LABEL48:
|
||||||
|
get_varp 300
|
||||||
|
istore 3
|
||||||
|
iload 3
|
||||||
|
iconst 0
|
||||||
|
if_icmplt LABEL54
|
||||||
|
jump LABEL56
|
||||||
|
LABEL54:
|
||||||
|
iconst 0
|
||||||
|
istore 3
|
||||||
|
LABEL56:
|
||||||
|
sconst "Special Attack: "
|
||||||
|
iload 3
|
||||||
|
iconst 10
|
||||||
|
div
|
||||||
|
tostring
|
||||||
|
sconst "%"
|
||||||
|
join_string 3
|
||||||
|
iconst 38862887
|
||||||
|
if_settext
|
||||||
|
iload 0
|
||||||
|
iload 3
|
||||||
|
iload 2
|
||||||
|
invoke 189
|
||||||
|
iconst 38862883
|
||||||
|
iconst 0
|
||||||
|
invoke 835
|
||||||
|
pop_int ; Specbar is fully built here
|
||||||
|
iload 1
|
||||||
|
iconst 0
|
||||||
|
if_icmple RETURN ; Return if the weapon isn't supposed to have a spec
|
||||||
|
jump CONTINUE ; Idk why I'm doing it like this but it's the jagex way
|
||||||
|
RETURN:
|
||||||
|
return
|
||||||
|
CONTINUE:
|
||||||
|
iload 3
|
||||||
|
iload 1
|
||||||
|
if_icmpge LABEL73
|
||||||
|
jump LABEL77
|
||||||
|
LABEL73:
|
||||||
|
iconst 3767611
|
||||||
|
iconst 38862886
|
||||||
|
if_setcolour
|
||||||
|
jump LABEL80
|
||||||
|
LABEL77:
|
||||||
|
iconst 12907
|
||||||
|
iconst 38862886
|
||||||
|
if_setcolour
|
||||||
|
LABEL80:
|
||||||
|
iconst 94
|
||||||
|
iconst 3
|
||||||
|
inv_getobj
|
||||||
|
istore 4
|
||||||
|
iconst 111
|
||||||
|
iconst 115
|
||||||
|
iconst 1739
|
||||||
|
iload 4
|
||||||
|
enum
|
||||||
|
sconst " ("
|
||||||
|
iconst 111
|
||||||
|
iconst 105
|
||||||
|
iconst 906
|
||||||
|
iload 4
|
||||||
|
enum
|
||||||
|
iconst 10
|
||||||
|
div
|
||||||
|
tostring
|
||||||
|
sconst "%)"
|
||||||
|
join_string 4
|
||||||
|
sstore 0
|
||||||
|
iload 4
|
||||||
|
switch
|
||||||
|
22737: LABEL108
|
||||||
|
22740: LABEL108
|
||||||
|
22743: LABEL108
|
||||||
|
22731: LABEL108
|
||||||
|
22734: LABEL108
|
||||||
|
jump LABEL116
|
||||||
|
LABEL108:
|
||||||
|
iconst 111
|
||||||
|
iconst 115
|
||||||
|
iconst 1739
|
||||||
|
iload 4
|
||||||
|
enum
|
||||||
|
sconst " 5-100% "
|
||||||
|
join_string 2
|
||||||
|
sstore 0
|
||||||
|
LABEL116:
|
||||||
|
get_varbit 5712
|
||||||
|
iconst 0
|
||||||
|
if_icmpeq LABEL120
|
||||||
|
jump LABEL185
|
||||||
|
LABEL120:
|
||||||
|
iload 4
|
||||||
|
iconst 11235
|
||||||
|
if_icmpeq LABEL136
|
||||||
|
iload 4
|
||||||
|
iconst 20408
|
||||||
|
if_icmpeq LABEL136
|
||||||
|
iload 4
|
||||||
|
iconst 12765
|
||||||
|
if_icmpeq LABEL136
|
||||||
|
iload 4
|
||||||
|
iconst 12768
|
||||||
|
if_icmpeq LABEL136
|
||||||
|
iload 4
|
||||||
|
iconst 12767
|
||||||
|
if_icmpeq LABEL136
|
||||||
|
jump LABEL169
|
||||||
|
LABEL136:
|
||||||
|
iconst 94
|
||||||
|
iconst 13
|
||||||
|
inv_getobj
|
||||||
|
iconst 11212
|
||||||
|
if_icmpeq LABEL157
|
||||||
|
iconst 94
|
||||||
|
iconst 13
|
||||||
|
inv_getobj
|
||||||
|
iconst 11227
|
||||||
|
if_icmpeq LABEL157
|
||||||
|
iconst 94
|
||||||
|
iconst 13
|
||||||
|
inv_getobj
|
||||||
|
iconst 11228
|
||||||
|
if_icmpeq LABEL157
|
||||||
|
iconst 94
|
||||||
|
iconst 13
|
||||||
|
inv_getobj
|
||||||
|
iconst 11229
|
||||||
|
if_icmpeq LABEL157
|
||||||
|
jump LABEL169
|
||||||
|
LABEL157:
|
||||||
|
sconst "Descent of Dragons: Deal a double attack with dragon arrows that inflicts up to 50% more damage (minimum damage of 8 per hit). ("
|
||||||
|
iconst 111
|
||||||
|
iconst 105
|
||||||
|
iconst 906
|
||||||
|
iload 4
|
||||||
|
enum
|
||||||
|
iconst 10
|
||||||
|
div
|
||||||
|
tostring
|
||||||
|
sconst "%)"
|
||||||
|
join_string 3
|
||||||
|
sstore 0
|
||||||
|
LABEL169:
|
||||||
|
iconst 526
|
||||||
|
iconst -2147483645
|
||||||
|
iconst -1
|
||||||
|
iconst 38862889
|
||||||
|
sload 0
|
||||||
|
iconst 25
|
||||||
|
iconst 160
|
||||||
|
sconst "IiIsii"
|
||||||
|
iconst 38862882
|
||||||
|
if_setonmouserepeat
|
||||||
|
iconst 40
|
||||||
|
iconst 38862889
|
||||||
|
sconst "I"
|
||||||
|
iconst 38862882
|
||||||
|
if_setonmouseleave
|
||||||
|
jump LABEL189
|
||||||
|
LABEL185:
|
||||||
|
iconst -1
|
||||||
|
sconst ""
|
||||||
|
iconst 38862882
|
||||||
|
if_setonmouserepeat
|
||||||
|
LABEL189:
|
||||||
|
return
|
||||||
Reference in New Issue
Block a user