This commit is contained in:
PKLite
2019-08-01 00:30:23 -04:00
80 changed files with 1167 additions and 745 deletions

View File

@@ -44,6 +44,7 @@ public final class AnimationID
public static final int WOODCUTTING_DRAGON = 2846;
public static final int WOODCUTTING_INFERNAL = 2117;
public static final int WOODCUTTING_3A_AXE = 7264;
public static final int WOODCUTTING_CRYSTAL = 8324;
public static final int CONSUMING = 829; // consuming consumables
public static final int FIREMAKING = 733;
public static final int DEATH = 836;
@@ -94,6 +95,7 @@ public final class AnimationID
public static final int FISHING_BARBTAIL_HARPOON = 5108;
public static final int FISHING_DRAGON_HARPOON = 7401;
public static final int FISHING_INFERNAL_HARPOON = 7402;
public static final int FISHING_CRYSTAL_HARPOON = 8336;
public static final int FISHING_OILY_ROD = 622;
public static final int FISHING_KARAMBWAN = 1193;
public static final int FISHING_CRUSHING_INFERNAL_EELS = 7553;
@@ -107,9 +109,11 @@ public final class AnimationID
public static final int MINING_ADAMANT_PICKAXE = 628;
public static final int MINING_RUNE_PICKAXE = 624;
public static final int MINING_DRAGON_PICKAXE = 7139;
public static final int MINING_DRAGON_PICKAXE_ORN = 642;
public static final int MINING_DRAGON_PICKAXE_UPGRADED = 642;
public static final int MINING_DRAGON_PICKAXE_OR = 8346;
public static final int MINING_INFERNAL_PICKAXE = 4482;
public static final int MINING_3A_PICKAXE = 7283;
public static final int MINING_CRYSTAL_PICKAXE = 8347;
public static final int MINING_MOTHERLODE_BRONZE = 6753;
public static final int MINING_MOTHERLODE_IRON = 6754;
public static final int MINING_MOTHERLODE_STEEL = 6755;
@@ -118,9 +122,11 @@ public final class AnimationID
public static final int MINING_MOTHERLODE_ADAMANT = 6756;
public static final int MINING_MOTHERLODE_RUNE = 6752;
public static final int MINING_MOTHERLODE_DRAGON = 6758;
public static final int MINING_MOTHERLODE_DRAGON_ORN = 335;
public static final int MINING_MOTHERLODE_DRAGON_UPGRADED = 335;
public static final int MINING_MOTHERLODE_DRAGON_OR = 8344;
public static final int MINING_MOTHERLODE_INFERNAL = 4481;
public static final int MINING_MOTHERLODE_3A = 7282;
public static final int MINING_MOTHERLODE_CRYSTAL = 8345;
public static final int DENSE_ESSENCE_CHIPPING = 7201;
public static final int DENSE_ESSENCE_CHISELING = 7202;
public static final int HERBLORE_POTIONMAKING = 363; //used for both herb and secondary

View File

@@ -1452,16 +1452,16 @@ public interface Client extends GameShell
/**
* Sets which NPCs are hidden
*
* @param names the names of the npcs seperated by ','
* @param names the names of the npcs
*/
void setNPCsNames(String names);
void setNPCsNames(List<String> names);
/**
* Sets which NPCs are hidden on death
*
* @param names the names of the npcs seperated by ','
* @param names the names of the npcs
*/
void setNPCsHiddenOnDeath(String names);
void setNPCsHiddenOnDeath(List<String> names);
/**
* Sets whether 2D sprites (ie. overhead prayers) related to

View File

@@ -975,7 +975,7 @@ public class WidgetID
static final int PVP_WIDGET_CONTAINER = 54; // OUTDATED?
static final int SKULL = 56; // OUTDATED?
static final int ATTACK_RANGE = 59; // OUTDATED?
static final int BOUNTY_HUNTER_INFO = 19;
static final int BOUNTY_HUNTER_INFO = 18;
static final int KILLDEATH_RATIO = 15;
static final int SKULL_CONTAINER = 61;
static final int SAFE_ZONE = 63;

View File

@@ -29,7 +29,6 @@ import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableMap;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Point;
import java.awt.Rectangle;
import java.io.File;
@@ -66,7 +65,6 @@ import net.runelite.api.events.ConfigChanged;
import net.runelite.client.RuneLite;
import static net.runelite.client.RuneLite.PROFILES_DIR;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.ui.FontManager;
import net.runelite.client.util.ColorUtil;
@Singleton
@@ -508,10 +506,6 @@ public class ConfigManager
{
return Enum.valueOf((Class<? extends Enum>) type, str);
}
if (type == Font.class)
{
return FontManager.getFontOrDefault(FontManager.lookupFont(str));
}
if (type == Instant.class)
{
return Instant.parse(str);
@@ -568,10 +562,6 @@ public class ConfigManager
{
return ((Enum) object).name();
}
if (object instanceof Font)
{
return FontManager.getFontName((Font)object);
}
if (object instanceof Dimension)
{
Dimension d = (Dimension) object;

View File

@@ -24,18 +24,21 @@
*/
package net.runelite.client.config;
import java.awt.Font;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import net.runelite.client.ui.FontManager;
@Getter
@RequiredArgsConstructor
public enum FontType
{
REGULAR("Regular"),
BOLD("Bold"),
SMALL("Small");
REGULAR("Regular", FontManager.getRunescapeFont()),
BOLD("Bold", FontManager.getRunescapeBoldFont()),
SMALL("Small", FontManager.getRunescapeSmallFont());
private final String name;
private final Font font;
@Override
public String toString()

View File

@@ -256,7 +256,7 @@ public enum WorldLocation
s = entry.getValue();
return s;
}
int distTo = worldArea.distanceTo(worldArea);
int distTo = worldArea.distanceTo(worldPoint);
if (distTo < dist)
{
dist = distTo;

View File

@@ -91,8 +91,8 @@ public class ChatCommandsPlugin extends Plugin
private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: <col=ff0000>(\\d+)</col>");
private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: <col=ff0000>(\\d+)</col>");
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?:Fight|Lap) duration: <col=ff0000>[0-9:]+</col>. Personal best: ([0-9:]+)");
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?:Fight|Lap) duration: <col=ff0000>([0-9:]+)</col> \\(new personal best\\)");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>[0-9:]+</col>\\. Personal best: ([0-9:]+)");
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>([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 String TOTAL_LEVEL_COMMAND_STRING = "!total";
@@ -113,6 +113,7 @@ public class ChatCommandsPlugin extends Plugin
private boolean logKills;
private HiscoreEndpoint hiscoreEndpoint; // hiscore endpoint for current player
private String lastBossKill;
private int lastPb = -1;
@Inject
private Client client;
@@ -244,7 +245,17 @@ public class ChatCommandsPlugin extends Plugin
int kc = Integer.parseInt(matcher.group(2));
setKc(boss, kc);
lastBossKill = boss;
// We either already have the pb, or need to remember the boss for the upcoming pb
if (lastPb > -1)
{
log.debug("Got out-of-order personal best for {}: {}", boss, lastPb);
setPb(boss, lastPb);
lastPb = -1;
}
else
{
lastBossKill = boss;
}
return;
}
@@ -312,19 +323,16 @@ public class ChatCommandsPlugin extends Plugin
setKc("Barrows Chests", kc);
}
if (lastBossKill != null)
matcher = KILL_DURATION_PATTERN.matcher(message);
if (matcher.find())
{
matcher = KILL_DURATION_PATTERN.matcher(message);
if (matcher.find())
{
matchPb(matcher);
}
matchPb(matcher);
}
matcher = NEW_PB_PATTERN.matcher(message);
if (matcher.find())
{
matchPb(matcher);
}
matcher = NEW_PB_PATTERN.matcher(message);
if (matcher.find())
{
matchPb(matcher);
}
lastBossKill = null;
@@ -337,8 +345,19 @@ public class ChatCommandsPlugin extends Plugin
if (s.length == 2)
{
int seconds = Integer.parseInt(s[0]) * 60 + Integer.parseInt(s[1]);
log.debug("Got personal best for {}: {}", lastBossKill, seconds);
setPb(lastBossKill, seconds);
if (lastBossKill != null)
{
// Most bosses sent boss kill message, and then pb message, so we
// use the remembered lastBossKill
log.debug("Got personal best for {}: {}", lastBossKill, seconds);
setPb(lastBossKill, seconds);
lastPb = -1;
}
else
{
// Some bosses send the pb message, and then the kill message!
lastPb = seconds;
}
}
}

View File

@@ -30,7 +30,6 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Insets;
import java.awt.Rectangle;
@@ -101,7 +100,6 @@ import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.ComboBoxListRenderer;
import net.runelite.client.ui.components.IconButton;
@@ -1017,37 +1015,6 @@ public class ConfigPanel extends PluginPanel
item.add(button, BorderLayout.EAST);
}
if (cid.getType() == Font.class)
{
JComboBox box = new JComboBox(FontManager.getAvailableFontNames());
box.setPreferredSize(new Dimension(150, 25));
box.setRenderer(new ComboBoxListRenderer());
box.setForeground(Color.WHITE);
box.setFocusable(false);
String currentlyConfigured = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName());
if (FontManager.lookupFont(currentlyConfigured) != null)
{
box.setSelectedItem(currentlyConfigured);
box.setToolTipText(currentlyConfigured);
}
else
{
log.debug("Selected font wasn't found on this system, resetting font back to runescape regular");
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), FontManager.getRunescapeFont());
}
box.addItemListener(e ->
{
if (e.getStateChange() == ItemEvent.SELECTED && box.getSelectedItem() != null)
{
final Font selected = FontManager.lookupFont(box.getSelectedItem().toString());
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), selected);
box.setToolTipText(box.getSelectedItem().toString());
}
});
item.add(box, BorderLayout.EAST);
}
mainPanel.add(item);
}
}

View File

@@ -26,6 +26,7 @@
package net.runelite.client.plugins.devtools;
import java.awt.Color;
import java.awt.Font;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
@@ -62,6 +63,7 @@ import net.runelite.api.coords.LocalPoint;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -75,6 +77,7 @@ class DevToolsOverlay extends Overlay
private static final int ITEM_EMPTY = 6512;
private static final int ITEM_FILLED = 20594;
private static final Font FONT = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 16);
private static final Color RED = new Color(221, 44, 0);
private static final Color GREEN = new Color(0, 200, 83);
private static final Color TURQOISE = new Color(0, 200, 157);
@@ -112,6 +115,7 @@ class DevToolsOverlay extends Overlay
@Override
public Dimension render(Graphics2D graphics)
{
graphics.setFont(FONT);
if (plugin.getPlayers().isActive())
{
@@ -394,7 +398,7 @@ class DevToolsOverlay extends Overlay
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2));
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (fm.getHeight() / 2) - fm.getMaxDescent());
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (textBounds.getHeight() / 2));
graphics.setColor(new Color(255, 255, 255, 65));
graphics.fill(slotBounds);
@@ -536,7 +540,7 @@ class DevToolsOverlay extends Overlay
Rectangle2D textBounds = fm.getStringBounds(text, graphics);
int textX = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2));
int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (fm.getHeight() / 2) - fm.getMaxDescent());
int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (textBounds.getHeight() / 2));
graphics.setColor(Color.BLACK);
graphics.drawString(text, textX + 1, textY + 1);

View File

