runeliteplus: merge upstream

This commit is contained in:
Zeruth
2019-07-25 14:30:56 -04:00
parent 51e1ae5aaf
commit 5de903304e
69 changed files with 888 additions and 4463 deletions

View File

@@ -411,12 +411,8 @@ public class ItemManager
* @param itemId item id
* @return item composition
*/
<<<<<<< HEAD
public ItemDefinition getItemDefinition(int itemId)
=======
@Nonnull
public ItemComposition getItemComposition(int itemId)
>>>>>>> Upstream/master
public ItemDefinition getItemDefinition(int itemId)
{
assert client.isClientThread() : "getItemDefinition must be called on client thread";
return itemDefinitions.getUnchecked(itemId);

View File

@@ -34,7 +34,7 @@ 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.ItemDefinition;
import net.runelite.api.widgets.ItemQuantityMode;
import net.runelite.api.widgets.JavaScriptCallback;
import net.runelite.api.widgets.Widget;
@@ -59,7 +59,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
private final ItemManager itemManager;
private final Client client;
private Map<Integer, ItemComposition> results = new LinkedHashMap<>();
private Map<Integer, ItemDefinition> results = new LinkedHashMap<>();
private String tooltipText;
private int index = -1;
@@ -121,7 +121,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
int x = PADDING;
int y = PADDING * 3;
int idx = 0;
for (ItemComposition itemComposition : results.values())
for (ItemDefinition itemDefinition : results.values())
{
Widget item = container.createChild(-1, WidgetType.GRAPHIC);
item.setXPositionMode(WidgetPositionMode.ABSOLUTE_LEFT);
@@ -130,8 +130,8 @@ public class ChatboxItemSearch extends ChatboxTextInput
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.setName("<col=ff9040>" + itemDefinition.getName());
item.setItemId(itemDefinition.getId());
item.setItemQuantity(10000);
item.setItemQuantityMode(ItemQuantityMode.NEVER);
item.setBorderType(1);
@@ -152,7 +152,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
{
if (onItemSelected != null)
{
onItemSelected.accept(itemComposition.getId());
onItemSelected.accept(itemDefinition.getId());
}
chatboxPanelManager.close();
@@ -289,7 +289,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
for (int i = 0; i < client.getItemCount() && results.size() < MAX_RESULTS; i++)
{
ItemComposition itemComposition = itemManager.getItemComposition(itemManager.canonicalize(i));
ItemDefinition itemComposition = itemManager.getItemDefinition(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))

View File

@@ -114,6 +114,7 @@ public class TabInterface
private static final int SCROLL_TICK = 500;
private static final int INCINERATOR_WIDTH = 48;
private static final int INCINERATOR_HEIGHT = 39;
private static TagTab iconToSet;
private final Client client;
private final ClientThread clientThread;
@@ -592,7 +593,6 @@ public class TabInterface
bankSearch.search(InputType.NONE, rememberedSearch, true);
}
<<<<<<< HEAD
if (iconToSet != null)
{
if (event.getOption().startsWith(CHANGE_ICON + " ("))
@@ -612,8 +612,6 @@ 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)

View File

@@ -27,25 +27,16 @@ 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.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -60,29 +51,15 @@ public class ChatboxPerformancePlugin extends Plugin
private Client client;
@Inject
<<<<<<< HEAD
private ClientThread clientThread;
@Inject
private EventBus eventBus;
@Override
protected void startUp() throws Exception
{
eventBus.subscribe(WidgetPositioned.class, this, this::onWidgetPositioned);
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
}
private void onWidgetPositioned(WidgetPositioned event)
=======
private ClientThread clientThread;
@Override
public void startUp()
>>>>>>> Upstream/master
{
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
@@ -96,9 +73,9 @@ public class ChatboxPerformancePlugin extends Plugin
{
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT));
}
eventBus.unregister(this);
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent ev)
{
if (!"chatboxBackgroundBuilt".equals(ev.getEventName()))

View File

@@ -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(2457, 3362, 0), KANDARIN, "South of the Tree Gnome Stronghold, north-east of the Outpost."),
KANDARIN_OUTPOST(new WorldPoint(2458, 3364, 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."),

View File

@@ -86,7 +86,6 @@ 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;
@@ -128,11 +127,10 @@ enum FishingSpot
FISHING_SPOT_4316
),
SALMON("Salmon, Trout", ItemID.RAW_SALMON,
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
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
),
BARB_FISH("Sturgeon, Salmon, Trout", ItemID.LEAPING_STURGEON,
FISHING_SPOT_1542, FISHING_SPOT_7323

View File

@@ -281,6 +281,7 @@ public interface GroundItemsConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "itemHighlightMode",
name = "Item Highlight Mode",
@@ -616,11 +617,11 @@ public interface GroundItemsConfig extends Config
}
@ConfigItem(
keyName = "showTimer",
name = "Show ground item tick countdown timer",
description = "Shows how many ticks left until disappearing.",
position = 48,
parent = "miscStub"
keyName = "showTimer",
name = "Show ground item tick countdown timer",
description = "Shows how many ticks left until disappearing.",
position = 48,
parent = "miscStub"
)
default boolean showTimer()
{

View File

@@ -52,12 +52,7 @@ 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;
@@ -72,11 +67,11 @@ import net.runelite.api.events.ClientTick;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemDespawned;
import net.runelite.api.events.ItemQuantityChanged;
import net.runelite.api.events.ItemSpawned;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.GameTick;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
@@ -110,9 +105,10 @@ import net.runelite.client.util.Text;
@Singleton
public class GroundItemsPlugin extends Plugin
{
@Getter(AccessLevel.PUBLIC)
public static final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
// ItemID for coins
private static final int COINS = ItemID.COINS_995;
// items stay on the ground for 30 mins in an instance
private static final int INSTANCE_DURATION_MILLIS = 45 * 60 * 1000;
private static final int INSTANCE_DURATION_TICKS = (int) floor(30 * 60 / 0.6);
@@ -124,7 +120,6 @@ public class GroundItemsPlugin extends Plugin
private static final int DEATH_DURATION_TICKS = (int) floor(60 * 60 / 0.6);
private static final int NORMAL_DURATION_MILLIS = 60 * 1000;
private static final int NORMAL_DURATION_TICKS = (int) floor(60 / 0.6);
// Ground item menu options
private static final int FIRST_OPTION = MenuAction.GROUND_ITEM_FIRST_OPTION.getId();
private static final int SECOND_OPTION = MenuAction.GROUND_ITEM_SECOND_OPTION.getId();
@@ -134,65 +129,45 @@ public class GroundItemsPlugin extends Plugin
private static final int EXAMINE_ITEM = MenuAction.EXAMINE_ITEM_GROUND.getId();
private static final int WALK = MenuAction.WALK.getId();
private static final int CAST_ON_ITEM = MenuAction.SPELL_CAST_ON_GROUND_ITEM.getId();
private static final String TELEGRAB_TEXT = ColorUtil.wrapWithColorTag("Telekinetic Grab", Color.GREEN) + ColorUtil.prependColorTag(" -> ", Color.WHITE);
private final Map<Integer, Color> priceChecks = new LinkedHashMap<>();
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private Map.Entry<Rectangle, GroundItem> textBoxBounds;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private Map.Entry<Rectangle, GroundItem> hiddenBoxBounds;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private Map.Entry<Rectangle, GroundItem> highlightBoxBounds;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private boolean hotKeyPressed;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private boolean hideAll;
private List<String> hiddenItemList = new CopyOnWriteArrayList<>();
private List<String> highlightedItemsList = new CopyOnWriteArrayList<>();
@Inject
private GroundItemInputListener inputListener;
@Inject
private MouseManager mouseManager;
@Inject
private KeyManager keyManager;
@Inject
private Client client;
@Inject
private ItemManager itemManager;
@Inject
private OverlayManager overlayManager;
@Inject
private GroundItemsConfig config;
@Inject
private GroundItemsOverlay overlay;
@Inject
private Notifier notifier;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PUBLIC)
public static final Map<GroundItem.GroundItemKey, GroundItem> collectedGroundItems = new LinkedHashMap<>();
private final Map<Integer, Color> priceChecks = new LinkedHashMap<>();
private LoadingCache<String, Boolean> highlightedItems;
private LoadingCache<String, Boolean> hiddenItems;
@@ -446,7 +421,7 @@ public class GroundItemsPlugin extends Plugin
}
}
private void sendLootNotification(String itemName, String message)
private void sendLootNotification(String itemName, String message)
{
String notification = "[" + client.getLocalPlayer().getName() + "] " +
"Received a " + message + " item: " + itemName;
@@ -467,7 +442,7 @@ public class GroundItemsPlugin extends Plugin
{
int menuType = menuEntry.getType();
if (menuType == FIRST_OPTION || menuType == SECOND_OPTION || menuType == THIRD_OPTION
|| menuType == FOURTH_OPTION || menuType == FIFTH_OPTION || menuType == EXAMINE_ITEM)
|| menuType == FOURTH_OPTION || menuType == FIFTH_OPTION || menuType == EXAMINE_ITEM)
{
for (MenuEntryWithCount entryWCount : newEntries)
{
@@ -489,13 +464,13 @@ public class GroundItemsPlugin extends Plugin
{
final int aMenuType = a.getEntry().getType();
if (aMenuType == FIRST_OPTION || aMenuType == SECOND_OPTION || aMenuType == THIRD_OPTION
|| aMenuType == FOURTH_OPTION || aMenuType == FIFTH_OPTION || aMenuType == EXAMINE_ITEM
|| aMenuType == WALK)
|| aMenuType == FOURTH_OPTION || aMenuType == FIFTH_OPTION || aMenuType == EXAMINE_ITEM
|| aMenuType == WALK)
{ // only check for item related menu types, so we don't sort other stuff
final int bMenuType = b.getEntry().getType();
if (bMenuType == FIRST_OPTION || bMenuType == SECOND_OPTION || bMenuType == THIRD_OPTION
|| bMenuType == FOURTH_OPTION || bMenuType == FIFTH_OPTION || bMenuType == EXAMINE_ITEM
|| bMenuType == WALK)
|| bMenuType == FOURTH_OPTION || bMenuType == FIFTH_OPTION || bMenuType == EXAMINE_ITEM
|| bMenuType == WALK)
{
final MenuEntry aEntry = a.getEntry();
final int aId = aEntry.getIdentifier();
@@ -883,8 +858,8 @@ public class GroundItemsPlugin extends Plugin
// Explicit highlight takes priority over implicit hide
return isExplicitHidden || (!isExplicitHighlight && canBeHidden && underGe && underHa)
? this.hiddenColor
: null;
? this.hiddenColor
: null;
}
private int getGePriceFromItemId(int itemId)

View File

@@ -34,5 +34,5 @@ public enum PriceDisplayMode
HA,
GE,
BOTH,
OFF;
OFF
}

View File

@@ -34,5 +34,5 @@ public enum ValueCalculationMode
{
HA, // calc highlight by HA value
GE, // calc by GE
HIGHEST;
HIGHEST
}

View File

@@ -77,10 +77,7 @@ 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_";
@@ -302,53 +299,38 @@ public class GroundMarkerPlugin extends Plugin
if (hotKeyPressed && event.getOption().equals(WALK_HERE))
{
MenuEntry[] menuEntries = client.getMenuEntries();
int lastIndex = menuEntries.length;
menuEntries = Arrays.copyOf(menuEntries, lastIndex + 4);
int lastIndex = menuEntries.length;
menuEntries = Arrays.copyOf(menuEntries, lastIndex + 4);
final Tile tile = client.getSelectedSceneTile();
if (tile == null)
{
return;
}
final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation());
final int regionId = loc.getRegionID();
final Tile tile = client.getSelectedSceneTile();
if (tile == null)
{
return;
}
final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation());
final int regionId = loc.getRegionID();
for (int i = 4; i > 0; i--)
{
MenuEntry menuEntry = menuEntries[lastIndex] = new MenuEntry();
for (int i = 4; i > 0; i--)
{
MenuEntry menuEntry = menuEntries[lastIndex] = new MenuEntry();
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, loc.getRegionX(), loc.getRegionY(), client.getPlane(), i);
final Optional<GroundMarkerPoint> stream = getPoints(regionId).stream().filter(x -> x.equals(point)).findAny();
final String option = (stream.isPresent() && stream.get().getGroup() == i) ? UNMARK : MARK;
menuEntry.setOption(ColorUtil.prependColorTag(Text.removeTags(option + (i == 1 ? "" : " (Group " + i + ")")), getColor(i)));
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);
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, loc.getRegionX(), loc.getRegionY(), client.getPlane(), i);
final Optional<GroundMarkerPoint> stream = getPoints(regionId).stream().filter(x -> x.equals(point)).findAny();
final String option = (stream.isPresent() && stream.get().getGroup() == i) ? UNMARK : MARK;
menuEntry.setOption(ColorUtil.prependColorTag(Text.removeTags(option + (i == 1 ? "" : " (Group " + i + ")")), getColor(i)));
menuEntry.setTarget(event.getTarget());
menuEntry.setType(MenuAction.RUNELITE.getId());
>>>>>>> Upstream/master
lastIndex++;
}
client.setMenuEntries(menuEntries);
}
}
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
!(event.getOption().equals(MARK) || event.getOption().equals(UNMARK)))
{
return;
}

