Merge pull request #1707 from Owain94/0310-merge

project: Merge upstream
This commit is contained in:
Kyle
2019-10-04 23:00:47 +01:00
committed by GitHub
68 changed files with 2186 additions and 768 deletions

View File

@@ -46,11 +46,14 @@ import joptsimple.util.EnumConverter;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.account.SessionManager;
import net.runelite.client.callback.Hooks;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.CommandManager;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.discord.DiscordService;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ClanManager;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.LootManager;
@@ -148,6 +151,12 @@ public class RuneLite
@Inject
private Provider<ChatboxPanelManager> chatboxPanelManager;
@Inject
private Hooks hooks;
@Inject
private EventBus eventBus;
@Inject
@Nullable
private Client client;
@@ -348,6 +357,8 @@ public class RuneLite
lootManager.get();
chatboxPanelManager.get();
eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged);
// Add core overlays
WidgetOverlay.createOverlays(client).forEach(overlayManager::add);
overlayManager.add(infoBoxOverlay.get());

View File

@@ -28,6 +28,7 @@ import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.name.Names;
import java.applet.Applet;
import java.io.File;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
@@ -51,12 +52,15 @@ import net.runelite.client.task.Scheduler;
import net.runelite.client.util.DeferredEventBus;
import net.runelite.client.util.ExecutorServiceExceptionLogger;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Cache;
import okhttp3.OkHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class RuneLiteModule extends AbstractModule
{
private static final int MAX_OKHTTP_CACHE_SIZE = 20 * 1024 * 1024; // 20mb
private final ClientUpdateCheckMode updateCheckMode;
private final boolean developerMode;
@@ -72,7 +76,9 @@ public class RuneLiteModule extends AbstractModule
bindConstant().annotatedWith(Names.named("updateCheckMode")).to(updateCheckMode);
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()));
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT);
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
.cache(new Cache(new File(RuneLite.RUNELITE_DIR, "cache" + File.separator + "okhttp"), MAX_OKHTTP_CACHE_SIZE))
.build());
bind(MenuManager.class);
bind(ChatMessageManager.class);
bind(ItemManager.class);

View File