@@ -192,7 +192,7 @@ class VarInspector extends JFrame
{
lastTick = tick;
JLabel header = new JLabel("Tick " + tick);
header.setFont(FontManager.getSmallFont(getFont()));
header.setFont(FontManager.getRunescapeSmallFont());
header.setBorder(new CompoundBorder(
BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
BorderFactory.createEmptyBorder(3, 6, 0, 0)

View File

@@ -84,71 +84,74 @@ enum DiscordGameEventType
BOSS_SMOKE_DEVIL("Thermonuclear smoke devil", DiscordAreaType.BOSSES, 9363, 9619),
BOSS_VORKATH("Vorkath", DiscordAreaType.BOSSES, 9023),
BOSS_WINTERTODT("Wintertodt", DiscordAreaType.BOSSES, 6462),
BOSS_ZALCANO("Zalcano", DiscordAreaType.BOSSES, 13250),
BOSS_ZULRAH("Zulrah", DiscordAreaType.BOSSES, 9007),
// Cities
CITY_AL_KHARID("Al Kharid", DiscordAreaType.CITIES, 13105, 13106),
CITY_APE_ATOLL("Ape Atoll", DiscordAreaType.CITIES, 10795, 11051, 10974, 11050),
CITY_ARCEUUS_HOUSE("Arceuus", DiscordAreaType.CITIES, 6459, 6715, 6458, 6714),
CITY_ARDOUGNE("Ardougne", DiscordAreaType.CITIES, 10548, 10547, 10292, 10291, 10036, 10035, 9780, 9779),
CITY_BARBARIAN_VILLAGE("Barbarian Village", DiscordAreaType.CITIES, 12341),
CITY_BANDIT_CAMP("Bandit Camp", DiscordAreaType.CITIES, 12591),
CITY_BEDABIN_CAMP("Bedabin Camp", DiscordAreaType.CITIES, 12590),
CITY_BRIMHAVEN("Brimhaven", DiscordAreaType.CITIES, 11057, 11058),
CITY_BURGH_DE_ROTT("Burgh de Rott", DiscordAreaType.CITIES, 13874, 13873, 14130, 14129),
CITY_BURTHORPE("Burthorpe", DiscordAreaType.CITIES, 11319, 11575),
CITY_CANIFIS("Canifis", DiscordAreaType.CITIES, 13878),
CITY_CATHERBY("Catherby", DiscordAreaType.CITIES, 11317, 11318, 11061),
CITY_CORSAIR_CAVE("Corsair Cove", DiscordAreaType.CITIES, 10028, 10284),
CITY_DORGESH_KAAN("Dorgesh-Kaan", DiscordAreaType.CITIES, 10835, 10834),
CITY_DRAYNOR("Draynor", DiscordAreaType.CITIES, 12338),
CITY_EDGEVILLE("Edgeville", DiscordAreaType.CITIES, 12342),
CITY_ENTRANA("Entrana", DiscordAreaType.CITIES, 11060, 11316),
CITY_FALADOR("Falador", DiscordAreaType.CITIES, 11828, 11572, 11571, 11827, 12084),
CITY_GOBLIN_VILLAGE("Goblin Village", DiscordAreaType.CITIES, 11830),
CITY_GUTANOTH("Gu'Tanoth", DiscordAreaType.CITIES, 10031),
CITY_HOSIDIUS_HOUSE("Hosidius", DiscordAreaType.CITIES, 6713, 6712, 6455, 6711, 6710, 6965, 6966, 7222, 7223, 6967),
CITY_JATISZO("Jatizso", DiscordAreaType.CITIES, 9531),
CITY_JIGGIG("Jiggig", DiscordAreaType.CITIES, 9775),
CITY_KARAMJA("Karamja", DiscordAreaType.CITIES, 11569, 11568, 11567, 11566, 11313, 11312, 11311),
CITY_KELDAGRIM("Keldagrim", DiscordAreaType.CITIES, 11423, 11422, 11679, 11678),
CITY_LLETYA("Lletya", DiscordAreaType.CITIES, 9265),
CITY_LOVAKENGJ_HOUSE("Lovakengj", DiscordAreaType.CITIES, 5692, 5948, 5691, 5947, 6203, 6202, 5690, 5946),
CITY_LUMBRIDGE("Lumbridge", DiscordAreaType.CITIES, 12850),
CITY_LUNAR_ISLE("Lunar Isle", DiscordAreaType.CITIES, 8253, 8252, 8509, 8508),
CITY_MEIYERDITCH("Meiyerditch", DiscordAreaType.CITIES, 14132, 14388, 14387, 14386, 14385),
CITY_MISCELLANIA("Miscellania", DiscordAreaType.CITIES, 10044, 10300),
CITY_MOS_LE_HARMLESS("Mos Le'Harmless", DiscordAreaType.CITIES, 14638),
CITY_MORTTON("Mort'ton", DiscordAreaType.CITIES, 13875),
CITY_MOR_UI_REK("Mor UI Rek", DiscordAreaType.CITIES, 9808, 9807, 10064, 10063),
CITY_AL_KHARID("Al Kharid" , DiscordAreaType.CITIES, 13105, 13106),
CITY_APE_ATOLL("Ape Atoll" , DiscordAreaType.CITIES, 10795, 11051, 10974, 11050),
CITY_ARCEUUS_HOUSE("Arceuus" , DiscordAreaType.CITIES, 6459, 6715, 6458, 6714),
CITY_ARDOUGNE("Ardougne" , DiscordAreaType.CITIES, 10548, 10547, 10292, 10291, 10036, 10035, 9780, 9779),
CITY_BARBARIAN_VILLAGE("Barbarian Village" , DiscordAreaType.CITIES, 12341),
CITY_BANDIT_CAMP("Bandit Camp" , DiscordAreaType.CITIES, 12591),
CITY_BEDABIN_CAMP("Bedabin Camp" , DiscordAreaType.CITIES, 12590),
CITY_BRIMHAVEN("Brimhaven" , DiscordAreaType.CITIES, 11057, 11058),
CITY_BURGH_DE_ROTT("Burgh de Rott" , DiscordAreaType.CITIES, 13874, 13873, 14130, 14129),
CITY_BURTHORPE("Burthorpe" , DiscordAreaType.CITIES, 11319, 11575),
CITY_CANIFIS("Canifis" , DiscordAreaType.CITIES, 13878),
CITY_CATHERBY("Catherby" , DiscordAreaType.CITIES, 11317, 11318, 11061),
CITY_CORSAIR_CAVE("Corsair Cove" , DiscordAreaType.CITIES, 10028, 10284),
CITY_DORGESH_KAAN("Dorgesh-Kaan" , DiscordAreaType.CITIES, 10835, 10834),
CITY_DRAYNOR("Draynor" , DiscordAreaType.CITIES, 12338),
CITY_EDGEVILLE("Edgeville" , DiscordAreaType.CITIES, 12342),
CITY_ENTRANA("Entrana" , DiscordAreaType.CITIES, 11060, 11316),
CITY_FALADOR("Falador" , DiscordAreaType.CITIES, 11828, 11572, 11571, 11827, 12084),
CITY_GOBLIN_VILLAGE("Goblin Village" , DiscordAreaType.CITIES, 11830),
CITY_GUTANOTH("Gu'Tanoth" , DiscordAreaType.CITIES, 10031),
CITY_GWENITH("Gwenith", DiscordAreaType.CITIES, 8501, 8757, 9013),
CITY_HOSIDIUS_HOUSE("Hosidius" , DiscordAreaType.CITIES, 6713, 6712, 6455, 6711, 6710, 6965, 6966, 7222, 7223, 6967),
CITY_JATISZO("Jatizso" , DiscordAreaType.CITIES, 9531),
CITY_JIGGIG("Jiggig" , DiscordAreaType.CITIES, 9775),
CITY_KARAMJA("Karamja" , DiscordAreaType.CITIES, 11569, 11568, 11567, 11566, 11313, 11312, 11311),
CITY_KELDAGRIM("Keldagrim" , DiscordAreaType.CITIES, 11423, 11422, 11679, 11678),
CITY_LLETYA("Lletya" , DiscordAreaType.CITIES, 9265),
CITY_LOVAKENGJ_HOUSE("Lovakengj" , DiscordAreaType.CITIES, 5692, 5948, 5691, 5947, 6203, 6202, 5690, 5946),
CITY_LUMBRIDGE("Lumbridge" , DiscordAreaType.CITIES, 12850),
CITY_LUNAR_ISLE("Lunar Isle" , DiscordAreaType.CITIES, 8253, 8252, 8509, 8508),
CITY_MEIYERDITCH("Meiyerditch" , DiscordAreaType.CITIES, 14132, 14388, 14387, 14386, 14385),
CITY_MISCELLANIA("Miscellania" , DiscordAreaType.CITIES, 10044, 10300),
CITY_MOS_LE_HARMLESS("Mos Le'Harmless" , DiscordAreaType.CITIES, 14638),
CITY_MORTTON("Mort'ton" , DiscordAreaType.CITIES, 13875),
CITY_MOR_UI_REK("Mor UI Rek" , DiscordAreaType.CITIES, 9808, 9807, 10064, 10063),
CITY_MOUNT_KARUULM("Mount Karuulm", DiscordAreaType.CITIES, 5179, 4923, 5180),
CITY_NARDAH("Nardah", DiscordAreaType.CITIES, 13613),
CITY_NEITIZNOT("Neitiznot", DiscordAreaType.CITIES, 9275),
CITY_PISCATORIS("Piscatoris", DiscordAreaType.CITIES, 9273),
CITY_POLLNIVNEACH("Pollnivneach", DiscordAreaType.CITIES, 13358),
CITY_PORT_KHAZARD("Port Khazard", DiscordAreaType.CITIES, 10545),
CITY_PORT_PHASMATYS("Port Phasmatys", DiscordAreaType.CITIES, 14646),
CITY_PORT_SARIM("Port Sarim", DiscordAreaType.CITIES, 12082),
CITY_PISCARILIUS_HOUSE("Port Piscarilius", DiscordAreaType.CITIES, 6971, 7227, 6970, 7226),
CITY_RELLEKKA("Rellekka", DiscordAreaType.CITIES, 10553),
CITY_RIMMINGTON("Rimmington", DiscordAreaType.CITIES, 11826, 11570),
CITY_SEERS_VILLAGE("Seers' Village", DiscordAreaType.CITIES, 10806),
CITY_SHAYZIEN_HOUSE("Shayzien", DiscordAreaType.CITIES, 5944, 5943, 6200, 6199, 5688),
CITY_SHILO_VILLAGE("Shilo Village", DiscordAreaType.CITIES, 11310),
CITY_SOPHANEM("Sophanem", DiscordAreaType.CITIES, 13099),
CITY_TAI_BWO_WANNAI("Tai Bwo Wannai", DiscordAreaType.CITIES, 11056, 11055),
CITY_TAVERLEY("Taverley", DiscordAreaType.CITIES, 11574, 11573),
CITY_TREE_GNOME_STRONGHOLD("Tree Gnome Stronghold", DiscordAreaType.CITIES, 9782, 9781),
CITY_TREE_GNOME_VILLAGE("Tree Gnome Village", DiscordAreaType.CITIES, 10033),
CITY_TROLL_STRONGHOLD("Troll Stronghold", DiscordAreaType.CITIES, 11321),
CITY_TYRAS_CAMP("Tyras Camp", DiscordAreaType.CITIES, 8753, 8752),
CITY_UZER("Uzer", DiscordAreaType.CITIES, 13872),
CITY_VARROCK("Varrock", DiscordAreaType.CITIES, 12596, 12597, 12598, 12852, 12853, 12854, 13108, 13109, 13110),
CITY_WITCHHAVEN("Witchaven", DiscordAreaType.CITIES, 10803),
CITY_NARDAH("Nardah" , DiscordAreaType.CITIES, 13613),
CITY_NEITIZNOT("Neitiznot" , DiscordAreaType.CITIES, 9275),
CITY_PISCATORIS("Piscatoris" , DiscordAreaType.CITIES, 9273),
CITY_POLLNIVNEACH("Pollnivneach" , DiscordAreaType.CITIES, 13358),
CITY_PORT_KHAZARD("Port Khazard" , DiscordAreaType.CITIES, 10545),
CITY_PORT_PHASMATYS("Port Phasmatys" , DiscordAreaType.CITIES, 14646),
CITY_PORT_SARIM("Port Sarim" , DiscordAreaType.CITIES, 12082),
CITY_PISCARILIUS_HOUSE("Port Piscarilius" , DiscordAreaType.CITIES, 6971, 7227, 6970, 7226),
CITY_PRIFDDINAS("Prifddinas", DiscordAreaType.CITIES, 12894, 12895, 13150, 13151),
CITY_RELLEKKA("Rellekka" , DiscordAreaType.CITIES, 10553),
CITY_RIMMINGTON("Rimmington" , DiscordAreaType.CITIES, 11826, 11570),
CITY_SEERS_VILLAGE("Seers' Village" , DiscordAreaType.CITIES, 10806),
CITY_SHAYZIEN_HOUSE("Shayzien" , DiscordAreaType.CITIES, 5944, 5943, 6200, 6199, 5688),
CITY_SHILO_VILLAGE("Shilo Village" , DiscordAreaType.CITIES, 11310),
CITY_SOPHANEM("Sophanem" , DiscordAreaType.CITIES, 13099),
CITY_TAI_BWO_WANNAI("Tai Bwo Wannai" , DiscordAreaType.CITIES, 11056, 11055),
CITY_TAVERLEY("Taverley" , DiscordAreaType.CITIES, 11574, 11573),
CITY_TREE_GNOME_STRONGHOLD("Tree Gnome Stronghold" , DiscordAreaType.CITIES, 9782, 9781),
CITY_TREE_GNOME_VILLAGE("Tree Gnome Village" , DiscordAreaType.CITIES, 10033),
CITY_TROLL_STRONGHOLD("Troll Stronghold" , DiscordAreaType.CITIES, 11321),
CITY_TYRAS_CAMP("Tyras Camp" , DiscordAreaType.CITIES, 8753, 8752),
CITY_UZER("Uzer" , DiscordAreaType.CITIES, 13872),
CITY_VARROCK("Varrock" , DiscordAreaType.CITIES, 12596, 12597, 12598, 12852, 12853, 12854, 13108, 13109, 13110),
CITY_WITCHHAVEN("Witchaven" , DiscordAreaType.CITIES, 10803),
CITY_WOODCUTTING_GUILD("Woodcutting Guild", DiscordAreaType.CITIES, 6454, 6198, 6298),
CITY_YANILLE("Yanille", DiscordAreaType.CITIES, 10288, 10032),
CITY_ZANARIS("Zanaris", DiscordAreaType.CITIES, 9285, 9541, 9540, 9797),
CITY_ZULANDRA("Zul-Andra", DiscordAreaType.CITIES, 8751),
CITY_YANILLE("Yanille" , DiscordAreaType.CITIES, 10288, 10032),
CITY_ZANARIS("Zanaris" , DiscordAreaType.CITIES, 9285, 9541, 9540, 9797),
CITY_ZULANDRA("Zul-Andra" , DiscordAreaType.CITIES, 8751),
// Dungeons
DUNGEON_ABANDONED_MINE("Abandoned Mine", DiscordAreaType.DUNGEONS, 13718, 11079, 11078, 11077, 10823, 10822, 10821),
@@ -180,6 +183,7 @@ enum DiscordGameEventType
DUNGEON_GOBLIN_CAVE("Goblin Cave", DiscordAreaType.DUNGEONS, 10393),
DUNGEON_GRAND_TREE_TUNNELS("Grand Tree Tunnels", DiscordAreaType.DUNGEONS, 9882),
DUNGEON_HAM("H.A.M Dungeon", DiscordAreaType.DUNGEONS, 12694, 10321),
DUNGEON_IORWERTH("Iorwerth Dungeon", DiscordAreaType.DUNGEONS, 12738, 12993, 12994),
DUNGEON_JATIZSO_MINES("Jatizo Mines", DiscordAreaType.DUNGEONS, 9631),
DUNGEON_JIGGIG_BURIAL_TOMB("Jiggig Burial Tomb", DiscordAreaType.DUNGEONS, 9875, 9874),
DUNGEON_JOGRE("Jogre Dungeon", DiscordAreaType.DUNGEONS, 11412),
@@ -211,6 +215,7 @@ enum DiscordGameEventType
DUNGEON_THE_WARRENS("The Warrens", DiscordAreaType.DUNGEONS, 7070, 7326),
DUNGEON_TOLNA("Dungeon of Tolna", DiscordAreaType.DUNGEONS, 13209),
DUNGEON_TOWER_OF_LIFE("Tower of Life Basement", DiscordAreaType.DUNGEONS, 12100),
DUNGEON_TRAHAEARN_MINE("Trahaearn Mine", DiscordAreaType.DUNGEONS, 13249),
DUNGEON_TUNNEL_OF_CHAOS("Tunnel of Chaos", DiscordAreaType.DUNGEONS, 12625),
DUNGEON_UNDERGROUND_PASS("Underground Pass", DiscordAreaType.DUNGEONS, 9369, 9370),
DUNGEON_VARROCKSEWERS("Varrock Sewers", DiscordAreaType.DUNGEONS, 12954, 13210),
@@ -232,6 +237,7 @@ enum DiscordGameEventType
MG_CLAN_WARS("Clan Wars", DiscordAreaType.MINIGAMES, 13135, 13134, 13133, 13131, 13130, 13387, 13386),
MG_DUEL_ARENA("Duel Arena", DiscordAreaType.MINIGAMES, 13362),
MG_FISHING_TRAWLER("Fishing Trawler", DiscordAreaType.MINIGAMES, 7499),
MG_GAUNTLET("Gauntlet", DiscordAreaType.MINIGAMES, 12995),
MG_INFERNO("The Inferno", DiscordAreaType.MINIGAMES, 9043),
MG_LAST_MAN_STANDING("Last Man Standing", DiscordAreaType.MINIGAMES, 13660, 13659, 13658, 13916, 13915, 13914),
MG_MAGE_TRAINING_ARENA("Mage Training Arena", DiscordAreaType.MINIGAMES, 13462, 13463),

View File

@@ -132,10 +132,10 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 10,
keyName = "hideNPCsNames",
name = "Hide NPCs Names",
description = "Configures which NPCs to hide"
position = 10,
keyName = "hideNPCsNames",
name = "Hide NPCs Names",
description = "Configures which NPCs to hide"
)
default String hideNPCsNames()
{
@@ -143,7 +143,18 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 10,
position = 11,
keyName = "hideDeadNPCs",
name = "Hide Dead NPCs",
description = "Configures whether or not NPCs that just died are hidden"
)
default boolean hideDeadNPCs()
{
return false;
}
@ConfigItem(
position = 12,
keyName = "hideNPCsOnDeath",
name = "Hide NPCs On Death",
description = "Configures which NPCs to hide when they die"
@@ -154,7 +165,7 @@ public interface EntityHiderConfig extends Config
}
@ConfigItem(
position = 11,
position = 13,
keyName = "hideProjectiles",
name = "Hide Projectiles",
description = "Configures whether or not projectiles are hidden"
@@ -163,16 +174,4 @@ public interface EntityHiderConfig extends Config
{
return false;
}
@ConfigItem(
position = 12,
keyName = "hideDeadNPCs",
name = "Hide Dead NPCs",
description = "Configures whether or not NPCs that just died are hidden"
)
default boolean hideDeadNPCs()
{
return false;
}
}

View File

@@ -38,6 +38,7 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Entity Hider",
@@ -107,8 +108,8 @@ public class EntityHiderPlugin extends Plugin
client.setNPCsHidden(config.hideNPCs());
client.setNPCsHidden2D(config.hideNPCs2D());
client.setNPCsNames(config.hideNPCsNames());
client.setNPCsHiddenOnDeath(config.hideNPCsOnDeath());
client.setNPCsNames(Text.fromCSV(config.hideNPCsNames()));
client.setNPCsHiddenOnDeath(Text.fromCSV(config.hideNPCsOnDeath()));
client.setAttackersHidden(config.hideAttackers());

View File

@@ -49,7 +49,7 @@ class ItemPanel extends JPanel
JLabel name = new JLabel(item.getName());
JLabel location = new JLabel(StringUtils.capitalize(kitType.toString().toLowerCase()));
location.setFont(FontManager.getSmallFont(getFont()));
location.setFont(FontManager.getRunescapeSmallFont());
JLabel imageLabel = new JLabel();
icon.addTo(imageLabel);

View File

@@ -223,14 +223,14 @@ class FeedPanel extends PluginPanel
Color darkerForeground = UIManager.getColor("Label.foreground").darker();
JLabel titleLabel = new JLabel(item.getTitle());
titleLabel.setFont(FontManager.getSmallFont(getFont()));
titleLabel.setFont(FontManager.getRunescapeSmallFont());
titleLabel.setBackground(null);
titleLabel.setForeground(darkerForeground);
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - TIME_WIDTH, 0));
Duration duration = Duration.between(Instant.ofEpochMilli(item.getTimestamp()), Instant.now());
JLabel timeLabel = new JLabel(durationToString(duration));
timeLabel.setFont(FontManager.getSmallFont(getFont()));
timeLabel.setFont(FontManager.getRunescapeSmallFont());
timeLabel.setForeground(darkerForeground);
titleAndTime.add(titleLabel, BorderLayout.WEST);
@@ -239,9 +239,9 @@ class FeedPanel extends PluginPanel
JPanel content = new JPanel(new BorderLayout());
content.setBackground(null);
JLabel contentLabel = new JLabel(lineBreakText(item.getContent(), FontManager.getSmallFont(getFont())));
JLabel contentLabel = new JLabel(lineBreakText(item.getContent(), FontManager.getRunescapeSmallFont()));
contentLabel.setBorder(new EmptyBorder(2, 0, 0, 0));
contentLabel.setFont(FontManager.getSmallFont(getFont()));
contentLabel.setFont(FontManager.getRunescapeSmallFont());
contentLabel.setForeground(darkerForeground);
content.add(contentLabel, BorderLayout.CENTER);

