Merge pull request #8603 from trimbe/fix-questlist
quest list plugin: use progress script to trigger hiding quests
This commit is contained in:
@@ -36,12 +36,11 @@ import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
@@ -104,46 +103,45 @@ public class QuestListPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (widgetLoaded.getGroupId() == WidgetID.QUESTLIST_GROUP_ID)
|
||||
if (!event.getEventName().equals("questProgressUpdated"))
|
||||
{
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
questSearchButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
questSearchButton.setSpriteId(SpriteID.GE_SEARCH);
|
||||
questSearchButton.setOriginalWidth(18);
|
||||
questSearchButton.setOriginalHeight(17);
|
||||
questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questSearchButton.setOriginalX(5);
|
||||
questSearchButton.setOriginalY(0);
|
||||
questSearchButton.setHasListener(true);
|
||||
questSearchButton.setAction(1, MENU_OPEN);
|
||||
questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
questSearchButton.setName(MENU_SEARCH);
|
||||
questSearchButton.revalidate();
|
||||
return;
|
||||
}
|
||||
|
||||
questHideButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
redrawHideButton();
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
questSearchButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
questSearchButton.setSpriteId(SpriteID.GE_SEARCH);
|
||||
questSearchButton.setOriginalWidth(18);
|
||||
questSearchButton.setOriginalHeight(17);
|
||||
questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questSearchButton.setOriginalX(5);
|
||||
questSearchButton.setOriginalY(0);
|
||||
questSearchButton.setHasListener(true);
|
||||
questSearchButton.setAction(1, MENU_OPEN);
|
||||
questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
questSearchButton.setName(MENU_SEARCH);
|
||||
questSearchButton.revalidate();
|
||||
|
||||
questHideButton.setOriginalWidth(13);
|
||||
questHideButton.setOriginalHeight(13);
|
||||
questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questHideButton.setOriginalX(24);
|
||||
questHideButton.setOriginalY(2);
|
||||
questHideButton.setHasListener(true);
|
||||
questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden());
|
||||
questHideButton.setAction(1, MENU_TOGGLE);
|
||||
questHideButton.revalidate();
|
||||
questHideButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
redrawHideButton();
|
||||
|
||||
questSet = new EnumMap<>(QuestContainer.class);
|
||||
questHideButton.setOriginalWidth(13);
|
||||
questHideButton.setOriginalHeight(13);
|
||||
questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questHideButton.setOriginalX(24);
|
||||
questHideButton.setOriginalY(2);
|
||||
questHideButton.setHasListener(true);
|
||||
questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden());
|
||||
questHideButton.setAction(1, MENU_TOGGLE);
|
||||
questHideButton.revalidate();
|
||||
|
||||
if (!header.isHidden())
|
||||
{
|
||||
updateFilter();
|
||||
}
|
||||
}
|
||||
questSet = new EnumMap<>(QuestContainer.class);
|
||||
|
||||
updateFilter();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,21 +257,26 @@ public class QuestListPlugin extends Plugin
|
||||
|
||||
int y = miniList.getRelativeY() + miniList.getHeight() + 10;
|
||||
|
||||
int newHeight = 0;
|
||||
int newHeight;
|
||||
if (container.getScrollHeight() > 0)
|
||||
{
|
||||
newHeight = (container.getScrollY() * y) / container.getScrollHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
newHeight = 0;
|
||||
}
|
||||
|
||||
container.setScrollHeight(y);
|
||||
container.revalidateScroll();
|
||||
|
||||
client.runScript(
|
||||
ScriptID.UPDATE_SCROLLBAR,
|
||||
WidgetInfo.QUESTLIST_SCROLLBAR.getId(),
|
||||
WidgetInfo.QUESTLIST_CONTAINER.getId(),
|
||||
newHeight
|
||||
);
|
||||
clientThread.invokeLater(() ->
|
||||
client.runScript(
|
||||
ScriptID.UPDATE_SCROLLBAR,
|
||||
WidgetInfo.QUESTLIST_SCROLLBAR.getId(),
|
||||
WidgetInfo.QUESTLIST_CONTAINER.getId(),
|
||||
newHeight
|
||||
));
|
||||
}
|
||||
|
||||
private void updateList(QuestContainer questContainer, String filter)
|
||||
@@ -309,7 +312,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))
|
||||
.filter(w -> !w.isSelfHidden() && !QUEST_HEADERS.contains(w.getText()))
|
||||
.filter(w -> !QUEST_HEADERS.contains(w.getText()))
|
||||
.map(w -> new QuestWidget(w, Text.removeTags(w.getText()).toLowerCase()))
|
||||
.collect(Collectors.toList());
|
||||
questSet.put(questContainer, quests);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
A6B3A7BFE7B688A08F69B91A7FD5C7184D71147D3DAF74B1262369D85DBB3A03
|
||||
198
runelite-client/src/main/scripts/QuestListShowProgress.rs2asm
Normal file
198
runelite-client/src/main/scripts/QuestListShowProgress.rs2asm
Normal file
@@ -0,0 +1,198 @@
|
||||
.id 1354
|
||||
.int_stack_count 3
|
||||
.string_stack_count 0
|
||||
.int_var_count 7
|
||||
.string_var_count 0
|
||||
iconst 0
|
||||
istore 3
|
||||
iconst 0
|
||||
istore 4
|
||||
iconst 0
|
||||
istore 5
|
||||
invoke 1340
|
||||
istore 6
|
||||
LABEL8:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL12
|
||||
jump LABEL56
|
||||
LABEL12:
|
||||
iload 0
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL18
|
||||
jump LABEL51
|
||||
LABEL18:
|
||||
iload 5
|
||||
invoke 1357
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL25
|
||||
jump LABEL28
|
||||
LABEL25:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL37
|
||||
LABEL28:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL32
|
||||
jump LABEL35
|
||||
LABEL32:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL37
|
||||
LABEL35:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL37:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL51:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL8
|
||||
LABEL56:
|
||||
iconst 0
|
||||
invoke 2245
|
||||
istore 6
|
||||
istore 5
|
||||
LABEL60:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL64
|
||||
jump LABEL108
|
||||
LABEL64:
|
||||
iload 1
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL70
|
||||
jump LABEL103
|
||||
LABEL70:
|
||||
iload 5
|
||||
invoke 1358
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL77
|
||||
jump LABEL80
|
||||
LABEL77:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL89
|
||||
LABEL80:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL84
|
||||
jump LABEL87
|
||||
LABEL84:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL89
|
||||
LABEL87:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL89:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL103:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL60
|
||||
LABEL108:
|
||||
iconst 0
|
||||
invoke 2265
|
||||
istore 6
|
||||
istore 5
|
||||
LABEL112:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL116
|
||||
jump LABEL160
|
||||
LABEL116:
|
||||
iload 2
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL122
|
||||
jump LABEL155
|
||||
LABEL122:
|
||||
iload 5
|
||||
invoke 1359
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL129
|
||||
jump LABEL132
|
||||
LABEL129:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL141
|
||||
LABEL132:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL136
|
||||
jump LABEL139
|
||||
LABEL136:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL141
|
||||
LABEL139:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL141:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL155:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL112
|
||||
LABEL160:
|
||||
sconst "questProgressUpdated"
|
||||
runelite_callback
|
||||
return
|
||||
Reference in New Issue
Block a user