@@ -51,6 +51,7 @@ import net.runelite.api.WorldMapManager;
import net.runelite.api.events.BeforeMenuRender;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.Event;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.hooks.Callbacks;
import net.runelite.api.hooks.DrawCallbacks;
@@ -126,6 +127,7 @@ public class Hooks implements Callbacks
private Graphics2D stretchedGraphics;
private long lastCheck;
private boolean ignoreNextNpcUpdate;
private boolean shouldProcessGameTick;
private static MainBufferProvider lastMainBufferProvider;
@@ -459,15 +461,36 @@ public class Hooks implements Callbacks
overlayManager.getItemWidgets().clear();
}
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
switch (gameStateChanged.getGameState())
{
case LOGGING_IN:
case HOPPING:
ignoreNextNpcUpdate = true;
}
}
@Override
public void updateNpcs()
{
// The NPC update event seem to run every server tick,
// but having the game tick event after all packets
// have been processed is typically more useful.
shouldProcessGameTick = true;
if (ignoreNextNpcUpdate)
{
// After logging in an NPC update happens outside of the normal game tick, which
// is sent prior to skills and vars being bursted, so ignore it.
ignoreNextNpcUpdate = false;
log.debug("Skipping login updateNpc");
}
else
{
// The NPC update event seem to run every server tick,
// but having the game tick event after all packets
// have been processed is typically more useful.
shouldProcessGameTick = true;
}
// Replay deferred events, otherwise if two npc
// update packets get processed in one frame, a
// update packets get processed in one client tick, a
// despawn event could be published prior to the
// spawn event, which is deferred
deferredEventBus.replay();

View File

@@ -136,7 +136,7 @@ public class ItemManager
private final Client client;
private final ScheduledExecutorService scheduledExecutorService;
private final ClientThread clientThread;
private final ItemClient itemClient = new ItemClient();
private final ItemClient itemClient;
private final ImmutableMap<Integer, ItemStats> itemStatMap;
private final LoadingCache<ImageKey, AsyncBufferedImage> itemImages;
private final LoadingCache<Integer, ItemDefinition> itemDefinitions;
@@ -149,12 +149,14 @@ public class ItemManager
Client client,
ScheduledExecutorService executor,
ClientThread clientThread,
EventBus eventbus
EventBus eventbus,
ItemClient itemClient
)
{
this.client = client;
this.scheduledExecutorService = executor;
this.clientThread = clientThread;
this.itemClient = itemClient;
scheduledExecutorService.scheduleWithFixedDelay(this::loadPrices, 0, 30, TimeUnit.MINUTES);
scheduledExecutorService.submit(this::loadStats);

View File

@@ -29,7 +29,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.Shape;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -90,7 +90,7 @@ class AgilityOverlay extends Overlay
}
return;
}
Area objectClickbox = object.getClickbox();
Shape objectClickbox = object.getClickbox();
if (objectClickbox != null)
{
AgilityShortcut agilityShortcut = obstacle.getShortcut();

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.blastfurnace;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.Area;
import java.awt.Shape;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
@@ -110,7 +110,7 @@ class BlastFurnaceClickBoxOverlay extends Overlay
if (localLocation.distanceTo(location) <= MAX_DISTANCE)
{
Area objectClickbox = object.getClickbox();
Shape objectClickbox = object.getClickbox();
if (objectClickbox != null)
{
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))

View File

@@ -94,13 +94,13 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
.put(new WorldPoint(3544, 3256, 0), "North-east of Burgh de Rott.")
.put(new WorldPoint(2841, 3267, 0), "Crandor island.")
.put(new WorldPoint(3168, 3041, 0), "Bedabin Camp.")
.put(new WorldPoint(2542, 3031, 0), "Gu'Tanoth.")
.put(new WorldPoint(2542, 3031, 0), "Gu'Tanoth, may require 20gp.")
.put(new WorldPoint(2581, 3030, 0), "Gu'Tanoth island, enter cave north-west of Feldip Hills (AKS).")
.put(new WorldPoint(2961, 3024, 0), "Ship yard (DKP).")
.put(new WorldPoint(2339, 3311, 0), "East of Prifddinas on Arandar mountain pass.")
.put(new WorldPoint(3440, 3341, 0), "Nature Spirit's grotto.")
.put(new WorldPoint(2763, 2974, 0), "Cairn Isle, west of Shilo Village.")
.put(new WorldPoint(3138, 2969, 0), "West of Bandit Camp.")
.put(new WorldPoint(3138, 2969, 0), "West of Bandit Camp in Kharidian Desert.")
.put(new WorldPoint(2924, 2963, 0), "On the southern part of eastern Karamja.")
.put(new WorldPoint(2838, 2914, 0), "Kharazi Jungle, near water pool.")
.put(new WorldPoint(3441, 3419, 0), "Mort Myre Swamp.")

View File

@@ -142,8 +142,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
new EmoteClue("Panic on the pier where you catch the Fishing trawler. Have nothing equipped at all when you do.", "Fishing trawler", null, new WorldPoint(2676, 3169, 0), PANIC, emptySlot("Nothing at all", HEAD, CAPE, AMULET, WEAPON, BODY, SHIELD, LEGS, GLOVES, BOOTS, RING, AMMO)),
new EmoteClue("Panic on the Wilderness volcano bridge. Beware of double agents! Equip any headband and crozier.", "Wilderness volcano", VOLCANO_IN_THE_NORTHEASTERN_WILDERNESS, new WorldPoint(3368, 3935, 0), PANIC, any("Any headband", range(RED_HEADBAND, BROWN_HEADBAND), range(WHITE_HEADBAND, GREEN_HEADBAND)), any("Any crozier", item(ANCIENT_CROZIER), item(ARMADYL_CROZIER), item(BANDOS_CROZIER), range(SARADOMIN_CROZIER, ZAMORAK_CROZIER))),
new EmoteClue("Do a push up at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a dragon defender and a slayer helm of any kind.", "Warriors' guild", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), PUSH_UP, item(DRAGON_BATTLEAXE), item(DRAGON_DEFENDER), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))),
new EmoteClue("Blow a raspberry at Gypsy Aris in her tent. Equip a gold ring and a gold necklace.", "Varrock", GYPSY_TENT_ENTRANCE, new WorldPoint(3203, 3424, 0), RASPBERRY, item(GOLD_RING), item(GOLD_NECKLACE)),
new EmoteClue("Blow a raspberry at the bank of the Warrior's guild. Beware of double agents! Equip a dragon battleaxe, a slayer helm of any kind and a dragon defender or avernic defender.", "Warriors' guild", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), RASPBERRY, item(DRAGON_BATTLEAXE), any("Dragon defender or Avernic defender", item(DRAGON_DEFENDER), item(AVERNIC_DEFENDER)), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))),
new EmoteClue("Blow a raspberry in the bank of the Warriors' Guild. Beware of double agents! Equip a dragon battleaxe, a slayer helm of any kind and a dragon defender or avernic defender.", "Warriors' guild", WARRIORS_GUILD_BANK_29047, new WorldPoint(2843, 3543, 0), RASPBERRY, item(DRAGON_BATTLEAXE), any("Dragon defender or Avernic defender", item(DRAGON_DEFENDER), item(AVERNIC_DEFENDER)), any("Any slayer helmet", item(SLAYER_HELMET), item(BLACK_SLAYER_HELMET), item(GREEN_SLAYER_HELMET), item(PURPLE_SLAYER_HELMET), item(RED_SLAYER_HELMET), item(TURQUOISE_SLAYER_HELMET), item(SLAYER_HELMET_I), item(BLACK_SLAYER_HELMET_I), item(GREEN_SLAYER_HELMET_I), item(PURPLE_SLAYER_HELMET_I), item(RED_SLAYER_HELMET_I), item(TURQUOISE_SLAYER_HELMET_I), item(HYDRA_SLAYER_HELMET), item(HYDRA_SLAYER_HELMET_I))),
new EmoteClue("Blow a raspberry at the monkey cage in Ardougne Zoo. Equip a studded leather body, bronze platelegs and a normal staff with no orb.", "Ardougne Zoo", NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO, new WorldPoint(2607, 3282, 0), RASPBERRY, item(STUDDED_BODY), item(BRONZE_PLATELEGS), item(STAFF)),
new EmoteClue("Blow a raspberry in the Fishing Guild bank. Beware of double agents! Equip an elemental shield, blue dragonhide chaps and a rune warhammer.", "Fishing Guild", FISHING_GUILD_BANK, new WorldPoint(2588, 3419, 0), RASPBERRY, item(ELEMENTAL_SHIELD), item(BLUE_DHIDE_CHAPS), item(RUNE_WARHAMMER)),
new EmoteClue("Blow raspberries outside the entrance to Keep Le Faye. Equip a coif, an iron platebody and leather gloves.", "Keep Le Faye", OUTSIDE_KEEP_LE_FAYE, new WorldPoint(2757, 3401, 0), RASPBERRY, item(COIF), item(IRON_PLATEBODY), item(LEATHER_GLOVES)),
@@ -158,7 +157,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
new EmoteClue("Spin at Flynn's Mace Shop.", "Falador", null, new WorldPoint(2950, 3387, 0), SPIN),
new EmoteClue("Spin at the crossroads north of Rimmington. Equip a green gnome hat, cream gnome top and leather chaps.", "Rimmington", ROAD_JUNCTION_NORTH_OF_RIMMINGTON, new WorldPoint(2981, 3276, 0), SPIN, item(GREEN_HAT), item(CREAM_ROBE_TOP), item(LEATHER_CHAPS)),
new EmoteClue("Spin in Draynor Manor by the fountain. Equip an iron platebody, studded leather chaps and a bronze full helmet.", "Draynor Manor", DRAYNOR_MANOR_BY_THE_FOUNTAIN, new WorldPoint(3088, 3336, 0), SPIN, item(IRON_PLATEBODY), item(STUDDED_CHAPS), item(BRONZE_FULL_HELM)),
new EmoteClue("Spin in front of the Soul altar. Beware of double agents! Equip a dragon pickaxe, helm of neitiznot and a pair of rune boots.", "Soul altar", SOUL_ALTAR, new WorldPoint(1815, 3856, 0), SPIN, any("Dragon pickaxe", item(DRAGON_PICKAXE), item(DRAGON_PICKAXE_12797), item(INFERNAL_PICKAXE), item(INFERNAL_PICKAXE_UNCHARGED), item(DRAGON_PICKAXEOR)), item(HELM_OF_NEITIZNOT), item(RUNE_BOOTS)),
new EmoteClue("Spin in front of the Soul altar. Beware of double agents! Equip a dragon pickaxe, helm of neitiznot and a pair of rune boots.", "Soul altar", SOUL_ALTAR, new WorldPoint(1815, 3856, 0), SPIN, any("Dragon or Crystal pickaxe", item(DRAGON_PICKAXE), item(DRAGON_PICKAXE_12797), item(INFERNAL_PICKAXE), item(INFERNAL_PICKAXE_UNCHARGED), item(DRAGON_PICKAXEOR), item(CRYSTAL_PICKAXE), item(CRYSTAL_PICKAXE_INACTIVE)), item(HELM_OF_NEITIZNOT), item(RUNE_BOOTS)),
new EmoteClue("Spin in the Varrock Castle courtyard. Equip a black axe, a coif and a ruby ring.", "Varrock Castle", OUTSIDE_VARROCK_PALACE_COURTYARD, new WorldPoint(3213, 3463, 0), SPIN, item(BLACK_AXE), item(COIF), item(RUBY_RING)),
new EmoteClue("Spin in West Ardougne Church. Equip a dragon spear and red dragonhide chaps.", "Ardougne", CHAPEL_IN_WEST_ARDOUGNE, new WorldPoint(2530, 3290, 0), SPIN, item(DRAGON_SPEAR), item(RED_DHIDE_CHAPS)),
new EmoteClue("Spin on the bridge by the Barbarian Village. Salute before you talk to me. Equip purple gloves, a steel kiteshield and a mithril full helmet.", "Barbarian Village", EAST_OF_THE_BARBARIAN_VILLAGE_BRIDGE, new WorldPoint(3105, 3420, 0), SPIN, SALUTE, item(PURPLE_GLOVES), item(STEEL_KITESHIELD), item(MITHRIL_FULL_HELM)),