View File

@@ -68,15 +68,4 @@ public interface FpsConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "drawPing",
name = "Draw ping indicator",
description = "Show a number in the corner for the current ping",
position = 3
)
default boolean drawPing()
{
return false;
}
}

View File

@@ -26,14 +26,14 @@ package net.runelite.client.plugins.fps;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.Point;
import net.runelite.api.Varbits;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -51,6 +51,10 @@ import net.runelite.client.ui.overlay.OverlayUtil;
@Singleton
public class FpsOverlay extends Overlay
{
private static final int Y_OFFSET = 1;
private static final int X_OFFSET = 1;
private static final String FPS_STRING = " FPS";
// Local dependencies
private final Client client;
private final FpsPlugin plugin;
@@ -84,62 +88,30 @@ public class FpsOverlay extends Overlay
return isEnforced() ? Color.red : Color.yellow;
}
private static Color getPingColor(int ping)
{
if (ping >= 100 || ping < 0)
{
return Color.red;
}
else if (ping >= 50)
{
return Color.yellow;
}
return Color.green;
}
private int calculateOffset()
{
if ((client.getVar(Varbits.SIDE_PANELS) == 1) && client.isResized())
{
return 27;
}
return 2;
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.isDrawFps() && !plugin.isDrawPing())
if (!plugin.isDrawFps())
{
return null;
}
final int offset = calculateOffset();
// On resizable bottom line mode the logout button is at the top right, so offset the overlay
// to account for it
Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON);
int xOffset = X_OFFSET;
if (logoutButton != null && !logoutButton.isHidden())
{
xOffset += logoutButton.getWidth();
}
final String text = client.getFPS() + FPS_STRING;
final int textWidth = graphics.getFontMetrics().stringWidth(text);
final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent();
final int width = (int) client.getRealDimensions().getWidth();
final FontMetrics fontMetrics = graphics.getFontMetrics();
int baseYOffset = (fontMetrics.getAscent() - fontMetrics.getDescent()) + 1;
if (plugin.isDrawFps())
{
final String fpsText = String.format("%d FPS", client.getFPS());
final int textWidth = fontMetrics.stringWidth(fpsText);
final Point point = new Point(width - textWidth - offset, baseYOffset);
OverlayUtil.renderTextLocation(graphics, point, fpsText, getFpsValueColor());
baseYOffset += 11;
}
if (plugin.isDrawPing())
{
final String pingText = String.format("%dms", plugin.getPing());
final int textWidth = fontMetrics.stringWidth(pingText);
final Point point = new Point(width - textWidth - offset, baseYOffset);
OverlayUtil.renderTextLocation(graphics, point, pingText, getPingColor(plugin.getPing()));
}
final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET);
OverlayUtil.renderTextLocation(graphics, point, text, getFpsValueColor());
return null;
}

View File

@@ -27,27 +27,19 @@ package net.runelite.client.plugins.fps;
import com.google.inject.Inject;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ExecutorServiceExceptionLogger;
import net.runelite.client.util.ping.Ping;
/**
* Performance has two primary areas, this plugin class just keeps those areas up to date and handles setup / teardown.
* FPS Control has two primary areas, this plugin class just keeps those areas up to date and handles setup / teardown.
*
* <p>Overlay paints the current FPS, the color depends on whether or not FPS is being enforced.
* The overlay is lightweight and is merely and indicator.
@@ -55,15 +47,11 @@ import net.runelite.client.util.ping.Ping;
* <p>Draw Listener, sleeps a calculated amount after each canvas paint operation.
* This is the heart of the plugin, the amount of sleep taken is regularly adjusted to account varying
* game and system load, it usually finds the sweet spot in about two seconds.
*
* <p>Pinging the world, when logged in and ping display is enabled, every 5 seconds the remote server
* for the current world is pinged. A scheduled method in this class is responsible for that. When ping fails
* or those conditions are not met, ping will have the value of -1.
*/
@PluginDescriptor(
name = "Performance",
description = "Show current Ping and FPS or set an FPS limit",
tags = {"frames", "framerate", "limit", "overlay", "ping"},
description = "Show current FPS or set an FPS limit",
tags = {"frames", "framerate", "limit", "overlay"},
enabledByDefault = false
)
@Singleton
@@ -71,9 +59,6 @@ public class FpsPlugin extends Plugin
{
static final String CONFIG_GROUP_KEY = "fpscontrol";
@Getter
private int ping;
@Inject
private OverlayManager overlayManager;
@@ -86,30 +71,18 @@ public class FpsPlugin extends Plugin
@Inject
private DrawManager drawManager;
@Inject
private Client client;
@Inject
private FpsConfig fpsConfig;
@Inject
private EventBus eventBus;
private final ScheduledExecutorService pingExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
private boolean loaded = false;
private boolean shutdown;
@Getter(AccessLevel.PACKAGE)
private FpsLimitMode limitMode;
@Getter(AccessLevel.PACKAGE)
private boolean drawFps;
@Getter(AccessLevel.PACKAGE)
private boolean drawPing;
@Provides
FpsConfig provideConfig(ConfigManager configManager)
{
@@ -124,7 +97,6 @@ public class FpsPlugin extends Plugin
limitMode = fpsConfig.limitMode();
drawFps = fpsConfig.drawFps();
drawPing = fpsConfig.drawPing();
}
}
@@ -134,11 +106,6 @@ public class FpsPlugin extends Plugin
overlay.onFocusChanged(event);
}
private void onGameStateChanged(GameStateChanged event)
{
shutdown = event.getGameState() != GameState.LOGGED_IN;
}
@Override
protected void startUp() throws Exception
{
@@ -146,17 +113,9 @@ public class FpsPlugin extends Plugin
limitMode = fpsConfig.limitMode();
drawFps = fpsConfig.drawFps();
drawPing = fpsConfig.drawPing();
overlayManager.add(overlay);
drawManager.registerEveryFrameListener(drawListener);
drawListener.reloadConfig();
shutdown = client.getGameState() != GameState.LOGGED_IN;
if (!loaded)
{
pingExecutorService.scheduleAtFixedRate(this::getPingToCurrentWorld, 5, 5, TimeUnit.SECONDS);
loaded = true;
}
}
@Override
@@ -166,25 +125,11 @@ public class FpsPlugin extends Plugin
overlayManager.remove(overlay);
drawManager.unregisterEveryFrameListener(drawListener);
shutdown = true;
}
private void addSubscriptions()
{
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
}
private void getPingToCurrentWorld()
{
if (!shutdown && drawPing)
{
ping = Ping.ping(String.format("oldschool%d.runescape.com", client.getWorld() - 300));
}
else
{
ping = -1;
}
}
}

View File

@@ -136,11 +136,11 @@ class GrandExchangeOfferSlot extends JPanel
itemName.setForeground(Color.WHITE);
itemName.setVerticalAlignment(JLabel.BOTTOM);
itemName.setFont(FontManager.getSmallFont(getFont()));
itemName.setFont(FontManager.getRunescapeSmallFont());
offerInfo.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
offerInfo.setVerticalAlignment(JLabel.TOP);
offerInfo.setFont(FontManager.getSmallFont(getFont()));
offerInfo.setFont(FontManager.getRunescapeSmallFont());
JLabel switchFaceViewIcon = new JLabel();
switchFaceViewIcon.setIcon(RIGHT_ARROW_ICON);
@@ -172,11 +172,11 @@ class GrandExchangeOfferSlot extends JPanel
itemPrice.setForeground(Color.WHITE);
itemPrice.setVerticalAlignment(JLabel.BOTTOM);
itemPrice.setFont(FontManager.getSmallFont(getFont()));
itemPrice.setFont(FontManager.getRunescapeSmallFont());
offerSpent.setForeground(Color.WHITE);
offerSpent.setVerticalAlignment(JLabel.TOP);
offerSpent.setFont(FontManager.getSmallFont(getFont()));
offerSpent.setFont(FontManager.getRunescapeSmallFont());
JLabel switchDetailsViewIcon = new JLabel();
switchDetailsViewIcon.setIcon(LEFT_ARROW_ICON);

View File

@@ -109,6 +109,8 @@ public class GroundItemsOverlay extends Overlay
{
return null;
}
final FontMetrics fm = graphics.getFontMetrics();
final Player player = client.getLocalPlayer();
if (player == null || client.getViewportWidget() == null)
@@ -116,8 +118,6 @@ public class GroundItemsOverlay extends Overlay
return null;
}
final FontMetrics fm = graphics.getFontMetrics();
offsetMap.clear();
final LocalPoint localLocation = player.getLocalLocation();
final Point mousePos = client.getMouseCanvasPosition();
@@ -319,14 +319,14 @@ public class GroundItemsOverlay extends Overlay
// Item bounds
int x = textX - 2;
int y = textY - stringHeight - 2 + fm.getMaxDescent();
int y = textY - stringHeight - 2;
int width = stringWidth + 4;
int height = stringHeight + 4;
final Rectangle itemBounds = new Rectangle(x, y, width, height);
// Hidden box
x += width + 2;
y = textY - (fm.getMaxAscent() + RECTANGLE_SIZE) / 2;
y = textY - (RECTANGLE_SIZE + stringHeight) / 2;
width = height = RECTANGLE_SIZE;
final Rectangle itemHiddenBox = new Rectangle(x, y, width, height);

View File

@@ -294,7 +294,7 @@ public class HiscorePanel extends PluginPanel
private JPanel makeSkillPanel(HiscoreSkill skill)
{
JLabel label = new JLabel();
label.setFont(FontManager.getSmallFont(getFont()));
label.setFont(FontManager.getRunescapeSmallFont());
label.setText("--");
String skillName = (skill == null ? "combat" : skill.getName().toLowerCase());

View File

@@ -195,11 +195,12 @@ public class IdleNotifierPlugin extends Plugin
case WOODCUTTING_DRAGON:
case WOODCUTTING_INFERNAL:
case WOODCUTTING_3A_AXE:
/* Cooking(Fire, Range) */
case WOODCUTTING_CRYSTAL:
/* Cooking(Fire, Range) */
case COOKING_FIRE:
case COOKING_RANGE:
case COOKING_WINE:
/* Crafting(Gem Cutting, Glassblowing, Spinning, Battlestaves, Pottery) */
/* Crafting(Gem Cutting, Glassblowing, Spinning, Battlestaves, Pottery) */
case GEM_CUTTING_OPAL:
case GEM_CUTTING_JADE:
case GEM_CUTTING_REDTOPAZ:
@@ -214,7 +215,7 @@ public class IdleNotifierPlugin extends Plugin
case CRAFTING_LEATHER:
case CRAFTING_POTTERS_WHEEL:
case CRAFTING_POTTERY_OVEN:
/* Fletching(Cutting, Stringing) */
/* Fletching(Cutting, Stringing) */
case FLETCHING_BOW_CUTTING:
case FLETCHING_STRING_NORMAL_SHORTBOW:
case FLETCHING_STRING_OAK_SHORTBOW:
@@ -228,11 +229,11 @@ public class IdleNotifierPlugin extends Plugin
case FLETCHING_STRING_MAPLE_LONGBOW:
case FLETCHING_STRING_YEW_LONGBOW:
case FLETCHING_STRING_MAGIC_LONGBOW:
/* Smithing(Anvil, Furnace, Cannonballs */
/* Smithing(Anvil, Furnace, Cannonballs */
case SMITHING_ANVIL:
case SMITHING_SMELTING:
case SMITHING_CANNONBALL:
/* Fishing */
/* Fishing */
case FISHING_CRUSHING_INFERNAL_EELS:
case FISHING_CUTTING_SACRED_EELS:
case FISHING_BIG_NET:
@@ -246,7 +247,7 @@ public class IdleNotifierPlugin extends Plugin
case FISHING_OILY_ROD:
case FISHING_KARAMBWAN:
case FISHING_BAREHAND:
/* Mining(Normal) */
/* Mining(Normal) */
case MINING_BRONZE_PICKAXE:
case MINING_IRON_PICKAXE:
case MINING_STEEL_PICKAXE:
@@ -255,16 +256,32 @@ public class IdleNotifierPlugin extends Plugin
case MINING_ADAMANT_PICKAXE:
case MINING_RUNE_PICKAXE:
case MINING_DRAGON_PICKAXE:
case MINING_DRAGON_PICKAXE_ORN:
case MINING_DRAGON_PICKAXE_UPGRADED:
case MINING_DRAGON_PICKAXE_OR:
case MINING_INFERNAL_PICKAXE:
case MINING_3A_PICKAXE:
case MINING_CRYSTAL_PICKAXE:
case DENSE_ESSENCE_CHIPPING:
case DENSE_ESSENCE_CHISELING:
/* Herblore */
/* Mining(Motherlode) */
case MINING_MOTHERLODE_BRONZE:
case MINING_MOTHERLODE_IRON:
case MINING_MOTHERLODE_STEEL:
case MINING_MOTHERLODE_BLACK:
case MINING_MOTHERLODE_MITHRIL:
case MINING_MOTHERLODE_ADAMANT:
case MINING_MOTHERLODE_RUNE:
case MINING_MOTHERLODE_DRAGON:
case MINING_MOTHERLODE_DRAGON_UPGRADED:
case MINING_MOTHERLODE_DRAGON_OR:
case MINING_MOTHERLODE_INFERNAL:
case MINING_MOTHERLODE_3A:
case MINING_MOTHERLODE_CRYSTAL:
/* Herblore */
case HERBLORE_PESTLE_AND_MORTAR:
case HERBLORE_POTIONMAKING:
case HERBLORE_MAKE_TAR:
/* Magic */
/* Magic */
case MAGIC_CHARGING_ORBS:
case MAGIC_LUNAR_PLANK_MAKE:
case MAGIC_LUNAR_STRING_JEWELRY:
@@ -273,16 +290,16 @@ public class IdleNotifierPlugin extends Plugin
case MAGIC_ENCHANTING_AMULET_1:
case MAGIC_ENCHANTING_AMULET_2:
case MAGIC_ENCHANTING_AMULET_3:
/* Prayer */
/* Prayer */
case USING_GILDED_ALTAR:
/* Farming */
/* Farming */
case FARMING_MIX_ULTRACOMPOST:
case FARMING_HARVEST_BUSH:
case FARMING_HARVEST_HERB:
case FARMING_HARVEST_FRUIT_TREE:
case FARMING_HARVEST_FLOWER:
case FARMING_HARVEST_ALLOTMENT:
/* Misc */
/* Misc */
case PISCARILIUS_CRANE_REPAIR:
case HOME_MAKE_TABLET:
case SAND_COLLECTION:

View File

@@ -117,7 +117,7 @@ public class InfoPanel extends PluginPanel
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
versionPanel.setLayout(new GridLayout(0, 1));
final Font smallFont = FontManager.getSmallFont(getFont());
final Font smallFont = FontManager.getRunescapeSmallFont();
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
version.setFont(smallFont);
@@ -207,7 +207,7 @@ public class InfoPanel extends PluginPanel
/**
* Builds a link panel with a given icon, text and url to redirect to.
*/
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, String url)
private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, String url)
{
return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.browse(url));
}
@@ -215,7 +215,7 @@ public class InfoPanel extends PluginPanel
/**
* Builds a link panel with a given icon, text and callable to call.
*/
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, Runnable callback)
private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, Runnable callback)
{
JPanel container = new JPanel();
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
@@ -269,11 +269,11 @@ public class InfoPanel extends PluginPanel
JLabel topLine = new JLabel(topText);
topLine.setForeground(Color.WHITE);
topLine.setFont(FontManager.getSmallFont(getFont()));
topLine.setFont(FontManager.getRunescapeSmallFont());
JLabel bottomLine = new JLabel(bottomText);
bottomLine.setForeground(Color.WHITE);
bottomLine.setFont(FontManager.getSmallFont(getFont()));
bottomLine.setFont(FontManager.getRunescapeSmallFont());
textContainer.add(topLine);
textContainer.add(bottomLine);

View File

@@ -170,7 +170,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
final Rectangle bounds = itemWidget.getCanvasBounds();
final TextComponent textComponent = new TextComponent();
textComponent.setPosition(new Point(bounds.x, bounds.y + 1 + graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent()));
textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15));
textComponent.setText(charges < 0 ? "?" : String.valueOf(charges));
textComponent.setColor(plugin.getColor(charges));
textComponent.render(graphics);

