Merge remote-tracking branch 'upstream/master' into master

This commit is contained in:
ThatGamerBlue
2021-03-24 16:58:14 +00:00
40 changed files with 943 additions and 1362 deletions

View File

@@ -766,6 +766,10 @@ public class ConfigManager
{
return Integer.parseInt(str);
}
if (type == double.class || type == Double.class)
{
return Double.parseDouble(str);
}
if (type == Color.class)
{
return ColorUtil.fromString(str);

View File

@@ -189,13 +189,13 @@ public enum AgilityShortcut
TAVERLEY_DUNGEON_ROCKS_SOUTH(70, "Rocks", new WorldPoint(2887, 9631, 0), ROCKS, ROCKS_14106),
FOSSIL_ISLAND_HARDWOOD_NORTH(70, "Hole" , new WorldPoint(3712, 3828, 0), HOLE_31481, HOLE_31482),
FOSSIL_ISLAND_HARDWOOD_SOUTH(70, "Hole" , new WorldPoint(3714, 3816, 0), HOLE_31481, HOLE_31482),
AL_KHARID_WINDOW(70, "Window", new WorldPoint(3295, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW)
AL_KHARID_WINDOW(70, "Window", new WorldPoint(3293, 3158, 0), BROKEN_WALL_33344, BIG_WINDOW)
{
@Override
public boolean matches(TileObject object)
{
// there are two BIG_WINDOW objects right next to each other here, but only this one is valid
return object.getId() != BIG_WINDOW || object.getWorldLocation().equals(getWorldLocation());
return object.getId() != BIG_WINDOW || object.getWorldLocation().equals(new WorldPoint(3295, 3158, 0));
}
},
GWD_SARADOMIN_ROPE_NORTH(70, "Rope Descent", new WorldPoint(2912, 5300, 0), NULL_26371, NULL_26561),

View File

@@ -41,7 +41,6 @@ import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.PlayerMenuOptionsChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
@@ -78,8 +77,7 @@ public class MenuManager
*/
public void addManagedCustomMenu(WidgetMenuOption customMenuOption)
{
WidgetInfo widget = customMenuOption.getWidget();
managedMenuOptions.put(widget.getId(), customMenuOption);
managedMenuOptions.put(customMenuOption.getWidgetId(), customMenuOption);
}
/**
@@ -89,8 +87,7 @@ public class MenuManager
*/
public void removeManagedCustomMenu(WidgetMenuOption customMenuOption)
{
WidgetInfo widget = customMenuOption.getWidget();
managedMenuOptions.remove(widget.getId(), customMenuOption);
managedMenuOptions.remove(customMenuOption.getWidgetId(), customMenuOption);
}
private boolean menuContainsCustomMenu(WidgetMenuOption customMenuOption)
@@ -208,6 +205,7 @@ public class MenuManager
customMenu.setMenuOption(event.getMenuOption());
customMenu.setMenuTarget(event.getMenuTarget());
customMenu.setWidget(curMenuOption.getWidget());
customMenu.setWidgetId(curMenuOption.getWidgetId());
eventBus.post(customMenu);
return;
}

View File

@@ -24,9 +24,11 @@
*/
package net.runelite.client.menus;
import net.runelite.api.widgets.WidgetInfo;
import java.awt.Color;
import javax.annotation.Nullable;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.ui.JagexColors;
import net.runelite.client.util.ColorUtil;
@@ -35,20 +37,33 @@ public final class WidgetMenuOption
/**
* The left hand text to be displayed on the menu option. (ex. the menuOption of "Drop Bones" is "Drop")
*/
@Getter
@Setter
private String menuOption;
/**
* The right hand text to be displayed on the menu option. (ex. the menuTarget of "Drop Bones" is "Bones")
*/
@Getter
private String menuTarget;
/**
* The color that the menuTarget should be. Defaults to the brownish color that most menu options have.
*/
@Getter
@Setter
private Color color = JagexColors.MENU_TARGET;
/**
* The widgetinfo to add the option to, if available
*/
@Nullable
@Getter
private final WidgetInfo widget;
/**
* The widget to add the option to
*/
private final WidgetInfo widget;
@Getter
private final int widgetId;
/**
* Creates a menu to be added to right click menus. The menu will only be added if match is found within the menu options
@@ -62,11 +77,22 @@ public final class WidgetMenuOption
this.menuOption = menuOption;
setMenuTarget(menuTarget);
this.widget = widget;
this.widgetId = widget.getId();
}
public void setMenuOption(String option)
/**
* Creates a menu to be added to right click menus. The menu will only be added if match is found within the menu options
*
* @param menuOption Option text of this right click option
* @param menuTarget Target text of this right click option
* @param widgetId The widget to attach this option to
*/
public WidgetMenuOption(String menuOption, String menuTarget, int widgetId)
{
menuOption = option;
this.menuOption = menuOption;
setMenuTarget(menuTarget);
this.widget = null;
this.widgetId = widgetId;
}
/**
@@ -78,29 +104,4 @@ public final class WidgetMenuOption
{
menuTarget = ColorUtil.wrapWithColorTag(target, color);
}
public String getMenuOption()
{
return menuOption;
}
public String getMenuTarget()
{
return menuTarget;
}
public WidgetInfo getWidget()
{
return widget;
}
public Color getColor()
{
return color;
}
public void setColor(Color col)
{
color = col;
}
}

View File

@@ -66,7 +66,7 @@ enum CannonSpots
MINIONS_OF_SCARABAS(new WorldPoint(3297, 9252, 0)),
ROGUE(new WorldPoint(3285, 3930, 0)),
SCORPION(new WorldPoint(3233, 10335, 0)),
SKELETON(new WorldPoint(3018, 3592, 0)),
SKELETON(new WorldPoint(3017, 3589, 0)),
SMOKE_DEVIL(new WorldPoint(2398, 9444, 0)),
SPIDER(new WorldPoint(3169, 3886, 0)),
SUQAHS(new WorldPoint(2114, 3943, 0)),

View File

@@ -96,22 +96,22 @@ public class ChatCommandsPlugin extends Plugin
{
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (?:completion count for |subdued |completed )?(.+?) (?:(?:kill|harvest|lap|completion) )?(?:count )?is: <col=ff0000>(\\d+)</col>");
private static final String COX_TEAM_SIZES = "(?:\\d+(?:\\+|-\\d+)? players|Solo)";
private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>(?<pb>[0-9:]+)</col> \\(new personal best\\)</col>");
private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>[0-9:]+</col> Personal best: </col><col=ff0000>(?<pb>[0-9:]+)</col>");
private static final Pattern TOB_WAVE_PB_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>(?<pb>[0-9:]+)</col> \\(Personal best!\\)");
private static final Pattern TOB_WAVE_DURATION_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>[0-9:]+</col><br></col>Personal best: (?<pb>[0-9:]+)");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>[0-9:]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+)");
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>(?<pb>[0-9:]+)</col> \\(new personal best\\)");
private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(new personal best\\)</col>");
private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>[0-9:.]+</col> Personal best: </col><col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col>");
private static final Pattern TOB_WAVE_PB_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(Personal best!\\)");
private static final Pattern TOB_WAVE_DURATION_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>[0-9:.]+</col><br></col>Personal best: (?<pb>[0-9:]+(?:\\.[0-9]+)?)");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>[0-9:.]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+(?:\\.[0-9]+)?)");
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>(?<pb>[0-9:]+(?:\\.[0-9]+)?)</col> \\(new personal best\\)");
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?");
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?");
private static final Pattern ADVENTURE_LOG_TITLE_PATTERN = Pattern.compile("The Exploits of (.+)");
private static final Pattern ADVENTURE_LOG_COX_PB_PATTERN = Pattern.compile("Fastest (?:kill|run)(?: - \\(Team size: " + COX_TEAM_SIZES + "\\))?: ([0-9:]+)");
private static final Pattern ADVENTURE_LOG_COX_PB_PATTERN = Pattern.compile("Fastest (?:kill|run)(?: - \\(Team size: " + COX_TEAM_SIZES + "\\))?: ([0-9:]+(?:\\.[0-9]+)?)");
private static final Pattern ADVENTURE_LOG_BOSS_PB_PATTERN = Pattern.compile("[a-zA-Z]+(?: [a-zA-Z]+)*");
private static final Pattern ADVENTURE_LOG_PB_PATTERN = Pattern.compile("(" + ADVENTURE_LOG_BOSS_PB_PATTERN + "(?: - " + ADVENTURE_LOG_BOSS_PB_PATTERN + ")*) (?:" + ADVENTURE_LOG_COX_PB_PATTERN + "( )*)+");
private static final Pattern HS_PB_PATTERN = Pattern.compile("Floor (?<floor>\\d) time: <col=ff0000>(?<floortime>[0-9:]+)</col>(?: \\(new personal best\\)|. Personal best: (?<floorpb>[0-9:]+))" +
"(?:<br>Overall time: <col=ff0000>(?<otime>[0-9:]+)</col>(?: \\(new personal best\\)|. Personal best: (?<opb>[0-9:]+)))?");
private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: <col=ff0000>(\\d+)</col>\\.");
private static final Pattern HS_KC_GHC_PATTERN = Pattern.compile("You have opened the Grand Hallowed Coffin <col=ff0000>(\\d+)</col> times?!");
private static final Pattern HS_PB_PATTERN = Pattern.compile("Floor (?<floor>\\d) time: <col=ff0000>(?<floortime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<floorpb>[0-9:]+(?:\\.[0-9]+)?))" +
"(?:<br>Overall time: <col=ff0000>(?<otime>[0-9:]+(?:\\.[0-9]+)?)</col>(?: \\(new personal best\\)|. Personal best: (?<opb>[0-9:]+(?:\\.[0-9]+)?)))?");
private static final Pattern HS_KC_FLOOR_PATTERN = Pattern.compile("You have completed Floor (\\d) of the Hallowed Sepulchre! Total completions: <col=ff0000>([0-9,]+)</col>\\.");
private static final Pattern HS_KC_GHC_PATTERN = Pattern.compile("You have opened the Grand Hallowed Coffin <col=ff0000>([0-9,]+)</col> times?!");
private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
private static final String PRICE_COMMAND_STRING = "!price";
@@ -143,7 +143,7 @@ public class ChatCommandsPlugin extends Plugin
private HiscoreEndpoint hiscoreEndpoint; // hiscore endpoint for current player
private String lastBossKill;
private int lastBossTime = -1;
private int lastPb = -1;
private double lastPb = -1;
@Inject
private Client client;
@@ -251,14 +251,14 @@ public class ChatCommandsPlugin extends Plugin
return killCount == null ? 0 : killCount;
}
private void setPb(String boss, int seconds)
private void setPb(String boss, double seconds)
{
configManager.setRSProfileConfiguration("personalbest", boss.toLowerCase(), seconds);
}
private int getPb(String boss)
private double getPb(String boss)
{
Integer personalBest = configManager.getRSProfileConfiguration("personalbest", boss.toLowerCase(), int.class);
Double personalBest = configManager.getRSProfileConfiguration("personalbest", boss.toLowerCase(), double.class);
return personalBest == null ? 0 : personalBest;
}
@@ -394,14 +394,14 @@ public class ChatCommandsPlugin extends Plugin
if (matcher.find())
{
int floor = Integer.parseInt(matcher.group(1));
int kc = Integer.parseInt(matcher.group(2));
int kc = Integer.parseInt(matcher.group(2).replaceAll(",", ""));
setKc("Hallowed Sepulchre Floor " + floor, kc);
}
matcher = HS_KC_GHC_PATTERN.matcher(message);
if (matcher.find())
{
int kc = Integer.parseInt(matcher.group(1));
int kc = Integer.parseInt(matcher.group(1).replaceAll(",", ""));
setKc("Hallowed Sepulchre", kc);
}
@@ -412,23 +412,24 @@ public class ChatCommandsPlugin extends Plugin
}
}
private static int timeStringToSeconds(String timeString)
@VisibleForTesting
static double timeStringToSeconds(String timeString)
{
String[] s = timeString.split(":");
if (s.length == 2) // mm:ss
{
return Integer.parseInt(s[0]) * 60 + Integer.parseInt(s[1]);
return Integer.parseInt(s[0]) * 60 + Double.parseDouble(s[1]);
}
else if (s.length == 3) // h:mm:ss
{
return Integer.parseInt(s[0]) * 60 * 60 + Integer.parseInt(s[1]) * 60 + Integer.parseInt(s[2]);
return Integer.parseInt(s[0]) * 60 * 60 + Integer.parseInt(s[1]) * 60 + Double.parseDouble(s[2]);
}
return Integer.parseInt(timeString);
return Double.parseDouble(timeString);
}
private void matchPb(Matcher matcher)
{
int seconds = timeStringToSeconds(matcher.group("pb"));
double seconds = timeStringToSeconds(matcher.group("pb"));
if (lastBossKill != null)
{
// Most bosses sent boss kill message, and then pb message, so we
@@ -514,13 +515,13 @@ public class ChatCommandsPlugin extends Plugin
bossName.equalsIgnoreCase("chambers of xeric challenge mode"))
{
Matcher mCoxRuns = ADVENTURE_LOG_COX_PB_PATTERN.matcher(mCounterText.group());
int bestPbTime = Integer.MAX_VALUE;
double bestPbTime = Double.MAX_VALUE;
while (mCoxRuns.find())
{
bestPbTime = Math.min(timeStringToSeconds(mCoxRuns.group(1)), bestPbTime);
}
// So we don't reset people's already saved PB's if they had one before the update
int currentPb = getPb(bossName);
double currentPb = getPb(bossName);
if (currentPb == 0 || currentPb > bestPbTime)
{
setPb(bossName, bestPbTime);
@@ -841,7 +842,7 @@ public class ChatCommandsPlugin extends Plugin
search = longBossName(search);
final int pb;
final double pb;
try
{
pb = chatClient.getPb(player, search);
@@ -852,8 +853,14 @@ public class ChatCommandsPlugin extends Plugin
return;
}
int minutes = pb / 60;
int seconds = pb % 60;
int minutes = (int) (Math.floor(pb) / 60);
double seconds = pb % 60;
// If the seconds is an integer, it is ambiguous if the pb is a precise
// pb or not. So we always show it without the trailing .00.
final String time = Math.floor(seconds) == seconds ?
String.format("%d:%02d", minutes, (int) seconds) :
String.format("%d:%05.2f", minutes, seconds);
String response = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
@@ -861,7 +868,7 @@ public class ChatCommandsPlugin extends Plugin
.append(ChatColorType.NORMAL)
.append(" personal best: ")
.append(ChatColorType.HIGHLIGHT)
.append(String.format("%d:%02d", minutes, seconds))
.append(time)
.build();
log.debug("Setting response {}", response);
@@ -876,7 +883,7 @@ public class ChatCommandsPlugin extends Plugin
int idx = value.indexOf(' ');
final String boss = longBossName(value.substring(idx + 1));
final int pb = getPb(boss);
final double pb = getPb(boss);
if (pb <= 0)
{
return false;

View File

@@ -78,7 +78,6 @@ public class MapClue extends ClueScroll implements ObjectClueScroll
new MapClue(CLUE_SCROLL_MEDIUM_7292, new WorldPoint(2578, 3597, 0), "South-east of the Lighthouse. Fairy ring ALP"),
new MapClue(CLUE_SCROLL_MEDIUM_7294, new WorldPoint(2666, 3562, 0), "Between Seers' Village and Rellekka. South-west of Fairy ring CJR"),
new MapClue(CLUE_SCROLL_HARD, new WorldPoint(3309, 3503, 0), CRATE_2620, "A crate in the Lumber Yard, north-east of Varrock."),
new MapClue(CLUE_SCROLL_HARD_2729, new WorldPoint(3190, 3963, 0), "Behind the Magic axe hut in level 56 Wilderness."),
new MapClue(CLUE_SCROLL_HARD_3520, new WorldPoint(2615, 3078, 0), "Yanille anvils, south of the bank. You can dig from inside the building."),
new MapClue(CLUE_SCROLL_HARD_3522, new WorldPoint(2488, 3308, 0), "In the western section of West Ardougne."),
new MapClue(CLUE_SCROLL_HARD_3524, new WorldPoint(2457, 3182, 0), CRATE_18506, "In a crate by the stairs to the Observatory Dungeon."),

View File

@@ -85,6 +85,7 @@ enum DiscordGameEventType
BOSS_SARACHNIS("Sarachnis", DiscordAreaType.BOSSES, 7322),
BOSS_SKOTIZO("Skotizo", DiscordAreaType.BOSSES, 6810),
BOSS_SMOKE_DEVIL("Thermonuclear smoke devil", DiscordAreaType.BOSSES, 9363, 9619),
BOSS_TEMPOROSS("Tempoross", DiscordAreaType.BOSSES, 12078),
BOSS_VORKATH("Vorkath", DiscordAreaType.BOSSES, 9023),
BOSS_WINTERTODT("Wintertodt", DiscordAreaType.BOSSES, 6462),
BOSS_ZALCANO("Zalcano", DiscordAreaType.BOSSES, 12126),
@@ -374,7 +375,7 @@ enum DiscordGameEventType
REGION_KEBOS_LOWLANDS("Kebos Lowlands", DiscordAreaType.REGIONS, 4665, 4666, 4921, 5178),
REGION_KEBOS_SWAMP("Kebos Swamp", DiscordAreaType.REGIONS, 4664, 4920, 5174, 5175, 5176, 5430, 5431),
REGION_KHARAZI_JUNGLE("Kharazi Jungle", DiscordAreaType.REGIONS, 11053, 11309, 11565, 11821),
REGION_KHARIDIAN_DESERT("Kharidian Desert", DiscordAreaType.REGIONS, 12844, 12845, 12846, 12847, 12848, 13100, 13101, 13102, 13103, 13104, 13357, 13359, 13360, 13614, 13615, 13616),
REGION_KHARIDIAN_DESERT("Kharidian Desert", DiscordAreaType.REGIONS, 12587, 12844, 12845, 12846, 12847, 12848, 13100, 13101, 13102, 13103, 13104, 13357, 13359, 13360, 13614, 13615, 13616),
REGION_KILLERWATT_PLANE("Killerwatt Plane", DiscordAreaType.REGIONS, 10577),
REGION_KOUREND("Great Kourend", DiscordAreaType.REGIONS, 6201, 6457, 6713),
REGION_KOUREND_WOODLAND("Kourend Woodland", DiscordAreaType.REGIONS, 5942, 6197, 6453),
@@ -411,10 +412,12 @@ enum DiscordGameEventType
REGION_QUARRY("Quarry", DiscordAreaType.REGIONS, 12589),
REGION_RANGING_GUILD("Ranging Guild", DiscordAreaType.REGIONS, 10549),
REGION_RATCATCHERS_MANSION("Ratcatchers Mansion", DiscordAreaType.REGIONS, 11343),
REGION_RUINS_OF_UNKAH("Ruins of Unkah", DiscordAreaType.REGIONS, 12588),
REGION_RUNE_ESSENCE_MINE("Rune Essence Mine", DiscordAreaType.REGIONS, 11595),
// The Beekeper, Pinball, and Gravedigger randoms share a region (7758), and although they are not technically ScapeRune, that name is most commonly
// associated with random events, so those three have been denoted ScapeRune to avoid leaving multiple random event regions without an assigned name.
REGION_SCAPERUNE("ScapeRune", DiscordAreaType.REGIONS, 10058, 7758, 8261),
REGION_SEA_SPIRIT_DOCK("Sea Spirit Dock", DiscordAreaType.REGIONS, 12332),
REGION_SHIP_YARD("Ship Yard", DiscordAreaType.REGIONS, 11823),
REGION_SILVAREA("Silvarea", DiscordAreaType.REGIONS, 13366),
REGION_SINCLAR_MANSION("Sinclair Mansion", DiscordAreaType.REGIONS, 10807),

View File

@@ -511,7 +511,14 @@ class OpenCLManager
new long[]{(long) largeModels * (LARGE_SIZE / largeFaceCount)}, new long[]{LARGE_SIZE / largeFaceCount}, 1, new cl_event[]{acquireGLBuffers}, computeEvents[numComputeEvents++]);
}
clEnqueueReleaseGLObjects(commandQueue, glBuffers.length, glBuffers, numComputeEvents, computeEvents, null);
if (numComputeEvents == 0)
{
clEnqueueReleaseGLObjects(commandQueue, glBuffers.length, glBuffers, 0, null, null);
}
else
{
clEnqueueReleaseGLObjects(commandQueue, glBuffers.length, glBuffers, numComputeEvents, computeEvents, null);
}
}
void finish()

View File

@@ -107,11 +107,11 @@ public class HiscorePanel extends PluginPanel
KALPHITE_QUEEN, KING_BLACK_DRAGON, KRAKEN,
KREEARRA, KRIL_TSUTSAROTH, MIMIC,
NIGHTMARE, OBOR, SARACHNIS,
SCORPIA, SKOTIZO, THE_GAUNTLET,
THE_CORRUPTED_GAUNTLET, THEATRE_OF_BLOOD, THERMONUCLEAR_SMOKE_DEVIL,
TZKAL_ZUK, TZTOK_JAD, VENENATIS,
VETION, VORKATH, WINTERTODT,
ZALCANO, ZULRAH
SCORPIA, SKOTIZO, TEMPOROSS,
THE_GAUNTLET, THE_CORRUPTED_GAUNTLET, THEATRE_OF_BLOOD,
THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK, TZTOK_JAD,
VENENATIS, VETION, VORKATH,
WINTERTODT, ZALCANO, ZULRAH
);
private static final HiscoreEndpoint[] ENDPOINTS = {

View File

@@ -40,12 +40,12 @@ import net.runelite.api.Tile;
import net.runelite.api.coords.Direction;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -118,14 +118,6 @@ public class HunterPlugin extends Plugin
* ------------------------------------------------------------------------------
*/
case ObjectID.DEADFALL: // Deadfall trap placed
if (localPlayer.getWorldLocation().distanceTo(trapLocation) <= 2)
{
log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), trapLocation);
traps.put(trapLocation, new HunterTrap(gameObject));
lastActionTime = Instant.now();
}
break;
case ObjectID.MONKEY_TRAP: // Maniacal monkey trap placed
// If player is right next to "object" trap assume that player placed the trap
if (localPlayer.getWorldLocation().distanceTo(trapLocation) <= 2)
@@ -166,15 +158,15 @@ public class HunterPlugin extends Plugin
switch (trapOrientation)
{
case NORTH:
translatedTrapLocation = trapLocation.dy(1);
case SOUTH:
translatedTrapLocation = trapLocation.dy(-1);
break;
case EAST:
translatedTrapLocation = trapLocation.dx(1);
case WEST:
translatedTrapLocation = trapLocation.dx(-1);
break;
}
log.debug("Trap placed by \"{}\" on {}", localPlayer.getName(), translatedTrapLocation);
log.debug("Trap placed by \"{}\" on {} facing {}", localPlayer.getName(), translatedTrapLocation, trapOrientation);
traps.put(translatedTrapLocation, new HunterTrap(gameObject));
lastActionTime = Instant.now();
}

