wasd plugin: allow input to world map search when focused
This commit is contained in:
@@ -34,7 +34,9 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public enum VarClientInt
|
||||
{
|
||||
TOOLTIP_TIMEOUT(1);
|
||||
TOOLTIP_TIMEOUT(1),
|
||||
|
||||
WORLD_MAP_SEARCH_FOCUSED(190);
|
||||
|
||||
private final int index;
|
||||
}
|
||||
|
||||
@@ -117,6 +117,7 @@ public class WidgetID
|
||||
static final int OPTION = 42;
|
||||
static final int TOOLTIP = 35;
|
||||
static final int MAPVIEW = 3;
|
||||
static final int SEARCH = 21;
|
||||
}
|
||||
|
||||
static class SlayerRewards
|
||||
|
||||
@@ -51,6 +51,7 @@ public enum WidgetInfo
|
||||
WORLD_MAP_OPTION(WidgetID.WORLD_MAP_MENU_GROUP_ID, WidgetID.WorldMap.OPTION),
|
||||
WORLD_MAP_TOOLTIP(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.TOOLTIP),
|
||||
WORLD_MAP_VIEW(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.MAPVIEW),
|
||||
WORLD_MAP_SEARCH(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.SEARCH),
|
||||
|
||||
CLUE_SCROLL_TEXT(WidgetID.CLUE_SCROLL_GROUP_ID, WidgetID.Cluescroll.CLUE_TEXT),
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -108,7 +109,20 @@ public class WASDCameraPlugin extends Plugin
|
||||
boolean chatboxFocused()
|
||||
{
|
||||
Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
|
||||
return chatboxParent != null && chatboxParent.getOnKeyListener() != null;
|
||||
if (chatboxParent == null || chatboxParent.getOnKeyListener() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// the search box on the world map can be focused, and chat input goes there, even
|
||||
// though the chatbox still has its key listener.
|
||||
Widget worldMapSearch = client.getWidget(WidgetInfo.WORLD_MAP_SEARCH);
|
||||
if (worldMapSearch != null && client.getVar(VarClientInt.WORLD_MAP_SEARCH_FOCUSED) == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean chatboxDialog()
|
||||
|
||||
Reference in New Issue
Block a user