View File

@@ -72,6 +72,7 @@ enum ItemIdentification
MAGIC_SAPLING(Type.SAPLING, "Magic", "MAG", ItemID.MAGIC_SAPLING, ItemID.MAGIC_SEEDLING, ItemID.MAGIC_SEEDLING_W),
REDWOOD_SAPLING(Type.SAPLING, "Red", "RED", ItemID.REDWOOD_SAPLING, ItemID.REDWOOD_SEEDLING, ItemID.REDWOOD_SEEDLING_W),
SPIRIT_SAPLING(Type.SAPLING, "Spirit", "SPI", ItemID.SPIRIT_SAPLING, ItemID.SPIRIT_SEEDLING, ItemID.SPIRIT_SEEDLING_W),
CRYSTAL_SAPLING(Type.SAPLING, "Crystal", "CRY", ItemID.CRYSTAL_SAPLING, ItemID.CRYSTAL_SEEDLING, ItemID.CRYSTAL_SEEDLING_W),
APPLE_SAPLING(Type.SAPLING, "Apple", "APP", ItemID.APPLE_SAPLING, ItemID.APPLE_SEEDLING, ItemID.APPLE_SEEDLING_W),
BANANA_SAPLING(Type.SAPLING, "Banana", "BAN", ItemID.BANANA_SAPLING, ItemID.BANANA_SEEDLING, ItemID.BANANA_SEEDLING_W),

View File

@@ -49,7 +49,7 @@ class BookPanel extends JPanel
JLabel image = new JLabel();
b.getIcon().addTo(image);
JLabel name = new JLabel(b.getShortName());
location.setFont(FontManager.getSmallFont(getFont()));
location.setFont(FontManager.getRunescapeSmallFont());
layout.setVerticalGroup(layout.createParallelGroup()
.addComponent(image)

View File

@@ -97,12 +97,12 @@ class LootTrackerBox extends JPanel
logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker());
final JLabel titleLabel = new JLabel(Text.removeTags(id));
titleLabel.setFont(FontManager.getSmallFont(getFont()));
titleLabel.setFont(FontManager.getRunescapeSmallFont());
titleLabel.setForeground(Color.WHITE);
logTitle.add(titleLabel, BorderLayout.WEST);
subTitleLabel.setFont(FontManager.getSmallFont(getFont()));
subTitleLabel.setFont(FontManager.getRunescapeSmallFont());
subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
logTitle.add(subTitleLabel, BorderLayout.CENTER);
@@ -121,7 +121,7 @@ class LootTrackerBox extends JPanel
subTitleLabel.setText(subtitle);
}
priceLabel.setFont(FontManager.getSmallFont(getFont()));
priceLabel.setFont(FontManager.getRunescapeSmallFont());
priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
logTitle.add(priceLabel, BorderLayout.EAST);

View File

@@ -349,8 +349,8 @@ class LootTrackerPanel extends PluginPanel
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
overallInfo.setLayout(new GridLayout(2, 1));
overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0));
overallKillsLabel.setFont(FontManager.getSmallFont(getFont()));
overallGpLabel.setFont(FontManager.getSmallFont(getFont()));
overallKillsLabel.setFont(FontManager.getRunescapeSmallFont());
overallGpLabel.setFont(FontManager.getRunescapeSmallFont());
overallInfo.add(overallKillsLabel);
overallInfo.add(overallGpLabel);
overallPanel.add(overallIcon, BorderLayout.WEST);

View File