View File

@@ -140,7 +140,7 @@ public class SkillChallengeClue extends ClueScroll implements NpcClueScroll
new SkillChallengeClue("Chop a yew tree.", ANY_AXE),
new SkillChallengeClue("Fix a magical lamp in Dorgesh-Kaan.", item(ItemID.LIGHT_ORB)),
new SkillChallengeClue("Burn a yew log.", item(ItemID.YEW_LOGS), item(ItemID.TINDERBOX)),
new SkillChallengeClue("Catch and cook a swordfish.", "cook a swordfish.", ANY_HARPOON),
new SkillChallengeClue("Cook a swordfish", "cook a swordfish", item(ItemID.RAW_SWORDFISH)),
new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)),
new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)),
new SkillChallengeClue("Activate the Chivalry prayer."),

View File

@@ -63,7 +63,9 @@ public class DefaultWorldPlugin extends Plugin
@Inject
private ClientThread clientThread;
private final WorldClient worldClient = new WorldClient();
@Inject
private WorldClient worldClient;
private int worldCache;
private boolean worldChangeRequired;

View File

@@ -32,6 +32,7 @@ import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import java.util.List;
import javax.inject.Inject;
@@ -326,10 +327,10 @@ class DevToolsOverlay extends Overlay
// Draw a polygon around the convex hull
// of the model vertices
Polygon p = gameObject.getConvexHull();
Shape p = gameObject.getConvexHull();
if (p != null)
{
graphics.drawPolygon(p);
graphics.draw(p);
}
// This is incredibly taxing to run, only uncomment if you know what you're doing.
/*renderGameObjectWireframe(graphics, gameObject, Color.CYAN);*/
@@ -372,16 +373,16 @@ class DevToolsOverlay extends Overlay
OverlayUtil.renderTileOverlay(graphics, decorObject, "ID: " + decorObject.getId(), DEEP_PURPLE);
}
Polygon p = decorObject.getConvexHull();
Shape p = decorObject.getConvexHull();
if (p != null)
{
graphics.drawPolygon(p);
graphics.draw(p);
}
p = decorObject.getConvexHull2();
if (p != null)
{
graphics.drawPolygon(p);
graphics.draw(p);
}
}
}
@@ -553,23 +554,6 @@ class DevToolsOverlay extends Overlay
graphics.drawString(text, textX, textY);
}
private void renderGameObjectWireframe(Graphics2D graphics, GameObject gameObject, Color color)
{
Polygon[] polys = gameObject.getPolygons();
if (polys == null)
{
return;
}
graphics.setColor(color);
for (Polygon p : polys)
{
graphics.drawPolygon(p);
}
}
private void renderPlayerWireframe(Graphics2D graphics, Player player, Color color)
{
Polygon[] polys = player.getPolygons();

View File

@@ -66,13 +66,15 @@ public class FeedPlugin extends Plugin
@Inject
private ScheduledExecutorService executorService;
@Inject
private FeedClient feedClient;
@Inject
private EventBus eventBus;
private FeedPanel feedPanel;
private NavigationButton navButton;
private final FeedClient feedClient = new FeedClient();
private final Supplier<FeedResult> feedSupplier = Suppliers.memoizeWithExpiration(() ->
{
try

View File

@@ -32,6 +32,7 @@ import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.Shape;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
@@ -201,7 +202,7 @@ public class GauntletOverlay extends Overlay
if (plugin.isOverlayBoss())
{
Polygon polygon = boss.getConvexHull();
Shape polygon = boss.getConvexHull();
if (polygon == null)
{
@@ -315,7 +316,7 @@ public class GauntletOverlay extends Overlay
{
// Don't use Convex Hull click box. As the room start to fill up, your FPS will dip.
Polygon polygon = object.getGameObject().getConvexHull();
Shape polygon = object.getGameObject().getConvexHull();
if (polygon == null)
{

View File

@@ -30,6 +30,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.time.Instant;
@@ -46,12 +47,12 @@ import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.util.Text;
import net.runelite.client.graphics.ModelOutlineRenderer;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.api.util.Text;
@Singleton
public class NpcSceneOverlay extends Overlay
@@ -181,8 +182,9 @@ public class NpcSceneOverlay extends Overlay
renderPoly(graphics, color, tilePoly);
break;
case HULL:
final Polygon objectClickbox = actor.getConvexHull();
renderPoly(graphics, color, objectClickbox);
final Shape objectClickbox = actor.getConvexHull();
graphics.setColor(color);
graphics.draw(objectClickbox);
break;
case THIN_OUTLINE:
modelOutliner.drawOutline(actor, 1, color);

View File

@@ -28,8 +28,7 @@ package net.runelite.client.plugins.objectindicators;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.Shape;
import static java.lang.Math.floor;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -101,8 +100,8 @@ class ObjectIndicatorsOverlay extends Overlay
}
break;
case HULL:
final Polygon polygon;
Polygon polygon2 = null;
final Shape polygon;
Shape polygon2 = null;
if (object instanceof GameObject)
{
@@ -129,7 +128,7 @@ class ObjectIndicatorsOverlay extends Overlay
}
break;
case CLICKBOX:
Area clickbox = object.getClickbox();
Shape clickbox = object.getClickbox();
if (clickbox != null)
{
OverlayUtil.renderHoverableArea(graphics, object.getClickbox(), client.getMouseCanvasPosition(), TRANSPARENT, objectColor, objectColor.darker());

View File

@@ -63,4 +63,15 @@ public interface OpponentInfoConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "showOpponentsInMenu",
name = "Show opponents in menu",
description = "Marks opponents names in the menu which you are attacking or are attacking you (NPC only)",
position = 3
)
default boolean showOpponentsInMenu()
{
return false;
}
}

View File

@@ -36,11 +36,15 @@ import lombok.Getter;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.NPC;
import net.runelite.api.WorldType;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.InteractingChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
@@ -124,6 +128,7 @@ public class OpponentInfoPlugin extends Plugin
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
}
private void onGameStateChanged(GameStateChanged gameStateChanged)
@@ -198,4 +203,28 @@ public class OpponentInfoPlugin extends Plugin
this.hitpointsDisplayStyle = config.hitpointsDisplayStyle();
this.showOpponentsOpponent = config.showOpponentsOpponent();
}
private void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{
if (menuEntryAdded.getType() != MenuOpcode.NPC_SECOND_OPTION.getId()
|| !menuEntryAdded.getOption().equals("Attack")
|| !config.showOpponentsInMenu())
{
return;
}
int npcIndex = menuEntryAdded.getIdentifier();
NPC npc = client.getCachedNPCs()[npcIndex];
if (npc == null)
{
return;
}
if (npc.getInteracting() == client.getLocalPlayer() || lastOpponent == npc)
{
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries[menuEntries.length - 1].setTarget("*" + menuEntryAdded.getTarget());
client.setMenuEntries(menuEntries);
}
}
}

View File

@@ -30,7 +30,7 @@ import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Player;
@@ -92,12 +92,12 @@ public class GangplankOverlay extends Overlay
if (noviceGangplankTile != null)
{
Polygon polygon = noviceGangplankTile.getGameObjects()[0].getConvexHull();
Shape polygon = noviceGangplankTile.getGameObjects()[0].getConvexHull();
if (polygon != null)
{
graphics.setColor(noviceCbColor);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(polygon);
graphics.draw(polygon);
graphics.setColor(setColorAlpha(noviceCbColor, 45));
graphics.fill(polygon);
@@ -112,12 +112,12 @@ public class GangplankOverlay extends Overlay
if (intermediateGangplankTile != null)
{
Polygon polygon = intermediateGangplankTile.getGameObjects()[0].getConvexHull();
Shape polygon = intermediateGangplankTile.getGameObjects()[0].getConvexHull();
if (polygon != null)
{
graphics.setColor(intermediateCbColor);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(polygon);
graphics.draw(polygon);
graphics.setColor(setColorAlpha(intermediateCbColor, 45));
graphics.fill(polygon);
@@ -132,12 +132,12 @@ public class GangplankOverlay extends Overlay
if (veteranGangplankTile != null)
{
Polygon polygon = veteranGangplankTile.getGameObjects()[0].getConvexHull();
Shape polygon = veteranGangplankTile.getGameObjects()[0].getConvexHull();
if (polygon != null)
{
graphics.setColor(veteranCbColor);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(polygon);
graphics.draw(polygon);
graphics.setColor(setColorAlpha(veteranCbColor, 45));
graphics.fill(polygon);

View File

@@ -31,6 +31,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@@ -141,7 +142,7 @@ public class NpcHighlightOverlay extends Overlay
private void renderHullOverlay(Graphics2D graphics, NPC npc, Color color)
{
Polygon objectClickbox = npc.getConvexHull();
Shape objectClickbox = npc.getConvexHull();
if (objectClickbox != null)
{
graphics.setColor(color);

View File

@@ -30,7 +30,7 @@ import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.Area;
import java.awt.Shape;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.GameObject;
@@ -185,7 +185,7 @@ public class RepairOverlay extends Overlay
return null;
}
private void renderObjectOverlay(Graphics2D graphics, Area area, Color color, Point mousePosition)
private void renderObjectOverlay(Graphics2D graphics, Shape area, Color color, Point mousePosition)
{
if (area == null)
{

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.pyramidplunder;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.geom.Area;
import java.awt.Shape;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
@@ -119,7 +119,7 @@ public class PyramidPlunderOverlay extends Overlay
objectID = impostor.getId();
}
Area objectClickbox = object.getClickbox();
Shape objectClickbox = object.getClickbox();
if (objectClickbox != null)
{
Color configColor = Color.GREEN;

View File

@@ -2,7 +2,7 @@ package net.runelite.client.plugins.raids.shortcuts;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.image.BufferedImage;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -48,7 +48,7 @@ public class ShortcutOverlay extends Overlay
{
if (shortcut.getPlane() == client.getPlane())
{
Polygon poly;
Shape poly;
if ((shortcut instanceof GameObject))
{
poly = ((GameObject) shortcut).getConvexHull();

View File

@@ -28,7 +28,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.Shape;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
@@ -74,7 +74,7 @@ public class RoguesDenOverlay extends Overlay
{
if (tile.getPlane() == client.getPlane())
{
final Area clickBox = obstacle.getClickbox();
final Shape clickBox = obstacle.getClickbox();
if (clickBox != null)
{
final Point mouse = client.getMouseCanvasPosition();
@@ -93,7 +93,7 @@ public class RoguesDenOverlay extends Overlay
}
else
{
Polygon p;
Shape p;
if (obstacle instanceof GameObject)
{
p = ((GameObject) obstacle).getConvexHull();
@@ -106,7 +106,7 @@ public class RoguesDenOverlay extends Overlay
if (p != null)
{
graphics.setColor(OBJECT_COLOR);
graphics.drawPolygon(p);
graphics.draw(p);
}
}
}

View File

@@ -30,7 +30,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.Area;
import java.awt.Shape;
import net.runelite.api.Client;
import net.runelite.api.DecorativeObject;
import net.runelite.api.NPC;
@@ -105,7 +105,7 @@ class AbyssOverlay extends Overlay
}
Point mousePosition = client.getMouseCanvasPosition();
Area objectClickbox = object.getClickbox();
Shape objectClickbox = object.getClickbox();
if (objectClickbox != null)
{
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))

View File

@@ -31,6 +31,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
@@ -43,12 +44,12 @@ import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.util.Text;
import net.runelite.client.graphics.ModelOutlineRenderer;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.api.util.Text;
@Singleton
public class TargetClickboxOverlay extends Overlay
@@ -129,7 +130,7 @@ public class TargetClickboxOverlay extends Overlay
break;
case HULL:
Polygon objectClickbox = actor.getConvexHull();
Shape objectClickbox = actor.getConvexHull();
if (objectClickbox == null)
{

View File

@@ -28,6 +28,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
@@ -69,11 +70,11 @@ public class TarnsLairOverlay extends Overlay
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
Polygon p = tile.getGameObjects()[0].getConvexHull();
Shape p = tile.getGameObjects()[0].getConvexHull();
if (p != null)
{
graphics.setColor(Color.GREEN);
graphics.drawPolygon(p);
graphics.draw(p);
}
}
});
@@ -82,11 +83,11 @@ public class TarnsLairOverlay extends Overlay
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
{
Polygon p = tile.getGameObjects()[0].getConvexHull();
Shape p = tile.getGameObjects()[0].getConvexHull();
if (p != null)
{
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
graphics.draw(p);
}
}
});

View File

@@ -5,6 +5,7 @@ import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -248,7 +249,7 @@ public class NyloHandler extends RoomHandler
{
try
{
Polygon objectClickbox = npc.getConvexHull();
Shape objectClickbox = npc.getConvexHull();
Color color;
String name = npc.getName() != null ? npc.getName() : "";
@@ -266,7 +267,8 @@ public class NyloHandler extends RoomHandler
color = Color.LIGHT_GRAY;
}
renderPoly(graphics, color, objectClickbox);
graphics.setColor(color);
graphics.draw(objectClickbox);
}
catch (Exception ex)
{

View File

@@ -141,6 +141,9 @@ public class WorldHopperPlugin extends Plugin
@Inject
private WorldHopperPingOverlay worldHopperOverlay;
@Inject
private WorldClient worldClient;
private ScheduledExecutorService hopperExecutorService;
private NavigationButton navButton;
@@ -533,7 +536,7 @@ public class WorldHopperPlugin extends Plugin
{
log.debug("Fetching worlds");
new WorldClient().lookupWorlds()
worldClient.lookupWorlds()
.subscribeOn(Schedulers.io())
.take(1)
.subscribe(

View File

@@ -30,6 +30,7 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.AnimationID;
@@ -174,7 +175,7 @@ public class ZalcanoOverlay extends Overlay
{
if (plugin.getGolem() != null)
{
Polygon hull = plugin.getGolem().getConvexHull();
Shape hull = plugin.getGolem().getConvexHull();
if (hull != null)
{
OverlayUtil.renderPolygon(graphics, hull, new Color(206, 41, 231));
@@ -187,7 +188,7 @@ public class ZalcanoOverlay extends Overlay
{
if (plugin.getZalcano() != null)
{
Polygon hull = plugin.getZalcano().getConvexHull();
Shape hull = plugin.getZalcano().getConvexHull();
if (hull != null)
{
OverlayUtil.renderPolygon(graphics, hull, config.zalcanoHullColor());

View File

@@ -33,8 +33,8 @@ import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Rectangle;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.Stroke;
import java.awt.geom.Area;
import java.awt.image.BufferedImage;
import java.util.List;
import net.runelite.api.Actor;
@@ -61,14 +61,14 @@ public class OverlayUtil
private static final int MINIMAP_DOT_RADIUS = 4;
private static final double UNIT = Math.PI / 1024.0d;
public static void renderPolygon(Graphics2D graphics, Polygon poly, Color color)
public static void renderPolygon(Graphics2D graphics, Shape poly, Color color)
{
graphics.setColor(color);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.draw(poly);
graphics.setColor(new Color(0, 0, 0, 50));
graphics.fillPolygon(poly);
graphics.fill(poly);
graphics.setStroke(originalStroke);
}
@@ -211,7 +211,7 @@ public class OverlayUtil
renderImageLocation(client, graphics, localLocation, image, 0);
}
public static void renderHoverableArea(Graphics2D graphics, Area area, net.runelite.api.Point mousePosition, Color fillColor, Color borderColor, Color borderHoverColor)
public static void renderHoverableArea(Graphics2D graphics, Shape area, net.runelite.api.Point mousePosition, Color fillColor, Color borderColor, Color borderHoverColor)
{
if (area != null)
{
@@ -326,7 +326,7 @@ public class OverlayUtil
}
}
public static void renderClickBox(Graphics2D graphics, Point mousePosition, Area objectClickbox, Color configColor)
public static void renderClickBox(Graphics2D graphics, Point mousePosition, Shape objectClickbox, Color configColor)
{
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))
{