View File

@@ -217,14 +217,12 @@ public class WoodcuttingPlugin extends Plugin
{
if (tree.getRespawnTime() != null && !recentlyLoggedIn && currentPlane == object.getPlane())
{
Point max = object.getSceneMaxLocation();
Point min = object.getSceneMinLocation();
int lenX = max.getX() - min.getX();
int lenY = max.getY() - min.getY();
log.debug("Adding respawn timer for {} tree at {}", tree, object.getLocalLocation());
final int region = client.getLocalPlayer().getWorldLocation().getRegionID();
TreeRespawn treeRespawn = new TreeRespawn(tree, lenX, lenY, WorldPoint.fromScene(client, min.getX(), min.getY(), client.getPlane()), Instant.now(), (int) tree.getRespawnTime(region).toMillis());
Point min = object.getSceneMinLocation();
WorldPoint base = WorldPoint.fromScene(client, min.getX(), min.getY(), client.getPlane());
TreeRespawn treeRespawn = new TreeRespawn(tree, object.sizeX() - 1, object.sizeY() - 1,
base, Instant.now(), (int) tree.getRespawnTime(base.getRegionID()).toMillis());
respawns.add(treeRespawn);
}

View File

@@ -24,19 +24,28 @@
*/
package net.runelite.client.plugins.xpglobes;
import java.awt.image.BufferedImage;
import java.time.Instant;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Skill;
@Getter
@Setter
@AllArgsConstructor
class XpGlobe
{
private Skill skill;
private int currentXp;
private int currentLevel;
private Instant time;
private int size;
private BufferedImage skillIcon;
XpGlobe(Skill skill, int currentXp, int currentLevel, Instant time)
{
this.skill = skill;
this.currentXp = currentXp;
this.currentLevel = currentLevel;
this.time = time;
}
}

View File

@@ -56,6 +56,7 @@ import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.tooltip.Tooltip;
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
import net.runelite.client.util.ImageUtil;
public class XpGlobesOverlay extends Overlay
{
@@ -65,6 +66,7 @@ public class XpGlobesOverlay extends Overlay
private static final int TOOLTIP_RECT_SIZE_X = 150;
private static final Color DARK_OVERLAY_COLOR = new Color(0, 0, 0, 180);
static final String FLIP_ACTION = "Flip";
private static final double GLOBE_ICON_RATIO = 0.65;
private final Client client;
private final XpGlobesPlugin plugin;
@@ -235,7 +237,8 @@ public class XpGlobesOverlay extends Overlay
private void drawSkillImage(Graphics2D graphics, XpGlobe xpGlobe, int x, int y)
{
BufferedImage skillImage = iconManager.getSkillImage(xpGlobe.getSkill());
final int orbSize = config.xpOrbSize();
final BufferedImage skillImage = getScaledSkillIcon(xpGlobe, orbSize);
if (skillImage == null)
{
@@ -244,12 +247,42 @@ public class XpGlobesOverlay extends Overlay
graphics.drawImage(
skillImage,
x + (config.xpOrbSize() / 2) - (skillImage.getWidth() / 2),
y + (config.xpOrbSize() / 2) - (skillImage.getHeight() / 2),
x + (orbSize / 2) - (skillImage.getWidth() / 2),
y + (orbSize / 2) - (skillImage.getHeight() / 2),
null
);
}
private BufferedImage getScaledSkillIcon(XpGlobe xpGlobe, int orbSize)
{
// Cache the previous icon if the size hasn't changed
if (xpGlobe.getSkillIcon() != null && xpGlobe.getSize() == orbSize)
{
return xpGlobe.getSkillIcon();
}
BufferedImage icon = iconManager.getSkillImage(xpGlobe.getSkill());
if (icon == null)
{
return null;
}
final int size = orbSize - config.progressArcStrokeWidth();
final int width = (int) (size * GLOBE_ICON_RATIO);
final int height = (int) (size * GLOBE_ICON_RATIO);
if (width <= 0 || height <= 0)
{
return null;
}
icon = ImageUtil.resizeImage(icon, width, height);
xpGlobe.setSkillIcon(icon);
xpGlobe.setSize(orbSize);
return icon;
}
private void drawTooltip(XpGlobe mouseOverSkill, int goalXp)
{
// reset the timer on XpGlobe to prevent it from disappearing while hovered over it

View File

@@ -168,6 +168,7 @@ public class GameEventManager
Arrays.stream(tile.getGameObjects())
.filter(Objects::nonNull)
.filter(object -> object.getSceneMinLocation().equals(tile.getSceneLocation()))
.forEach(object ->
{
final GameObjectSpawned objectSpawned = new GameObjectSpawned();