Merge remote-tracking branch 'Upstream/master'
# Conflicts: # runelite-api/src/main/java/net/runelite/api/Client.java # runelite-api/src/main/java/net/runelite/api/TileItem.java # runelite-api/src/main/java/net/runelite/api/events/ItemDespawned.java # runelite-api/src/main/java/net/runelite/api/events/ItemQuantityChanged.java # runelite-api/src/main/java/net/runelite/api/events/ItemSpawned.java # runelite-client/src/main/java/net/runelite/client/game/ItemManager.java # runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java # runelite-client/src/main/java/net/runelite/client/plugins/chatboxperformance/ChatboxPerformancePlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/groundmarkers/GroundMarkerPlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/loottracker/LootTrackerPlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/mta/enchantment/EnchantmentRoom.java # runelite-client/src/main/java/net/runelite/client/plugins/npchighlight/NpcIndicatorsPlugin.java # runelite-client/src/main/java/net/runelite/client/plugins/objectindicators/ObjectIndicatorsPlugin.java
This commit is contained in:
@@ -43,6 +43,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@@ -410,7 +411,12 @@ public class ItemManager
|
||||
* @param itemId item id
|
||||
* @return item composition
|
||||
*/
|
||||
<<<<<<< HEAD
|
||||
public ItemDefinition getItemDefinition(int itemId)
|
||||
=======
|
||||
@Nonnull
|
||||
public ItemComposition getItemComposition(int itemId)
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
assert client.isClientThread() : "getItemDefinition must be called on client thread";
|
||||
return itemDefinitions.getUnchecked(itemId);
|
||||
|
||||
@@ -38,7 +38,7 @@ import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
@@ -163,7 +163,7 @@ public class LootManager
|
||||
|
||||
private void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
final Item item = itemSpawned.getItem();
|
||||
final TileItem item = itemSpawned.getItem();
|
||||
final Tile tile = itemSpawned.getTile();
|
||||
final LocalPoint location = tile.getLocalLocation();
|
||||
final int packed = location.getSceneX() << 8 | location.getSceneY();
|
||||
@@ -173,14 +173,14 @@ public class LootManager
|
||||
|
||||
private void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
final Item item = itemDespawned.getItem();
|
||||
final TileItem item = itemDespawned.getItem();
|
||||
final LocalPoint location = itemDespawned.getTile().getLocalLocation();
|
||||
log.debug("Item despawn {} ({}) location {},{}", item.getId(), item.getQuantity(), location);
|
||||
}
|
||||
|
||||
private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged)
|
||||
{
|
||||
final Item item = itemQuantityChanged.getItem();
|
||||
final TileItem item = itemQuantityChanged.getItem();
|
||||
final Tile tile = itemQuantityChanged.getTile();
|
||||
final LocalPoint location = tile.getLocalLocation();
|
||||
final int packed = location.getSceneX() << 8 | location.getSceneY();
|
||||
|
||||
@@ -0,0 +1,314 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Ron Young <https://github.com/raiyni>
|
||||
* 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.game.chatbox;
|
||||
|
||||
import com.google.common.primitives.Ints;
|
||||
import com.google.inject.Inject;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.widgets.ItemQuantityMode;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
import net.runelite.api.widgets.WidgetSizeMode;
|
||||
import net.runelite.api.widgets.WidgetTextAlignment;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
|
||||
@Singleton
|
||||
public class ChatboxItemSearch extends ChatboxTextInput
|
||||
{
|
||||
private static final int ICON_HEIGHT = 32;
|
||||
private static final int ICON_WIDTH = 36;
|
||||
private static final int PADDING = 6;
|
||||
private static final int MAX_RESULTS = 24;
|
||||
private static final int FONT_SIZE = 16;
|
||||
private static final int HOVERED_OPACITY = 128;
|
||||
|
||||
private final ChatboxPanelManager chatboxPanelManager;
|
||||
private final ItemManager itemManager;
|
||||
private final Client client;
|
||||
|
||||
private Map<Integer, ItemComposition> results = new LinkedHashMap<>();
|
||||
private String tooltipText;
|
||||
private int index = -1;
|
||||
|
||||
@Getter
|
||||
private Consumer<Integer> onItemSelected;
|
||||
|
||||
@Inject
|
||||
private ChatboxItemSearch(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread,
|
||||
ItemManager itemManager, Client client)
|
||||
{
|
||||
super(chatboxPanelManager, clientThread);
|
||||
this.chatboxPanelManager = chatboxPanelManager;
|
||||
this.itemManager = itemManager;
|
||||
this.client = client;
|
||||
|
||||
lines(1);
|
||||
prompt("Item Search");
|
||||
onChanged(searchString ->
|
||||
clientThread.invokeLater(() ->
|
||||
{
|
||||
filterResults();
|
||||
update();
|
||||
}));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
Widget container = chatboxPanelManager.getContainerWidget();
|
||||
container.deleteAllChildren();
|
||||
|
||||
Widget promptWidget = container.createChild(-1, WidgetType.TEXT);
|
||||
promptWidget.setText(getPrompt());
|
||||
promptWidget.setTextColor(0x800000);
|
||||
promptWidget.setFontId(getFontID());
|
||||
promptWidget.setOriginalX(0);
|
||||
promptWidget.setOriginalY(5);
|
||||
promptWidget.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
|
||||
promptWidget.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
|
||||
promptWidget.setOriginalHeight(FONT_SIZE);
|
||||
promptWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
|
||||
promptWidget.setYTextAlignment(WidgetTextAlignment.CENTER);
|
||||
promptWidget.setWidthMode(WidgetSizeMode.MINUS);
|
||||
promptWidget.revalidate();
|
||||
|
||||
buildEdit(0, 5 + FONT_SIZE, container.getWidth(), FONT_SIZE);
|
||||
|
||||
Widget separator = container.createChild(-1, WidgetType.LINE);
|
||||
separator.setOriginalX(0);
|
||||
separator.setOriginalY(8 + (FONT_SIZE * 2));
|
||||
separator.setXPositionMode(WidgetPositionMode.ABSOLUTE_CENTER);
|
||||
separator.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
|
||||
separator.setOriginalHeight(0);
|
||||
separator.setOriginalWidth(16);
|
||||
separator.setWidthMode(WidgetSizeMode.MINUS);
|
||||
separator.setTextColor(0x666666);
|
||||
separator.revalidate();
|
||||
|
||||
int x = PADDING;
|
||||
int y = PADDING * 3;
|
||||
int idx = 0;
|
||||
for (ItemComposition itemComposition : results.values())
|
||||
{
|
||||
Widget item = container.createChild(-1, WidgetType.GRAPHIC);
|
||||
item.setXPositionMode(WidgetPositionMode.ABSOLUTE_LEFT);
|
||||
item.setYPositionMode(WidgetPositionMode.ABSOLUTE_TOP);
|
||||
item.setOriginalX(x);
|
||||
item.setOriginalY(y + FONT_SIZE * 2);
|
||||
item.setOriginalHeight(ICON_HEIGHT);
|
||||
item.setOriginalWidth(ICON_WIDTH);
|
||||
item.setName("<col=ff9040>" + itemComposition.getName());
|
||||
item.setItemId(itemComposition.getId());
|
||||
item.setItemQuantity(10000);
|
||||
item.setItemQuantityMode(ItemQuantityMode.NEVER);
|
||||
item.setBorderType(1);
|
||||
item.setAction(0, tooltipText);
|
||||
item.setHasListener(true);
|
||||
|
||||
if (index == idx)
|
||||
{
|
||||
item.setOpacity(HOVERED_OPACITY);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.setOnMouseOverListener((JavaScriptCallback) ev -> item.setOpacity(HOVERED_OPACITY));
|
||||
item.setOnMouseLeaveListener((JavaScriptCallback) ev -> item.setOpacity(0));
|
||||
}
|
||||
|
||||
item.setOnOpListener((JavaScriptCallback) ev ->
|
||||
{
|
||||
if (onItemSelected != null)
|
||||
{
|
||||
onItemSelected.accept(itemComposition.getId());
|
||||
}
|
||||
|
||||
chatboxPanelManager.close();
|
||||
});
|
||||
|
||||
x += ICON_WIDTH + PADDING;
|
||||
if (x + ICON_WIDTH >= container.getWidth())
|
||||
{
|
||||
y += ICON_HEIGHT + PADDING;
|
||||
x = PADDING;
|
||||
}
|
||||
|
||||
item.revalidate();
|
||||
++idx;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent ev)
|
||||
{
|
||||
switch (ev.getKeyCode())
|
||||
{
|
||||
case KeyEvent.VK_ENTER:
|
||||
ev.consume();
|
||||
if (index > -1)
|
||||
{
|
||||
if (onItemSelected != null)
|
||||
{
|
||||
onItemSelected.accept(results.keySet().toArray(new Integer[results.size()])[index]);
|
||||
}
|
||||
|
||||
chatboxPanelManager.close();
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_TAB:
|
||||
case KeyEvent.VK_RIGHT:
|
||||
ev.consume();
|
||||
if (!results.isEmpty())
|
||||
{
|
||||
index++;
|
||||
if (index >= results.size())
|
||||
{
|
||||
index = 0;
|
||||
}
|
||||
clientThread.invokeLater(this::update);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_LEFT:
|
||||
ev.consume();
|
||||
if (!results.isEmpty())
|
||||
{
|
||||
index--;
|
||||
if (index < 0)
|
||||
{
|
||||
index = results.size() - 1;
|
||||
}
|
||||
clientThread.invokeLater(this::update);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_UP:
|
||||
ev.consume();
|
||||
if (results.size() >= (MAX_RESULTS / 2))
|
||||
{
|
||||
index -= MAX_RESULTS / 2;
|
||||
if (index < 0)
|
||||
{
|
||||
if (results.size() == MAX_RESULTS)
|
||||
{
|
||||
index += results.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
index += MAX_RESULTS;
|
||||
}
|
||||
index = Ints.constrainToRange(index, 0, results.size() - 1);
|
||||
}
|
||||
|
||||
clientThread.invokeLater(this::update);
|
||||
}
|
||||
break;
|
||||
case KeyEvent.VK_DOWN:
|
||||
ev.consume();
|
||||
if (results.size() >= (MAX_RESULTS / 2))
|
||||
{
|
||||
index += MAX_RESULTS / 2;
|
||||
if (index >= MAX_RESULTS)
|
||||
{
|
||||
if (results.size() == MAX_RESULTS)
|
||||
{
|
||||
index -= results.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
index -= MAX_RESULTS;
|
||||
}
|
||||
index = Ints.constrainToRange(index, 0, results.size() - 1);
|
||||
}
|
||||
|
||||
clientThread.invokeLater(this::update);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
super.keyPressed(ev);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void close()
|
||||
{
|
||||
// Clear search string when closed
|
||||
value("");
|
||||
results.clear();
|
||||
index = -1;
|
||||
super.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ChatboxTextInput onDone(Consumer<String> onDone)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void filterResults()
|
||||
{
|
||||
results.clear();
|
||||
index = -1;
|
||||
|
||||
String search = getValue().toLowerCase();
|
||||
if (search.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < client.getItemCount() && results.size() < MAX_RESULTS; i++)
|
||||
{
|
||||
ItemComposition itemComposition = itemManager.getItemComposition(itemManager.canonicalize(i));
|
||||
String name = itemComposition.getName();
|
||||
// The client assigns "null" to item names of items it doesn't know about
|
||||
if (!name.equals("null") && name.toLowerCase().contains(search))
|
||||
{
|
||||
// This may already be in the map due to canonicalize mapping the item to something we've already seen
|
||||
results.putIfAbsent(itemComposition.getId(), itemComposition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChatboxItemSearch onItemSelected(Consumer<Integer> onItemSelected)
|
||||
{
|
||||
this.onItemSelected = onItemSelected;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatboxItemSearch tooltipText(final String text)
|
||||
{
|
||||
tooltipText = text;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
private static final Pattern BREAK_MATCHER = Pattern.compile("[^a-zA-Z0-9']");
|
||||
|
||||
private final ChatboxPanelManager chatboxPanelManager;
|
||||
private final ClientThread clientThread;
|
||||
protected final ClientThread clientThread;
|
||||
|
||||
private static IntPredicate getDefaultCharValidator()
|
||||
{
|
||||
|
||||
@@ -37,7 +37,6 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.ItemID.AGILITY_ARENA_TICKET;
|
||||
import net.runelite.api.MenuAction;
|
||||
@@ -46,6 +45,7 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
import static net.runelite.api.Skill.AGILITY;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.BoostedLevelChanged;
|
||||
@@ -321,7 +321,7 @@ public class AgilityPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
final Item item = itemSpawned.getItem();
|
||||
final TileItem item = itemSpawned.getItem();
|
||||
final Tile tile = itemSpawned.getTile();
|
||||
|
||||
if (item.getId() == ItemID.MARK_OF_GRACE)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class BankSearch
|
||||
// selecting/changing tab
|
||||
if (closeInput)
|
||||
{
|
||||
client.runScript(ScriptID.RESET_CHATBOX_INPUT);
|
||||
client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0);
|
||||
}
|
||||
|
||||
client.setVar(VarClientInt.INPUT_TYPE, inputType.getType());
|
||||
|
||||
@@ -78,6 +78,7 @@ import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxItemSearch;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
import net.runelite.client.plugins.banktags.BankTagsConfig;
|
||||
import net.runelite.client.plugins.banktags.BankTagsPlugin;
|
||||
@@ -126,10 +127,10 @@ public class TabInterface
|
||||
private final Rectangle bounds = new Rectangle();
|
||||
private final Rectangle canvasBounds = new Rectangle();
|
||||
|
||||
private ChatboxItemSearch searchProvider;
|
||||
private TagTab activeTab;
|
||||
private int maxTabs;
|
||||
private int currentTabIndex;
|
||||
private TagTab iconToSet = null;
|
||||
private Instant startScroll = Instant.now();
|
||||
private String rememberedSearch;
|
||||
private boolean waitSearchTick;
|
||||
@@ -156,7 +157,8 @@ public class TabInterface
|
||||
final ChatboxPanelManager chatboxPanelManager,
|
||||
final BankTagsConfig config,
|
||||
final Notifier notifier,
|
||||
final BankSearch bankSearch)
|
||||
final BankSearch bankSearch,
|
||||
final ChatboxItemSearch searchProvider)
|
||||
{
|
||||
this.client = client;
|
||||
this.clientThread = clientThread;
|
||||
@@ -167,6 +169,7 @@ public class TabInterface
|
||||
this.config = config;
|
||||
this.notifier = notifier;
|
||||
this.bankSearch = bankSearch;
|
||||
this.searchProvider = searchProvider;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
@@ -333,7 +336,7 @@ public class TabInterface
|
||||
{
|
||||
bankSearch.reset(true);
|
||||
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -343,7 +346,20 @@ public class TabInterface
|
||||
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||
break;
|
||||
case Tab.CHANGE_ICON:
|
||||
iconToSet = tabManager.find(Text.removeTags(event.getOpbase()));
|
||||
final String tag = Text.removeTags(event.getOpbase());
|
||||
searchProvider
|
||||
.tooltipText(CHANGE_ICON + " (" + tag + ")")
|
||||
.onItemSelected((itemId) ->
|
||||
{
|
||||
TagTab iconToSet = tabManager.find(tag);
|
||||
if (iconToSet != null)
|
||||
{
|
||||
iconToSet.setIconItemId(itemId);
|
||||
iconToSet.getIcon().setItemId(itemId);
|
||||
tabManager.setIcon(iconToSet.getTag(), itemId + "");
|
||||
}
|
||||
})
|
||||
.build();
|
||||
break;
|
||||
case Tab.DELETE_TAB:
|
||||
String target = Text.standardize(event.getOpbase());
|
||||
@@ -526,12 +542,6 @@ public class TabInterface
|
||||
entries = createMenuEntry(event, REMOVE_TAG + " (" + activeTab.getTag() + ")", event.getTarget(), entries);
|
||||
client.setMenuEntries(entries);
|
||||
}
|
||||
else if (iconToSet != null && (entry.getOption().startsWith("Withdraw-") || entry.getOption().equals("Release")))
|
||||
{
|
||||
// TODO: Do not replace every withdraw option with change icon option
|
||||
entry.setOption(CHANGE_ICON + " (" + iconToSet.getTag() + ")");
|
||||
client.setMenuEntries(entries);
|
||||
}
|
||||
else if (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()
|
||||
&& event.getOption().equals("Deposit inventory"))
|
||||
{
|
||||
@@ -582,6 +592,7 @@ public class TabInterface
|
||||
bankSearch.search(InputType.NONE, rememberedSearch, true);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (iconToSet != null)
|
||||
{
|
||||
if (event.getOption().startsWith(CHANGE_ICON + " ("))
|
||||
@@ -601,6 +612,8 @@ public class TabInterface
|
||||
iconToSet = null;
|
||||
}
|
||||
|
||||
=======
|
||||
>>>>>>> Upstream/master
|
||||
if (activeTab != null
|
||||
&& event.getOption().equals("Search")
|
||||
&& client.getWidget(WidgetInfo.BANK_SEARCH_BUTTON_BACKGROUND).getSpriteId() != SpriteID.EQUIPMENT_SLOT_SELECTED)
|
||||
|
||||
@@ -27,13 +27,25 @@ package net.runelite.client.plugins.chatboxperformance;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
<<<<<<< HEAD
|
||||
import net.runelite.api.events.WidgetPositioned;
|
||||
=======
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
>>>>>>> Upstream/master
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
import net.runelite.api.widgets.WidgetSizeMode;
|
||||
<<<<<<< HEAD
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
=======
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
>>>>>>> Upstream/master
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@@ -48,6 +60,7 @@ public class ChatboxPerformancePlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
<<<<<<< HEAD
|
||||
private EventBus eventBus;
|
||||
|
||||
@Override
|
||||
@@ -63,34 +76,36 @@ public class ChatboxPerformancePlugin extends Plugin
|
||||
}
|
||||
|
||||
private void onWidgetPositioned(WidgetPositioned event)
|
||||
=======
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Override
|
||||
public void startUp()
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
if (!areWidgetsFixed())
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
fixChatbox();
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean areWidgetsFixed()
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
Widget widget = client.getWidget(WidgetInfo.CHATBOX_TRANSPARENT_BACKGROUND);
|
||||
if (widget == null)
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
return true;
|
||||
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
|
||||
}
|
||||
|
||||
Widget[] widgets = widget.getChildren();
|
||||
|
||||
if (widgets != null && widgets.length > 0)
|
||||
{
|
||||
Widget last = widgets[widgets.length - 1];
|
||||
return last != null && last.getOpacity() < 254;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void fixChatbox()
|
||||
@Subscribe
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent ev)
|
||||
{
|
||||
if (!"chatboxBackgroundBuilt".equals(ev.getEventName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fixDarkBackground();
|
||||
fixWhiteLines(true);
|
||||
fixWhiteLines(false);
|
||||
|
||||
@@ -34,6 +34,6 @@ class JagexPrintableCharMatcher extends CharMatcher
|
||||
// Characters which are printable
|
||||
return (c >= 32 && c <= 126)
|
||||
|| c == 128
|
||||
|| (c >= 161 && c <= 255);
|
||||
|| (c >= 160 && c <= 255);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Area:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Location:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(getArea())
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
|
||||
@@ -85,7 +85,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Area:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Location:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(getArea())
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
|
||||
@@ -160,7 +160,7 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
|
||||
else
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Possible areas:")
|
||||
.left("Possible locations:")
|
||||
.build());
|
||||
|
||||
final Map<HotColdArea, Integer> locationCounts = new EnumMap<>(HotColdArea.class);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class MusicClue extends ClueScroll implements NpcClueScroll
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Area:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Location:").build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Falador Park")
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
|
||||
@@ -108,7 +108,7 @@ public enum HotColdLocation
|
||||
KANDARIN_KHAZARD_BATTLEFIELD(new WorldPoint(2518, 3249, 0), KANDARIN, "Khazard Battlefield, in the small ruins south of tracker gnome 2."),
|
||||
KANDARIN_WEST_ARDY(new WorldPoint(2533, 3320, 0), KANDARIN, "West Ardougne, near the staircase outside the Civic Office."),
|
||||
KANDARIN_SW_TREE_GNOME_STRONGHOLD(new WorldPoint(2411, 3431, 0), KANDARIN, "South-west Tree Gnome Stronghold"),
|
||||
KANDARIN_OUTPOST(new WorldPoint(2458, 3364, 0), KANDARIN, "South of the Tree Gnome Stronghold, north-east of the Outpost."),
|
||||
KANDARIN_OUTPOST(new WorldPoint(2457, 3362, 0), KANDARIN, "South of the Tree Gnome Stronghold, north-east of the Outpost."),
|
||||
KANDARIN_BAXTORIAN_FALLS(new WorldPoint(2534, 3479, 0), KANDARIN, "South-east of Almera's house on Baxtorian Falls."),
|
||||
KANDARIN_BA_AGILITY_COURSE(new WorldPoint(2536, 3546, 0), KANDARIN, "Inside the Barbarian Agility Course. Completion of Alfred Grimhand's Barcrawl is required."),
|
||||
KARAMJA_MUSA_POINT(new WorldPoint(2914, 3168, 0), KARAMJA, "Musa Point, banana plantation."),
|
||||
|
||||
@@ -44,8 +44,8 @@ import net.runelite.api.DecorativeObject;
|
||||
import net.runelite.api.DynamicObject;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemLayer;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCDefinition;
|
||||
@@ -285,9 +285,9 @@ class DevToolsOverlay extends Overlay
|
||||
if (player.getLocalLocation().distanceTo(itemLayer.getLocalLocation()) <= MAX_DISTANCE)
|
||||
{
|
||||
Node current = itemLayer.getBottom();
|
||||
while (current instanceof Item)
|
||||
while (current instanceof TileItem)
|
||||
{
|
||||
Item item = (Item) current;
|
||||
TileItem item = (TileItem) current;
|
||||
OverlayUtil.renderTileOverlay(graphics, itemLayer, "ID: " + item.getId() + " Qty:" + item.getQuantity(), RED);
|
||||
current = current.getNext();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ import net.runelite.client.util.ImageUtil;
|
||||
public class EmojiPlugin extends Plugin
|
||||
{
|
||||
private static final Pattern TAG_REGEXP = Pattern.compile("<[^>]*>");
|
||||
private static final Pattern WHITESPACE_REGEXP = Pattern.compile("[\\s\\u00A0]");
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -182,9 +183,9 @@ public class EmojiPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private String updateMessage(final String message)
|
||||
String updateMessage(final String message)
|
||||
{
|
||||
final String[] messageWords = message.split(" ");
|
||||
final String[] messageWords = WHITESPACE_REGEXP.split(message);
|
||||
|
||||
boolean editedMessage = false;
|
||||
for (int i = 0; i < messageWords.length; i++)
|
||||
|
||||
@@ -86,6 +86,7 @@ import static net.runelite.api.NpcID.FISHING_SPOT_8525;
|
||||
import static net.runelite.api.NpcID.FISHING_SPOT_8526;
|
||||
import static net.runelite.api.NpcID.FISHING_SPOT_8527;
|
||||
import static net.runelite.api.NpcID.ROD_FISHING_SPOT;
|
||||
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1506;
|
||||
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1508;
|
||||
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1509;
|
||||
import static net.runelite.api.NpcID.ROD_FISHING_SPOT_1513;
|
||||
@@ -127,10 +128,11 @@ enum FishingSpot
|
||||
FISHING_SPOT_4316
|
||||
),
|
||||
SALMON("Salmon, Trout", ItemID.RAW_SALMON,
|
||||
ROD_FISHING_SPOT, ROD_FISHING_SPOT_1508, ROD_FISHING_SPOT_1509,
|
||||
ROD_FISHING_SPOT_1513, ROD_FISHING_SPOT_1515, ROD_FISHING_SPOT_1516,
|
||||
ROD_FISHING_SPOT_1526, ROD_FISHING_SPOT_1527, ROD_FISHING_SPOT_7463,
|
||||
ROD_FISHING_SPOT_7464, ROD_FISHING_SPOT_7468, ROD_FISHING_SPOT_8524
|
||||
ROD_FISHING_SPOT, ROD_FISHING_SPOT_1506, ROD_FISHING_SPOT_1508,
|
||||
ROD_FISHING_SPOT_1509, ROD_FISHING_SPOT_1513, ROD_FISHING_SPOT_1515,
|
||||
ROD_FISHING_SPOT_1516, ROD_FISHING_SPOT_1526, ROD_FISHING_SPOT_1527,
|
||||
ROD_FISHING_SPOT_7463, ROD_FISHING_SPOT_7464, ROD_FISHING_SPOT_7468,
|
||||
ROD_FISHING_SPOT_8524
|
||||
),
|
||||
BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON,
|
||||
FISHING_SPOT_1542, FISHING_SPOT_7323
|
||||
|
||||
@@ -52,8 +52,12 @@ import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
<<<<<<< HEAD
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
=======
|
||||
import net.runelite.api.ItemComposition;
|
||||
>>>>>>> Upstream/master
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.ItemLayer;
|
||||
import net.runelite.api.MenuAction;
|
||||
@@ -62,6 +66,7 @@ import net.runelite.api.Node;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Scene;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -323,7 +328,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
|
||||
private void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
Item item = itemSpawned.getItem();
|
||||
TileItem item = itemSpawned.getItem();
|
||||
Tile tile = itemSpawned.getTile();
|
||||
|
||||
GroundItem groundItem = buildGroundItem(tile, item);
|
||||
@@ -348,7 +353,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
|
||||
private void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
Item item = itemDespawned.getItem();
|
||||
TileItem item = itemDespawned.getItem();
|
||||
Tile tile = itemDespawned.getTile();
|
||||
|
||||
GroundItem.GroundItemKey groundItemKey = new GroundItem.GroundItemKey(item.getId(), tile.getWorldLocation());
|
||||
@@ -370,7 +375,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
|
||||
private void onItemQuantityChanged(ItemQuantityChanged itemQuantityChanged)
|
||||
{
|
||||
Item item = itemQuantityChanged.getItem();
|
||||
TileItem item = itemQuantityChanged.getItem();
|
||||
Tile tile = itemQuantityChanged.getTile();
|
||||
int oldQuantity = itemQuantityChanged.getOldQuantity();
|
||||
int newQuantity = itemQuantityChanged.getNewQuantity();
|
||||
@@ -579,7 +584,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private GroundItem buildGroundItem(final Tile tile, final Item item)
|
||||
private GroundItem buildGroundItem(final Tile tile, final TileItem item)
|
||||
{
|
||||
// Collect the data for the item
|
||||
final int itemId = item.getId();
|
||||
@@ -711,9 +716,9 @@ public class GroundItemsPlugin extends Plugin
|
||||
int quantity = 1;
|
||||
Node current = itemLayer.getBottom();
|
||||
|
||||
while (current instanceof Item)
|
||||
while (current instanceof TileItem)
|
||||
{
|
||||
Item item = (Item) current;
|
||||
TileItem item = (TileItem) current;
|
||||
if (item.getId() == itemId)
|
||||
{
|
||||
quantity = item.getQuantity();
|
||||
|
||||
@@ -77,7 +77,10 @@ public class GroundMarkerPlugin extends Plugin
|
||||
{
|
||||
private static final String CONFIG_GROUP = "groundMarker";
|
||||
private static final String MARK = "Mark tile";
|
||||
<<<<<<< HEAD
|
||||
private static final Pattern GROUP_MATCHER = Pattern.compile(".*ark tile \\(Group (\\d)\\)");
|
||||
=======
|
||||
>>>>>>> Upstream/master
|
||||
private static final String UNMARK = "Unmark tile";
|
||||
private static final String WALK_HERE = "Walk here";
|
||||
private static final String REGION_PREFIX = "region_";
|
||||
@@ -321,8 +324,18 @@ public class GroundMarkerPlugin extends Plugin
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
menuEntry.setType(MenuAction.RUNELITE.getId());
|
||||
|
||||
<<<<<<< HEAD
|
||||
lastIndex++;
|
||||
}
|
||||
=======
|
||||
final WorldPoint worldPoint = WorldPoint.fromLocalInstance(client, client.getSelectedSceneTile().getLocalLocation());
|
||||
final int regionId = worldPoint.getRegionID();
|
||||
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), config.markerColor());
|
||||
|
||||
menuEntry.setOption(getPoints(regionId).contains(point) ? UNMARK : MARK);
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
menuEntry.setType(MenuAction.RUNELITE.getId());
|
||||
>>>>>>> Upstream/master
|
||||
|
||||
client.setMenuEntries(menuEntries);
|
||||
}
|
||||
@@ -330,7 +343,12 @@ public class GroundMarkerPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId() || (!event.getOption().contains(MARK) && !event.getOption().contains(UNMARK)))
|
||||
=======
|
||||
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId() ||
|
||||
!(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK)))
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ import net.runelite.api.HealthBar;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.Sprite;
|
||||
import net.runelite.api.events.BeforeMenuRender;
|
||||
import net.runelite.api.events.ClientTick;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.PostHealthBar;
|
||||
import net.runelite.api.events.WidgetPositioned;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
@@ -129,7 +129,12 @@ public class InterfaceStylesPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
private void onWidgetPositioned(WidgetPositioned widgetPositioned)
|
||||
=======
|
||||
@Subscribe
|
||||
public void onClientTick(ClientTick event)
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
adjustWidgetDimensions();
|
||||
}
|
||||
|
||||
@@ -137,6 +137,11 @@ public class LootTrackerPlugin extends Plugin
|
||||
private static final String HERBIBOAR_LOOTED_MESSAGE = "You harvest herbs from the herbiboar, whereupon it escapes.";
|
||||
private static final String HERBIBOR_EVENT = "Herbiboar";
|
||||
|
||||
// Hespori loot handling
|
||||
private static final String HESPORI_LOOTED_MESSAGE = "You have successfully cleared this patch for new crops.";
|
||||
private static final String HESPORI_EVENT = "Hespori";
|
||||
private static final int HESPORI_REGION = 5021;
|
||||
|
||||
// Chest loot handling
|
||||
private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!";
|
||||
private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*");
|
||||
@@ -684,8 +689,16 @@ public class LootTrackerPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
// Remove all tags
|
||||
final String chatMessage = Text.removeTags(message);
|
||||
=======
|
||||
if (HESPORI_REGION == client.getLocalPlayer().getWorldLocation().getRegionID() && message.equals(HESPORI_LOOTED_MESSAGE))
|
||||
{
|
||||
eventType = HESPORI_EVENT;
|
||||
takeInventorySnapshot();
|
||||
}
|
||||
>>>>>>> Upstream/master
|
||||
|
||||
// Check if message is for a clue scroll reward
|
||||
final Matcher m = CLUE_SCROLL_PATTERN.matcher(chatMessage);
|
||||
@@ -762,6 +775,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
|
||||
public void onItemContainerChanged(ItemContainerChanged event)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (pvpDeath && RESPAWN_REGIONS.contains(client.getLocalPlayer().getWorldLocation().getRegionID()))
|
||||
{
|
||||
Multiset snapshot;
|
||||
@@ -808,6 +822,9 @@ public class LootTrackerPlugin extends Plugin
|
||||
|
||||
}
|
||||
if (eventType != null && (CHEST_EVENT_TYPES.containsValue(eventType) || HERBIBOR_EVENT.equals(eventType)))
|
||||
=======
|
||||
if (eventType != null && (CHEST_EVENT_TYPES.containsValue(eventType) || HERBIBOR_EVENT.equals(eventType) || HESPORI_EVENT.equals(eventType)))
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
if (event.getItemContainer() != client.getItemContainer(InventoryID.INVENTORY))
|
||||
{
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<<<<<<< HEAD
|
||||
/*
|
||||
* Copyright (c) 2018, Jasper Ketelaar <Jasper0781@gmail.com>
|
||||
* All rights reserved.
|
||||
@@ -163,3 +164,146 @@ public class EnchantmentRoom extends MTARoom
|
||||
&& player.getWorldLocation().getPlane() == 0;
|
||||
}
|
||||
}
|
||||
=======
|
||||
/*
|
||||
* Copyright (c) 2018, Jasper Ketelaar <Jasper0781@gmail.com>
|
||||
* 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.mta.enchantment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemDespawned;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.mta.MTAConfig;
|
||||
import net.runelite.client.plugins.mta.MTARoom;
|
||||
|
||||
@Slf4j
|
||||
public class EnchantmentRoom extends MTARoom
|
||||
{
|
||||
private static final int MTA_ENCHANT_REGION = 13462;
|
||||
|
||||
private final Client client;
|
||||
private final List<WorldPoint> dragonstones = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
private EnchantmentRoom(MTAConfig config, Client client)
|
||||
{
|
||||
super(config);
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOADING)
|
||||
{
|
||||
dragonstones.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (!inside() || !config.enchantment())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPoint nearest = findNearestStone();
|
||||
if (nearest != null)
|
||||
{
|
||||
client.setHintArrow(nearest);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
}
|
||||
|
||||
private WorldPoint findNearestStone()
|
||||
{
|
||||
WorldPoint nearest = null;
|
||||
double dist = Double.MAX_VALUE;
|
||||
WorldPoint local = client.getLocalPlayer().getWorldLocation();
|
||||
for (WorldPoint worldPoint : dragonstones)
|
||||
{
|
||||
double currDist = local.distanceTo(worldPoint);
|
||||
if (nearest == null || currDist < dist)
|
||||
{
|
||||
dist = currDist;
|
||||
nearest = worldPoint;
|
||||
}
|
||||
}
|
||||
return nearest;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
final TileItem item = itemSpawned.getItem();
|
||||
final Tile tile = itemSpawned.getTile();
|
||||
|
||||
if (item.getId() == ItemID.DRAGONSTONE_6903)
|
||||
{
|
||||
WorldPoint location = tile.getWorldLocation();
|
||||
log.debug("Adding dragonstone at {}", location);
|
||||
dragonstones.add(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
final TileItem item = itemDespawned.getItem();
|
||||
final Tile tile = itemDespawned.getTile();
|
||||
|
||||
if (item.getId() == ItemID.DRAGONSTONE_6903)
|
||||
{
|
||||
WorldPoint location = tile.getWorldLocation();
|
||||
log.debug("Removed dragonstone at {}", location);
|
||||
dragonstones.remove(location);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean inside()
|
||||
{
|
||||
Player player = client.getLocalPlayer();
|
||||
return player != null && player.getWorldLocation().getRegionID() == MTA_ENCHANT_REGION
|
||||
&& player.getWorldLocation().getPlane() == 0;
|
||||
}
|
||||
}
|
||||
>>>>>>> Upstream/master
|
||||
|
||||
@@ -87,7 +87,11 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
|
||||
// Option added to NPC menu
|
||||
private static final String TAG = "Tag";
|
||||
<<<<<<< HEAD
|
||||
private static final String UNTAG = "Untag";
|
||||
=======
|
||||
private static final String UNTAG = "Un-tag";
|
||||
>>>>>>> Upstream/master
|
||||
|
||||
private static final Set<MenuAction> NPC_MENU_ACTIONS = ImmutableSet.of(MenuAction.NPC_FIRST_OPTION, MenuAction.NPC_SECOND_OPTION,
|
||||
MenuAction.NPC_THIRD_OPTION, MenuAction.NPC_FOURTH_OPTION, MenuAction.NPC_FIFTH_OPTION);
|
||||
@@ -316,7 +320,11 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
// Add tag option
|
||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||
final MenuEntry tagEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||
<<<<<<< HEAD
|
||||
tagEntry.setOption(npcTags.contains(event.getIdentifier()) ? UNTAG : TAG);
|
||||
=======
|
||||
tagEntry.setOption(highlightedNpcs.stream().anyMatch(npc -> npc.getIndex() == event.getIdentifier()) ? UNTAG : TAG);
|
||||
>>>>>>> Upstream/master
|
||||
tagEntry.setTarget(event.getTarget());
|
||||
tagEntry.setParam0(event.getActionParam0());
|
||||
tagEntry.setParam1(event.getActionParam1());
|
||||
@@ -328,9 +336,14 @@ public class NpcIndicatorsPlugin extends Plugin
|
||||
|
||||
private void onMenuOptionClicked(MenuOptionClicked click)
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
if (click.getMenuAction() != MenuAction.RUNELITE
|
||||
|| (!click.getOption().equals(TAG)
|
||||
&& !click.getOption().equals(UNTAG)))
|
||||
=======
|
||||
if (click.getMenuAction() != MenuAction.RUNELITE ||
|
||||
!(click.getMenuOption().equals(TAG) || click.getMenuOption().equals(UNTAG)))
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -247,9 +247,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
return;
|
||||
}
|
||||
|
||||
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
|
||||
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||
<<<<<<< HEAD
|
||||
|
||||
String option = MARK;
|
||||
|
||||
@@ -288,6 +291,9 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
|
||||
menuEntry.setOption(option);
|
||||
|
||||
=======
|
||||
menuEntry.setOption(objects.contains(findTileObject(tile, event.getIdentifier())) ? UNMARK : MARK);
|
||||
>>>>>>> Upstream/master
|
||||
menuEntry.setTarget(event.getTarget());
|
||||
menuEntry.setParam0(event.getActionParam0());
|
||||
menuEntry.setParam1(event.getActionParam1());
|
||||
@@ -299,8 +305,12 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuAction() != MenuAction.RUNELITE
|
||||
<<<<<<< HEAD
|
||||
|| (!event.getOption().equals(MARK)
|
||||
&& !event.getOption().equals(UNMARK)))
|
||||
=======
|
||||
|| !(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK)))
|
||||
>>>>>>> Upstream/master
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,9 +114,9 @@ public class TimersPlugin extends Plugin
|
||||
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 =< Antipoison < 0
|
||||
private static final int POISON_TICK_LENGTH = 30;
|
||||
|
||||
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 1 minute, 15 seconds.</col>");
|
||||
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 5 minutes, 0 seconds.</col>");
|
||||
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 2 minutes, 30 seconds.</col>");
|
||||
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
||||
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\.</col>");
|
||||
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
||||
|
||||
private TimerTimer freezeTimer;
|
||||
private int freezeTime = -1; // time frozen, in game ticks
|
||||
|
||||
@@ -39,6 +39,7 @@ import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.SwingUtilities;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MenuAction;
|
||||
@@ -61,6 +62,7 @@ import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.MiscUtils;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
{
|
||||
private static final int BORDER = 5;
|
||||
@@ -496,8 +498,23 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
}
|
||||
|
||||
subGraphics.translate(point.x, point.y);
|
||||
final Dimension dimension = MoreObjects.firstNonNull(overlay.render(subGraphics), new Dimension());
|
||||
subGraphics.dispose();
|
||||
|
||||
final Dimension overlayDimension;
|
||||
try
|
||||
{
|
||||
overlayDimension = overlay.render(subGraphics);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.warn("Error during overlay rendering", ex);
|
||||
return;
|
||||
}
|
||||
finally
|
||||
{
|
||||
subGraphics.dispose();
|
||||
}
|
||||
|
||||
final Dimension dimension = MoreObjects.firstNonNull(overlayDimension, new Dimension());
|
||||
overlay.setBounds(new Rectangle(point, dimension));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.ui.overlay.components;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.FontMetrics;
|
||||
@@ -96,6 +97,7 @@ public class TooltipComponent implements RenderableEntity
|
||||
char[] chars = line.toCharArray();
|
||||
|
||||
int begin = 0;
|
||||
boolean inTag = false;
|
||||
for (int j = 0; j < chars.length; j++)
|
||||
{
|
||||
if (chars[j] == '<')
|
||||
@@ -110,8 +112,9 @@ public class TooltipComponent implements RenderableEntity
|
||||
lineX += metrics.stringWidth(text);
|
||||
|
||||
begin = j;
|
||||
inTag = true;
|
||||
}
|
||||
else if (chars[j] == '>')
|
||||
else if (chars[j] == '>' && inTag)
|
||||
{
|
||||
String subLine = line.substring(begin + 1, j);
|
||||
|
||||
@@ -148,6 +151,7 @@ public class TooltipComponent implements RenderableEntity
|
||||
}
|
||||
|
||||
begin = j + 1;
|
||||
inTag = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,12 +166,14 @@ public class TooltipComponent implements RenderableEntity
|
||||
return new Dimension(tooltipWidth + OFFSET * 2, tooltipHeight + OFFSET * 2);
|
||||
}
|
||||
|
||||
private static int calculateTextWidth(FontMetrics metrics, String line)
|
||||
@VisibleForTesting
|
||||
static int calculateTextWidth(FontMetrics metrics, String line)
|
||||
{
|
||||
char[] chars = line.toCharArray();
|
||||
int textWidth = 0;
|
||||
|
||||
int begin = 0;
|
||||
boolean inTag = false;
|
||||
for (int j = 0; j < chars.length; j++)
|
||||
{
|
||||
if (chars[j] == '<')
|
||||
@@ -175,8 +181,9 @@ public class TooltipComponent implements RenderableEntity
|
||||
textWidth += metrics.stringWidth(line.substring(begin, j));
|
||||
|
||||
begin = j;
|
||||
inTag = true;
|
||||
}
|
||||
else if (chars[j] == '>')
|
||||
else if (chars[j] == '>' && inTag)
|
||||
{
|
||||
String subLine = line.substring(begin + 1, j);
|
||||
|
||||
@@ -190,6 +197,7 @@ public class TooltipComponent implements RenderableEntity
|
||||
}
|
||||
|
||||
begin = j + 1;
|
||||
inTag = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -66,6 +66,19 @@ public class TooltipOverlay extends Overlay
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return renderTooltips(graphics, tooltips);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Tooltips must always be cleared each frame
|
||||
tooltipManager.clear();
|
||||
}
|
||||
}
|
||||
|
||||
private Dimension renderTooltips(Graphics2D graphics, List<Tooltip> tooltips)
|
||||
{
|
||||
final Rectangle clientCanvasBounds = new Rectangle(client.getRealDimensions());
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
final Point mousePosition = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + OFFSET);
|
||||
@@ -113,7 +126,6 @@ public class TooltipOverlay extends Overlay
|
||||
newBounds.width = Math.max(newBounds.width, dimension.width);
|
||||
}
|
||||
|
||||
tooltipManager.clear();
|
||||
return newBounds.getSize();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,8 +33,8 @@ import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Node;
|
||||
@@ -180,9 +180,9 @@ public class GameEventManager
|
||||
{
|
||||
Node current = itemLayer.getBottom();
|
||||
|
||||
while (current instanceof Item)
|
||||
while (current instanceof TileItem)
|
||||
{
|
||||
final Item item = (Item) current;
|
||||
final TileItem item = (TileItem) current;
|
||||
|
||||
current = current.getNext();
|
||||
|
||||
|
||||
@@ -52,6 +52,11 @@ import net.runelite.api.Sprite;
|
||||
@Slf4j
|
||||
public class ImageUtil
|
||||
{
|
||||
static
|
||||
{
|
||||
ImageIO.setUseCache(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a {@link BufferedImage} from an {@link Image}.
|
||||
*
|
||||
|
||||
@@ -174,7 +174,13 @@
|
||||
"vial": [
|
||||
229,
|
||||
2389,
|
||||
2390
|
||||
2390,
|
||||
23839,
|
||||
23879
|
||||
],
|
||||
"pestle and mortar": [
|
||||
233,
|
||||
23865
|
||||
],
|
||||
"unicorn horn": [
|
||||
237,
|
||||
@@ -186,6 +192,8 @@
|
||||
],
|
||||
"key": [
|
||||
275,
|
||||
293,
|
||||
298,
|
||||
423,
|
||||
1543,
|
||||
1544,
|
||||
@@ -230,10 +238,6 @@
|
||||
21057,
|
||||
21058
|
||||
],
|
||||
"a key": [
|
||||
293,
|
||||
298
|
||||
],
|
||||
"glarials urn": [
|
||||
296,
|
||||
297
|
||||
@@ -252,7 +256,8 @@
|
||||
357,
|
||||
367,
|
||||
369,
|
||||
20854
|
||||
20854,
|
||||
23873
|
||||
],
|
||||
"shark": [
|
||||
385,
|
||||
@@ -656,7 +661,7 @@
|
||||
8987,
|
||||
9665
|
||||
],
|
||||
"bronze fire arrows": [
|
||||
"bronze fire arrow": [
|
||||
598,
|
||||
942
|
||||
],
|
||||
@@ -1337,7 +1342,12 @@
|
||||
23179,
|
||||
23180,
|
||||
23181,
|
||||
23182
|
||||
23182,
|
||||
23770,
|
||||
23814,
|
||||
23815,
|
||||
23816,
|
||||
23817
|
||||
],
|
||||
"radimus notes": [
|
||||
714,
|
||||
@@ -1605,6 +1615,10 @@
|
||||
11046,
|
||||
20587
|
||||
],
|
||||
"flier": [
|
||||
956,
|
||||
23670
|
||||
],
|
||||
"skull": [
|
||||
964,
|
||||
965
|
||||
@@ -2131,17 +2145,14 @@
|
||||
1481,
|
||||
1482,
|
||||
1483,
|
||||
1484
|
||||
1484,
|
||||
23812
|
||||
],
|
||||
"paladins badge": [
|
||||
1488,
|
||||
1489,
|
||||
1490
|
||||
],
|
||||
"a magic scroll": [
|
||||
1505,
|
||||
6949
|
||||
],
|
||||
"logs": [
|
||||
1511,
|
||||
2511
|
||||
@@ -2661,7 +2672,8 @@
|
||||
2380,
|
||||
2381,
|
||||
2382,
|
||||
2383
|
||||
2383,
|
||||
23802
|
||||
],
|
||||
"silverlight key": [
|
||||
2399,
|
||||
@@ -2770,23 +2782,23 @@
|
||||
2529,
|
||||
17152
|
||||
],
|
||||
"iron fire arrows": [
|
||||
"iron fire arrow": [
|
||||
2532,
|
||||
2533
|
||||
],
|
||||
"steel fire arrows": [
|
||||
"steel fire arrow": [
|
||||
2534,
|
||||
2535
|
||||
],
|
||||
"mithril fire arrows": [
|
||||
"mithril fire arrow": [
|
||||
2536,
|
||||
2537
|
||||
],
|
||||
"adamant fire arrows": [
|
||||
"adamant fire arrow": [
|
||||
2538,
|
||||
2539
|
||||
],
|
||||
"rune fire arrows": [
|
||||
"rune fire arrow": [
|
||||
2540,
|
||||
2541
|
||||
],
|
||||
@@ -3431,6 +3443,10 @@
|
||||
4041,
|
||||
4042
|
||||
],
|
||||
"explosive potion": [
|
||||
4045,
|
||||
23818
|
||||
],
|
||||
"decorative sword": [
|
||||
4068,
|
||||
4503,
|
||||
@@ -3595,6 +3611,7 @@
|
||||
],
|
||||
"crystal bow": [
|
||||
4212,
|
||||
4213,
|
||||
4214,
|
||||
4215,
|
||||
4216,
|
||||
@@ -3615,7 +3632,14 @@
|
||||
11755,
|
||||
11756,
|
||||
11757,
|
||||
11758
|
||||
11758,
|
||||
16888,
|
||||
16889,
|
||||
23901,
|
||||
23902,
|
||||
23903,
|
||||
23983,
|
||||
23985
|
||||
],
|
||||
"crystal shield": [
|
||||
4224,
|
||||
@@ -3629,6 +3653,7 @@
|
||||
4232,
|
||||
4233,
|
||||
4234,
|
||||
4235,
|
||||
11759,
|
||||
11760,
|
||||
11761,
|
||||
@@ -3639,7 +3664,11 @@
|
||||
11766,
|
||||
11767,
|
||||
11768,
|
||||
11769
|
||||
11769,
|
||||
16890,
|
||||
16891,
|
||||
23991,
|
||||
23993
|
||||
],
|
||||
"nettle tea": [
|
||||
4239,
|
||||
@@ -4586,16 +4615,13 @@
|
||||
6065,
|
||||
10621
|
||||
],
|
||||
"mourner trousers": [
|
||||
6066,
|
||||
6067
|
||||
],
|
||||
"teleport crystal": [
|
||||
6099,
|
||||
6100,
|
||||
6101,
|
||||
6102,
|
||||
13102
|
||||
13102,
|
||||
23904
|
||||
],
|
||||
"ghostly boots": [
|
||||
6106,
|
||||
@@ -4843,13 +4869,40 @@
|
||||
6617,
|
||||
10618
|
||||
],
|
||||
"hand mirror": [
|
||||
6639,
|
||||
23775
|
||||
],
|
||||
"red crystal": [
|
||||
6640,
|
||||
23776
|
||||
],
|
||||
"yellow crystal": [
|
||||
6641,
|
||||
23777
|
||||
],
|
||||
"green crystal": [
|
||||
6642,
|
||||
23778,
|
||||
23783
|
||||
],
|
||||
"cyan crystal": [
|
||||
6643,
|
||||
22366
|
||||
22366,
|
||||
23779
|
||||
],
|
||||
"blue crystal": [
|
||||
6644,
|
||||
23780
|
||||
],
|
||||
"magenta crystal": [
|
||||
6645,
|
||||
23781
|
||||
],
|
||||
"fractured crystal": [
|
||||
6646,
|
||||
6647
|
||||
6647,
|
||||
23784
|
||||
],
|
||||
"newly made crystal": [
|
||||
6651,
|
||||
@@ -7241,7 +7294,7 @@
|
||||
11229,
|
||||
20389
|
||||
],
|
||||
"dragon fire arrows": [
|
||||
"dragon fire arrow": [
|
||||
11217,
|
||||
11222
|
||||
],
|
||||
@@ -7720,7 +7773,8 @@
|
||||
],
|
||||
"dragon pickaxe": [
|
||||
11920,
|
||||
12797
|
||||
12797,
|
||||
23677
|
||||
],
|
||||
"malediction ward": [
|
||||
11924,
|
||||
@@ -8141,7 +8195,14 @@
|
||||
13098,
|
||||
13099,
|
||||
13100,
|
||||
13101
|
||||
13101,
|
||||
16892,
|
||||
16893,
|
||||
23895,
|
||||
23896,
|
||||
23897,
|
||||
23987,
|
||||
23989
|
||||
],
|
||||
"vetion jr": [
|
||||
13179,
|
||||
@@ -8598,6 +8659,12 @@
|
||||
20781,
|
||||
21059
|
||||
],
|
||||
"corrupted helm": [
|
||||
20838,
|
||||
23840,
|
||||
23841,
|
||||
23842
|
||||
],
|
||||
"dragon thrownaxe": [
|
||||
20849,
|
||||
21207
|
||||
@@ -8780,7 +8847,7 @@
|
||||
21334,
|
||||
21336
|
||||
],
|
||||
"amethyst fire arrows": [
|
||||
"amethyst fire arrow": [
|
||||
21328,
|
||||
21330
|
||||
],
|
||||
@@ -9235,5 +9302,172 @@
|
||||
"giant egg sac": [
|
||||
23517,
|
||||
23520
|
||||
],
|
||||
"crystal seedling": [
|
||||
23655,
|
||||
23657
|
||||
],
|
||||
"crystal axe": [
|
||||
23673,
|
||||
23675,
|
||||
23862
|
||||
],
|
||||
"crystal pickaxe": [
|
||||
23680,
|
||||
23682,
|
||||
23863
|
||||
],
|
||||
"divine super combat potion": [
|
||||
23685,
|
||||
23688,
|
||||
23691,
|
||||
23694
|
||||
],
|
||||
"divine super attack potion": [
|
||||
23697,
|
||||
23700,
|
||||
23703,
|
||||
23706
|
||||
],
|
||||
"divine super strength potion": [
|
||||
23709,
|
||||
23712,
|
||||
23715,
|
||||
23718
|
||||
],
|
||||
"divine super defence potion": [
|
||||
23721,
|
||||
23724,
|
||||
23727,
|
||||
23730
|
||||
],
|
||||
"divine ranging potion": [
|
||||
23733,
|
||||
23736,
|
||||
23739,
|
||||
23742
|
||||
],
|
||||
"divine magic potion": [
|
||||
23745,
|
||||
23748,
|
||||
23751,
|
||||
23754
|
||||
],
|
||||
"crystal harpoon": [
|
||||
23762,
|
||||
23764,
|
||||
23864
|
||||
],
|
||||
"crystal dust": [
|
||||
23804,
|
||||
23867,
|
||||
23964
|
||||
],
|
||||
"crystal seed": [
|
||||
23808,
|
||||
23810
|
||||
],
|
||||
"weapon frame": [
|
||||
23834,
|
||||
23871
|
||||
],
|
||||
"grym leaf": [
|
||||
23835,
|
||||
23875
|
||||
],
|
||||
"linum tirinum": [
|
||||
23836,
|
||||
23876
|
||||
],
|
||||
"phren bark": [
|
||||
23838,
|
||||
23878
|
||||
],
|
||||
"corrupted body": [
|
||||
23843,
|
||||
23844,
|
||||
23845
|
||||
],
|
||||
"corrupted legs": [
|
||||
23846,
|
||||
23847,
|
||||
23848
|
||||
],
|
||||
"corrupted halberd": [
|
||||
23849,
|
||||
23850,
|
||||
23851
|
||||
],
|
||||
"corrupted staff": [
|
||||
23852,
|
||||
23853,
|
||||
23854
|
||||
],
|
||||
"corrupted bow": [
|
||||
23855,
|
||||
23856,
|
||||
23857
|
||||
],
|
||||
"egniol potion": [
|
||||
23882,
|
||||
23883,
|
||||
23884,
|
||||
23885
|
||||
],
|
||||
"crystal helm": [
|
||||
23886,
|
||||
23887,
|
||||
23888,
|
||||
23971,
|
||||
23973
|
||||
],
|
||||
"crystal body": [
|
||||
23889,
|
||||
23890,
|
||||
23891,
|
||||
23975,
|
||||
23977
|
||||
],
|
||||
"crystal legs": [
|
||||
23892,
|
||||
23893,
|
||||
23894,
|
||||
23979,
|
||||
23981
|
||||
],
|
||||
"crystal staff": [
|
||||
23898,
|
||||
23899,
|
||||
23900
|
||||
],
|
||||
"crystal crown": [
|
||||
23911,
|
||||
23913,
|
||||
23915,
|
||||
23917,
|
||||
23919,
|
||||
23921,
|
||||
23923,
|
||||
23925
|
||||
],
|
||||
"blade of saeldor": [
|
||||
23995,
|
||||
23997
|
||||
],
|
||||
"elven top": [
|
||||
24009,
|
||||
24015,
|
||||
24021,
|
||||
24027
|
||||
],
|
||||
"elven skirt": [
|
||||
24012,
|
||||
24018
|
||||
],
|
||||
"memoriam crystal": [
|
||||
24030,
|
||||
24031,
|
||||
24032,
|
||||
24033
|
||||
]
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
4D9A96A7D57F6B9661273FB645A0510DD0F02C8A9C2E133772065F8AB588614D
|
||||
A6B3A7BFE7B688A08F69B91A7FD5C7184D71147D3DAF74B1262369D85DBB3A03
|
||||
@@ -77,14 +77,14 @@ LABEL60:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL64
|
||||
jump LABEL119
|
||||
jump LABEL108
|
||||
LABEL64:
|
||||
iload 1
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL70
|
||||
jump LABEL114
|
||||
jump LABEL103
|
||||
LABEL70:
|
||||
iload 5
|
||||
invoke 1358
|
||||
@@ -96,7 +96,7 @@ LABEL70:
|
||||
LABEL77:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL100
|
||||
jump LABEL89
|
||||
LABEL80:
|
||||
iload 3
|
||||
iconst 0
|
||||
@@ -105,24 +105,11 @@ LABEL80:
|
||||
LABEL84:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL100
|
||||
jump LABEL89
|
||||
LABEL87:
|
||||
iconst 105
|
||||
iconst 74
|
||||
iconst 2099
|
||||
iload 5
|
||||
enum
|
||||
iconst 603
|
||||
if_icmpeq LABEL95
|
||||
jump LABEL98
|
||||
LABEL95:
|
||||
iconst 10461087
|
||||
istore 4
|
||||
jump LABEL100
|
||||
LABEL98:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL100:
|
||||
LABEL89:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
@@ -137,54 +124,54 @@ LABEL100:
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL114:
|
||||
LABEL103:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL60
|
||||
LABEL119:
|
||||
LABEL108:
|
||||
iconst 0
|
||||
invoke 2265
|
||||
istore 6
|
||||
istore 5
|
||||
LABEL123:
|
||||
LABEL112:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL127
|
||||
jump LABEL171
|
||||
LABEL127:
|
||||
if_icmplt LABEL116
|
||||
jump LABEL160
|
||||
LABEL116:
|
||||
iload 2
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL133
|
||||
jump LABEL166
|
||||
LABEL133:
|
||||
if_icmpeq LABEL122
|
||||
jump LABEL155
|
||||
LABEL122:
|
||||
iload 5
|
||||
invoke 1359
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL140
|
||||
jump LABEL143
|
||||
LABEL140:
|
||||
if_icmpeq LABEL129
|
||||
jump LABEL132
|
||||
LABEL129:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL152
|
||||
LABEL143:
|
||||
jump LABEL141
|
||||
LABEL132:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL147
|
||||
jump LABEL150
|
||||
LABEL147:
|
||||
if_icmpeq LABEL136
|
||||
jump LABEL139
|
||||
LABEL136:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL152
|
||||
LABEL150:
|
||||
jump LABEL141
|
||||
LABEL139:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL152:
|
||||
LABEL141:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
@@ -199,13 +186,13 @@ LABEL152:
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL166:
|
||||
LABEL155:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL123
|
||||
LABEL171:
|
||||
jump LABEL112
|
||||
LABEL160:
|
||||
sconst "questProgressUpdated"
|
||||
runelite_callback
|
||||
return
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
975C2E20F49CD83A72B6A7BA4CF34F9B476F26DCD2649B0CE79B3F93CBB892DD
|
||||
@@ -0,0 +1,426 @@
|
||||
.id 923
|
||||
.int_stack_count 0
|
||||
.string_stack_count 0
|
||||
.int_var_count 5
|
||||
.string_var_count 0
|
||||
; callback "chatboxBackgroundBuilt"
|
||||
; used by the ChatboxPerformancePlugin to know when it needs to rebuild.
|
||||
; Unmark the plugin as hidden and toggle it. The chatbox should change opacity
|
||||
; slightly
|
||||
iconst 10616834
|
||||
cc_deleteall
|
||||
iconst 0
|
||||
istore 0
|
||||
get_varc_int 41
|
||||
iconst 1337
|
||||
if_icmpeq LABEL8
|
||||
jump LABEL24
|
||||
LABEL8:
|
||||
invoke 922
|
||||
iconst 1
|
||||
if_icmpeq LABEL12
|
||||
jump LABEL15
|
||||
LABEL12:
|
||||
iconst 1
|
||||
istore 0
|
||||
jump LABEL24
|
||||
LABEL15:
|
||||
getwindowmode
|
||||
iconst 1
|
||||
if_icmpeq LABEL19
|
||||
jump LABEL24
|
||||
LABEL19:
|
||||
iconst 0
|
||||
set_varc_int 41
|
||||
iconst 0
|
||||
iconst 0
|
||||
invoke 183
|
||||
LABEL24:
|
||||
iload 0
|
||||
iconst 10616869
|
||||
if_sethide
|
||||
get_varbit 6374
|
||||
iconst 1
|
||||
if_icmpeq LABEL31
|
||||
jump LABEL48
|
||||
LABEL31:
|
||||
getwindowmode
|
||||
iconst 1
|
||||
if_icmpne LABEL35
|
||||
jump LABEL48
|
||||
LABEL35:
|
||||
iconst 1
|
||||
iconst 0
|
||||
iconst 2
|
||||
iconst 0
|
||||
iconst 10616890
|
||||
if_setposition
|
||||
iconst -1
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 10617391
|
||||
if_setposition
|
||||
jump LABEL60
|
||||
LABEL48:
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 10616890
|
||||
if_setposition
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 2
|
||||
iconst 0
|
||||
iconst 10617391
|
||||
if_setposition
|
||||
LABEL60:
|
||||
iconst 10616870
|
||||
cc_deleteall
|
||||
iconst 10616888
|
||||
cc_deleteall
|
||||
iconst 0
|
||||
istore 1
|
||||
clientclock
|
||||
get_varc_int 223
|
||||
if_icmplt LABEL70
|
||||
jump LABEL82
|
||||
LABEL70:
|
||||
invoke 900
|
||||
iconst 1129
|
||||
if_icmpne LABEL74
|
||||
jump LABEL82
|
||||
LABEL74:
|
||||
iconst 1
|
||||
istore 1
|
||||
iconst 2155
|
||||
get_varc_int 223
|
||||
sconst "i"
|
||||
iconst 10616870
|
||||
if_setontimer
|
||||
jump LABEL86
|
||||
LABEL82:
|
||||
iconst -1
|
||||
sconst ""
|
||||
iconst 10616870
|
||||
if_setontimer
|
||||
LABEL86:
|
||||
invoke 921
|
||||
iconst 0
|
||||
if_icmpeq LABEL90
|
||||
jump LABEL156
|
||||
LABEL90:
|
||||
iconst 1
|
||||
iconst 10616870
|
||||
if_setnoclickthrough
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpeq LABEL97
|
||||
jump LABEL135
|
||||
LABEL97:
|
||||
iconst 10616870
|
||||
iconst 5
|
||||
iconst 0
|
||||
cc_create
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 1
|
||||
cc_setsize
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 1
|
||||
cc_setposition
|
||||
iconst 1017
|
||||
cc_setgraphic
|
||||
iconst 0
|
||||
cc_settiling
|
||||
iconst 0
|
||||
cc_settrans
|
||||
iconst 10616888
|
||||
iconst 3
|
||||
iconst 0
|
||||
cc_create
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 1
|
||||
iconst 0
|
||||
cc_setsize
|
||||
iconst 0
|
||||
iconst 15
|
||||
iconst 1
|
||||
iconst 2
|
||||
cc_setposition
|
||||
iconst 8418912
|
||||
cc_setcolour
|
||||
iconst 1
|
||||
cc_setfill
|
||||
LABEL135:
|
||||
iconst 10617391
|
||||
iconst 792
|
||||
iconst 789
|
||||
iconst 790
|
||||
iconst 791
|
||||
iconst 773
|
||||
iconst 788
|
||||
iconst 0
|
||||
invoke 838
|
||||
invoke 2373
|
||||
iconst 1
|
||||
if_icmpeq LABEL148
|
||||
jump LABEL152
|
||||
LABEL148:
|
||||
iconst 255
|
||||
iconst 10616835
|
||||
if_settrans
|
||||
jump LABEL155
|
||||
LABEL152:
|
||||
iconst 0
|
||||
iconst 10616835
|
||||
if_settrans
|
||||
LABEL155:
|
||||
return
|
||||
LABEL156:
|
||||
iconst 16384
|
||||
iconst 25
|
||||
div
|
||||
istore 2
|
||||
iconst 16384
|
||||
istore 3
|
||||
get_varbit 2570
|
||||
iconst 1
|
||||
if_icmpeq LABEL166
|
||||
jump LABEL170
|
||||
LABEL166:
|
||||
iconst 1
|
||||
iconst 10616870
|
||||
if_setnoclickthrough
|
||||
jump LABEL176
|
||||
LABEL170:
|
||||
iconst 0
|
||||
iconst 10616870
|
||||
if_setnoclickthrough
|
||||
iconst 1
|
||||
iconst 10616870
|
||||
2006
|
||||
LABEL176:
|
||||
iconst 0
|
||||
istore 4
|
||||
iload 1
|
||||
iconst 0
|
||||
if_icmpeq LABEL182
|
||||
jump LABEL332
|
||||
LABEL182:
|
||||
invoke 1972
|
||||
iconst 0
|
||||
if_icmpeq LABEL186
|
||||
jump LABEL266
|
||||
LABEL186:
|
||||
iload 4
|
||||
iconst 20
|
||||
if_icmplt LABEL190
|
||||
jump LABEL265
|
||||
LABEL190:
|
||||
iconst 10616870
|
||||
iconst 3
|
||||
iload 4
|
||||
cc_create
|
||||
iconst 0
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
cc_setsize
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 2
|
||||
cc_setposition
|
||||
iconst 0
|
||||
cc_setcolour
|
||||
iconst 1
|
||||
cc_setfill
|
||||
iconst 254
|
||||
cc_settrans
|
||||
iconst 10616888
|
||||
iconst 3
|
||||
iload 4
|
||||
iconst 2
|
||||
multiply
|
||||
cc_create
|
||||
iconst 10616888
|
||||
iconst 3
|
||||
iload 4
|
||||
iconst 2
|
||||
multiply
|
||||
iconst 1
|
||||
add
|
||||
cc_create 1
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
iconst 0
|
||||
cc_setsize
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
iconst 0
|
||||
cc_setsize 1
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
cc_setposition
|
||||
iconst 0
|
||||
iconst 15
|
||||
iconst 0
|
||||
iconst 2
|
||||
cc_setposition 1
|
||||
iconst 16777215
|
||||
cc_setcolour
|
||||
iconst 16777215
|
||||
cc_setcolour 1
|
||||
iconst 1
|
||||
cc_setfill
|
||||
iconst 1
|
||||
cc_setfill 1
|
||||
iconst 251
|
||||
cc_settrans
|
||||
iconst 250
|
||||
cc_settrans 1
|
||||
iload 4
|
||||
iconst 1
|
||||
add
|
||||
iload 3
|
||||
iload 2
|
||||
sub
|
||||
istore 3
|
||||
istore 4
|
||||
jump LABEL186
|
||||
LABEL265:
|
||||
sconst "chatboxBackgroundBuilt"
|
||||
runelite_callback
|
||||
jump LABEL332
|
||||
LABEL266:
|
||||
iconst 10616870
|
||||
iconst 3
|
||||
iload 4
|
||||
cc_create
|
||||
iconst 0
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
cc_setsize
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 2
|
||||
cc_setposition
|
||||
iconst 0
|
||||
cc_setcolour
|
||||
iconst 1
|
||||
cc_setfill
|
||||
iconst 225
|
||||
cc_settrans
|
||||
iconst 10616888
|
||||
iconst 3
|
||||
iload 4
|
||||
iconst 2
|
||||
multiply
|
||||
cc_create
|
||||
iconst 10616888
|
||||
iconst 3
|
||||
iload 4
|
||||
iconst 2
|
||||
multiply
|
||||
iconst 1
|
||||
add
|
||||
cc_create 1
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
iconst 0
|
||||
cc_setsize
|
||||
iload 3
|
||||
iconst 1
|
||||
iconst 2
|
||||
iconst 0
|
||||
cc_setsize 1
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 0
|
||||
cc_setposition
|
||||
iconst 0
|
||||
iconst 15
|
||||
iconst 0
|
||||
iconst 2
|
||||
cc_setposition 1
|
||||
iconst 16777215
|
||||
cc_setcolour
|
||||
iconst 16777215
|
||||
cc_setcolour 1
|
||||
iconst 1
|
||||
cc_setfill
|
||||
iconst 1
|
||||
cc_setfill 1
|
||||
iconst 200
|
||||
cc_settrans
|
||||
iconst 130
|
||||
cc_settrans 1
|
||||
LABEL332:
|
||||
iconst 10617391
|
||||
iconst 1190
|
||||
iconst 1187
|
||||
iconst 1188
|
||||
iconst 1189
|
||||
iconst 1185
|
||||
iconst 1186
|
||||
iconst 1
|
||||
invoke 838
|
||||
iload 0
|
||||
iconst 1
|
||||
if_icmpeq LABEL345
|
||||
jump LABEL349
|
||||
LABEL345:
|
||||
iconst 255
|
||||
iconst 10616835
|
||||
if_settrans
|
||||
jump LABEL380
|
||||
LABEL349:
|
||||
invoke 1972
|
||||
iconst 0
|
||||
if_icmpeq LABEL353
|
||||
jump LABEL357
|
||||
LABEL353:
|
||||
iconst 155
|
||||
iconst 10616835
|
||||
if_settrans
|
||||
jump LABEL380
|
||||
LABEL357:
|
||||
iconst 255
|
||||
iconst 10616835
|
||||
if_settrans
|
||||
iconst 10616834
|
||||
iconst 3
|
||||
iconst 0
|
||||
cc_create
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 1
|
||||
cc_setsize
|
||||
iconst 0
|
||||
iconst 0
|
||||
iconst 1
|
||||
iconst 1
|
||||
cc_setposition
|
||||
iconst 0
|
||||
cc_setcolour
|
||||
iconst 1
|
||||
cc_setfill
|
||||
iconst 225
|
||||
cc_settrans
|
||||
LABEL380:
|
||||
return
|
||||
@@ -67,17 +67,9 @@ public class ContainerCalculationTest
|
||||
@Test
|
||||
public void testCalculate()
|
||||
{
|
||||
Item coins = mock(Item.class);
|
||||
when(coins.getId())
|
||||
.thenReturn(ItemID.COINS_995);
|
||||
when(coins.getQuantity())
|
||||
.thenReturn(Integer.MAX_VALUE);
|
||||
Item coins = new Item(ItemID.COINS_995, Integer.MAX_VALUE);
|
||||
|
||||
Item whip = mock(Item.class);
|
||||
when(whip.getId())
|
||||
.thenReturn(ItemID.ABYSSAL_WHIP);
|
||||
when(whip.getQuantity())
|
||||
.thenReturn(1_000_000_000);
|
||||
Item whip = new Item(ItemID.ABYSSAL_WHIP, 1_000_000_000);
|
||||
|
||||
Item[] items = ImmutableList.of(
|
||||
coins,
|
||||
|
||||
@@ -54,7 +54,6 @@ public class ChatFilterPluginTest
|
||||
private ChatFilterConfig chatFilterConfig;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private Player localPlayer;
|
||||
|
||||
@Inject
|
||||
@@ -121,6 +120,16 @@ public class ChatFilterPluginTest
|
||||
assertNull(chatFilterPlugin.censorMessage("te\u008Cst"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReplayedMessage()
|
||||
{
|
||||
when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.REMOVE_MESSAGE);
|
||||
when(chatFilterConfig.filteredWords()).thenReturn("hello osrs");
|
||||
|
||||
chatFilterPlugin.updateFilteredPatterns();
|
||||
assertNull(chatFilterPlugin.censorMessage("hello\u00A0osrs"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromFriendIsFiltered()
|
||||
{
|
||||
|
||||
@@ -44,6 +44,8 @@ import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class EmojiPluginTest
|
||||
@@ -113,4 +115,17 @@ public class EmojiPluginTest
|
||||
|
||||
verify(messageNode).setRuneLiteFormatMessage("<img=10>");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEmojiUpdateMessage()
|
||||
{
|
||||
String PARTY_POPPER = "<img=" + (-1 + Emoji.getEmoji("@@@").ordinal()) + '>';
|
||||
String OPEN_MOUTH = "<img=" + (-1 + Emoji.getEmoji(":O").ordinal()) + '>';
|
||||
assertNull(emojiPlugin.updateMessage("@@@@@"));
|
||||
assertEquals(PARTY_POPPER, emojiPlugin.updateMessage("@@@"));
|
||||
assertEquals(PARTY_POPPER + ' ' + PARTY_POPPER, emojiPlugin.updateMessage("@@@ @@@"));
|
||||
assertEquals(PARTY_POPPER + ' ' + OPEN_MOUTH, emojiPlugin.updateMessage("@@@\u00A0:O"));
|
||||
assertEquals(PARTY_POPPER + ' ' + OPEN_MOUTH + ' ' + PARTY_POPPER, emojiPlugin.updateMessage("@@@\u00A0:O @@@"));
|
||||
assertEquals(PARTY_POPPER + " Hello World " + PARTY_POPPER, emojiPlugin.updateMessage("@@@\u00A0Hello World\u00A0@@@"));
|
||||
}
|
||||
}
|
||||
@@ -135,8 +135,7 @@ public class ItemChargePluginTest
|
||||
when(client.getItemContainer(eq(InventoryID.EQUIPMENT))).thenReturn(equipmentItemContainer);
|
||||
Item[] items = new Item[EquipmentInventorySlot.RING.getSlotIdx() + 1];
|
||||
when(equipmentItemContainer.getItems()).thenReturn(items);
|
||||
Item ring = mock(Item.class);
|
||||
when(ring.getId()).thenReturn(ItemID.RING_OF_FORGING);
|
||||
Item ring = new Item(ItemID.RING_OF_FORGING, 1);
|
||||
items[EquipmentInventorySlot.RING.getSlotIdx()] = ring;
|
||||
// Run message
|
||||
chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", USED_RING_OF_FORGING, "", 0);
|
||||
|
||||
@@ -100,18 +100,13 @@ public class ItemsKeptOnDeathPluginTest
|
||||
when(itemManager.canonicalize(id)).thenReturn(id);
|
||||
when(itemManager.getItemPrice(id, true)).thenReturn(price);
|
||||
|
||||
return mockItem(id, qty);
|
||||
return item(id, qty);
|
||||
}
|
||||
|
||||
// Creates a mocked item
|
||||
private Item mockItem(final int id, final int qty)
|
||||
// Creates a new item
|
||||
private static Item item(final int id, final int qty)
|
||||
{
|
||||
Item item = mock(Item.class);
|
||||
|
||||
when(item.getId()).thenReturn(id);
|
||||
when(item.getQuantity()).thenReturn(qty);
|
||||
|
||||
return item;
|
||||
return new Item(id, qty);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -126,12 +126,12 @@ public class MotherlodePluginTest
|
||||
// Create before inventory
|
||||
ItemContainer inventory = mock(ItemContainer.class);
|
||||
Item[] items = new Item[]{
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.GOLDEN_NUGGET, 4),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.GOLDEN_NUGGET, 4),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
|
||||
};
|
||||
when(inventory.getItems())
|
||||
@@ -145,16 +145,16 @@ public class MotherlodePluginTest
|
||||
inventory = mock(ItemContainer.class);
|
||||
// +1 rune, +4 nugget, +2 coal, +1 addy
|
||||
items = new Item[]{
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.RUNITE_ORE, 1),
|
||||
mockItem(ItemID.GOLDEN_NUGGET, 8),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.COAL, 1),
|
||||
mockItem(ItemID.ADAMANTITE_ORE, 1),
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.RUNITE_ORE, 1),
|
||||
item(ItemID.GOLDEN_NUGGET, 8),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.COAL, 1),
|
||||
item(ItemID.ADAMANTITE_ORE, 1),
|
||||
|
||||
};
|
||||
when(inventory.getItems())
|
||||
@@ -171,11 +171,8 @@ public class MotherlodePluginTest
|
||||
verifyNoMoreInteractions(motherlodeSession);
|
||||
}
|
||||
|
||||
private static Item mockItem(int itemId, int quantity)
|
||||
private static Item item(int itemId, int quantity)
|
||||
{
|
||||
Item item = mock(Item.class);
|
||||
when(item.getId()).thenReturn(itemId);
|
||||
when(item.getQuantity()).thenReturn(quantity);
|
||||
return item;
|
||||
return new Item(itemId, quantity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
||||
* 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.ui.overlay.components;
|
||||
|
||||
import java.awt.FontMetrics;
|
||||
import static net.runelite.client.ui.overlay.components.TooltipComponent.calculateTextWidth;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Test;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class TooltipComponentTest
|
||||
{
|
||||
@Test
|
||||
public void testCalculateTextWidth()
|
||||
{
|
||||
FontMetrics fontMetics = mock(FontMetrics.class);
|
||||
when(fontMetics.stringWidth(anyString())).thenAnswer((invocation) -> ((String) invocation.getArguments()[0]).length());
|
||||
|
||||
assertEquals(11, calculateTextWidth(fontMetics, "line1<col=ff0000>>line2"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user