@@ -32,6 +32,7 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.menuentryswapper.util.BurningAmuletMode;
import net.runelite.client.plugins.menuentryswapper.util.CombatBraceletMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode;
import net.runelite.client.plugins.menuentryswapper.util.DigsitePendantMode;
import net.runelite.client.plugins.menuentryswapper.util.DuelingRingMode;
import net.runelite.client.plugins.menuentryswapper.util.FairyRingMode;
@@ -47,7 +48,6 @@ import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
import net.runelite.client.plugins.menuentryswapper.util.teleEquippedMode;
import net.runelite.client.plugins.menuentryswapper.util.CharterOption;
@@ -218,37 +218,11 @@ public interface MenuEntrySwapperConfig extends Config
return false;
}
@ConfigItem(
keyName = "teleEquippedCape",
name = "Teleport Equipped Cape",
description = "Makes Teleport/Tele to POH the left click option on equip screen",
position = 1,
group = "Equipment swapper"
)
default boolean teleEquippedCape()
{
return false;
}
@ConfigItem(
keyName = "telecapeMode",
name = "ModeTeleCape",
description = "",
position = 2,
group = "Equipment swapper",
hidden = true,
unhide = "teleEquippedCape"
)
default teleEquippedMode telecapeMode()
{
return teleEquippedMode.TELEPORT;
}
@ConfigItem(
keyName = "maxMode",
name = "Mode",
description = "",
position = 3,
position = 1,
group = "Equipment swapper",
hidden = true,
unhide = "swapMax"
@@ -262,7 +236,7 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "swapArdougneCape",
name = "Swap Ardougne Cape",
description = "Enables swapping of 'Teleport' and 'Wear'.",
position = 4,
position = 2,
group = "Equipment swapper"
)
default boolean getSwapArdougneCape()
@@ -274,7 +248,7 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "swapConstructionCape",
name = "Swap Construction Cape",
description = "Enables swapping of 'Teleport' and 'Wear'.",
position = 5,
position = 3,
group = "Equipment swapper"
)
default boolean getSwapConstructionCape()
@@ -282,11 +256,25 @@ public interface MenuEntrySwapperConfig extends Config
return true;
}
@ConfigItem(
keyName = "constructionCapeMode",
name = "Mode",
description = "",
position = 4,
group = "Equipment swapper",
hidden = true,
unhide = "swapConstructionCape"
)
default ConstructionCapeMode constructionCapeMode()
{
return ConstructionCapeMode.TELE_TO_POH;
}
@ConfigItem(
keyName = "swapCraftingCape",
name = "Swap Crafting Cape",
description = "Enables swapping of 'Teleport' and 'Wear'.",
position = 6,
position = 5,
group = "Equipment swapper"
)
default boolean getSwapCraftingCape()
@@ -298,7 +286,7 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "swapMagicCape",
name = "Swap Magic Cape",
description = "Enables swapping of 'Spellbook' and 'Wear'.",
position = 7,
position = 6,
group = "Equipment swapper"
)
default boolean getSwapMagicCape()
@@ -310,7 +298,7 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "swapExplorersRing",
name = "Swap Explorer's Ring",
description = "Enables swapping of 'Spellbook' and 'Wear'.",
position = 8,
position = 7,
group = "Equipment swapper"
)
default boolean getSwapExplorersRing()
@@ -322,19 +310,19 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "swapAdmire",
name = "Admire",
description = "Swap 'Admire' with 'Teleport', 'Spellbook' and 'Perks' (max cape) for mounted skill capes.",
position = 9,
position = 8,
group = "Equipment swapper"
)
default boolean swapAdmire()
{
return true;
}
@ConfigItem(
keyName = "swapQuestCape",
name = "Swap Quest Cape",
description = "Enables swapping Quest cape options in worn interface.",
position = 10,
position = 9,
group = "Equipment swapper"
)
default boolean swapQuestCape()
@@ -346,7 +334,7 @@ public interface MenuEntrySwapperConfig extends Config
keyName = "questCapeMode",
name = "Mode",
description = "",
position = 11,
position = 10,
group = "Equipment swapper",
hidden = true,
unhide = "swapQuestCape"
@@ -652,20 +640,20 @@ public interface MenuEntrySwapperConfig extends Config
description = "Don't open implings if bank has a clue.",
position = 23,
group = "Miscellaneous"
)
default boolean swapImps()
)
default boolean swapImps()
{
return false;
}
@ConfigItem(
@ConfigItem(
keyName = "charterOption",
name = "Trader Crew",
description = "Configure whether you want Charter or Trade to be the first option of Trader Crewmembers.",
position = 24,
group = "Miscellaneous"
)
default CharterOption charterOption()
)
default CharterOption charterOption()
{
return CharterOption.TRADE;
}
@@ -1665,9 +1653,9 @@ default CharterOption charterOption()
)
default boolean hideCastToB()
{
return true;
}
{
return true;
}
@ConfigItem(
keyName = "hideCastIgnoredToB",

View File

@@ -104,7 +104,7 @@ import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode;
import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode;
import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode;
import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode;
import net.runelite.client.plugins.menuentryswapper.util.teleEquippedMode;
import net.runelite.client.plugins.menuentryswapper.util.ConstructionCapeMode;
import static net.runelite.client.util.MenuUtil.swap;
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
@@ -214,7 +214,7 @@ public class MenuEntrySwapperPlugin extends Plugin
@Setter(AccessLevel.PACKAGE)
private boolean shiftModifier = false;
private boolean getWithdrawOne;
private String getWithdrawOneItems;
private boolean getWithdrawFive;
@@ -227,11 +227,10 @@ public class MenuEntrySwapperPlugin extends Plugin
private boolean getWithdrawAll;
private String getWithdrawAllItems;
private boolean swapMax;
private boolean teleEquippedCape;
private teleEquippedMode telecapeMode;
private MaxCapeMode maxMode;
private boolean getSwapArdougneCape;
private boolean getSwapConstructionCape;
private ConstructionCapeMode constructionCapeMode;
private boolean getSwapCraftingCape;
private boolean getSwapMagicCape;
private boolean getSwapExplorersRing;
@@ -610,9 +609,9 @@ public class MenuEntrySwapperPlugin extends Plugin
{
if (this.hideDropRunecraftingPouch && (
entry.getTarget().contains("Small pouch")
|| entry.getTarget().contains("Medium pouch")
|| entry.getTarget().contains("Large pouch")
|| entry.getTarget().contains("Giant pouch")))
|| entry.getTarget().contains("Medium pouch")
|| entry.getTarget().contains("Large pouch")
|| entry.getTarget().contains("Giant pouch")))
{
continue;
}
@@ -990,7 +989,7 @@ public class MenuEntrySwapperPlugin extends Plugin
else if (target.contains("construct. cape") && this.getSwapConstructionCape)
{
swap(client, "Tele to poh", option, target);
swap(client, constructionCapeMode.toString(), option, target);
}
else if (target.contains("magic cape") && this.getSwapMagicCape)
@@ -1098,7 +1097,7 @@ public class MenuEntrySwapperPlugin extends Plugin
break;
}
}
if (option.equals("talk-to") || option.equals("attack"))
{
if (this.swapPickpocket)
@@ -1228,12 +1227,12 @@ public class MenuEntrySwapperPlugin extends Plugin
{
swap(client, "pay-toll(10gp)", option, target, true);
}
else if (this.swapHardWoodGrove && option.equals("open") && target.equals("hardwood grove doors"))
{
swap(client, "quick-pay(100)", option, target, true);
}
else if (this.swapTravel && option.equals("inspect") && target.equals("trapdoor"))
{
swap(client, "travel", option, target, true);
@@ -1362,7 +1361,7 @@ public class MenuEntrySwapperPlugin extends Plugin
{
swap(client, "quick-leave", option, target, true);
}
else if (this.swapAdmire && option.equals("admire"))
{
swap(client, "teleport", option, target, true);
@@ -1551,12 +1550,6 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.addSwap("remove", "burning amulet", this.getBurningAmuletMode.toString());
}
if (this.teleEquippedCape)
{
menuManager.addSwap("remove", "tele to poh", this.telecapeMode.toString());
menuManager.addSwap("remove", "teleport", this.telecapeMode.toString());
}
if (this.getCombatBracelet)
{
menuManager.addSwap("remove", "combat bracelet", this.getCombatBraceletMode.toString());
@@ -1635,7 +1628,7 @@ public class MenuEntrySwapperPlugin extends Plugin
menuManager.removeSwaps("ring of wealth");
menuManager.removeSwaps("max cape");
menuManager.removeSwaps("quest point cape");
}
private void delete(int target)
@@ -1801,11 +1794,10 @@ public class MenuEntrySwapperPlugin extends Plugin
this.getWithdrawAll = config.getWithdrawAll();
this.getWithdrawAllItems = config.getWithdrawAllItems();
this.swapMax = config.swapMax();
this.teleEquippedCape = config.teleEquippedCape();
this.telecapeMode = config.telecapeMode();
this.maxMode = config.maxMode();
this.getSwapArdougneCape = config.getSwapArdougneCape();
this.getSwapConstructionCape = config.getSwapConstructionCape();
this.constructionCapeMode = config.constructionCapeMode();
this.getSwapCraftingCape = config.getSwapCraftingCape();
this.getSwapMagicCape = config.getSwapMagicCape();
this.getSwapExplorersRing = config.getSwapExplorersRing();

View File

@@ -1,13 +1,13 @@
package net.runelite.client.plugins.menuentryswapper.util;
public enum teleEquippedMode
public enum ConstructionCapeMode
{
TELE_TO_POH("Tele to POH"),
TELEPORT("teleport");
TELEPORT("Teleport");
private final String name;
teleEquippedMode(String name)
ConstructionCapeMode(String name)
{
this.name = name;
}

View File

@@ -43,18 +43,7 @@ import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.AnimationID;
import static net.runelite.api.AnimationID.IDLE;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_3A;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_ADAMANT;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_BLACK;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_BRONZE;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_DRAGON;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_DRAGON_ORN;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_INFERNAL;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_IRON;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_MITHRIL;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_RUNE;
import static net.runelite.api.AnimationID.MINING_MOTHERLODE_STEEL;
import static net.runelite.api.AnimationID.*;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
@@ -451,7 +440,9 @@ public class MotherlodePlugin extends Plugin
case MINING_MOTHERLODE_ADAMANT:
case MINING_MOTHERLODE_RUNE:
case MINING_MOTHERLODE_DRAGON:
case MINING_MOTHERLODE_DRAGON_ORN:
case MINING_MOTHERLODE_DRAGON_UPGRADED:
case MINING_MOTHERLODE_DRAGON_OR:
case MINING_MOTHERLODE_CRYSTAL:
case MINING_MOTHERLODE_INFERNAL:
case MINING_MOTHERLODE_3A:
lastAnimation = animation;

View File

@@ -53,7 +53,7 @@ public class MTAInventoryOverlay extends Overlay
{
if (room.inside())
{
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
graphics.setFont(FontManager.getRunescapeBoldFont());
room.over(graphics);
}
}

View File

@@ -53,7 +53,7 @@ public class MTASceneOverlay extends Overlay
{
if (room.inside())
{
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
graphics.setFont(FontManager.getRunescapeBoldFont());
room.under(graphics);
}
}

View File

@@ -102,14 +102,19 @@ class NightmareZoneOverlay extends Overlay
renderAbsorptionCounter();
final int currentPoints = client.getVar(Varbits.NMZ_POINTS);
final int totalPoints = currentPoints + client.getVar(VarPlayer.NMZ_REWARD_POINTS);
panelComponent.getChildren().clear();
TableComponent tableComponent = new TableComponent();
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
tableComponent.addRow("Points:", StackFormatter.formatNumber(client.getVar(Varbits.NMZ_POINTS)));
tableComponent.addRow("Points:", StackFormatter.formatNumber(currentPoints));
tableComponent.addRow("Points/Hour:", StackFormatter.formatNumber(plugin.getPointsPerHour()));
if (plugin.isShowtotalpoints())
{
tableComponent.addRow("Total:", StackFormatter.formatNumber(client.getVar(VarPlayer.NMZ_REWARD_POINTS) + client.getVar(Varbits.NMZ_POINTS)));
tableComponent.addRow("Total:", StackFormatter.formatNumber(totalPoints));
}
panelComponent.getChildren().add(tableComponent);

View File

@@ -25,11 +25,14 @@
package net.runelite.client.plugins.nightmarezone;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.Arrays;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import java.time.Duration;
import java.time.Instant;
import lombok.Getter;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
@@ -56,6 +59,7 @@ import net.runelite.client.util.Text;
public class NightmareZonePlugin extends Plugin
{
private static final int[] NMZ_MAP_REGION = {9033};
private static final Duration HOUR = Duration.ofHours(1);
@Inject
private Notifier notifier;
@@ -75,6 +79,11 @@ public class NightmareZonePlugin extends Plugin
@Inject
private EventBus eventBus;
@Getter
private int pointsPerHour;
private Instant nmzSessionStartTime;
// This starts as true since you need to get
// above the threshold before sending notifications
private boolean absorptionNotificationSend = true;
@@ -120,6 +129,8 @@ public class NightmareZonePlugin extends Plugin
{
nmzWidget.setHidden(false);
}
resetPointsPerHour();
}
private void addSubscriptions()
@@ -155,6 +166,11 @@ public class NightmareZonePlugin extends Plugin
absorptionNotificationSend = true;
}
if (nmzSessionStartTime != null)
{
resetPointsPerHour();
}
return;
}
@@ -162,6 +178,11 @@ public class NightmareZonePlugin extends Plugin
{
checkAbsorption();
}
if (config.moveOverlay())
{
pointsPerHour = calculatePointsPerHour();
}
}
private void onChatMessage(ChatMessage event)
@@ -239,6 +260,32 @@ public class NightmareZonePlugin extends Plugin
return !Arrays.equals(client.getMapRegions(), NMZ_MAP_REGION);
}
private int calculatePointsPerHour()
{
Instant now = Instant.now();
final int currentPoints = client.getVar(Varbits.NMZ_POINTS);
if (nmzSessionStartTime == null)
{
nmzSessionStartTime = now;
}
Duration timeSinceStart = Duration.between(nmzSessionStartTime, now);
if (!timeSinceStart.isZero())
{
return (int) ((double) currentPoints * (double) HOUR.toMillis() / (double) timeSinceStart.toMillis());
}
return 0;
}
private void resetPointsPerHour()
{
nmzSessionStartTime = null;
pointsPerHour = 0;
}
private void updateConfig()
{
this.moveOverlay = config.moveOverlay();

View File

@@ -116,7 +116,7 @@ class ProfilesPanel extends PluginPanel
JPanel helpPanel = new JPanel(new BorderLayout());
helpPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
JLabel helpLabel = new JLabel("<html> <p>" + HELP + "</p></html>");
helpLabel.setFont(FontManager.getSmallFont(getFont()));
helpLabel.setFont(FontManager.getRunescapeSmallFont());
helpPanel.setPreferredSize(HELP_PREFERRED_SIZE);
// helpPanel.setSize(MINIMUM_SIZE);
helpPanel.add(helpLabel, BorderLayout.NORTH);

View File

@@ -24,41 +24,171 @@
*/
package net.runelite.client.plugins.roguesden;
import com.google.common.collect.Sets;
import java.util.Set;
import static net.runelite.api.NullObjectID.NULL_7235;
import static net.runelite.api.ObjectID.BLADE_7252;
import static net.runelite.api.ObjectID.CONTORTION_BARS;
import static net.runelite.api.ObjectID.FLOOR;
import static net.runelite.api.ObjectID.FLOOR_7230;
import static net.runelite.api.ObjectID.FLOOR_7245;
import static net.runelite.api.ObjectID.LEDGE_7240;
import static net.runelite.api.ObjectID.PENDULUM;
import static net.runelite.api.ObjectID.SPINNING_BLADES_7224;
import static net.runelite.api.ObjectID.WALL_7228;
import static net.runelite.api.ObjectID.WALL_7229;
import static net.runelite.api.ObjectID.WALL_7248;
import static net.runelite.api.ObjectID.WALL_7249;
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
import lombok.Getter;
import net.runelite.api.coords.WorldPoint;
import static net.runelite.api.ObjectID.*;
class Obstacles
{
static final Set<Integer> OBSTACLE_IDS_HULL = Sets.newHashSet(
SPINNING_BLADES_7224,
CONTORTION_BARS,
PENDULUM,
WALL_7249, /*Wall crushers*/
WALL_7248, /*Wall blade*/
LEDGE_7240, /*Ledge climb*/
NULL_7235 /*Wall safe*/
);
static final Map<WorldPoint, Obstacle> TILE_MAP = new HashMap<>();
static final Obstacle[] OBSTACLES =
{
new Obstacle(3050, 4997, "Enter"),
new Obstacle(3049, 4997, CONTORTION_BARS),
new Obstacle(3039, 4999, "Stand"),
new Obstacle(3029, 5003, "Run"),
new Obstacle(3024, 5001, "Open", GRILL_7255),
new Obstacle(3011, 5005, "Run"),
new Obstacle(3004, 5003, "Run"),
static final Set<Integer> OBSTACLE_IDS_TILE = Sets.newHashSet(
FLOOR, /*Floor spikes*/
WALL_7228, /*Wall spikes*/
WALL_7229, /*Wall spears*/
FLOOR_7245, /*Pressure pad a*/
FLOOR_7230, /*Pressure pad b*/
BLADE_7252, /*Floor blade*/
7239 /*Bridge [Ground object]*/
);
new Obstacle(2994, 5004, "Climb"),
new Obstacle(2993, 5004, LEDGE_7240),
new Obstacle(2994, 5005, "Climb"),
new Obstacle(2993, 5005, LEDGE_7240),
new Obstacle(2969, 5016, "Stand"),
new Obstacle(2969, 5017, "Stand"),
new Obstacle(2969, 5018, "Stand"),
new Obstacle(2969, 5019, "Stand"),
new Obstacle(2958, 5031, "Cross"),
new Obstacle(2962, 5050, "Stand"),
new Obstacle(2963, 5056, "Run"),
new Obstacle(2957, 5068, "Enter"),
new Obstacle(2957, 5069, PASSAGEWAY),
new Obstacle(2955, 5094, "Enter"),
new Obstacle(2955, 5095, PASSAGEWAY),
new Obstacle(2963, 5105, "Stand"),
new Obstacle(2972, 5098, "Enter"),
new Obstacle(2972, 5097, PASSAGEWAY),
new Obstacle(2972, 5094, "Open"),
new Obstacle(2972, 5094, GRILL_7255),
new Obstacle(2982, 5087, "Climb"),
new Obstacle(2983, 5087, LEDGE_7240),
new Obstacle(2982, 5090, "Climb"),
new Obstacle(2983, 5090, LEDGE_7240),
new Obstacle(2993, 5088, "Search"),
new Obstacle(2993, 5087, WALL_7249),
new Obstacle(2997, 5088, "Run"),
new Obstacle(2993, 5089, "Search"),
new Obstacle(2993, 5089, WALL_7249),
new Obstacle(2997, 5089, "Run"),
new Obstacle(3006, 5088, "Run"),
new Obstacle(3018, 5080, "Take"),
new Obstacle(3023, 5082, "Open", DOOR_7234),
// Maze
new Obstacle(3030, 5079, GRILL_7255),
new Obstacle(3032, 5078, GRILL_7255),
new Obstacle(3036, 5076, GRILL_7255),
new Obstacle(3039, 5079, GRILL_7255),
new Obstacle(3042, 5076, GRILL_7255),
new Obstacle(3044, 5069, GRILL_7255),
new Obstacle(3041, 5068, GRILL_7255),
new Obstacle(3040, 5070, GRILL_7255),
new Obstacle(3038, 5069, GRILL_7255),
new Obstacle(3028, 5033, "Stand"),
new Obstacle(3024, 5033, "Run"),
new Obstacle(3028, 5034, "Stand"),
new Obstacle(3024, 5034, "Run"),
new Obstacle(3015, 5033, "Open", GRILL_7255),
new Obstacle(3010, 5033, "Run/Open", GRILL_7255),
new Obstacle(3000, 5034, "Run"),
new Obstacle(2992, 5045, "Stand"),
new Obstacle(2992, 5053, "Run"),
new Obstacle(2992, 5067, "Stand"),
new Obstacle(2992, 5075, "Run"),
new Obstacle(3009, 5063, "Take"),
new Obstacle(3028, 5056, "Run"),
new Obstacle(3028, 5047, "Walk"),
new Obstacle(3018, 5047, "Crack", WALL_SAFE_7237),
// Start of 80+ thieving shortcut
new Obstacle(2967, 5061, "80 Thieving", DOOR_7246),
new Obstacle(2967, 5066, "80 Thieving", DOOR_7246),
new Obstacle(2974, 5061, "Enter"),
new Obstacle(2974, 5060, CONTORTION_BARS),
new Obstacle(2989, 5057, "Open", GRILL_7255),
new Obstacle(2989, 5058, "Open", GRILL_7255),
// The 3x3 square around the spinning blade in the middle of the maze
new AvoidObstacle(2977, 5090), new AvoidObstacle(2978, 5090), new AvoidObstacle(2979, 5090),
new AvoidObstacle(2977, 5089), new AvoidObstacle(2978, 5089), new AvoidObstacle(2979, 5089),
new AvoidObstacle(2977, 5088), new AvoidObstacle(2978, 5088), new AvoidObstacle(2979, 5088),
new TipObstacle(3014, 5063, "Stun NPC"),
new TipObstacle(2992, 5057, "Continue North"), // Hint for 80 thieving shortcut
};
@Getter
static class Obstacle
{
private WorldPoint tile;
private String hint;
private int objectId = -1;
private final Color tileColor = Color.GREEN;
// Highlights tile and shows a hint
private Obstacle(int x, int y, String hint)
{
tile = new WorldPoint(x, y, 1);
this.hint = hint;
}
// Doesn't highlight tile, but instead highlights object of objectId found on tile
private Obstacle(int x, int y, int objectId)
{
this(x, y, "");
this.objectId = objectId;
TILE_MAP.put(new WorldPoint(x, y, 1), this);
}
// Doesn't highlight tile, but instead highlights object of objectId found on tile and shows a hint
private Obstacle(int x, int y, String hint, int objectId)
{
this(x, y, objectId);
this.hint = hint;
}
}
private static class AvoidObstacle extends Obstacle
{
@Getter
private final Color tileColor = Color.RED;
private AvoidObstacle(int x, int y)
{
super(x, y, "AVOID");
}
}
private static class TipObstacle extends Obstacle
{
@Getter
private final Color tileColor = Color.ORANGE;
private TipObstacle(int x, int y, String hint)
{
super(x, y, hint);
}
}
}

View File

@@ -0,0 +1,81 @@
/*
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@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.roguesden;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
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;
class RoguesDenMinimapOverlay extends Overlay
{
private Client client;
private RoguesDenPlugin plugin;
@Inject
public RoguesDenMinimapOverlay(Client client, RoguesDenPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.isHasGem())
{
return null;
}
for (Obstacles.Obstacle obstacle : Obstacles.OBSTACLES)
{
final LocalPoint localPoint = LocalPoint.fromWorld(client, obstacle.getTile());
if (localPoint == null || obstacle.getTile().getPlane() != client.getPlane())
{
continue;
}
final Point minimapPoint = Perspective.localToMinimap(client, localPoint);
if (minimapPoint != null)
{
OverlayUtil.renderMinimapLocation(graphics, minimapPoint, obstacle.getObjectId() == -1 ? Color.GREEN : Color.RED);
}
}
return null;
}
}

View File

@@ -28,10 +28,15 @@ import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.geom.Area;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint;
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;
@@ -39,18 +44,22 @@ import net.runelite.client.ui.overlay.OverlayPosition;
@Singleton
public class RoguesDenOverlay extends Overlay
{
private static final int MAX_DISTANCE = 2350;
private static final Color OBJECT_BORDER_COLOR = Color.RED;
private static final Color OBJECT_COLOR = new Color(OBJECT_BORDER_COLOR.getRed(), OBJECT_BORDER_COLOR.getGreen(), OBJECT_BORDER_COLOR.getBlue(), 50);
private static final Color OBJECT_BORDER_HOVER_COLOR = OBJECT_BORDER_COLOR.darker();
private final Client client;
private final RoguesDenPlugin plugin;
private final ModelOutlineRenderer modelOutliner;
@Inject
public RoguesDenOverlay(final Client client, final RoguesDenPlugin plugin)
public RoguesDenOverlay(final Client client, final RoguesDenPlugin plugin, ModelOutlineRenderer modelOutliner)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.plugin = plugin;
this.modelOutliner = modelOutliner;
}
@Override
@@ -61,33 +70,74 @@ public class RoguesDenOverlay extends Overlay
return null;
}
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
plugin.getObstaclesHull().forEach((obstacle, tile) ->
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
if (tile.getPlane() == client.getPlane())
{
Polygon p = tile.getGameObjects()[0].getConvexHull();
if (p != null)
final Area clickBox = obstacle.getClickbox();
if (clickBox != null)
{
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
final Point mouse = client.getMouseCanvasPosition();
if (clickBox.contains(mouse.getX(), mouse.getY()))
{
graphics.setColor(OBJECT_BORDER_HOVER_COLOR);
}
else
{
graphics.setColor(OBJECT_BORDER_COLOR);
}
graphics.draw(clickBox);
graphics.setColor(OBJECT_COLOR);
graphics.fill(clickBox);
}
else
{
Polygon p;
if (obstacle instanceof GameObject)
{
p = ((GameObject) obstacle).getConvexHull();
}
else
{
p = obstacle.getCanvasTilePoly();
}
if (p != null)
{
graphics.setColor(OBJECT_COLOR);
graphics.drawPolygon(p);
}
}
}
});
plugin.getObstaclesTile().forEach((obstacle, tile) ->
for (Obstacles.Obstacle obstacle : Obstacles.OBSTACLES)
{
if (tile.getPlane() == client.getPlane() && obstacle.getLocalLocation().distanceTo(playerLocation) < MAX_DISTANCE)
final LocalPoint localPoint = LocalPoint.fromWorld(client, obstacle.getTile());
if (localPoint == null || obstacle.getTile().getPlane() != client.getPlane())
{
Polygon p = obstacle.getCanvasTilePoly();
if (p != null)
continue;
}
if (!obstacle.getHint().isEmpty())
{
final Polygon polygon = Perspective.getCanvasTilePoly(client, localPoint);
if (polygon != null)
{
graphics.setColor(Color.CYAN);
graphics.drawPolygon(p);
graphics.setColor(obstacle.getTileColor());
graphics.drawPolygon(polygon);
}
}
});
final Point textLocation = Perspective.getCanvasTextLocation(client, graphics, localPoint, obstacle.getHint(), 0);
if (textLocation != null)
{
graphics.setColor(Color.LIGHT_GRAY);
graphics.drawString(obstacle.getHint(), textLocation.getX(), textLocation.getY());
}
}
return null;
}

View File

@@ -25,18 +25,19 @@
package net.runelite.client.plugins.roguesden;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemID;
import static net.runelite.api.ItemID.MYSTIC_JEWEL;
import net.runelite.api.Tile;
import net.runelite.api.TileObject;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.DecorativeObjectChanged;
import net.runelite.api.events.DecorativeObjectDespawned;
import net.runelite.api.events.DecorativeObjectSpawned;
import net.runelite.api.events.GameObjectChanged;
import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
@@ -45,24 +46,27 @@ import net.runelite.api.events.GroundObjectChanged;
import net.runelite.api.events.GroundObjectDespawned;
import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.WallObjectChanged;
import net.runelite.api.events.WallObjectDespawned;
import net.runelite.api.events.WallObjectSpawned;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ItemUtil;
@PluginDescriptor(
name = "Rogues' Den",
description = "Mark tiles and clickboxes to help traverse the maze",
tags = {"agility", "maze", "minigame", "overlay", "thieving"}
name = "Rogues' Den",
description = "Mark tiles and clickboxes to help traverse the maze",
tags = {"agility", "maze", "minigame", "overlay", "thieving"}
)
@Singleton
public class RoguesDenPlugin extends Plugin
{
@Getter(AccessLevel.PACKAGE)
private final Map<TileObject, Tile> obstaclesHull = new HashMap<>();
private final HashMap<TileObject, Tile> obstaclesHull = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private final Map<TileObject, Tile> obstaclesTile = new HashMap<>();
private final HashMap<TileObject, Tile> obstaclesTile = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private boolean hasGem;
@@ -76,6 +80,9 @@ public class RoguesDenPlugin extends Plugin
@Inject
private RoguesDenOverlay overlay;
@Inject
private RoguesDenMinimapOverlay minimapOverlay;
@Inject
private EventBus eventBus;
@@ -85,6 +92,7 @@ public class RoguesDenPlugin extends Plugin
addSubscriptions();
overlayManager.add(overlay);
overlayManager.add(minimapOverlay);
}
@Override
@@ -93,6 +101,7 @@ public class RoguesDenPlugin extends Plugin
eventBus.unregister(this);
overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay);
obstaclesHull.clear();
obstaclesTile.clear();
hasGem = false;
@@ -108,6 +117,12 @@ public class RoguesDenPlugin extends Plugin
eventBus.subscribe(GroundObjectChanged.class, this, this::onGroundObjectChanged);
eventBus.subscribe(GroundObjectDespawned.class, this, this::onGroundObjectDespawned);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
eventBus.subscribe(WallObjectChanged.class, this, this::onWallObjectChanged);
eventBus.subscribe(WallObjectDespawned.class, this, this::onWallObjectDespawned);
eventBus.subscribe(DecorativeObjectSpawned.class, this, this::onDecorativeObjectSpawned);
eventBus.subscribe(DecorativeObjectChanged.class, this, this::onDecorativeObjectChanged);
eventBus.subscribe(DecorativeObjectDespawned.class, this, this::onDecorativeObjectDespawned);
}
private void onItemContainerChanged(ItemContainerChanged event)
@@ -117,16 +132,16 @@ public class RoguesDenPlugin extends Plugin
return;
}
for (Item item : event.getItemContainer().getItems())
{
if (item.getId() == ItemID.MYSTIC_JEWEL)
{
hasGem = true;
return;
}
}
hasGem = ItemUtil.containsItemId(event.getItemContainer().getItems(), MYSTIC_JEWEL);
}
hasGem = false;
private void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
{
obstaclesHull.clear();
obstaclesTile.clear();
}
}
private void onGameObjectSpawned(GameObjectSpawned event)
@@ -159,27 +174,48 @@ public class RoguesDenPlugin extends Plugin
onTileObject(event.getTile(), event.getGroundObject(), null);
}
private void onGameStateChanged(GameStateChanged event)
private void onWallObjectSpawned(WallObjectSpawned event)
{
if (event.getGameState() == GameState.LOADING)
{
obstaclesHull.clear();
obstaclesTile.clear();
}
onTileObject(event.getTile(), null, event.getWallObject());
}
private void onTileObject(Tile tile, TileObject oldObject, TileObject newObject)
private void onWallObjectChanged(WallObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getWallObject());
}
private void onWallObjectDespawned(WallObjectDespawned event)
{
onTileObject(event.getTile(), event.getWallObject(), null);
}
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
{
onTileObject(event.getTile(), null, event.getDecorativeObject());
}
private void onDecorativeObjectChanged(DecorativeObjectChanged event)
{
onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject());
}
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
{
onTileObject(event.getTile(), event.getDecorativeObject(), null);
}
private void onTileObject(final Tile tile, final TileObject oldObject, final TileObject newObject)
{
obstaclesHull.remove(oldObject);
if (newObject != null && Obstacles.OBSTACLE_IDS_HULL.contains(newObject.getId()))
if (newObject != null)
{
obstaclesHull.put(newObject, tile);
}
WorldPoint point = tile.getWorldLocation();
obstaclesTile.remove(oldObject);
if (newObject != null && Obstacles.OBSTACLE_IDS_TILE.contains(newObject.getId()))
{
obstaclesTile.put(newObject, tile);
Obstacles.Obstacle obstacle = Obstacles.TILE_MAP.get(point);
if (obstacle != null && obstacle.getObjectId() == newObject.getId())
{
obstaclesHull.put(newObject, tile);
}
}
}
}

View File

@@ -90,10 +90,6 @@ public class RunepouchOverlay extends WidgetItemOverlay
Point location = itemWidget.getCanvasLocation();
StringBuilder tooltipBuilder = new StringBuilder();
// location.getY() + graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent()
// this will draw the character exactly on the border
int yLocation = location.getY() + 1 +
graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent();
for (int i = 0; i < AMOUNT_VARBITS.length; i++)
{
Varbits amountVarbit = AMOUNT_VARBITS[i];
@@ -129,12 +125,9 @@ public class RunepouchOverlay extends WidgetItemOverlay
int yOffset = (1 + (graphics.getFontMetrics().getMaxAscent()) * i);
graphics.setColor(Color.black);
graphics.drawString("" + formatNumber(amount), location.getX() + (plugin.isShowIcons() ? 13 : 6),
yLocation + yOffset);
graphics.setColor(plugin.getFontColor());
graphics.drawString("" + formatNumber(amount), location.getX() + (plugin.isShowIcons() ? 12 : 5),
yLocation + yOffset);
location.getY() + 13 + (graphics.getFontMetrics().getHeight() - 1) * i);
graphics.setColor(plugin.getFontColor());
graphics.drawString("" + formatNumber(amount), location.getX() + (plugin.isShowIcons() ? 11 : 4),
@@ -149,13 +142,7 @@ public class RunepouchOverlay extends WidgetItemOverlay
if (image != null)
{
OverlayUtil.renderImageLocation(graphics,
//TODO :: SEE WHAT ONE IS RIGHT?
//new Point(location.getX() - 1, location.getY() + graphics.getFontMetrics().getMaxAscent() * i - 1),
//image);
//or
//new Point(location.getX(), location.getY() + (1 + graphics.getFontMetrics().getMaxAscent()) * i),
//image);
new Point(location.getX(), location.getY() + (1 + graphics.getFontMetrics().getMaxAscent()) * i),
new Point(location.getX() - 1, location.getY() + graphics.getFontMetrics().getHeight() * i - 1),
image);
}
}

View File

@@ -71,7 +71,7 @@ public class ScreenMarkerCreationPanel extends JPanel
setBorder(new EmptyBorder(8, 8, 8, 8));
setLayout(new BorderLayout());
instructionsLabel.setFont(FontManager.getSmallFont(getFont()));
instructionsLabel.setFont(FontManager.getRunescapeSmallFont());
instructionsLabel.setForeground(Color.WHITE);
JPanel actionsContainer = new JPanel(new GridLayout(1, 2, 8, 0));

View File

@@ -162,7 +162,7 @@ class ScreenMarkerPanel extends JPanel
nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR);
save.setVisible(false);
save.setFont(FontManager.getSmallFont(getFont()));
save.setFont(FontManager.getRunescapeSmallFont());
save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR);
save.addMouseListener(new MouseAdapter()
{
@@ -191,7 +191,7 @@ class ScreenMarkerPanel extends JPanel
});
cancel.setVisible(false);
cancel.setFont(FontManager.getSmallFont(getFont()));
cancel.setFont(FontManager.getRunescapeSmallFont());
cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
cancel.addMouseListener(new MouseAdapter()
{
@@ -217,7 +217,7 @@ class ScreenMarkerPanel extends JPanel
}
});
rename.setFont(FontManager.getSmallFont(getFont()));
rename.setFont(FontManager.getRunescapeSmallFont());
rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
rename.addMouseListener(new MouseAdapter()
{

View File

@@ -366,7 +366,7 @@ public class ScreenshotPlugin extends Plugin
if (this.screenshotPlayerDeath && client.getLocalPlayer().equals(e.getActor()))
{
takeScreenshot("Death");
takeScreenshot("Death - " + format(new Date()));
}

View File

@@ -117,7 +117,7 @@ class SlayerOverlay extends WidgetItemOverlay
return;
}
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
graphics.setFont(FontManager.getRunescapeBoldFont());
final Rectangle bounds = itemWidget.getCanvasBounds();
final TextComponent textComponent = new TextComponent();

View File

@@ -195,8 +195,8 @@ public class SlayerTaskPanel extends PluginPanel
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
overallInfo.setLayout(new GridLayout(2, 1));
overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0));
overallKillsLabel.setFont(FontManager.getSmallFont(getFont()));
overallTimeLabel.setFont(FontManager.getSmallFont(getFont()));
overallKillsLabel.setFont(FontManager.getRunescapeSmallFont());
overallTimeLabel.setFont(FontManager.getRunescapeSmallFont());
overallInfo.add(overallKillsLabel);
overallInfo.add(overallTimeLabel);
overallPanel.add(overallIcon, BorderLayout.WEST);

View File

@@ -90,8 +90,8 @@ class SuppliesTrackerPanel extends PluginPanel
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
overallInfo.setLayout(new GridLayout(2, 1));
overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0));
overallSuppliesUsedLabel.setFont(FontManager.getSmallFont(getFont()));
overallCostLabel.setFont(FontManager.getSmallFont(getFont()));
overallSuppliesUsedLabel.setFont(FontManager.getRunescapeSmallFont());
overallCostLabel.setFont(FontManager.getRunescapeSmallFont());
overallInfo.add(overallSuppliesUsedLabel);
overallInfo.add(overallCostLabel);
overallPanel.add(overallIcon, BorderLayout.WEST);

View File

@@ -106,11 +106,11 @@ class OverviewItemPanel extends JPanel
JLabel titleLabel = new JLabel(title);
titleLabel.setForeground(Color.WHITE);
titleLabel.setFont(FontManager.getSmallFont(getFont()));
titleLabel.setFont(FontManager.getRunescapeSmallFont());
statusLabel = new JLabel();
statusLabel.setForeground(Color.GRAY);
statusLabel.setFont(FontManager.getSmallFont(getFont()));
statusLabel.setFont(FontManager.getRunescapeSmallFont());
textContainer.add(titleLabel);
textContainer.add(statusLabel);

View File

@@ -67,10 +67,10 @@ public class TimeablePanel<T> extends JPanel
infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));
final JLabel location = new JShadowedLabel(title);
location.setFont(FontManager.getSmallFont(getFont()));
location.setFont(FontManager.getRunescapeSmallFont());
location.setForeground(Color.WHITE);
estimate.setFont(FontManager.getSmallFont(getFont()));
estimate.setFont(FontManager.getRunescapeSmallFont());
estimate.setForeground(Color.GRAY);
infoPanel.add(location);

View File

@@ -155,7 +155,7 @@ public class ClockTabPanel extends TabContentPanel
JLabel headerLabel = new JLabel(title);
headerLabel.setForeground(Color.WHITE);
headerLabel.setFont(FontManager.getSmallFont(getFont()));
headerLabel.setFont(FontManager.getRunescapeSmallFont());
panel.add(headerLabel, BorderLayout.CENTER);
IconButton addButton = new IconButton(ADD_ICON, ADD_ICON_HOVER);
@@ -175,7 +175,7 @@ public class ClockTabPanel extends TabContentPanel
JLabel infoLabel = new JShadowedLabel(text);
infoLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
infoLabel.setFont(FontManager.getSmallFont(getFont()));
infoLabel.setFont(FontManager.getRunescapeSmallFont());
panel.add(infoLabel);
return panel;

View File

@@ -129,7 +129,7 @@ class StopwatchPanel extends ClockPanel
private JLabel createSmallLabel(String text)
{
JLabel label = new JLabel(text, SwingConstants.CENTER);
label.setFont(FontManager.getSmallFont(getFont()));
label.setFont(FontManager.getRunescapeSmallFont());
label.setForeground(LAP_DATA_COLOR);
return label;

View File

@@ -92,7 +92,7 @@ public class FarmingTabPanel extends TabContentPanel
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
}
groupLabel.setFont(FontManager.getSmallFont(getFont()));
groupLabel.setFont(FontManager.getRunescapeSmallFont());
add(groupLabel, c);
c.gridy++;

View File

@@ -453,6 +453,7 @@ public class WintertodtPlugin extends Plugin
case WOODCUTTING_DRAGON:
case WOODCUTTING_INFERNAL:
case WOODCUTTING_3A_AXE:
case WOODCUTTING_CRYSTAL:
setActivity(WintertodtActivity.WOODCUTTING);
break;

View File

@@ -33,6 +33,7 @@ import static net.runelite.api.AnimationID.WOODCUTTING_3A_AXE;
import static net.runelite.api.AnimationID.WOODCUTTING_ADAMANT;
import static net.runelite.api.AnimationID.WOODCUTTING_BLACK;
import static net.runelite.api.AnimationID.WOODCUTTING_BRONZE;
import static net.runelite.api.AnimationID.WOODCUTTING_CRYSTAL;
import static net.runelite.api.AnimationID.WOODCUTTING_DRAGON;
import static net.runelite.api.AnimationID.WOODCUTTING_INFERNAL;
import static net.runelite.api.AnimationID.WOODCUTTING_IRON;
@@ -42,6 +43,7 @@ import static net.runelite.api.AnimationID.WOODCUTTING_STEEL;
import static net.runelite.api.ItemID.ADAMANT_AXE;
import static net.runelite.api.ItemID.BLACK_AXE;
import static net.runelite.api.ItemID.BRONZE_AXE;
import static net.runelite.api.ItemID.CRYSTAL_AXE;
import static net.runelite.api.ItemID.DRAGON_AXE;
import static net.runelite.api.ItemID.INFERNAL_AXE;
import static net.runelite.api.ItemID.IRON_AXE;
@@ -63,7 +65,8 @@ enum Axe
RUNE(WOODCUTTING_RUNE, RUNE_AXE),
DRAGON(WOODCUTTING_DRAGON, DRAGON_AXE),
INFERNAL(WOODCUTTING_INFERNAL, INFERNAL_AXE),
THIRDAGE(WOODCUTTING_3A_AXE, _3RD_AGE_AXE);
THIRDAGE(WOODCUTTING_3A_AXE, _3RD_AGE_AXE),
CRYSTAL(WOODCUTTING_CRYSTAL, CRYSTAL_AXE);
private final Integer animId;
private final Integer itemId;

View File

@@ -1,5 +1,6 @@
/*
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* Copyright (c) 2019, gregg1494 <https://github.com/gregg1494>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -123,4 +124,15 @@ public interface WorldHopperConfig extends Config
{
return SubscriptionFilterMode.BOTH;
}
@ConfigItem(
keyName = "displayPing",
name = "Display current ping",
description = "Displays ping to current game world",
position = 7
)
default boolean displayPing()
{
return false;
}
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (c) 2019, gregg1494 <https://github.com/gregg1494>
* 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.worldhopper;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Point;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
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.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
class WorldHopperPingOverlay extends Overlay
{
private static final int Y_OFFSET = 11;
private static final int X_OFFSET = 1;
private final Client client;
private final WorldHopperPlugin worldHopperPlugin;
@Inject
private WorldHopperPingOverlay(Client client, WorldHopperPlugin worldHopperPlugin)
{
this.client = client;
this.worldHopperPlugin = worldHopperPlugin;
setLayer(OverlayLayer.ABOVE_WIDGETS);
setPriority(OverlayPriority.HIGH);
setPosition(OverlayPosition.DYNAMIC);
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!worldHopperPlugin.isDisplayPing())
{
return null;
}
final int ping = worldHopperPlugin.getCurrentPing();
if (ping < 0)
{
return null;
}
final String text = ping + " ms";
final int textWidth = graphics.getFontMetrics().stringWidth(text);
final int textHeight = graphics.getFontMetrics().getAscent() - graphics.getFontMetrics().getDescent();
// Adjust ping offset for logout button
Widget logoutButton = client.getWidget(WidgetInfo.RESIZABLE_MINIMAP_LOGOUT_BUTTON);
int xOffset = X_OFFSET;
if (logoutButton != null && !logoutButton.isHidden())
{
xOffset += logoutButton.getWidth();
}
final int width = (int) client.getRealDimensions().getWidth();
final Point point = new Point(width - textWidth - xOffset, textHeight + Y_OFFSET);
OverlayUtil.renderTextLocation(graphics, point, text, Color.YELLOW);
return null;
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2018, Lotto <https://github.com/devLotto>
* Copyright (c) 2019, gregg1494 <https://github.com/gregg1494>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,6 +47,7 @@ import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.swing.SwingUtilities;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
@@ -78,6 +80,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ExecutorServiceExceptionLogger;
import net.runelite.client.util.HotkeyListener;
import net.runelite.client.util.Text;
@@ -98,8 +101,7 @@ import org.apache.commons.lang3.ArrayUtils;
public class WorldHopperPlugin extends Plugin
{
private static final int WORLD_FETCH_TIMER = 10;
private static final int WORLD_PING_TIMER = 10;
private static final int REFRESH_THROTTLE = 60_000; // ms
private static final int REFRESH_THROTTLE = 60_000; // ms
private static final int TICK_THROTTLE = (int) Duration.ofMinutes(10).toMillis();
private static final int DISPLAY_SWITCHER_MAX_ATTEMPTS = 3;
@@ -133,6 +135,12 @@ public class WorldHopperPlugin extends Plugin
@Inject
private EventBus eventBus;
@Inject
private OverlayManager overlayManager;
@Inject
private WorldHopperPingOverlay worldHopperOverlay;
private ScheduledExecutorService hopperExecutorService;
private NavigationButton navButton;
@@ -146,8 +154,9 @@ public class WorldHopperPlugin extends Plugin
private int favoriteWorld1, favoriteWorld2;
private ScheduledFuture<?> worldResultFuture, pingFuture;
private ScheduledFuture<?> worldResultFuture, pingFuture, currPingFuture;
private WorldResult worldResult;
private int currentWorld;
private Instant lastFetch;
private boolean firstRun;
@@ -158,6 +167,11 @@ public class WorldHopperPlugin extends Plugin
private boolean ping;
private boolean showWorldHopMessage;
private SubscriptionFilterMode subscriptionFilter;
@Getter(AccessLevel.PACKAGE)
private boolean displayPing;
@Getter(AccessLevel.PACKAGE)
private int currentPing;
private final HotkeyListener previousKeyListener = new HotkeyListener(() -> this.previousKey)
{
@@ -189,6 +203,7 @@ public class WorldHopperPlugin extends Plugin
addSubscriptions();
firstRun = true;
currentPing = -1;
keyManager.registerKeyListener(previousKeyListener);
keyManager.registerKeyListener(nextKeyListener);
@@ -213,11 +228,18 @@ public class WorldHopperPlugin extends Plugin
clientToolbar.addNavigation(navButton);
}
panel.setFilterMode(this.subscriptionFilter);
overlayManager.add(worldHopperOverlay);
panel.setFilterMode(config.subscriptionFilter());
// The plugin has its own executor for pings, as it blocks for a long time
hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
// On first run this schedules an initial ping on hopperExecutorService
worldResultFuture = executorService.scheduleAtFixedRate(this::tick, 0, WORLD_FETCH_TIMER, TimeUnit.MINUTES);
hopperExecutorService = new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor());
pingFuture = hopperExecutorService.scheduleAtFixedRate(this::pingWorlds, WORLD_PING_TIMER, WORLD_PING_TIMER, TimeUnit.MINUTES);
// Give some initial delay - this won't run until after pingInitialWorlds finishes from tick() anyway
pingFuture = hopperExecutorService.scheduleWithFixedDelay(this::pingNextWorld, 15, 3, TimeUnit.SECONDS);
currPingFuture = hopperExecutorService.scheduleWithFixedDelay(this::pingCurrentWorld, 15, 1, TimeUnit.SECONDS);
}
@Override
@@ -228,6 +250,11 @@ public class WorldHopperPlugin extends Plugin
pingFuture.cancel(true);
pingFuture = null;
currPingFuture.cancel(true);
currPingFuture = null;
overlayManager.remove(worldHopperOverlay);
keyManager.unregisterKeyListener(previousKeyListener);
keyManager.unregisterKeyListener(nextKeyListener);
@@ -482,7 +509,8 @@ public class WorldHopperPlugin extends Plugin
if (firstRun)
{
firstRun = false;
hopperExecutorService.execute(this::pingWorlds);
// On first run we ping all of the worlds at once to initialize the ping values
hopperExecutorService.execute(this::pingInitialWorlds);
}
}
@@ -504,6 +532,7 @@ public class WorldHopperPlugin extends Plugin
new WorldClient().lookupWorlds()
.subscribeOn(Schedulers.io())
.take(1)
.subscribe(
(worldResult) ->
{
@@ -775,7 +804,10 @@ public class WorldHopperPlugin extends Plugin
return null;
}
private void pingWorlds()
/**
* Ping all worlds. This takes a long time and is only run on first run.
*/
private void pingInitialWorlds()
{
if (worldResult == null || !this.showSidebar || !this.ping)
{
@@ -804,5 +836,66 @@ public class WorldHopperPlugin extends Plugin
this.ping = config.ping();
this.showWorldHopMessage = config.showWorldHopMessage();
this.subscriptionFilter = config.subscriptionFilter();
this.displayPing = config.displayPing();
}
/**
* Ping the next world
*/
private void pingNextWorld()
{
if (worldResult == null || !config.showSidebar() || !config.ping())
{
return;
}
List<World> worlds = worldResult.getWorlds();
if (worlds.isEmpty())
{
return;
}
if (currentWorld >= worlds.size())
{
// Wrap back around
currentWorld = 0;
}
World world = worlds.get(currentWorld++);
// If we are displaying the ping overlay, there is a separate scheduled task for the current world
boolean displayPing = config.displayPing() && client.getGameState() == GameState.LOGGED_IN;
if (displayPing && client.getWorld() == world.getId())
{
return;
}
int ping = Ping.ping(world);
log.trace("Ping for world {} is: {}", world.getId(), ping);
SwingUtilities.invokeLater(() -> panel.updatePing(world.getId(), ping));
}
/**
* Ping the current world for the ping overlay
*/
private void pingCurrentWorld()
{
// There is no reason to ping the current world if not logged in, as the overlay doesn't draw
if (worldResult == null || !config.displayPing() || client.getGameState() != GameState.LOGGED_IN)
{
return;
}
final World currentWorld = worldResult.findWorld(client.getWorld());
if (currentWorld == null)
{
log.debug("unable to find current world: {}", client.getWorld());
return;
}
currentPing = Ping.ping(currentWorld);
log.trace("Ping for current world is: {}", currentPing);
SwingUtilities.invokeLater(() -> panel.updatePing(currentWorld.getId(), currentPing));
}
}

View File

@@ -104,7 +104,7 @@ class WorldTableHeader extends JPanel
});
textLabel.setText(title);
textLabel.setFont(FontManager.getSmallFont(getFont()));
textLabel.setFont(FontManager.getRunescapeSmallFont());
final JMenuItem refresh = new JMenuItem("Refresh worlds");
refresh.addActionListener(e ->

View File

@@ -273,7 +273,7 @@ class WorldTableRow extends JPanel
column.setBorder(new EmptyBorder(0, 5, 0, 5));
playerCountField = new JLabel(world.getPlayers() + "");
playerCountField.setFont(FontManager.getSmallFont(getFont()));
playerCountField.setFont(FontManager.getRunescapeSmallFont());
column.add(playerCountField, BorderLayout.WEST);
@@ -302,7 +302,7 @@ class WorldTableRow extends JPanel
column.setBorder(new EmptyBorder(0, 5, 0, 5));
activityField = new JLabel(world.getActivity());
activityField.setFont(FontManager.getSmallFont(getFont()));
activityField.setFont(FontManager.getRunescapeSmallFont());
column.add(activityField, BorderLayout.WEST);

View File

@@ -72,7 +72,7 @@ enum QuestStartLocation
DARKNESS_OF_HALLOWVALE(Quest.DARKNESS_OF_HALLOWVALE, new WorldPoint(3494, 9628, 0)),
DEATH_PLATEAU_TROLL_STRONGHOLD(new Quest[]{Quest.DEATH_PLATEAU, Quest.TROLL_STRONGHOLD}, new WorldPoint(2895, 3528, 0)),
DEATH_TO_THE_DORGESHUUN(Quest.DEATH_TO_THE_DORGESHUUN, new WorldPoint(3316, 9613, 0)),
THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1846, 3556, 0)),
THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1780, 3569, 0)),
DESERT_TREASURE(Quest.DESERT_TREASURE, new WorldPoint(3177, 3043, 0)),
DEVIOUS_MINDS(Quest.DEVIOUS_MINDS, new WorldPoint(3405, 3492, 0)),
THE_DIG_SITE(Quest.THE_DIG_SITE, new WorldPoint(3363, 3337, 0)),