View File

@@ -53,14 +53,6 @@ enum HealthbarOverride implements SpriteOverride
FRONT_140PX(HEALTHBAR_DEFAULT_FRONT_140PX, "front_90px.png"),
FRONT_160PX(HEALTHBAR_DEFAULT_FRONT_160PX, "front_90px.png");
@Getter(AccessLevel.PUBLIC)
private final int spriteId;
private final String fileName;
@Getter(AccessLevel.PACKAGE)
private int padding = 1;
private static final Map<Integer, HealthbarOverride> MAP;
static
@@ -75,6 +67,12 @@ enum HealthbarOverride implements SpriteOverride
MAP = builder.build();
}
@Getter(AccessLevel.PUBLIC)
private final int spriteId;
private final String fileName;
@Getter(AccessLevel.PACKAGE)
private int padding = 1;
static HealthbarOverride get(int spriteID)
{
return MAP.get(spriteID);

View File

@@ -34,13 +34,13 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.HealthBar;
import net.runelite.api.SpriteID;
import net.runelite.api.Sprite;
import net.runelite.api.SpriteID;
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,12 +129,7 @@ public class InterfaceStylesPlugin extends Plugin
}
}
<<<<<<< HEAD
private void onWidgetPositioned(WidgetPositioned widgetPositioned)
=======
@Subscribe
public void onClientTick(ClientTick event)
>>>>>>> Upstream/master
{
adjustWidgetDimensions();
}