View File

@@ -180,10 +180,10 @@ class XpInfoBox extends JPanel
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
statsPanel.setBorder(new EmptyBorder(6, 5, 0, 2));
expGained.setFont(FontManager.getSmallFont(getFont()));
expHour.setFont(FontManager.getSmallFont(getFont()));
expLeft.setFont(FontManager.getSmallFont(getFont()));
actionsLeft.setFont(FontManager.getSmallFont(getFont()));
expGained.setFont(FontManager.getRunescapeSmallFont());
expHour.setFont(FontManager.getRunescapeSmallFont());
expLeft.setFont(FontManager.getRunescapeSmallFont());
actionsLeft.setFont(FontManager.getRunescapeSmallFont());
statsPanel.add(expGained);
statsPanel.add(expLeft);

View File

@@ -111,8 +111,8 @@ class XpPanel extends PluginPanel
overallInfo.setLayout(new GridLayout(2, 1));
overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0));
overallExpGained.setFont(FontManager.getSmallFont(getFont()));
overallExpHour.setFont(FontManager.getSmallFont(getFont()));
overallExpGained.setFont(FontManager.getRunescapeSmallFont());
overallExpHour.setFont(FontManager.getRunescapeSmallFont());
overallInfo.add(overallExpGained);
overallInfo.add(overallExpHour);