View File

@@ -137,11 +137,6 @@ 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 .*");
@@ -689,16 +684,8 @@ 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);
@@ -775,7 +762,6 @@ public class LootTrackerPlugin extends Plugin
public void onItemContainerChanged(ItemContainerChanged event)
{
<<<<<<< HEAD
if (pvpDeath && RESPAWN_REGIONS.contains(client.getLocalPlayer().getWorldLocation().getRegionID()))
{
Multiset snapshot;
@@ -822,9 +808,6 @@ 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))
{

View File

@@ -291,6 +291,78 @@ public class AlchemyRoom extends MTARoom
&& player.getWorldLocation().getPlane() == 2;
}
@Override
public void under(Graphics2D graphics)
{
if (!getConfig().alchemy() || best == null || !inside())
{
return;
}
boolean found = false;
for (Cupboard cupboard : cupboards)
{
if (cupboard == null)
{
continue;
}
GameObject object = cupboard.gameObject;
AlchemyItem alchemyItem = cupboard.alchemyItem;
if (alchemyItem == AlchemyItem.EMPTY)
{
continue;
}
if (alchemyItem.equals(best))
{
client.setHintArrow(object.getWorldLocation());
found = true;
}
BufferedImage image = itemManager.getImage(alchemyItem.getId());
Point canvasLoc = Perspective.getCanvasImageLocation(client, object.getLocalLocation(), image, IMAGE_Z_OFFSET);
if (canvasLoc != null)
{
graphics.drawImage(image, canvasLoc.getX(), canvasLoc.getY(), null);
}
}
if (!found && suggestion != null)
{
client.setHintArrow(suggestion.gameObject.getWorldLocation());
}
}
@Override
public void over(Graphics2D graphics)
{
if (!inside() || !config.alchemy() || best == null)
{
return;
}
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
if (inventory.isHidden())
{
return;
}
for (WidgetItem item : inventory.getWidgetItems())
{
if (item.getId() != best.getId())
{
continue;
}
drawItem(graphics, item);
}
}
private AlchemyItem getBest()
{
for (int i = 0; i < INFO_LENGTH; i++)
@@ -357,53 +429,6 @@ public class AlchemyRoom extends MTARoom
}
}
@Override
public void under(Graphics2D graphics)
{
if (!getConfig().alchemy() || best == null || !inside())
{
return;
}
boolean found = false;
for (Cupboard cupboard : cupboards)
{
if (cupboard == null)
{
continue;
}
GameObject object = cupboard.gameObject;
AlchemyItem alchemyItem = cupboard.alchemyItem;
if (alchemyItem == AlchemyItem.EMPTY)
{
continue;
}
if (alchemyItem.equals(best))
{
client.setHintArrow(object.getWorldLocation());
found = true;
}
BufferedImage image = itemManager.getImage(alchemyItem.getId());
Point canvasLoc = Perspective.getCanvasImageLocation(client, object.getLocalLocation(), image, IMAGE_Z_OFFSET);
if (canvasLoc != null)
{
graphics.drawImage(image, canvasLoc.getX(), canvasLoc.getY(), null);
}
}
if (!found && suggestion != null)
{
client.setHintArrow(suggestion.gameObject.getWorldLocation());
}
}
private Cupboard getSuggestion()
{
// check if a cupboard has the best item in it
@@ -443,32 +468,6 @@ public class AlchemyRoom extends MTARoom
return nearest;
}
@Override
public void over(Graphics2D graphics)
{
if (!inside() || !config.alchemy() || best == null)
{
return;
}
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
if (inventory.isHidden())
{
return;
}
for (WidgetItem item : inventory.getWidgetItems())
{
if (item.getId() != best.getId())
{
continue;
}
drawItem(graphics, item);
}
}
private void drawItem(Graphics2D graphics, WidgetItem item)
{
Rectangle bounds = item.getCanvasBounds();

View File

@@ -1,4 +1,3 @@
<<<<<<< HEAD
/*
* Copyright (c) 2018, Jasper Ketelaar <Jasper0781@gmail.com>
* All rights reserved.
@@ -31,10 +30,10 @@ import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Item;
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.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
@@ -122,7 +121,7 @@ public class EnchantmentRoom extends MTARoom
private void onItemSpawned(ItemSpawned itemSpawned)
{
final Item item = itemSpawned.getItem();
final TileItem item = itemSpawned.getItem();
final Tile tile = itemSpawned.getTile();
if (item.getId() == ItemID.DRAGONSTONE_6903)
@@ -135,7 +134,7 @@ public class EnchantmentRoom extends MTARoom
private void onItemDespawned(ItemDespawned itemDespawned)
{
final Item item = itemDespawned.getItem();
final TileItem item = itemDespawned.getItem();
final Tile tile = itemDespawned.getTile();
if (item.getId() == ItemID.DRAGONSTONE_6903)
@@ -164,146 +163,3 @@ 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

View File

@@ -47,10 +47,8 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
public class GraveyardRoom extends MTARoom
{
private static final int MTA_GRAVEYARD_REGION = 13462;
static final int MIN_SCORE = 16;
private static final int MTA_GRAVEYARD_REGION = 13462;
private final Client client;
private final MTAPlugin plugin;
private final ItemManager itemManager;

View File

@@ -93,6 +93,11 @@ public class TelekineticRoom extends MTARoom
addSubscriptions();
}
private static int manhattan(WorldPoint point1, WorldPoint point2)
{
return Math.abs(point1.getX() - point2.getX()) + Math.abs(point2.getY() - point1.getY());
}
private void addSubscriptions()
{
eventBus.subscribe(GameTick.class, this, this::onGameTick);
@@ -142,8 +147,8 @@ public class TelekineticRoom extends MTARoom
private void onGameTick(GameTick event)
{
if (!config.telekinetic()
|| !inside()
|| client.getGameState() != GameState.LOGGED_IN)
|| !inside()
|| client.getGameState() != GameState.LOGGED_IN)
{
maze = null;
moves.clear();
@@ -285,11 +290,6 @@ public class TelekineticRoom extends MTARoom
return nearest(areaNext, nearestAfter);
}
private static int manhattan(WorldPoint point1, WorldPoint point2)
{
return Math.abs(point1.getX() - point2.getX()) + Math.abs(point2.getY() - point1.getY());
}
private WorldPoint nearest(WorldArea area, WorldPoint worldPoint)
{
int dist = Integer.MAX_VALUE;
@@ -372,7 +372,7 @@ public class TelekineticRoom extends MTARoom
WorldPoint nghbWorld = WorldPoint.fromLocal(client, neighbour);
if (!nghbWorld.equals(next)
&& !closed.contains(nghbWorld))
&& !closed.contains(nghbWorld))
{
int score = scores.get(next) + 1;
@@ -424,10 +424,10 @@ public class TelekineticRoom extends MTARoom
private LocalPoint[] neighbours(LocalPoint point)
{
return new LocalPoint[]
{
neighbour(point, Direction.NORTH), neighbour(point, Direction.SOUTH),
neighbour(point, Direction.EAST), neighbour(point, Direction.WEST)
};
{
neighbour(point, Direction.NORTH), neighbour(point, Direction.SOUTH),
neighbour(point, Direction.EAST), neighbour(point, Direction.WEST)
};
}
private LocalPoint neighbour(LocalPoint point, Direction direction)

View File

@@ -87,11 +87,7 @@ 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);
@@ -320,11 +316,7 @@ 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());
@@ -336,14 +328,8 @@ 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
!(click.getOption().equals(TAG) || click.getOption().equals(UNTAG)))
{
return;
}

View File

@@ -252,48 +252,8 @@ public class ObjectIndicatorsPlugin extends Plugin implements KeyListener
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
<<<<<<< HEAD
String option = MARK;
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
final int x = event.getActionParam0();
final int y = event.getActionParam1();
final int z = client.getPlane();
final Tile tile = tiles[z][x][y];
final TileObject object = findTileObject(tile, event.getIdentifier());
if (object != null)
{
final ObjectDefinition objectDefinition = client.getObjectDefinition(object.getId());
final String name = objectDefinition.getName();
if (!Strings.isNullOrEmpty(name))
{
final WorldPoint loc = WorldPoint.fromLocalInstance(client, tile.getLocalLocation());
final int regionId = loc.getRegionID();
final ObjectPoint point = new ObjectPoint(
name,
regionId,
loc.getX() & (REGION_SIZE - 1),
loc.getY() & (REGION_SIZE - 1),
client.getPlane());
final Set<ObjectPoint> objectPoints = points.get(regionId);
if (objectPoints != null && objectPoints.contains(point))
{
option = UNMARK;
}
}
}
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());
@@ -305,12 +265,7 @@ 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
|| !(event.getOption().equals(MARK) || event.getOption().equals(UNMARK)))
{
return;
}

View File

@@ -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

View File

@@ -67,7 +67,7 @@ public class ClientLoader
{
try
{
URL localInjected = new File("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar").toURI().toURL();
URL localInjected = new File("./injected-client/build/libs/injected-client-" + RuneLiteAPI.getVersion() + ".jar").toURI().toURL();
log.info("Using local injected-client");
URLClassLoader classLoader = new URLClassLoader(new URL[]{localInjected});
Class<?> clientClass = classLoader.loadClass("client");