View File

@@ -27,6 +27,7 @@
package net.runelite.client.plugins.zulrah;
import javax.annotation.Nullable;
import net.runelite.api.NPC;
import net.runelite.api.Prayer;
import net.runelite.api.coords.LocalPoint;
@@ -101,6 +102,7 @@ public class ZulrahInstance
stage = 0;
}
@Nullable
public ZulrahPhase getPhase()
{
ZulrahPhase patternPhase = null;
@@ -116,6 +118,7 @@ public class ZulrahInstance
this.phase = phase;
}
@Nullable
public ZulrahPhase getNextPhase()
{
if (pattern != null)

View File

@@ -217,28 +217,32 @@ public class ZulrahPlugin extends Plugin
}
ZulrahPhase currentPhase = instance.getPhase();
ZulrahPhase nextPhase = instance.getNextPhase();
if (currentPhase == null)
if (currentPhase == null || nextPhase == null)
{
return;
}
Actor actor = event.getActor();
final Actor actor = event.getActor();
if (config.sounds() && zulrah != null && zulrah.equals(actor) && zulrah.getAnimation() == AnimationID.ZULRAH_PHASE)
{
Prayer prayer = instance.getNextPhase().getPrayer();
Prayer prayer = nextPhase.getPrayer();
if (prayer != null)
if (prayer == null)
{
switch (prayer)
{
case PROTECT_FROM_MAGIC:
soundManager.playSound(Sound.PRAY_MAGIC);
break;
case PROTECT_FROM_MISSILES:
soundManager.playSound(Sound.PRAY_RANGED);
break;
}
return;
}
switch (prayer)
{
case PROTECT_FROM_MAGIC:
soundManager.playSound(Sound.PRAY_MAGIC);
break;
case PROTECT_FROM_MISSILES:
soundManager.playSound(Sound.PRAY_RANGED);
break;
}
}
}

View File

@@ -24,19 +24,11 @@
*/
package net.runelite.client.ui;
import com.google.common.collect.ImmutableBiMap;
import java.awt.Canvas;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.awt.Font;
import java.awt.FontFormatException;
import java.awt.GraphicsEnvironment;
import java.io.IOException;
import java.util.Map;
import lombok.Getter;
import net.runelite.client.config.FontType;
import javax.swing.text.StyleContext;
public class FontManager
{
@@ -44,59 +36,37 @@ public class FontManager
private static final Font runescapeSmallFont;
private static final Font runescapeBoldFont;
@Getter
private static class CachedFont
{
private final Font reg;
private final Font small;
private final Font bold;
private CachedFont(Font f)
{
reg = f.deriveFont(14.0f);
small = getFontOffCorrectSize(f);
bold = f.deriveFont(Font.BOLD, 14.0f);
}
}
private static final ImmutableBiMap<String, Font> fontMap;
private static final Map<Font, CachedFont> derivedFontMap = new HashMap<>();
static
{
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
try
{
runescapeFont = Font.createFont(Font.TRUETYPE_FONT,
Font font = Font.createFont(Font.TRUETYPE_FONT,
FontManager.class.getResourceAsStream("runescape.ttf"))
.deriveFont(Font.PLAIN, 16);
ge.registerFont(font);
runescapeSmallFont = Font.createFont(Font.TRUETYPE_FONT,
runescapeFont = StyleContext.getDefaultStyleContext()
.getFont(font.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeFont);
Font smallFont = Font.createFont(Font.TRUETYPE_FONT,
FontManager.class.getResourceAsStream("runescape_small.ttf"))
.deriveFont(Font.PLAIN, 16);
ge.registerFont(smallFont);
runescapeBoldFont = Font.createFont(Font.TRUETYPE_FONT,
runescapeSmallFont = StyleContext.getDefaultStyleContext()
.getFont(smallFont.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeSmallFont);
Font boldFont = Font.createFont(Font.TRUETYPE_FONT,
FontManager.class.getResourceAsStream("runescape_bold.ttf"))
.deriveFont(Font.PLAIN, 16);
ge.registerFont(boldFont);
final LinkedHashMap<String, Font> _fontMap = new LinkedHashMap<>();
_fontMap.put("Runescape", runescapeFont);
// Get all available fonts on the system
Font[] availableFonts = ge.getAllFonts();
// build bidirectional map
Arrays.stream(availableFonts).sorted(Comparator.comparing(Font::getFontName)).forEach(f ->
{
if (!_fontMap.containsKey(f.getFontName()))
{
_fontMap.put(f.getFontName(), f);
}
});
fontMap = ImmutableBiMap.copyOf(_fontMap);
ge.registerFont(runescapeFont);
ge.registerFont(runescapeSmallFont);
runescapeBoldFont = StyleContext.getDefaultStyleContext()
.getFont(boldFont.getName(), Font.PLAIN, 16);
ge.registerFont(runescapeBoldFont);
}
catch (FontFormatException ex)
@@ -109,25 +79,6 @@ public class FontManager
}
}
private static Font getFontOffCorrectSize(Font f)
{
// Size of the font is already set
if (f.getSize2D() > 1)
{
return f;
}
// Dummy canvas for font metrics
Canvas c = new Canvas();
f = f.deriveFont(12f);
if (c.getFontMetrics(f).getMaxAscent() > 11)
{
f = f.deriveFont(11f);
}
return f;
}
public static Font getRunescapeFont()
{
return runescapeFont;
@@ -142,93 +93,4 @@ public class FontManager
{
return runescapeBoldFont;
}
private static boolean isRunescapeFont(Font f)
{
return f.equals(runescapeFont) || f.equals(runescapeSmallFont) || f.equals(runescapeBoldFont);
}
public static Font getSmallFont(Font f)
{
if (isRunescapeFont(f))
{
return runescapeSmallFont;
}
if (derivedFontMap.containsKey(f))
{
return derivedFontMap.get(f).getSmall();
}
// cache and return
CachedFont cachedFont = new CachedFont(f);
derivedFontMap.put(f, cachedFont);
return cachedFont.getSmall();
}
public static Font getFontFromType(Font f, FontType type)
{
switch (type)
{
case SMALL:
return getSmallFont(f);
case BOLD:
if (isRunescapeFont(f))
{
return runescapeBoldFont;
}
if (derivedFontMap.containsKey(f))
{
return derivedFontMap.get(f).getBold();
}
// cache and return
CachedFont cachedBoldFont = new CachedFont(f);
derivedFontMap.put(f, cachedBoldFont);
return cachedBoldFont.getBold();
default: //in this case regular
if (isRunescapeFont(f))
{
return runescapeFont;
}
if (derivedFontMap.containsKey(f))
{
return derivedFontMap.get(f).getReg();
}
// cache and return
CachedFont cachedFont = new CachedFont(f);
derivedFontMap.put(f, cachedFont);
return cachedFont.getReg();
}
}
public static Font lookupFont(String fontName)
{
return fontMap.get(fontName);
}
public static String getFontName(Font font)
{
return fontMap.inverse().get(font);
}
public static String[] getAvailableFontNames()
{
return fontMap.keySet().toArray(new String[0]);
}
public static boolean isAvailable(Font font)
{
return fontMap.containsKey(font.getFontName());
}
public static Font getFontOrDefault(Font font)
{
if (font == null || !fontMap.containsKey(font.getFontName()))
{
return getRunescapeFont();
}
return getFontOffCorrectSize(font);
}
}
}

View File

@@ -52,7 +52,7 @@ public class PluginErrorPanel extends JPanel
noResultsTitle.setForeground(Color.WHITE);
noResultsTitle.setHorizontalAlignment(SwingConstants.CENTER);
noResultsDescription.setFont(FontManager.getSmallFont(getFont()));
noResultsDescription.setFont(FontManager.getRunescapeSmallFont());
noResultsDescription.setForeground(Color.GRAY);
noResultsDescription.setHorizontalAlignment(SwingConstants.CENTER);

View File

@@ -77,15 +77,15 @@ public class ProgressBar extends DimmableJPanel
topIndent = 2;
}
leftLabel.setFont(FontManager.getSmallFont(getFont()));
leftLabel.setFont(FontManager.getRunescapeSmallFont());
leftLabel.setForeground(Color.WHITE);
leftLabel.setBorder(new EmptyBorder(topIndent, 5, 0, 0));
rightLabel.setFont(FontManager.getSmallFont(getFont()));
rightLabel.setFont(FontManager.getRunescapeSmallFont());
rightLabel.setForeground(Color.WHITE);
rightLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 5));
centerLabel.setFont(FontManager.getSmallFont(getFont()));
centerLabel.setFont(FontManager.getRunescapeSmallFont());
centerLabel.setForeground(Color.WHITE);
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
centerLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 0));

View File

@@ -56,7 +56,6 @@ import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseAdapter;
import net.runelite.client.input.MouseManager;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.JagexColors;
import net.runelite.client.util.ColorUtil;
import net.runelite.client.util.MiscUtils;
@@ -122,10 +121,9 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
private void updateConfig()
{
// Overlay Fonts
Font clientFont = runeLiteConfig.clientFont();
this.standardFont = FontManager.getFontFromType(clientFont, runeLiteConfig.fontType());
this.tooltipFont = FontManager.getFontFromType(clientFont, runeLiteConfig.tooltipFontType());
this.interfaceFont = FontManager.getFontFromType(clientFont, runeLiteConfig.interfaceFontType());
this.standardFont = runeLiteConfig.fontType().getFont();
this.tooltipFont = runeLiteConfig.tooltipFontType().getFont();
this.interfaceFont = runeLiteConfig.interfaceFontType().getFont();
}
private void onConfigChanged(ConfigChanged event)
@@ -486,7 +484,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
// Set font based on configuration
if (position == OverlayPosition.DYNAMIC || position == OverlayPosition.DETACHED)
{
subGraphics.setFont(this.standardFont);
subGraphics.setFont(this.standardFont); // TODO MAKE USE CONFIG SYSTEM
}
else if (position == OverlayPosition.TOOLTIP)
{

View File

@@ -39,7 +39,7 @@ import net.runelite.client.ui.FontManager;
@Setter
public class InfoBoxComponent implements LayoutableRenderableEntity
{
private static final int SEPARATOR = 2;
private static final int SEPARATOR = 3;
private static final int DEFAULT_SIZE = 32;
@Getter
@@ -63,15 +63,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
return new Dimension();
}
if (graphics.getFont().equals(FontManager.getRunescapeFont()) && getSize() > DEFAULT_SIZE)
{
graphics.setFont(FontManager.getRunescapeFont());
}
else
{
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
}
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : FontManager.getRunescapeFont());
final int baseX = preferredLocation.x;
final int baseY = preferredLocation.y;
@@ -99,7 +91,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
final TextComponent textComponent = new TextComponent();
textComponent.setColor(color);
textComponent.setText(text);
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - metrics.getMaxDescent() - SEPARATOR));
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR));
textComponent.render(graphics);
}

View File

@@ -68,7 +68,7 @@ public class LineComponent implements LayoutableRenderableEntity
final FontMetrics metrics = graphics.getFontMetrics();
final int baseX = preferredLocation.x;
final int baseY = preferredLocation.y;
final int baseY = preferredLocation.y + metrics.getHeight();
int x = baseX;
int y = baseY;
final int leftFullWidth = getLineWidth(left, metrics);
@@ -92,7 +92,6 @@ public class LineComponent implements LayoutableRenderableEntity
for (int i = 0; i < lineCount; i++)
{
y += metrics.getMaxAscent();
String leftText = "";
String rightText = "";
@@ -117,7 +116,7 @@ public class LineComponent implements LayoutableRenderableEntity
rightLineComponent.setText(rightText);
rightLineComponent.setColor(rightColor);
rightLineComponent.render(graphics);
y += metrics.getMaxDescent();
y += metrics.getHeight();
}
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
@@ -125,7 +124,6 @@ public class LineComponent implements LayoutableRenderableEntity
bounds.setSize(dimension);
return dimension;
}
y += metrics.getMaxAscent();
final TextComponent leftLineComponent = new TextComponent();
leftLineComponent.setPosition(new Point(x, y));
@@ -138,7 +136,6 @@ public class LineComponent implements LayoutableRenderableEntity
rightLineComponent.setText(right);
rightLineComponent.setColor(rightColor);
rightLineComponent.render(graphics);
y += metrics.getMaxDescent();
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
bounds.setLocation(preferredLocation);

View File

@@ -109,7 +109,7 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
final int width = preferredSize.width;
final int height = Math.max(preferredSize.height, 16);
final int progressTextX = barX + (width - metrics.stringWidth(textToWrite)) / 2;
final int progressTextY = barY + ((height - metrics.getHeight()) / 2) + metrics.getMaxAscent();
final int progressTextY = barY + ((height - metrics.getHeight()) / 2) + metrics.getHeight();
final int progressFill = (int) (width * Math.min(1, pc));
// Draw bar

View File

@@ -64,7 +64,7 @@ public class TitleComponent implements LayoutableRenderableEntity
titleComponent.setColor(color);
titleComponent.setPosition(new Point(
baseX + ((preferredSize.width - metrics.stringWidth(text)) / 2),
baseY + metrics.getMaxAscent()));
baseY + metrics.getHeight()));
final Dimension rendered = titleComponent.render(graphics);
final Dimension dimension = new Dimension(preferredSize.width, rendered.height);
bounds.setLocation(preferredLocation);

View File

@@ -106,7 +106,7 @@ public class TooltipComponent implements RenderableEntity
textComponent.setColor(nextColor);
String text = line.substring(begin, j);
textComponent.setText(text);
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
textComponent.render(graphics);
lineX += metrics.stringWidth(text);
@@ -144,7 +144,7 @@ public class TooltipComponent implements RenderableEntity
textComponent.setColor(nextColor);
String text = line.substring(begin, j + 1);
textComponent.setText(text);
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
textComponent.render(graphics);
lineX += metrics.stringWidth(text);
@@ -159,7 +159,7 @@ public class TooltipComponent implements RenderableEntity
final TextComponent textComponent = new TextComponent();
textComponent.setColor(nextColor);
textComponent.setText(line.substring(begin));
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
textComponent.render(graphics);
}

View File

@@ -278,7 +278,7 @@ public class WorldMapOverlay extends Overlay
graphics.setColor(JagexColors.TOOLTIP_BORDER);
graphics.drawRect((int) tooltipRect.getX(), (int) tooltipRect.getY(), (int) tooltipRect.getWidth(), (int) tooltipRect.getHeight());
graphics.setColor(JagexColors.TOOLTIP_TEXT);
graphics.drawString(tooltip, drawPoint.getX(), drawPoint.getY() + fm.getMaxAscent());
graphics.drawString(tooltip, drawPoint.getX(), drawPoint.getY() + height);
}
private Point clipToRectangle(Point drawPoint, Rectangle mapDisplayRectangle)

View File

@@ -78,6 +78,12 @@
"name": "Pollnivneach Rooftop",
"xp": 890
},
{
"level": 75,
"icon": 23962,
"name": "Prifddinas Agility Course",
"xp": 1220
},
{
"level": 80,
"icon": 11849,

View File

@@ -240,6 +240,12 @@
"name": "Lantadyme",
"xp": 134.5
},
{
"level": 74,
"icon": 23962,
"name": "Crystal Tree",
"xp": 13366
},
{
"level": 75,
"icon": 1513,

View File

@@ -266,4 +266,94 @@ public class ChatCommandsPluginTest
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("prifddinas agility course"), eq(61));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("prifddinas agility course"), eq(2));
}
}
@Test
public void testZukNewPb()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzKal-Zuk kill count is: <col=ff0000>2</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: <col=ff0000>104:31</col> (new personal best)", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(104 * 60 + 31));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(2));
}
@Test
public void testZukKill()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your TzKal-Zuk kill count is: <col=ff0000>3</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Duration: <col=ff0000>172:18</col>. Personal best: 134:52", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("tzkal-zuk"), eq(134 * 60 + 52));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("tzkal-zuk"), eq(3));
}
@Test
public void testGgNewPb()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Fight duration: <col=ff0000>1:36</col> (new personal best)", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: <col=ff0000>179</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(96));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(179));
}
@Test
public void testGgKill()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Fight duration: <col=ff0000>2:41</col>. Personal best: 2:14", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Grotesque Guardians kill count is: <col=ff0000>32</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("grotesque guardians"), eq(2 * 60 + 14));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("grotesque guardians"), eq(32));
}
@Test
public void testGuantletPersonalBest()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: <col=ff0000>10:24</col>. Personal best: 7:59.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: <col=ff0000>124</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124));
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(7 * 60 + 59));
}
@Test
public void testGuantletNewPersonalBest()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: <col=ff0000>10:24</col> (new personal best).", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Gauntlet completion count is: <col=ff0000>124</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("gauntlet"), eq(10 * 60 + 24));
verify(configManager).setConfiguration(eq("killcount.adam"), eq("gauntlet"), eq(124));
}
}

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.mixins;
import java.util.List;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClient;
@@ -68,10 +69,10 @@ public abstract class EntityHiderBridgeMixin implements RSClient
public static boolean hideDeadNPCs;
@Inject
public static String hideNPCsNames;
public static List<String> hideNPCsNames;
@Inject
public static String hideNPCsOnDeath;
public static List<String> hideNPCsOnDeath;
@Inject
@Override
@@ -138,14 +139,14 @@ public abstract class EntityHiderBridgeMixin implements RSClient
@Inject
@Override
public void setNPCsNames(String NPCs)
public void setNPCsNames(List<String> NPCs)
{
hideNPCsNames = NPCs;
}
@Inject
@Override
public void setNPCsHiddenOnDeath(String NPCs)
public void setNPCsHiddenOnDeath(List<String> NPCs)
{
hideNPCsOnDeath = NPCs;
}

View File

@@ -24,6 +24,9 @@
*/
package net.runelite.mixins;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
@@ -40,6 +43,12 @@ import net.runelite.rs.api.RSScene;
@Mixin(RSScene.class)
public abstract class EntityHiderMixin implements RSScene
{
@Inject
private static final Pattern WILDCARD_PATTERN = Pattern.compile("(?i)[^*]+|(\\*)");
@Inject
private static final Pattern TAG_REGEXP = Pattern.compile("<[^>]*>");
@Shadow("client")
private static RSClient client;
@@ -68,10 +77,10 @@ public abstract class EntityHiderMixin implements RSScene
private static boolean hideNPCs;
@Shadow("hideNPCsNames")
private static String hideNPCsNames;
private static List<String> hideNPCsNames;
@Shadow("hideNPCsOnDeath")
private static String hideNPCsOnDeath;
private static List<String> hideNPCsOnDeath;
@Shadow("hideNPCs2D")
private static boolean hideNPCs2D;
@@ -160,8 +169,6 @@ public abstract class EntityHiderMixin implements RSScene
else if (renderable instanceof RSNPC)
{
RSNPC npc = (RSNPC) renderable;
String[] names = hideNPCsNames.split(",");
String[] removeOnDeath = hideNPCsOnDeath.split(",");
if (!hideAttackers)
{
@@ -176,22 +183,22 @@ public abstract class EntityHiderMixin implements RSScene
return false;
}
for (String name : names)
for (String name : hideNPCsNames)
{
if (name != null && !name.equals(""))
{
if (npc.getName() != null && npc.getName().startsWith(name))
if (npc.getName() != null && matches(name, npc.getName()))
{
return false;
}
}
}
for (String name : removeOnDeath)
for (String name : hideNPCsOnDeath)
{
if (name != null && !name.equals(""))
{
if (npc.getName() != null && npc.getName().startsWith(name) && npc.getHealthRatio() == 0)
if (npc.getName() != null && matches(name, npc.getName()) && npc.getHealthRatio() == 0)
{
return false;
}
@@ -207,4 +214,34 @@ public abstract class EntityHiderMixin implements RSScene
return true;
}
@Inject
static private boolean matches(String pattern, String text)
{
String standardized = TAG_REGEXP.matcher(text)
.replaceAll("")
.replace('\u00A0', ' ')
.toLowerCase();
final Matcher matcher = WILDCARD_PATTERN.matcher(pattern.toLowerCase());
final StringBuffer buffer = new StringBuffer();
buffer.append("(?i)");
while (matcher.find())
{
if (matcher.group(1) != null)
{
matcher.appendReplacement(buffer, ".*");
}
else
{
matcher.appendReplacement(buffer, "\\\\Q" + matcher.group(0) + "\\\\E");
}
}
matcher.appendTail(buffer);
final String replaced = buffer.toString();
return standardized.matches(replaced);
}
}