plugins: reduce config calls by saving and reusing values, misc performance tweaks. (#799)
* Save config values -- AgilityPlugin * Static state value map * Don't run area in the for loop * Checking for bounds is enough for widget null check * Cache font settings * SAve config values -- AntiDragPlugin * Save config values -- AoEPlugin * Save config values -- AttackStylesPlugin * Save config values -- BankPlugin * Check if player is in kingdom * Save hideAutoRetaliate -- AttackStylesPlugin * Save config values -- BanListPlugin * Save config values -- BarbaranAssaultPlugin * Save config values -- BarrowsPlugin * Checkstyle * Move up updateConfig.java * Save config values -- BlackjackPlugin * Save config values -- BlastFurnacePlugin * Save config values -- BlastMinePlugin * Save config values -- BoostsPlugin * Save config values -- CannonPlugin * Fix bank plugin test * Parallelize plugin loading * Fix sidebar going AWOL * Save config values -- ChatFilterPlugin * Save config values -- ChatHistoryPlugin * Save config values -- ChatNotificationsPlugin * Save config values -- ChatTranslationPlugin * Save config values -- ClanChatPlugin * Save config values -- ClueScrollPlugin * Cleanup CombatCounterPlugin * Save config values -- CombatCounter * Checkstyle * Save config values -- CombatLevelPlugin * Convert game thread events without mutable field to singletons These should be safe to convert, events with mutable field should be checked * Checkstyle * Fix test * Save config values -- CookingPlugin * Save config values -- CorpPlugin * SAve config values -- CoxPlugin * Save config values -- DailyTasksPlugin * Save config values -- DiscordPlugin * Coxhelper checkstyle * Save config values -- EquipmentInspectorPlugin * SAve cofig values -- XpDropPlugin * Save config values -- FairyRingPlugin * Save config values -- FightCavePlugin * Save config values -- FishingPlugin * Save config values and refactor -- FlexoPlugin * Save config values -- FlinchingPlugin * Save config values -- FreezeTimersPlugin * Save config values -- GpuPlugin * Save config values -- GrandExchangePlugin * Save config values -- GroundItemsPlugin * Save config values -- GroundMarkerPlugin * Save config values -- GroundMarkerPlugin * Save config values -- HerbiboarPlugin * Save config values -- HidePrayersPlugin * Save config values -- HighAlchemyPlugin * Save config values -- HunterPlugin * Save config values -- BabyHydraPlugin * Fix Flexo * Checkstyle * Save config values -- IdleNotifierPlugin * Save config values -- ImplingsPlugin * Save config values and cleanup -- InfernoPlugin * Use EqualsAndHashCode for GroundMarkerPoint * Save config values -- InterfaceStylesPlugin * Save config values -- InventoryGridPlugin * Save config values -- InventorySetupPlugin * Checkstyle * Save config values -- InventoryTagsPlugin * Save config values -- InventoryViewerPlugin * Save config values -- ItemChargePlugin * Save config values -- ItemIdentificationPlugin * Save config values -- ItemPricesPlugin * Save config values -- ItemStatPlugin * Save config values -- KeyRemappingPlugin * Save config values -- KourendLibraryPlugin * Save config values -- LearnToClickPlugin * Save config values -- LizardmenShamanPlugin * Save config values -- LoginScreenPlugin * Cleanup LootAssistOverlay * Remove unused LootAssistConfig * Save config values -- LootTrackerPlugin * Save config values -- MetronomePlugin * Add border color ground items * Save config values -- WorstPluginEverPlugin * Fix inferno plugin * Save config values -- MinimapPlugin * Save config values -- MiningPlugin * Save config values -- MotherlodePlugin * Save config values -- MouseHighlightPlugin * Save config values -- MTAPlugin * Save config values -- MultiIndicatorsPlugin * Save config values -- NightmareZonePlugin * Save config values -- NpcIndicatorsPlugin * Save config values -- NpcStatusPlugin * Save config values -- NpcAggroAreaPlugin * Save config values -- ObjectIndicatorsPlugin * Save config values -- OpponentInfoPlugin * Save config values -- PartyPlugin * Save config values -- PerformanceStatsPlugin * Save config values and cleanup -- PestcontrolPlugin * Save config values , cleanup and refactor -- PileIndicatorsPlugin * Save config values -- PlayerIndicatorsPlugin * Save config values -- PlayerInfoPlugin * Save config values -- PluginSorterPlugin * Save config values -- PohPlugin * Checkstyle * Save config values -- PoisonPlugin * Save config values -- PrayAgainstPlayerPlugin * Save config values -- PrayerPlugin * Save config values -- PrayerAlertPlugin * Checkstyle * Save config values -- PuzzleSolverPlugin * Save config values -- PvpToolsPlugin * Save config values -- PyramidPlunderPlugin * Save config values -- RaidsPlugin * Save config values -- ShortcutPlugin * Save config values -- RaidsThievingPlugin * Oopsie * Save config values -- RegenMeterPlugin * Save config values -- ReportButtonPlugin * Save config values -- RunecraftPlugin * Save config values -- RunedokuPlugin * Save config values -- RunepouchPlugin * Save config values -- SafeSpotPlugin * Save config values -- ScreenshotPlugin * Save config values -- ShiftWalkerPlugin * Save config values -- SlayerPlugin * Save config values -- SmeltingPlugin * Save config values -- SpawnTimerPlugin * Save config values -- SpellbookPlugin * Save config values -- StatusBarsPlugin * Save config values -- ThievingPlugin * Checkstyle * Cleanup Zulrah * Save config values -- XpTrackerPlugin * Save config values -- XpGlobesPlugin * Save config values -- WorldMapPlugin * Save config values -- TheatrePlugin * Save config values -- TickTimersPlugin * Save config values -- TileIndicatorsPlugin * Save config values -- TimersPlugin * Save config values -- TitheFarmPlugin * Save config values -- TMorphPlugin * Save config values -- WarIndicatorPlugin * Save config values -- WhaleWatchersPlugin * Save config values -- WildernessLocationsPlugin * Save config values -- WintertodtPlugin * Save config values -- WorldHopperPlugin * Save config values -- WoodcuttingPlugin * Cleanup * Checkstyle * Fix tests
This commit is contained in:
@@ -87,9 +87,6 @@ public class Hooks implements Callbacks
|
||||
private static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
|
||||
private static final OverlayManager overlayManager = injector.getInstance(OverlayManager.class);
|
||||
|
||||
private static final GameTick GAME_TICK = new GameTick();
|
||||
private static final BeforeRender BEFORE_RENDER = new BeforeRender();
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@@ -151,13 +148,13 @@ public class Hooks implements Callbacks
|
||||
|
||||
deferredEventBus.replay();
|
||||
|
||||
eventBus.post(GAME_TICK);
|
||||
eventBus.post(GameTick.INSTANCE);
|
||||
|
||||
int tick = client.getTickCount();
|
||||
client.setTickCount(tick + 1);
|
||||
}
|
||||
|
||||
eventBus.post(BEFORE_RENDER);
|
||||
eventBus.post(BeforeRender.INSTANCE);
|
||||
|
||||
clientThread.invoke();
|
||||
|
||||
|
||||
@@ -43,11 +43,16 @@ import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
@@ -228,7 +233,6 @@ public class PluginManager
|
||||
.directed()
|
||||
.build();
|
||||
|
||||
List<Plugin> scannedPlugins = new ArrayList<>();
|
||||
ClassPath classPath = ClassPath.from(classLoader);
|
||||
|
||||
ImmutableSet<ClassInfo> classes = packageName == null ? classPath.getAllClasses()
|
||||
@@ -285,24 +289,47 @@ public class PluginManager
|
||||
throw new RuntimeException("Plugin dependency graph contains a cycle!");
|
||||
}
|
||||
|
||||
List<Class<? extends Plugin>> sortedPlugins = topologicalSort(graph);
|
||||
List<List<Class<? extends Plugin>>> sortedPlugins = topologicalGroupSort(graph);
|
||||
sortedPlugins = Lists.reverse(sortedPlugins);
|
||||
|
||||
for (Class<? extends Plugin> pluginClazz : sortedPlugins)
|
||||
{
|
||||
Plugin plugin;
|
||||
try
|
||||
{
|
||||
plugin = instantiate(scannedPlugins, (Class<Plugin>) pluginClazz);
|
||||
}
|
||||
catch (PluginInstantiationException ex)
|
||||
{
|
||||
log.warn("Error instantiating plugin!", ex);
|
||||
continue;
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
|
||||
scannedPlugins.add(plugin);
|
||||
}
|
||||
// some plugins get stuck on IO, so add some extra threads
|
||||
ExecutorService exec = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
|
||||
|
||||
List<Plugin> scannedPlugins = new CopyOnWriteArrayList<>();
|
||||
sortedPlugins.forEach(group ->
|
||||
{
|
||||
List<Future<?>> curGroup = new ArrayList<>();
|
||||
group.forEach(pluginClazz ->
|
||||
curGroup.add(exec.submit(() ->
|
||||
{
|
||||
Plugin plugin;
|
||||
try
|
||||
{
|
||||
plugin = instantiate(scannedPlugins, (Class<Plugin>) pluginClazz);
|
||||
}
|
||||
catch (PluginInstantiationException e)
|
||||
{
|
||||
log.warn("Error instantiating plugin!", e);
|
||||
return;
|
||||
}
|
||||
scannedPlugins.add(plugin);
|
||||
})));
|
||||
curGroup.forEach(future ->
|
||||
{
|
||||
try
|
||||
{
|
||||
future.get();
|
||||
}
|
||||
catch (InterruptedException | ExecutionException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
log.info("Plugin instantiation took {}ms", System.currentTimeMillis() - start);
|
||||
|
||||
return scannedPlugins;
|
||||
}
|
||||
@@ -515,40 +542,54 @@ public class PluginManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Topologically sort a graph. Uses Kahn's algorithm.
|
||||
*
|
||||
* Topologically sort a graph into separate groups.
|
||||
* Each group represents the dependency level of the plugins.
|
||||
* Plugins in group (index) 0 has no dependents.
|
||||
* Plugins in group 1 has dependents in group 0.
|
||||
* Plugins in group 2 has dependents in group 1, etc.
|
||||
* This allows for loading dependent groups serially, starting from the last group,
|
||||
* while loading plugins within each group in parallel.
|
||||
* @param graph
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
private <T> List<T> topologicalSort(Graph<T> graph)
|
||||
private <T> List<List<T>> topologicalGroupSort(Graph<T> graph)
|
||||
{
|
||||
MutableGraph<T> graphCopy = Graphs.copyOf(graph);
|
||||
List<T> l = new ArrayList<>();
|
||||
Set<T> s = graphCopy.nodes().stream()
|
||||
.filter(node -> graphCopy.inDegree(node) == 0)
|
||||
final Set<T> root = graph.nodes().stream()
|
||||
.filter(node -> graph.inDegree(node) == 0)
|
||||
.collect(Collectors.toSet());
|
||||
while (!s.isEmpty())
|
||||
{
|
||||
Iterator<T> it = s.iterator();
|
||||
T n = it.next();
|
||||
it.remove();
|
||||
final Map<T, Integer> dependencyCount = new HashMap<>();
|
||||
|
||||
l.add(n);
|
||||
root.forEach(n -> dependencyCount.put(n, 0));
|
||||
root.forEach(n -> graph.successors(n)
|
||||
.forEach(m -> incrementChildren(graph, dependencyCount, m, dependencyCount.get(n) + 1)));
|
||||
|
||||
for (T m : graphCopy.successors(n))
|
||||
// create list<list> dependency grouping
|
||||
final List<List<T>> dependencyGroups = new ArrayList<>();
|
||||
final int[] curGroup = {-1};
|
||||
|
||||
dependencyCount.entrySet().stream()
|
||||
.sorted(Map.Entry.comparingByValue())
|
||||
.forEach(entry ->
|
||||
{
|
||||
graphCopy.removeEdge(n, m);
|
||||
if (graphCopy.inDegree(m) == 0)
|
||||
if (entry.getValue() != curGroup[0])
|
||||
{
|
||||
s.add(m);
|
||||
curGroup[0] = entry.getValue();
|
||||
dependencyGroups.add(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!graphCopy.edges().isEmpty())
|
||||
dependencyGroups.get(dependencyGroups.size() - 1).add(entry.getKey());
|
||||
});
|
||||
|
||||
return dependencyGroups;
|
||||
}
|
||||
|
||||
private <T> void incrementChildren(Graph<T> graph, Map<T, Integer> dependencyCount, T n, int val)
|
||||
{
|
||||
if (!dependencyCount.containsKey(n) || dependencyCount.get(n) < val)
|
||||
{
|
||||
throw new RuntimeException("Graph has at least one cycle");
|
||||
dependencyCount.put(n, val);
|
||||
graph.successors(n).forEach(m ->
|
||||
incrementChildren(graph, dependencyCount, m, val + 1));
|
||||
}
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.account;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.JOptionPane;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
@@ -47,6 +48,7 @@ import net.runelite.client.util.ImageUtil;
|
||||
loadWhenOutdated = true
|
||||
)
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class AccountPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.FontTypeFace;
|
||||
@@ -66,6 +67,7 @@ import net.runelite.client.util.Text;
|
||||
description = "Display level requirements in Achievement Diary interface",
|
||||
tags = {"achievements", "tasks"}
|
||||
)
|
||||
@Singleton
|
||||
public class DiaryRequirementsPlugin extends Plugin
|
||||
{
|
||||
private static final String AND_JOINER = ", ";
|
||||
|
||||
@@ -32,45 +32,43 @@ import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.game.AgilityShortcut;
|
||||
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;
|
||||
|
||||
@Singleton
|
||||
class AgilityOverlay extends Overlay
|
||||
{
|
||||
private static final Color SHORTCUT_HIGH_LEVEL_COLOR = Color.ORANGE;
|
||||
|
||||
private final Client client;
|
||||
private final AgilityPlugin plugin;
|
||||
private final AgilityConfig config;
|
||||
|
||||
@Inject
|
||||
private AgilityOverlay(Client client, AgilityPlugin plugin, AgilityConfig config)
|
||||
private AgilityOverlay(final Client client, final AgilityPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
LocalPoint playerLocation = client.getLocalPlayer().getLocalLocation();
|
||||
Point mousePosition = client.getMouseCanvasPosition();
|
||||
final List<Tile> marksOfGrace = plugin.getMarksOfGrace();
|
||||
plugin.getObstacles().forEach((object, obstacle) ->
|
||||
{
|
||||
if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !config.highlightShortcuts() ||
|
||||
Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !config.showTrapOverlay())
|
||||
if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !plugin.isHighlightShortcuts() ||
|
||||
Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowTrapOverlay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +82,7 @@ class AgilityOverlay extends Overlay
|
||||
Polygon polygon = object.getCanvasTilePoly();
|
||||
if (polygon != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, polygon, config.getTrapColor());
|
||||
OverlayUtil.renderPolygon(graphics, polygon, plugin.getTrapColor());
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -92,10 +90,10 @@ class AgilityOverlay extends Overlay
|
||||
if (objectClickbox != null)
|
||||
{
|
||||
AgilityShortcut agilityShortcut = obstacle.getShortcut();
|
||||
Color configColor = agilityShortcut == null || agilityShortcut.getLevel() <= plugin.getAgilityLevel() ? config.getOverlayColor() : SHORTCUT_HIGH_LEVEL_COLOR;
|
||||
if (config.highlightMarks() && !marksOfGrace.isEmpty())
|
||||
Color configColor = agilityShortcut == null || agilityShortcut.getLevel() <= plugin.getAgilityLevel() ? plugin.getOverlayColor() : SHORTCUT_HIGH_LEVEL_COLOR;
|
||||
if (plugin.isHighlightMarks() && !marksOfGrace.isEmpty())
|
||||
{
|
||||
configColor = config.getMarkColor();
|
||||
configColor = plugin.getMarkColor();
|
||||
}
|
||||
|
||||
if (objectClickbox.contains(mousePosition.getX(), mousePosition.getY()))
|
||||
@@ -115,7 +113,7 @@ class AgilityOverlay extends Overlay
|
||||
|
||||
});
|
||||
|
||||
if (config.highlightMarks() && !marksOfGrace.isEmpty())
|
||||
if (plugin.isHighlightMarks() && !marksOfGrace.isEmpty())
|
||||
{
|
||||
for (Tile markOfGraceTile : marksOfGrace)
|
||||
{
|
||||
@@ -128,7 +126,7 @@ class AgilityOverlay extends Overlay
|
||||
continue;
|
||||
}
|
||||
|
||||
OverlayUtil.renderPolygon(graphics, poly, config.getMarkColor());
|
||||
OverlayUtil.renderPolygon(graphics, poly, plugin.getMarkColor());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
@@ -83,14 +85,15 @@ import net.runelite.client.util.ColorUtil;
|
||||
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}
|
||||
)
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class AgilityPlugin extends Plugin
|
||||
{
|
||||
private static final int AGILITY_ARENA_REGION_ID = 11157;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<TileObject, Obstacle> obstacles = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final List<Tile> marksOfGrace = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
@@ -117,13 +120,13 @@ public class AgilityPlugin extends Plugin
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private AgilitySession session;
|
||||
|
||||
private int lastAgilityXp;
|
||||
private WorldPoint lastArenaTicketPosition;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int agilityLevel;
|
||||
|
||||
@Provides
|
||||
@@ -132,9 +135,36 @@ public class AgilityPlugin extends Plugin
|
||||
return configManager.getConfig(AgilityConfig.class);
|
||||
}
|
||||
|
||||
// Config values
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showLapCount;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int lapTimeout;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean lapsToLevel;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean lapsToGoal;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color overlayColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightMarks;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color markColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightShortcuts;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showTrapOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color trapColor;
|
||||
private boolean notifyAgilityArena;
|
||||
private boolean showAgilityArenaTimer;
|
||||
private boolean showShortcutLevel;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(agilityOverlay);
|
||||
overlayManager.add(lapCounterOverlay);
|
||||
agilityLevel = client.getBoostedSkillLevel(Skill.AGILITY);
|
||||
@@ -179,16 +209,40 @@ public class AgilityPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!config.showAgilityArenaTimer())
|
||||
if (!event.getGroup().equals("agility"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
|
||||
if (!this.showAgilityArenaTimer)
|
||||
{
|
||||
removeAgilityArenaTimer();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.showLapCount = config.showLapCount();
|
||||
this.lapTimeout = config.lapTimeout();
|
||||
this.lapsToLevel = config.lapsToLevel();
|
||||
this.lapsToGoal = config.lapsToGoal();
|
||||
this.overlayColor = config.getOverlayColor();
|
||||
this.highlightMarks = config.highlightMarks();
|
||||
this.markColor = config.getMarkColor();
|
||||
this.highlightShortcuts = config.highlightShortcuts();
|
||||
this.showTrapOverlay = config.showTrapOverlay();
|
||||
this.trapColor = config.getTrapColor();
|
||||
this.notifyAgilityArena = config.notifyAgilityArena();
|
||||
this.showAgilityArenaTimer = config.showAgilityArenaTimer();
|
||||
this.showShortcutLevel = config.showShortcutLevel();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExperienceChanged(ExperienceChanged event)
|
||||
{
|
||||
if (event.getSkill() != AGILITY || !config.showLapCount())
|
||||
if (event.getSkill() != AGILITY || !this.showLapCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -272,12 +326,12 @@ public class AgilityPlugin extends Plugin
|
||||
{
|
||||
log.debug("Ticked position moved from {} to {}", oldTickPosition, newTicketPosition);
|
||||
|
||||
if (config.notifyAgilityArena())
|
||||
if (this.notifyAgilityArena)
|
||||
{
|
||||
notifier.notify("Ticket location changed");
|
||||
}
|
||||
|
||||
if (config.showAgilityArenaTimer())
|
||||
if (this.showAgilityArenaTimer)
|
||||
{
|
||||
showNewAgilityArenaTimer();
|
||||
}
|
||||
@@ -430,7 +484,7 @@ public class AgilityPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!config.showShortcutLevel())
|
||||
if (!this.showShortcutLevel)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class AgilitySession
|
||||
private int lapsTillLevel;
|
||||
private int lapsTillGoal;
|
||||
|
||||
AgilitySession(Courses course)
|
||||
AgilitySession(final Courses course)
|
||||
{
|
||||
this.course = course;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.agility;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
@@ -50,16 +51,16 @@ enum Courses
|
||||
|
||||
private final static Map<Integer, Courses> coursesByRegion;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final double totalXp;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int lastObstacleXp;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int regionId;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WorldPoint[] courseEndWorldPoints;
|
||||
|
||||
static
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.awt.Graphics2D;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
@@ -39,21 +40,20 @@ import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
|
||||
@Singleton
|
||||
class LapCounterOverlay extends Overlay
|
||||
{
|
||||
private final AgilityPlugin plugin;
|
||||
private final AgilityConfig config;
|
||||
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private LapCounterOverlay(AgilityPlugin plugin, AgilityConfig config)
|
||||
private LapCounterOverlay(final AgilityPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Agility overlay"));
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class LapCounterOverlay extends Overlay
|
||||
{
|
||||
AgilitySession session = plugin.getSession();
|
||||
|
||||
if (!config.showLapCount() ||
|
||||
if (!plugin.isShowLapCount() ||
|
||||
session == null ||
|
||||
session.getLastLapCompleted() == null ||
|
||||
session.getCourse() == null)
|
||||
@@ -70,7 +70,7 @@ class LapCounterOverlay extends Overlay
|
||||
return null;
|
||||
}
|
||||
|
||||
Duration lapTimeout = Duration.ofMinutes(config.lapTimeout());
|
||||
Duration lapTimeout = Duration.ofMinutes(plugin.getLapTimeout());
|
||||
Duration sinceLap = Duration.between(session.getLastLapCompleted(), Instant.now());
|
||||
|
||||
if (sinceLap.compareTo(lapTimeout) >= 0)
|
||||
@@ -85,12 +85,12 @@ class LapCounterOverlay extends Overlay
|
||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||
tableComponent.addRow("Total Laps:", Integer.toString(session.getTotalLaps()));
|
||||
|
||||
if (config.lapsToLevel() && session.getLapsTillLevel() > 0)
|
||||
if (plugin.isLapsToLevel() && session.getLapsTillLevel() > 0)
|
||||
{
|
||||
tableComponent.addRow("Laps until level:", Integer.toString(session.getLapsTillLevel()));
|
||||
}
|
||||
|
||||
if (config.lapsToGoal() && session.getLapsTillGoal() > 0)
|
||||
if (plugin.isLapsToGoal() && session.getLapsTillGoal() > 0)
|
||||
{
|
||||
tableComponent.addRow("Laps until goal:", Integer.toString(session.getLapsTillGoal()));
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ class HydraOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
HydraOverlay(HydraPlugin plugin, Client client, SpriteManager spriteManager)
|
||||
HydraOverlay(final HydraPlugin plugin, final Client client, final SpriteManager spriteManager)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -59,6 +60,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class HydraPlugin extends Plugin
|
||||
{
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
|
||||
@@ -55,7 +55,7 @@ class HydraSceneOverlay extends Overlay
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
public HydraSceneOverlay(Client client, HydraPlugin plugin)
|
||||
public HydraSceneOverlay(final Client client, final HydraPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
@@ -36,7 +37,7 @@ import net.runelite.client.util.StackFormatter;
|
||||
|
||||
class AmmoCounter extends Counter
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int itemID;
|
||||
private String name;
|
||||
private int total;
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.ammo;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.InventoryID;
|
||||
@@ -45,6 +46,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
description = "Shows the current ammo the player has equipped",
|
||||
tags = {"bolts", "darts", "chinchompa", "equipment"}
|
||||
)
|
||||
@Singleton
|
||||
public class AmmoPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.animsmoothing;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -39,6 +40,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
tags = {"npcs", "objects", "players"},
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Singleton
|
||||
public class AnimationSmoothingPlugin extends Plugin
|
||||
{
|
||||
static final String CONFIG_GROUP = "animationSmoothing";
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.runelite.client.config.ModifierlessKeybind;
|
||||
@ConfigGroup("antiDrag")
|
||||
public interface AntiDragConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "alwaysOn",
|
||||
|
||||
@@ -42,13 +42,13 @@ public class AntiDragOverlay extends Overlay
|
||||
{
|
||||
private static final int RADIUS = 20;
|
||||
|
||||
private Client client;
|
||||
private AntiDragConfig config;
|
||||
private final Client client;
|
||||
private final AntiDragPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private AntiDragOverlay(Client client, AntiDragConfig config)
|
||||
private AntiDragOverlay(final Client client, final AntiDragPlugin plugin)
|
||||
{
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
setPosition(OverlayPosition.TOOLTIP);
|
||||
setPriority(OverlayPriority.HIGHEST);
|
||||
@@ -58,7 +58,7 @@ public class AntiDragOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D g)
|
||||
{
|
||||
final Color color = config.color();
|
||||
final Color color = plugin.getColor();
|
||||
g.setColor(color);
|
||||
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
|
||||
@@ -26,11 +26,16 @@
|
||||
package net.runelite.client.plugins.antidrag;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -48,11 +53,11 @@ import net.runelite.client.util.HotkeyListener;
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
public class AntiDragPlugin extends Plugin
|
||||
{
|
||||
private static final int DEFAULT_DELAY = 5;
|
||||
|
||||
|
||||
private boolean toggleDrag;
|
||||
|
||||
@Inject
|
||||
@@ -82,14 +87,27 @@ public class AntiDragPlugin extends Plugin
|
||||
return configManager.getConfig(AntiDragConfig.class);
|
||||
}
|
||||
|
||||
private boolean alwaysOn;
|
||||
private boolean keybind;
|
||||
private Keybind key;
|
||||
private int dragDelay;
|
||||
private boolean reqfocus;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean configOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color color;
|
||||
private boolean changeCursor;
|
||||
private CustomCursor selectedCursor;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
if (config.keybind())
|
||||
updateConfig();
|
||||
if (this.keybind)
|
||||
{
|
||||
keyManager.registerKeyListener(hotkeyListener);
|
||||
}
|
||||
client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY);
|
||||
client.setInventoryDragDelay(this.alwaysOn ? this.dragDelay : DEFAULT_DELAY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -106,9 +124,11 @@ public class AntiDragPlugin extends Plugin
|
||||
{
|
||||
if (event.getGroup().equals("antiDrag"))
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
if (event.getKey().equals("keybind"))
|
||||
{
|
||||
if (config.keybind())
|
||||
if (this.keybind)
|
||||
{
|
||||
keyManager.registerKeyListener(hotkeyListener);
|
||||
}
|
||||
@@ -119,17 +139,30 @@ public class AntiDragPlugin extends Plugin
|
||||
}
|
||||
if (event.getKey().equals("alwaysOn"))
|
||||
{
|
||||
client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY);
|
||||
client.setInventoryDragDelay(this.alwaysOn ? this.dragDelay : DEFAULT_DELAY);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.alwaysOn = config.alwaysOn();
|
||||
this.keybind = config.keybind();
|
||||
this.key = config.key();
|
||||
this.dragDelay = config.dragDelay();
|
||||
this.reqfocus = config.reqfocus();
|
||||
this.configOverlay = config.overlay();
|
||||
this.color = config.color();
|
||||
this.changeCursor = config.changeCursor();
|
||||
this.selectedCursor = config.selectedCursor();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onFocusChanged(FocusChanged focusChanged)
|
||||
{
|
||||
if (!config.alwaysOn())
|
||||
if (!this.alwaysOn)
|
||||
{
|
||||
if (!focusChanged.isFocused() && config.reqfocus())
|
||||
if (!focusChanged.isFocused() && this.reqfocus)
|
||||
{
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
overlayManager.remove(overlay);
|
||||
@@ -137,33 +170,32 @@ public class AntiDragPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.key())
|
||||
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> this.key)
|
||||
{
|
||||
@Override
|
||||
public void hotkeyPressed()
|
||||
{
|
||||
if (!config.alwaysOn())
|
||||
if (!alwaysOn)
|
||||
{
|
||||
toggleDrag = !toggleDrag;
|
||||
if (toggleDrag)
|
||||
{
|
||||
if (config.overlay())
|
||||
if (configOverlay)
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
if (config.changeCursor())
|
||||
if (changeCursor)
|
||||
{
|
||||
CustomCursor selectedCursor = config.selectedCursor();
|
||||
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
|
||||
}
|
||||
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
client.setInventoryDragDelay(dragDelay);
|
||||
}
|
||||
else
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
if (config.changeCursor())
|
||||
if (changeCursor)
|
||||
{
|
||||
net.runelite.client.plugins.customcursor.CustomCursor selectedCursor = configManager.getConfig(CustomCursorConfig.class).selectedCursor();
|
||||
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
|
||||
@@ -172,4 +204,4 @@ public class AntiDragPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.antidrag;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.customcursor.CustomCursorPlugin;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
@@ -43,7 +44,8 @@ public enum CustomCursor
|
||||
ZAMORAK_GODSWORD("Zamorak Godsword", "cursor-zamorak-godsword.png");
|
||||
|
||||
private final String name;
|
||||
@Getter
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final BufferedImage cursorImage;
|
||||
|
||||
CustomCursor(String name, String icon)
|
||||
|
||||
@@ -28,11 +28,12 @@
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.time.Instant;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@AllArgsConstructor
|
||||
class AoeProjectile
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
@@ -48,6 +49,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import static net.runelite.client.util.ColorUtil.setAlphaComponent;
|
||||
|
||||
@Singleton
|
||||
public class AoeWarningOverlay extends Overlay
|
||||
{
|
||||
private static final int FILL_START_ALPHA = 25;
|
||||
@@ -55,16 +57,14 @@ public class AoeWarningOverlay extends Overlay
|
||||
|
||||
private final Client client;
|
||||
private final AoeWarningPlugin plugin;
|
||||
private final AoeWarningConfig config;
|
||||
|
||||
@Inject
|
||||
public AoeWarningOverlay(Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
|
||||
public AoeWarningOverlay(final Client client, final AoeWarningPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.UNDER_WIDGETS);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -115,7 +115,7 @@ public class AoeWarningOverlay extends Overlay
|
||||
int tickProgress = aoeProjectile.getFinalTick() - client.getTickCount();
|
||||
|
||||
int fillAlpha, outlineAlpha;
|
||||
if (config.isFadeEnabled())
|
||||
if (plugin.isConfigFadeEnabled())
|
||||
{
|
||||
fillAlpha = (int) ((1 - progress) * FILL_START_ALPHA);//alpha drop off over lifetime
|
||||
outlineAlpha = (int) ((1 - progress) * OUTLINE_START_ALPHA);
|
||||
@@ -152,12 +152,12 @@ public class AoeWarningOverlay extends Overlay
|
||||
outlineAlpha = 255;
|
||||
}
|
||||
|
||||
if (config.isOutlineEnabled())
|
||||
if (plugin.isConfigOutlineEnabled())
|
||||
{
|
||||
graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), outlineAlpha), true));
|
||||
graphics.setColor(new Color(setAlphaComponent(plugin.getOverlayColor().getRGB(), outlineAlpha), true));
|
||||
graphics.drawPolygon(tilePoly);
|
||||
}
|
||||
if (config.tickTimers())
|
||||
if (plugin.isTickTimers())
|
||||
{
|
||||
if (tickProgress >= 0)
|
||||
{
|
||||
@@ -165,7 +165,7 @@ public class AoeWarningOverlay extends Overlay
|
||||
plugin.getFontStyle(), color, centerPoint(tilePoly.getBounds()), plugin.isShadows(), 0);
|
||||
}
|
||||
}
|
||||
graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true));
|
||||
graphics.setColor(new Color(setAlphaComponent(plugin.getOverlayColor().getRGB(), fillAlpha), true));
|
||||
graphics.fillPolygon(tilePoly);
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -35,6 +36,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -70,12 +72,13 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
type = PluginType.PVM,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class AoeWarningPlugin extends Plugin
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, CrystalBomb> bombs = new HashMap<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<Projectile, AoeProjectile> projectiles = new HashMap<>();
|
||||
@Inject
|
||||
public AoeWarningConfig config;
|
||||
@@ -97,12 +100,6 @@ public class AoeWarningPlugin extends Plugin
|
||||
private List<WorldPoint> CrystalSpike = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> WintertodtSnowFall = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean shadows;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int textSize;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int fontStyle;
|
||||
|
||||
@Provides
|
||||
AoeWarningConfig getConfig(ConfigManager configManager)
|
||||
@@ -110,17 +107,73 @@ public class AoeWarningPlugin extends Plugin
|
||||
return configManager.getConfig(AoeWarningConfig.class);
|
||||
}
|
||||
|
||||
Map<Projectile, AoeProjectile> getProjectiles()
|
||||
{
|
||||
return projectiles;
|
||||
}
|
||||
// Config values
|
||||
private boolean aoeNotifyAll;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color overlayColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean configOutlineEnabled;
|
||||
private int delay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean configFadeEnabled;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean tickTimers;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int fontStyle;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int textSize;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean shadows;
|
||||
private boolean configShamansEnabled;
|
||||
private boolean configShamansNotifyEnabled;
|
||||
private boolean configArchaeologistEnabled;
|
||||
private boolean configArchaeologistNotifyEnabled;
|
||||
private boolean configIceDemonEnabled;
|
||||
private boolean configIceDemonNotifyEnabled;
|
||||
private boolean configVasaEnabled;
|
||||
private boolean configVasaNotifyEnabled;
|
||||
private boolean configTektonEnabled;
|
||||
private boolean configTektonNotifyEnabled;
|
||||
private boolean configVorkathEnabled;
|
||||
private boolean configVorkathNotifyEnabled;
|
||||
private boolean configGalvekEnabled;
|
||||
private boolean configGalvekNotifyEnabled;
|
||||
private boolean configGargBossEnabled;
|
||||
private boolean configGargBossNotifyEnabled;
|
||||
private boolean configVetionEnabled;
|
||||
private boolean configVetionNotifyEnabled;
|
||||
private boolean configChaosFanaticEnabled;
|
||||
private boolean configChaosFanaticNotifyEnabled;
|
||||
private boolean configOlmEnabled;
|
||||
private boolean configOlmNotifyEnabled;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean configbombDisplay;
|
||||
private boolean configbombDisplayNotifyEnabled;
|
||||
private boolean configLightningTrail;
|
||||
private boolean configLightningTrailNotifyEnabled;
|
||||
private boolean configCorpEnabled;
|
||||
private boolean configCorpNotifyEnabled;
|
||||
private boolean configWintertodtEnabled;
|
||||
private boolean configWintertodtNotifyEnabled;
|
||||
private boolean configXarpusEnabled;
|
||||
private boolean configXarpusNotifyEnabled;
|
||||
private boolean configaddyDrags;
|
||||
private boolean configaddyDragsNotifyEnabled;
|
||||
private boolean configDrakeEnabled;
|
||||
private boolean configDrakeNotifyEnabled;
|
||||
private boolean configCerbFireEnabled;
|
||||
private boolean configCerbFireNotifyEnabled;
|
||||
private boolean configDemonicGorillaEnabled;
|
||||
private boolean configDemonicGorillaNotifyEnabled;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(coreOverlay);
|
||||
overlayManager.add(bombOverlay);
|
||||
reset(true);
|
||||
reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -128,7 +181,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
{
|
||||
overlayManager.remove(coreOverlay);
|
||||
overlayManager.remove(bombOverlay);
|
||||
reset(false);
|
||||
reset();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -139,18 +192,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event.getKey())
|
||||
{
|
||||
case "fontStyle":
|
||||
fontStyle = config.fontStyle().getFont();
|
||||
break;
|
||||
case "textSize":
|
||||
textSize = config.textSize();
|
||||
break;
|
||||
case "shadows":
|
||||
shadows = config.shadows();
|
||||
break;
|
||||
}
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -159,7 +201,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
Projectile projectile = event.getProjectile();
|
||||
|
||||
int projectileId = projectile.getId();
|
||||
int projectileLifetime = config.delay() + (projectile.getRemainingCycles() * 20);
|
||||
int projectileLifetime = this.delay + (projectile.getRemainingCycles() * 20);
|
||||
int ticksRemaining = projectile.getRemainingCycles() / 30;
|
||||
if (!isTickTimersEnabledForProjectileID(projectileId))
|
||||
{
|
||||
@@ -174,7 +216,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime, tickCycle);
|
||||
projectiles.put(projectile, aoeProjectile);
|
||||
|
||||
if (config.aoeNotifyAll() || isConfigEnabledForProjectileId(projectileId, true))
|
||||
if (this.aoeNotifyAll || isConfigEnabledForProjectileId(projectileId, true))
|
||||
{
|
||||
notifier.notify("AoE attack detected!");
|
||||
}
|
||||
@@ -192,7 +234,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
case ObjectID.CRYSTAL_BOMB:
|
||||
bombs.put(wp, new CrystalBomb(gameObject, client.getTickCount()));
|
||||
|
||||
if (config.aoeNotifyAll() || config.bombDisplayNotifyEnabled())
|
||||
if (this.aoeNotifyAll || this.configbombDisplayNotifyEnabled)
|
||||
{
|
||||
notifier.notify("Bomb!");
|
||||
}
|
||||
@@ -205,11 +247,11 @@ public class AoeWarningPlugin extends Plugin
|
||||
break;
|
||||
case NullObjectID.NULL_26690:
|
||||
//Wintertodt Snowfall
|
||||
if (config.isWintertodtEnabled())
|
||||
if (this.configWintertodtEnabled)
|
||||
{
|
||||
WintertodtSnowFall.add(wp);
|
||||
|
||||
if (config.aoeNotifyAll() || config.isWintertodtNotifyEnabled())
|
||||
if (this.aoeNotifyAll || this.configWintertodtNotifyEnabled)
|
||||
{
|
||||
notifier.notify("Snow Fall!");
|
||||
}
|
||||
@@ -236,7 +278,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
break;
|
||||
case NullObjectID.NULL_26690:
|
||||
//Wintertodt Snowfall
|
||||
if (config.isWintertodtEnabled())
|
||||
if (this.configWintertodtEnabled)
|
||||
{
|
||||
WintertodtSnowFall.remove(wp);
|
||||
}
|
||||
@@ -256,7 +298,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (config.LightningTrail())
|
||||
if (this.configLightningTrail)
|
||||
{
|
||||
LightningTrail.clear();
|
||||
for (GraphicsObject o : client.getGraphicsObjects())
|
||||
@@ -265,7 +307,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
{
|
||||
LightningTrail.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
|
||||
if (config.aoeNotifyAll() || config.LightningTrailNotifyEnabled())
|
||||
if (this.aoeNotifyAll || this.configLightningTrailNotifyEnabled)
|
||||
{
|
||||
notifier.notify("Lightning!");
|
||||
}
|
||||
@@ -350,7 +392,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
return false;
|
||||
}
|
||||
|
||||
if (notify && config.aoeNotifyAll())
|
||||
if (notify && this.aoeNotifyAll)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -358,57 +400,110 @@ public class AoeWarningPlugin extends Plugin
|
||||
switch (projectileInfo)
|
||||
{
|
||||
case LIZARDMAN_SHAMAN_AOE:
|
||||
return notify ? config.isShamansNotifyEnabled() : config.isShamansEnabled();
|
||||
return notify ? this.configShamansNotifyEnabled : this.configShamansEnabled;
|
||||
case CRAZY_ARCHAEOLOGIST_AOE:
|
||||
return notify ? config.isArchaeologistNotifyEnabled() : config.isArchaeologistEnabled();
|
||||
return notify ? this.configArchaeologistNotifyEnabled : this.configArchaeologistEnabled;
|
||||
case ICE_DEMON_RANGED_AOE:
|
||||
case ICE_DEMON_ICE_BARRAGE_AOE:
|
||||
return notify ? config.isIceDemonNotifyEnabled() : config.isIceDemonEnabled();
|
||||
return notify ? this.configIceDemonNotifyEnabled : this.configIceDemonEnabled;
|
||||
case VASA_AWAKEN_AOE:
|
||||
case VASA_RANGED_AOE:
|
||||
return notify ? config.isVasaNotifyEnabled() : config.isVasaEnabled();
|
||||
return notify ? this.configVasaNotifyEnabled : this.configVasaEnabled;
|
||||
case TEKTON_METEOR_AOE:
|
||||
return notify ? config.isTektonNotifyEnabled() : config.isTektonEnabled();
|
||||
return notify ? this.configTektonNotifyEnabled : this.configTektonEnabled;
|
||||
case VORKATH_BOMB:
|
||||
case VORKATH_POISON_POOL:
|
||||
case VORKATH_SPAWN:
|
||||
case VORKATH_TICK_FIRE:
|
||||
return notify ? config.isVorkathNotifyEnabled() : config.isVorkathEnabled();
|
||||
return notify ? this.configVorkathNotifyEnabled : this.configVorkathEnabled;
|
||||
case VETION_LIGHTNING:
|
||||
return notify ? config.isVetionNotifyEnabled() : config.isVetionEnabled();
|
||||
return notify ? this.configVetionNotifyEnabled : this.configVetionEnabled;
|
||||
case CHAOS_FANATIC:
|
||||
return notify ? config.isChaosFanaticNotifyEnabled() : config.isChaosFanaticEnabled();
|
||||
return notify ? this.configChaosFanaticNotifyEnabled : this.configChaosFanaticEnabled;
|
||||
case GALVEK_BOMB:
|
||||
case GALVEK_MINE:
|
||||
return notify ? config.isGalvekNotifyEnabled() : config.isGalvekEnabled();
|
||||
return notify ? this.configGalvekNotifyEnabled : this.configGalvekEnabled;
|
||||
case DAWN_FREEZE:
|
||||
case DUSK_CEILING:
|
||||
return notify ? config.isGargBossNotifyEnabled() : config.isGargBossEnabled();
|
||||
return notify ? this.configGargBossNotifyEnabled : this.configGargBossEnabled;
|
||||
case OLM_FALLING_CRYSTAL:
|
||||
case OLM_BURNING:
|
||||
case OLM_FALLING_CRYSTAL_TRAIL:
|
||||
case OLM_ACID_TRAIL:
|
||||
case OLM_FIRE_LINE:
|
||||
return notify ? config.isOlmNotifyEnabled() : config.isOlmEnabled();
|
||||
return notify ? this.configOlmNotifyEnabled : this.configOlmEnabled;
|
||||
case CORPOREAL_BEAST:
|
||||
case CORPOREAL_BEAST_DARK_CORE:
|
||||
return notify ? config.isCorpNotifyEnabled() : config.isCorpEnabled();
|
||||
return notify ? this.configCorpNotifyEnabled : this.configCorpEnabled;
|
||||
case XARPUS_POISON_AOE:
|
||||
return notify ? config.isXarpusNotifyEnabled() : config.isXarpusEnabled();
|
||||
return notify ? this.configXarpusNotifyEnabled : this.configXarpusEnabled;
|
||||
case ADDY_DRAG_POISON:
|
||||
return notify ? config.addyDragsNotifyEnabled() : config.addyDrags();
|
||||
return notify ? this.configaddyDragsNotifyEnabled : this.configaddyDrags;
|
||||
case DRAKE_BREATH:
|
||||
return notify ? config.isDrakeNotifyEnabled() : config.isDrakeEnabled();
|
||||
return notify ? this.configDrakeNotifyEnabled : this.configDrakeEnabled;
|
||||
case CERB_FIRE:
|
||||
return notify ? config.isCerbFireNotifyEnabled() : config.isCerbFireEnabled();
|
||||
return notify ? this.configCerbFireNotifyEnabled : this.configCerbFireEnabled;
|
||||
case DEMONIC_GORILLA_BOULDER:
|
||||
return notify ? config.isDemonicGorillaNotifyEnabled() : config.isDemonicGorillaEnabled();
|
||||
return notify ? this.configDemonicGorillaNotifyEnabled : this.configDemonicGorillaEnabled;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void reset(boolean setConfig)
|
||||
public void updateConfig()
|
||||
{
|
||||
this.aoeNotifyAll = config.aoeNotifyAll();
|
||||
this.overlayColor = config.overlayColor();
|
||||
this.configOutlineEnabled = config.isOutlineEnabled();
|
||||
this.delay = config.delay();
|
||||
this.configFadeEnabled = config.isFadeEnabled();
|
||||
this.tickTimers = config.tickTimers();
|
||||
this.fontStyle = config.fontStyle().getFont();
|
||||
this.textSize = config.textSize();
|
||||
this.shadows = config.shadows();
|
||||
this.configShamansEnabled = config.isShamansEnabled();
|
||||
this.configShamansNotifyEnabled = config.isShamansNotifyEnabled();
|
||||
this.configArchaeologistEnabled = config.isArchaeologistEnabled();
|
||||
this.configArchaeologistNotifyEnabled = config.isArchaeologistNotifyEnabled();
|
||||
this.configIceDemonEnabled = config.isIceDemonEnabled();
|
||||
this.configIceDemonNotifyEnabled = config.isIceDemonNotifyEnabled();
|
||||
this.configVasaEnabled = config.isVasaEnabled();
|
||||
this.configVasaNotifyEnabled = config.isVasaNotifyEnabled();
|
||||
this.configTektonEnabled = config.isTektonEnabled();
|
||||
this.configTektonNotifyEnabled = config.isTektonNotifyEnabled();
|
||||
this.configVorkathEnabled = config.isVorkathEnabled();
|
||||
this.configVorkathNotifyEnabled = config.isVorkathNotifyEnabled();
|
||||
this.configGalvekEnabled = config.isGalvekEnabled();
|
||||
this.configGalvekNotifyEnabled = config.isGalvekNotifyEnabled();
|
||||
this.configGargBossEnabled = config.isGargBossEnabled();
|
||||
this.configGargBossNotifyEnabled = config.isGargBossNotifyEnabled();
|
||||
this.configVetionEnabled = config.isVetionEnabled();
|
||||
this.configVetionNotifyEnabled = config.isVetionNotifyEnabled();
|
||||
this.configChaosFanaticEnabled = config.isChaosFanaticEnabled();
|
||||
this.configChaosFanaticNotifyEnabled = config.isChaosFanaticNotifyEnabled();
|
||||
this.configOlmEnabled = config.isOlmEnabled();
|
||||
this.configOlmNotifyEnabled = config.isOlmNotifyEnabled();
|
||||
this.configbombDisplay = config.bombDisplay();
|
||||
this.configbombDisplayNotifyEnabled = config.bombDisplayNotifyEnabled();
|
||||
this.configLightningTrail = config.LightningTrail();
|
||||
this.configLightningTrailNotifyEnabled = config.LightningTrailNotifyEnabled();
|
||||
this.configCorpEnabled = config.isCorpEnabled();
|
||||
this.configCorpNotifyEnabled = config.isCorpNotifyEnabled();
|
||||
this.configWintertodtEnabled = config.isWintertodtEnabled();
|
||||
this.configWintertodtNotifyEnabled = config.isWintertodtNotifyEnabled();
|
||||
this.configXarpusEnabled = config.isXarpusEnabled();
|
||||
this.configXarpusNotifyEnabled = config.isXarpusNotifyEnabled();
|
||||
this.configaddyDrags = config.addyDrags();
|
||||
this.configaddyDragsNotifyEnabled = config.addyDragsNotifyEnabled();
|
||||
this.configDrakeEnabled = config.isDrakeEnabled();
|
||||
this.configDrakeNotifyEnabled = config.isDrakeNotifyEnabled();
|
||||
this.configCerbFireEnabled = config.isCerbFireEnabled();
|
||||
this.configCerbFireNotifyEnabled = config.isCerbFireNotifyEnabled();
|
||||
this.configDemonicGorillaEnabled = config.isDemonicGorillaEnabled();
|
||||
this.configDemonicGorillaNotifyEnabled = config.isDemonicGorillaNotifyEnabled();
|
||||
}
|
||||
|
||||
private void reset()
|
||||
{
|
||||
LightningTrail.clear();
|
||||
AcidTrail.clear();
|
||||
@@ -416,11 +511,5 @@ public class AoeWarningPlugin extends Plugin
|
||||
WintertodtSnowFall.clear();
|
||||
bombs.clear();
|
||||
projectiles.clear();
|
||||
if (setConfig)
|
||||
{
|
||||
fontStyle = config.fontStyle().getFont();
|
||||
textSize = config.textSize();
|
||||
shadows = config.shadows();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,10 +32,10 @@ import java.awt.Polygon;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.Iterator;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -50,6 +50,7 @@ import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class BombOverlay extends Overlay
|
||||
{
|
||||
|
||||
@@ -81,15 +82,13 @@ public class BombOverlay extends Overlay
|
||||
}
|
||||
|
||||
private final Client client;
|
||||
private final AoeWarningConfig config;
|
||||
private final AoeWarningPlugin plugin;
|
||||
|
||||
@Inject
|
||||
public BombOverlay(Client client, AoeWarningPlugin plugin, AoeWarningConfig config)
|
||||
public BombOverlay(final Client client, final AoeWarningPlugin plugin)
|
||||
{
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
setPriority(OverlayPriority.MED);
|
||||
@@ -98,7 +97,7 @@ public class BombOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.bombDisplay())
|
||||
if (plugin.isConfigbombDisplay())
|
||||
{
|
||||
drawBombs(graphics);
|
||||
}
|
||||
@@ -108,10 +107,8 @@ public class BombOverlay extends Overlay
|
||||
private void drawBombs(Graphics2D graphics)
|
||||
//I can condense drawDangerZone into this. Ambivalent though.
|
||||
{
|
||||
Iterator<Map.Entry<WorldPoint, CrystalBomb>> it = plugin.getBombs().entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
for (Map.Entry<WorldPoint, CrystalBomb> entry : plugin.getBombs().entrySet())
|
||||
{
|
||||
Map.Entry<WorldPoint, CrystalBomb> entry = it.next();
|
||||
CrystalBomb bomb = entry.getValue();
|
||||
drawDangerZone(graphics, bomb);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.time.Instant;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.GameObject;
|
||||
@@ -33,20 +34,20 @@ import net.runelite.api.coords.WorldPoint;
|
||||
@Slf4j
|
||||
class CrystalBomb
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Instant plantedOn;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Instant lastClockUpdate;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int objectId;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tickStarted;
|
||||
//
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private WorldPoint worldLocation;
|
||||
|
||||
CrystalBomb(GameObject gameObject, int startTick)
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
@@ -36,19 +37,18 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
@Singleton
|
||||
class AttackStylesOverlay extends Overlay
|
||||
{
|
||||
private final AttackStylesPlugin plugin;
|
||||
private final AttackStylesConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private AttackStylesOverlay(AttackStylesPlugin plugin, AttackStylesConfig config)
|
||||
private AttackStylesOverlay(final AttackStylesPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Attack style overlay"));
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ class AttackStylesOverlay extends Overlay
|
||||
panelComponent.getChildren().clear();
|
||||
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
||||
|
||||
if (warnedSkillSelected || config.alwaysShowStyle())
|
||||
if (warnedSkillSelected || plugin.isAlwaysShowStyle())
|
||||
{
|
||||
final String attackStyleString = plugin.getAttackStyle().getName();
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ import com.google.inject.Provides;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
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.Skill;
|
||||
@@ -60,6 +63,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
description = "Show your current attack style as an overlay",
|
||||
tags = {"combat", "defence", "magic", "overlay", "ranged", "strength", "warn", "pure"}
|
||||
)
|
||||
@Singleton
|
||||
public class AttackStylesPlugin extends Plugin
|
||||
{
|
||||
private int attackStyleVarbit = -1;
|
||||
@@ -91,9 +95,22 @@ public class AttackStylesPlugin extends Plugin
|
||||
return configManager.getConfig(AttackStylesConfig.class);
|
||||
}
|
||||
|
||||
// config values
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean alwaysShowStyle;
|
||||
private boolean warnForDefence;
|
||||
private boolean warnForAttack;
|
||||
private boolean warnForStrength;
|
||||
private boolean warnForRanged;
|
||||
private boolean warnForMagic;
|
||||
private boolean hideAutoRetaliate;
|
||||
private boolean removeWarnedStyles;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(overlay);
|
||||
|
||||
if (client.getGameState() == GameState.LOGGED_IN)
|
||||
@@ -104,11 +121,11 @@ public class AttackStylesPlugin extends Plugin
|
||||
|
||||
private void start()
|
||||
{
|
||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||
updateWarnedSkills(warnForAttack, Skill.ATTACK);
|
||||
updateWarnedSkills(warnForStrength, Skill.STRENGTH);
|
||||
updateWarnedSkills(warnForDefence, Skill.DEFENCE);
|
||||
updateWarnedSkills(warnForRanged, Skill.RANGED);
|
||||
updateWarnedSkills(warnForMagic, Skill.MAGIC);
|
||||
attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
|
||||
equippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE);
|
||||
castingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE);
|
||||
@@ -134,7 +151,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
return attackStyle;
|
||||
}
|
||||
|
||||
public boolean isWarnedSkillSelected()
|
||||
boolean isWarnedSkillSelected()
|
||||
{
|
||||
return warnedSkillSelected;
|
||||
}
|
||||
@@ -175,7 +192,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
hideWidget(client.getWidget(widgetKey), widgetsToHide.get(equippedWeaponType, widgetKey));
|
||||
}
|
||||
}
|
||||
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), config.hideAutoRetaliate());
|
||||
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -183,11 +200,11 @@ public class AttackStylesPlugin extends Plugin
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||
updateWarnedSkills(this.warnForAttack, Skill.ATTACK);
|
||||
updateWarnedSkills(this.warnForStrength, Skill.STRENGTH);
|
||||
updateWarnedSkills(this.warnForDefence, Skill.DEFENCE);
|
||||
updateWarnedSkills(this.warnForRanged, Skill.RANGED);
|
||||
updateWarnedSkills(this.warnForMagic, Skill.MAGIC);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,6 +241,8 @@ public class AttackStylesPlugin extends Plugin
|
||||
{
|
||||
if (event.getGroup().equals("attackIndicator"))
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
boolean enabled = event.getNewValue().equals("true");
|
||||
switch (event.getKey())
|
||||
{
|
||||
@@ -250,6 +269,18 @@ public class AttackStylesPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.alwaysShowStyle = config.alwaysShowStyle();
|
||||
this.warnForDefence = config.warnForDefence();
|
||||
this.warnForAttack = config.warnForAttack();
|
||||
this.warnForStrength = config.warnForStrength();
|
||||
this.warnForRanged = config.warnForRanged();
|
||||
this.warnForMagic = config.warnForMagic();
|
||||
this.hideAutoRetaliate = config.hideAutoRetaliate();
|
||||
this.removeWarnedStyles = config.removeWarnedStyles();
|
||||
}
|
||||
|
||||
private void updateAttackStyle(int equippedWeaponType, int attackStyleIndex, int castingMode)
|
||||
{
|
||||
AttackStyle[] attackStyles = WeaponType.getWeaponType(equippedWeaponType).getAttackStyles();
|
||||
@@ -298,7 +329,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
hideWarnedStyles(config.removeWarnedStyles());
|
||||
hideWarnedStyles(this.removeWarnedStyles);
|
||||
}
|
||||
|
||||
private void hideWarnedStyles(boolean enabled)
|
||||
|
||||
@@ -58,7 +58,7 @@ class BankCalculation
|
||||
Varbits.BANK_TAB_NINE_COUNT
|
||||
);
|
||||
|
||||
private final BankConfig config;
|
||||
private final BankPlugin plugin;
|
||||
private final ItemManager itemManager;
|
||||
private final Client client;
|
||||
|
||||
@@ -72,10 +72,10 @@ class BankCalculation
|
||||
private long haPrice;
|
||||
|
||||
@Inject
|
||||
BankCalculation(ItemManager itemManager, BankConfig config, Client client)
|
||||
BankCalculation(ItemManager itemManager, BankPlugin plugin, Client client)
|
||||
{
|
||||
this.itemManager = itemManager;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@@ -142,12 +142,12 @@ class BankCalculation
|
||||
continue;
|
||||
}
|
||||
|
||||
if (config.showGE())
|
||||
if (plugin.isShowGE())
|
||||
{
|
||||
itemIds.add(item.getId());
|
||||
}
|
||||
|
||||
if (config.showHA())
|
||||
if (plugin.isShowHA())
|
||||
{
|
||||
long alchValue = itemManager.getAlchValue(item.getId());
|
||||
|
||||
@@ -159,7 +159,7 @@ class BankCalculation
|
||||
}
|
||||
|
||||
// Now do the calculations
|
||||
if (config.showGE() && !itemIds.isEmpty())
|
||||
if (plugin.isShowGE() && !itemIds.isEmpty())
|
||||
{
|
||||
for (Item item : items)
|
||||
{
|
||||
|
||||
@@ -28,8 +28,12 @@ package net.runelite.client.plugins.bank;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.MenuShouldLeftClick;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
@@ -46,6 +50,7 @@ import net.runelite.client.util.StackFormatter;
|
||||
description = "Modifications to the banking interface",
|
||||
tags = {"grand", "exchange", "high", "alchemy", "prices", "deposit"}
|
||||
)
|
||||
@Singleton
|
||||
public class BankPlugin extends Plugin
|
||||
{
|
||||
private static final String DEPOSIT_WORN = "Deposit worn items";
|
||||
@@ -75,6 +80,21 @@ public class BankPlugin extends Plugin
|
||||
return configManager.getConfig(BankConfig.class);
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showGE;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showHA;
|
||||
private boolean showExact;
|
||||
private boolean rightClickBankInventory;
|
||||
private boolean rightClickBankEquip;
|
||||
private boolean rightClickBankLoot;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
@@ -94,9 +114,9 @@ public class BankPlugin extends Plugin
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
for (MenuEntry entry : menuEntries)
|
||||
{
|
||||
if ((entry.getOption().equals(DEPOSIT_WORN) && config.rightClickBankEquip())
|
||||
|| (entry.getOption().equals(DEPOSIT_INVENTORY) && config.rightClickBankInventory())
|
||||
|| (entry.getOption().equals(DEPOSIT_LOOT) && config.rightClickBankLoot()))
|
||||
if ((entry.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
|
||||
|| (entry.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory)
|
||||
|| (entry.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot))
|
||||
{
|
||||
event.setForceRightClick(true);
|
||||
return;
|
||||
@@ -107,9 +127,9 @@ public class BankPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if ((event.getOption().equals(DEPOSIT_WORN) && config.rightClickBankEquip())
|
||||
|| (event.getOption().equals(DEPOSIT_INVENTORY) && config.rightClickBankInventory())
|
||||
|| (event.getOption().equals(DEPOSIT_LOOT) && config.rightClickBankLoot()))
|
||||
if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
|
||||
|| (event.getOption().equals(DEPOSIT_INVENTORY) && this.rightClickBankInventory)
|
||||
|| (event.getOption().equals(DEPOSIT_LOOT) && this.rightClickBankLoot))
|
||||
{
|
||||
forceRightClickFlag = true;
|
||||
}
|
||||
@@ -128,16 +148,16 @@ public class BankPlugin extends Plugin
|
||||
long gePrice = bankCalculation.getGePrice();
|
||||
long haPrice = bankCalculation.getHaPrice();
|
||||
|
||||
if (config.showGE() && gePrice != 0)
|
||||
if (this.showGE && gePrice != 0)
|
||||
{
|
||||
strCurrentTab += " (";
|
||||
|
||||
if (config.showHA())
|
||||
if (this.showHA)
|
||||
{
|
||||
strCurrentTab += "EX: ";
|
||||
}
|
||||
|
||||
if (config.showExact())
|
||||
if (this.showExact)
|
||||
{
|
||||
strCurrentTab += StackFormatter.formatNumber(gePrice) + ")";
|
||||
}
|
||||
@@ -147,16 +167,16 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (config.showHA() && haPrice != 0)
|
||||
if (this.showHA && haPrice != 0)
|
||||
{
|
||||
strCurrentTab += " (";
|
||||
|
||||
if (config.showGE())
|
||||
if (this.showGE)
|
||||
{
|
||||
strCurrentTab += "HA: ";
|
||||
}
|
||||
|
||||
if (config.showExact())
|
||||
if (this.showExact)
|
||||
{
|
||||
strCurrentTab += StackFormatter.formatNumber(haPrice) + ")";
|
||||
}
|
||||
@@ -171,4 +191,25 @@ public class BankPlugin extends Plugin
|
||||
|
||||
stringStack[stringStackSize - 1] += strCurrentTab;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("bank"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.showGE = config.showGE();
|
||||
this.showHA = config.showHA();
|
||||
this.showExact = config.showExact();
|
||||
this.rightClickBankInventory = config.rightClickBankInventory();
|
||||
this.rightClickBankEquip = config.rightClickBankEquip();
|
||||
this.rightClickBankLoot = config.rightClickBankLoot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.util.Collection;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
@@ -82,6 +83,7 @@ import net.runelite.client.util.Text;
|
||||
tags = {"searching", "tagging"}
|
||||
)
|
||||
@PluginDependency(ClueScrollPlugin.class)
|
||||
@Singleton
|
||||
public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyListener
|
||||
{
|
||||
public static final String CONFIG_GROUP = "banktags";
|
||||
|
||||
@@ -8,7 +8,6 @@ import net.runelite.client.config.ConfigItem;
|
||||
|
||||
public interface BanListConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "bannedPlayers",
|
||||
name = "Manual Scammer List",
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ClanMember;
|
||||
@@ -67,7 +68,7 @@ import okhttp3.Response;
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class BanListPlugin extends Plugin
|
||||
{
|
||||
@@ -94,9 +95,16 @@ public class BanListPlugin extends Plugin
|
||||
return configManager.getConfig(BanListConfig.class);
|
||||
}
|
||||
|
||||
// save config values
|
||||
private boolean enableWDR;
|
||||
private boolean enableRuneWatch;
|
||||
private boolean highlightInClan;
|
||||
private boolean highlightInTrade;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
manualBans.addAll(Text.fromCSV(config.getBannedPlayers()));
|
||||
fetchFromWebsites();
|
||||
}
|
||||
@@ -128,6 +136,14 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.enableWDR = config.enableWDR();
|
||||
this.enableRuneWatch = config.enableRuneWatch();
|
||||
this.highlightInClan = config.highlightInClan();
|
||||
this.highlightInTrade = config.highlightInTrade();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently
|
||||
*/
|
||||
@@ -138,7 +154,7 @@ public class BanListPlugin extends Plugin
|
||||
|| client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null
|
||||
|| client.getViewportWidget() == null
|
||||
|| client.getWidget(WidgetInfo.CLAN_CHAT) == null
|
||||
|| !config.highlightInClan())
|
||||
|| !this.highlightInClan)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -163,7 +179,7 @@ public class BanListPlugin extends Plugin
|
||||
if (scamList != null)
|
||||
{
|
||||
sendWarning(Text.standardize(member.getUsername()), scamList);
|
||||
if (config.highlightInClan())
|
||||
if (this.highlightInClan)
|
||||
{
|
||||
highlightRedInCC();
|
||||
}
|
||||
@@ -172,7 +188,7 @@ public class BanListPlugin extends Plugin
|
||||
if (toxicList != null)
|
||||
{
|
||||
sendWarning(Text.standardize(member.getUsername()), toxicList);
|
||||
if (config.highlightInClan())
|
||||
if (this.highlightInClan)
|
||||
{
|
||||
highlightRedInCC();
|
||||
}
|
||||
@@ -185,7 +201,7 @@ public class BanListPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
{
|
||||
if (config.highlightInTrade())
|
||||
if (this.highlightInTrade)
|
||||
{
|
||||
if (widgetLoaded.getGroupId() == 335)
|
||||
{ //if trading window was loaded
|
||||
@@ -211,7 +227,7 @@ public class BanListPlugin extends Plugin
|
||||
*/
|
||||
private ListType checkScamList(String nameToBeChecked)
|
||||
{
|
||||
if (wdrScamArrayList.size() > 0 && config.enableWDR())
|
||||
if (wdrScamArrayList.size() > 0 && this.enableWDR)
|
||||
{
|
||||
if (wdrScamArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||
{
|
||||
@@ -219,7 +235,7 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (runeWatchArrayList.size() > 0 && config.enableRuneWatch())
|
||||
if (runeWatchArrayList.size() > 0 && this.enableRuneWatch)
|
||||
{
|
||||
if (runeWatchArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||
{
|
||||
@@ -241,7 +257,7 @@ public class BanListPlugin extends Plugin
|
||||
private ListType checkToxicList(String nameToBeChecked)
|
||||
{
|
||||
|
||||
if (wdrToxicArrayList.size() > 0 && config.enableWDR())
|
||||
if (wdrToxicArrayList.size() > 0 && this.enableWDR)
|
||||
{
|
||||
if (wdrToxicArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase))
|
||||
{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
@@ -46,7 +47,7 @@ import java.awt.Stroke;
|
||||
import java.awt.BasicStroke;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Singleton
|
||||
class AboveSceneOverlay extends Overlay
|
||||
{
|
||||
private static final int HEALTH_BAR_HEIGHT = 20;
|
||||
@@ -62,18 +63,16 @@ class AboveSceneOverlay extends Overlay
|
||||
|
||||
private final Client client;
|
||||
private final BarbarianAssaultPlugin game;
|
||||
private final BarbarianAssaultConfig config;
|
||||
|
||||
|
||||
@Inject
|
||||
private AboveSceneOverlay(Client client, BarbarianAssaultPlugin game, BarbarianAssaultConfig config)
|
||||
private AboveSceneOverlay(final Client client, final BarbarianAssaultPlugin game)
|
||||
{
|
||||
super(game);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.client = client;
|
||||
this.game = game;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -88,11 +87,11 @@ class AboveSceneOverlay extends Overlay
|
||||
{
|
||||
|
||||
case HEALER:
|
||||
if (config.showTeammateHealthbars())
|
||||
if (game.isShowTeammateHealthbars())
|
||||
{
|
||||
renderHealthBars(graphics);
|
||||
}
|
||||
if (config.healerCodes())
|
||||
if (game.isHealerCodes())
|
||||
{
|
||||
renderHealerCodes(graphics);
|
||||
}
|
||||
@@ -100,7 +99,7 @@ class AboveSceneOverlay extends Overlay
|
||||
|
||||
|
||||
case COLLECTOR:
|
||||
if (config.highlightCollectorEggs())
|
||||
if (game.isHighlightCollectorEggs())
|
||||
{
|
||||
renderEggs(graphics);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -43,7 +44,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
|
||||
@Singleton
|
||||
class AboveWidgetsOverlay extends Overlay
|
||||
{
|
||||
private static final int OFFSET_X_TEXT_QUANTITY = 0;
|
||||
@@ -51,18 +52,15 @@ class AboveWidgetsOverlay extends Overlay
|
||||
|
||||
private final Client client;
|
||||
private final BarbarianAssaultPlugin game;
|
||||
private final BarbarianAssaultConfig config;
|
||||
|
||||
|
||||
@Inject
|
||||
private AboveWidgetsOverlay(Client client, BarbarianAssaultPlugin game, BarbarianAssaultConfig config)
|
||||
private AboveWidgetsOverlay(final Client client, final BarbarianAssaultPlugin game)
|
||||
{
|
||||
super(game);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
this.game = game;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +73,7 @@ class AboveWidgetsOverlay extends Overlay
|
||||
|
||||
Role role = game.getRole();
|
||||
|
||||
if (config.showTimer())
|
||||
if (game.isShowTimer())
|
||||
{
|
||||
renderTimer(graphics, role);
|
||||
}
|
||||
@@ -83,23 +81,23 @@ class AboveWidgetsOverlay extends Overlay
|
||||
switch (role)
|
||||
{
|
||||
case ATTACKER:
|
||||
if (config.highlightArrows())
|
||||
if (game.isHighlightArrows())
|
||||
{
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), config.highlightArrowColor());
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightArrowColor());
|
||||
}
|
||||
break;
|
||||
|
||||
case DEFENDER:
|
||||
if (config.highlightBait())
|
||||
if (game.isHighlightBait())
|
||||
{
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), config.highlightBaitColor());
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightBaitColor());
|
||||
}
|
||||
break;
|
||||
|
||||
case HEALER:
|
||||
if (config.highlightPoison())
|
||||
if (game.isHighlightPoison())
|
||||
{
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), config.highlightPoisonColor());
|
||||
renderInventoryHighlights(graphics, game.getRole().getListenItem(game.getLastListenText()), game.getHighlightPoisonColor());
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -115,11 +113,11 @@ class AboveWidgetsOverlay extends Overlay
|
||||
return;
|
||||
}
|
||||
|
||||
if (role == Role.COLLECTOR && config.showEggCountOverlay() && game.getWave() != null)
|
||||
if (role == Role.COLLECTOR && game.isShowEggCountOverlay() && game.getWave() != null)
|
||||
{
|
||||
roleText.setText("(" + game.getWave().getCollectedEggCount() + ") " + formatClock());
|
||||
}
|
||||
else if (role == Role.HEALER && config.showHpCountOverlay() && game.getWave() != null)
|
||||
else if (role == Role.HEALER && game.isShowHpCountOverlay() && game.getWave() != null)
|
||||
{
|
||||
roleText.setText("(" + game.getWave().getHpHealed() + ") " + formatClock());
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.menus.ComparableEntry;
|
||||
@@ -40,19 +41,19 @@ class BarbarianAssaultMenu
|
||||
{
|
||||
private final MenuManager menuManager;
|
||||
private final BarbarianAssaultPlugin game;
|
||||
private final BarbarianAssaultConfig config;
|
||||
private final ArrayList<ComparableEntry> tracker = new ArrayList<>();
|
||||
@Getter @Setter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean hornUpdated = false;
|
||||
@Getter @Setter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean rebuildForced = false;
|
||||
|
||||
@Inject
|
||||
BarbarianAssaultMenu(MenuManager menuManager, BarbarianAssaultPlugin game, BarbarianAssaultConfig config)
|
||||
BarbarianAssaultMenu(final MenuManager menuManager, final BarbarianAssaultPlugin game)
|
||||
{
|
||||
this.menuManager = menuManager;
|
||||
this.game = game;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
private boolean isHornOptionHidden(String option)
|
||||
@@ -100,24 +101,24 @@ class BarbarianAssaultMenu
|
||||
case TELL_BLUE_ATTACKER_HORN:
|
||||
case TELL_GREEN_ATTACKER_HORN:
|
||||
case TELL_RED_ATTACKER_HORN:
|
||||
return ((role == Role.ATTACKER && isHornOptionHidden(entry.getOption())) || role == null) && config.removeIncorrectCalls();
|
||||
return ((role == Role.ATTACKER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls();
|
||||
|
||||
case ATTACK_PENANCE_FIGHTER:
|
||||
case ATTACK_PENANCE_RANGER:
|
||||
case GET_SPIKES_PETRIFIED_MUSHROOM:
|
||||
case TAKE_ATTACKER_ITEM_MACHINE:
|
||||
return (role != Role.ATTACKER && role != null) && config.removeUnusedMenus();
|
||||
return (role != Role.ATTACKER && role != null) && game.isRemoveUnusedMenus();
|
||||
|
||||
|
||||
// Defender role Options
|
||||
case TELL_MEAT_DEFENDER_HORN:
|
||||
case TELL_TOFU_DEFENDER_HORN:
|
||||
case TELL_WORMS_DEFENDER_HORN:
|
||||
return ((role == Role.DEFENDER && isHornOptionHidden(entry.getOption())) || role == null) && config.removeIncorrectCalls();
|
||||
return ((role == Role.DEFENDER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls();
|
||||
|
||||
case BLOCK_PENANCE_CAVE:
|
||||
return ((role != Role.DEFENDER && role != null) && config.removeUnusedMenus())
|
||||
|| (role == Role.DEFENDER && config.removePenanceCave());
|
||||
return ((role != Role.DEFENDER && role != null) && game.isRemoveUnusedMenus())
|
||||
|| (role == Role.DEFENDER && game.isRemovePenanceCave());
|
||||
|
||||
case DUNK_LAVA_CRATER:
|
||||
case FIX:
|
||||
@@ -125,7 +126,7 @@ class BarbarianAssaultMenu
|
||||
case TAKE_DEFENDER_ITEM_MACHINE:
|
||||
case TAKE_HAMMER:
|
||||
case TAKE_LOGS:
|
||||
return (role != Role.DEFENDER && role != null) && config.removeUnusedMenus();
|
||||
return (role != Role.DEFENDER && role != null) && game.isRemoveUnusedMenus();
|
||||
|
||||
|
||||
// Collector role options
|
||||
@@ -133,7 +134,7 @@ class BarbarianAssaultMenu
|
||||
case TELL_AGGRESSIVE_COLLECTOR_HORN:
|
||||
case TELL_CONTROLLED_COLLECTOR_HORN:
|
||||
case TELL_DEFENSIVE_COLLECTOR_HORN:
|
||||
return ((role == Role.COLLECTOR && isHornOptionHidden(entry.getOption())) || role == null) && config.removeIncorrectCalls();
|
||||
return ((role == Role.COLLECTOR && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls();
|
||||
|
||||
case CONVERT_COLLECTOR_CONVERTER:
|
||||
case LOAD_EGG_HOPPER:
|
||||
@@ -141,40 +142,40 @@ class BarbarianAssaultMenu
|
||||
case TAKE_GREEN_EGG:
|
||||
case TAKE_RED_EGG:
|
||||
case TAKE_YELLOW_EGG:
|
||||
return (role != Role.COLLECTOR && role != null) && config.removeUnusedMenus();
|
||||
return (role != Role.COLLECTOR && role != null) && game.isRemoveUnusedMenus();
|
||||
|
||||
|
||||
// Healer role options
|
||||
case TELL_CRACKERS_HEALER_HORN:
|
||||
case TELL_TOFU_HEALER_HORN:
|
||||
case TELL_WORMS_HEALER_HORN:
|
||||
return ((role == Role.HEALER && isHornOptionHidden(entry.getOption())) || role == null) && config.removeIncorrectCalls();
|
||||
return ((role == Role.HEALER && isHornOptionHidden(entry.getOption())) || role == null) && game.isRemoveIncorrectCalls();
|
||||
|
||||
case DUNK_POISON_CRATER:
|
||||
case STOCK_UP_HEALER_ITEM_MACHINE:
|
||||
case TAKE_HEALER_ITEM_MACHINE:
|
||||
case TAKE_FROM_HEALER_SPRING:
|
||||
case DRINK_FROM_HEALER_SPRING:
|
||||
return (role != Role.HEALER && role != null) && config.removeUnusedMenus();
|
||||
return (role != Role.HEALER && role != null) && game.isRemoveUnusedMenus();
|
||||
|
||||
case USE_VIAL_GROUND:
|
||||
case USE_VIAL_ITEM:
|
||||
case USE_VIAL_NPC:
|
||||
case USE_VIAL_WIDGET:
|
||||
return role == Role.HEALER && config.removeUnusedMenus();
|
||||
return role == Role.HEALER && game.isRemoveUnusedMenus();
|
||||
|
||||
|
||||
// Any role options
|
||||
case DROP_HORN:
|
||||
case EXAMINE_HORN:
|
||||
case USE_HORN:
|
||||
return config.removeIncorrectCalls();
|
||||
return game.isRemoveIncorrectCalls();
|
||||
|
||||
case MEDIC_HORN:
|
||||
return config.removeIncorrectCalls() && !hornUpdated;
|
||||
return game.isRemoveIncorrectCalls() && !hornUpdated;
|
||||
|
||||
default:
|
||||
return role != null && config.removeUnusedMenus();
|
||||
return role != null && game.isRemoveUnusedMenus();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -189,15 +190,15 @@ class BarbarianAssaultMenu
|
||||
|
||||
void enableSwaps()
|
||||
{
|
||||
if (config.swapLadder())
|
||||
if (game.isSwapLadder())
|
||||
{
|
||||
menuManager.addSwap("climb-down", "ladder", "quick-start", "ladder");
|
||||
}
|
||||
if (config.swapCollectorBag())
|
||||
if (game.isSwapCollectorBag())
|
||||
{
|
||||
menuManager.addSwap("look-in", "collection bag", "empty", "collection bag");
|
||||
}
|
||||
if (config.swapDestroyEggs())
|
||||
if (game.isSwapDestroyEggs())
|
||||
{
|
||||
menuManager.addSwap("use", "blue egg", "destroy", "blue egg");
|
||||
menuManager.addSwap("use", "green egg", "destroy", "green egg");
|
||||
@@ -207,17 +208,17 @@ class BarbarianAssaultMenu
|
||||
|
||||
void disableSwaps(boolean force)
|
||||
{
|
||||
if (!config.swapLadder() || force)
|
||||
if (!game.isSwapLadder() || force)
|
||||
{
|
||||
menuManager.removeSwap("climb-down", "ladder", "quick-start", "ladder");
|
||||
}
|
||||
|
||||
if (!config.swapCollectorBag() || force)
|
||||
if (!game.isSwapCollectorBag() || force)
|
||||
{
|
||||
menuManager.removeSwap("look-in", "collection bag", "empty", "collection bag");
|
||||
}
|
||||
|
||||
if (!config.swapDestroyEggs() || force)
|
||||
if (!game.isSwapDestroyEggs() || force)
|
||||
{
|
||||
menuManager.removeSwap("use", "blue egg", "destroy", "blue egg");
|
||||
menuManager.removeSwap("use", "green egg", "destroy", "green egg");
|
||||
|
||||
@@ -30,6 +30,7 @@ package net.runelite.client.plugins.barbarianassault;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Provides;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.image.BufferedImage;
|
||||
@@ -42,6 +43,8 @@ import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -108,6 +111,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
|
||||
)
|
||||
@Singleton
|
||||
public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
private static final String ENDGAME_REWARD_NEEDLE_TEXT = "<br>5";
|
||||
@@ -241,16 +245,71 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
private String poisonUsed = null;
|
||||
|
||||
|
||||
@Provides
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||
}
|
||||
|
||||
// save config values
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean swapLadder;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showTimer;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean removeIncorrectCalls;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean removeUnusedMenus;
|
||||
private boolean prayerMetronome;
|
||||
private int prayerMetronomeVolume;
|
||||
private boolean showDeathTimes;
|
||||
private DeathTimesMode showDeathTimesMode;
|
||||
private boolean waveTimes;
|
||||
private boolean showTotalRewards;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightArrows;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color highlightArrowColor;
|
||||
private boolean removeIncorrectAttackStyles;
|
||||
private boolean tagging;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightBait;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color highlightBaitColor;
|
||||
private boolean showDefTimer;
|
||||
private boolean deprioritizeBait;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean removePenanceCave;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightPoison;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color highlightPoisonColor;
|
||||
private boolean highlightNotification;
|
||||
private Color highlightNotificationColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showHpCountOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showTeammateHealthbars;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean healerCodes;
|
||||
private boolean healerMenuOption;
|
||||
private boolean shiftOverstock;
|
||||
private boolean controlHealer;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean swapCollectorBag;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean swapDestroyEggs;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean highlightCollectorEggs;
|
||||
private boolean deprioritizeIncorrectEggs;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showEggCountOverlay;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24);
|
||||
torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO);
|
||||
clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
||||
@@ -329,10 +388,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
|
||||
switch (configChanged.getKey())
|
||||
{
|
||||
case "showTimer":
|
||||
if (!config.showTimer())
|
||||
if (!this.showTimer)
|
||||
{
|
||||
showRoleSprite();
|
||||
}
|
||||
@@ -352,7 +413,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
break;
|
||||
|
||||
case "showDefTimer":
|
||||
if (config.showDefTimer() && getRole() == Role.DEFENDER)
|
||||
if (this.showDefTimer && getRole() == Role.DEFENDER)
|
||||
{
|
||||
addTickTimer();
|
||||
}
|
||||
@@ -364,9 +425,9 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
case "showDeathTimes":
|
||||
case "showDeathTimesMode":
|
||||
if (config.showDeathTimes()
|
||||
&& (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX
|
||||
|| config.showDeathTimesMode() == DeathTimesMode.BOTH))
|
||||
if (this.showDeathTimes
|
||||
&& (this.showDeathTimesMode == DeathTimesMode.INFO_BOX
|
||||
|| this.showDeathTimesMode == DeathTimesMode.BOTH))
|
||||
{
|
||||
addAllDeathTimes();
|
||||
}
|
||||
@@ -383,7 +444,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
break;
|
||||
|
||||
case "removeIncorrectAttackStyles":
|
||||
if (!config.removeIncorrectAttackStyles())
|
||||
if (!this.removeIncorrectAttackStyles)
|
||||
{
|
||||
clientThread.invoke(this::showAllStyles);
|
||||
}
|
||||
@@ -391,6 +452,44 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.swapLadder = config.swapLadder();
|
||||
this.showTimer = config.showTimer();
|
||||
this.removeIncorrectCalls = config.removeIncorrectCalls();
|
||||
this.removeUnusedMenus = config.removeUnusedMenus();
|
||||
this.prayerMetronome = config.prayerMetronome();
|
||||
this.prayerMetronomeVolume = config.prayerMetronomeVolume();
|
||||
this.showDeathTimes = config.showDeathTimes();
|
||||
this.showDeathTimesMode = config.showDeathTimesMode();
|
||||
this.waveTimes = config.waveTimes();
|
||||
this.showTotalRewards = config.showTotalRewards();
|
||||
this.highlightArrows = config.highlightArrows();
|
||||
this.highlightArrowColor = config.highlightArrowColor();
|
||||
this.removeIncorrectAttackStyles = config.removeIncorrectAttackStyles();
|
||||
this.tagging = config.tagging();
|
||||
this.highlightBait = config.highlightBait();
|
||||
this.highlightBaitColor = config.highlightBaitColor();
|
||||
this.showDefTimer = config.showDefTimer();
|
||||
this.deprioritizeBait = config.deprioritizeBait();
|
||||
this.removePenanceCave = config.removePenanceCave();
|
||||
this.highlightPoison = config.highlightPoison();
|
||||
this.highlightPoisonColor = config.highlightPoisonColor();
|
||||
this.highlightNotification = config.highlightNotification();
|
||||
this.highlightNotificationColor = config.highlightNotificationColor();
|
||||
this.showHpCountOverlay = config.showHpCountOverlay();
|
||||
this.showTeammateHealthbars = config.showTeammateHealthbars();
|
||||
this.healerCodes = config.healerCodes();
|
||||
this.healerMenuOption = config.healerMenuOption();
|
||||
this.shiftOverstock = config.shiftOverstock();
|
||||
this.controlHealer = config.controlHealer();
|
||||
this.swapCollectorBag = config.swapCollectorBag();
|
||||
this.swapDestroyEggs = config.swapDestroyEggs();
|
||||
this.highlightCollectorEggs = config.highlightCollectorEggs();
|
||||
this.deprioritizeIncorrectEggs = config.deprioritizeIncorrectEggs();
|
||||
this.showEggCountOverlay = config.showEggCountOverlay();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
@@ -408,7 +507,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
Widget pointsWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||
if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT))
|
||||
{
|
||||
if (config.showTotalRewards() && pointsWidget != null)
|
||||
if (this.showTotalRewards && pointsWidget != null)
|
||||
{
|
||||
// The wave will be null if the plugin is disabled mid game, but
|
||||
// the wave points will still be accurate if it is re-enabled
|
||||
@@ -433,7 +532,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
announceGameTime();
|
||||
|
||||
if (config.showTotalRewards() && scorecard != null && scorecard.getNumberOfWaves() == 9)
|
||||
if (this.showTotalRewards && scorecard != null && scorecard.getNumberOfWaves() == 9)
|
||||
{
|
||||
announce(scorecard.getGameSummary());
|
||||
}
|
||||
@@ -496,11 +595,11 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
wave.setHpHealed(wave.getHpHealed() + health);
|
||||
}
|
||||
}
|
||||
else if (message.contains("the wrong type of poisoned food to use") && config.highlightNotification())
|
||||
else if (message.contains("the wrong type of poisoned food to use") && this.highlightNotification)
|
||||
{
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
final String nodeValue = Text.removeTags(messageNode.getValue());
|
||||
messageNode.setValue(ColorUtil.wrapWithColorTag(nodeValue, config.highlightNotificationColor()));
|
||||
messageNode.setValue(ColorUtil.wrapWithColorTag(nodeValue, this.highlightNotificationColor));
|
||||
chatMessageManager.update(messageNode);
|
||||
}
|
||||
else if (message.startsWith("All of the Penance"))
|
||||
@@ -528,9 +627,9 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
break;
|
||||
}
|
||||
|
||||
if (config.showDeathTimes() && wave != null
|
||||
&& (config.showDeathTimesMode() == DeathTimesMode.CHAT_BOX
|
||||
|| config.showDeathTimesMode() == DeathTimesMode.BOTH))
|
||||
if (this.showDeathTimes && wave != null
|
||||
&& (this.showDeathTimesMode == DeathTimesMode.CHAT_BOX
|
||||
|| this.showDeathTimesMode == DeathTimesMode.BOTH))
|
||||
{
|
||||
final MessageNode node = chatMessage.getMessageNode();
|
||||
final String nodeValue = Text.removeTags(node.getValue());
|
||||
@@ -635,9 +734,9 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
tickCounter.setCount(tickNum);
|
||||
}
|
||||
|
||||
if (config.prayerMetronome() && isAnyPrayerActive())
|
||||
if (this.prayerMetronome && isAnyPrayerActive())
|
||||
{
|
||||
for (int i = 0; i < config.prayerMetronomeVolume(); i++)
|
||||
for (int i = 0; i < this.prayerMetronomeVolume; i++)
|
||||
{
|
||||
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP);
|
||||
}
|
||||
@@ -821,7 +920,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
// This doesn't have to be done in BeforeRender. And although it is
|
||||
// inefficient, it's only being done while in the instance. Will
|
||||
// likely be changed in the future
|
||||
if (getRole() == Role.ATTACKER && config.removeIncorrectAttackStyles())
|
||||
if (getRole() == Role.ATTACKER && this.removeIncorrectAttackStyles)
|
||||
{
|
||||
Widget weapon = client.getWidget(WidgetInfo.COMBAT_WEAPON);
|
||||
|
||||
@@ -891,7 +990,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
switch (getRole())
|
||||
{
|
||||
case ATTACKER:
|
||||
if (config.tagging() && option.equals("attack") && (target.startsWith("penance fighter") || target.startsWith("penance ranger")))
|
||||
if (this.tagging && option.equals("attack") && (target.startsWith("penance fighter") || target.startsWith("penance ranger")))
|
||||
{
|
||||
String tag = StringUtils.substringBefore(entry.getTarget(), ")");
|
||||
|
||||
@@ -932,7 +1031,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
priority.add(entry);
|
||||
continue;
|
||||
}
|
||||
else if (config.deprioritizeIncorrectEggs()
|
||||
else if (this.deprioritizeIncorrectEggs
|
||||
&& option.equals("take")
|
||||
&& (target.equals("blue egg") || target.equals("green egg") || target.equals("red egg")))
|
||||
{
|
||||
@@ -954,7 +1053,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
priority.add(entry);
|
||||
continue;
|
||||
}
|
||||
else if (config.deprioritizeBait()
|
||||
else if (this.deprioritizeBait
|
||||
&& option.equals("take")
|
||||
&& (target.equals("tofu") || target.equals("crackers") || target.equals("worms")))
|
||||
{
|
||||
@@ -963,7 +1062,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
break;
|
||||
|
||||
case HEALER:
|
||||
if (config.healerMenuOption() && target.contains("penance healer") && healers.containsKey(identifier))
|
||||
if (this.healerMenuOption && target.contains("penance healer") && healers.containsKey(identifier))
|
||||
{
|
||||
String tag = StringUtils.substringBefore(entry.getTarget(), " (");
|
||||
int time = healers.get(identifier).timeToPoison();
|
||||
@@ -978,17 +1077,17 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
if ((target.startsWith("poisoned meat ->") || target.startsWith("poisoned tofu ->") || target.startsWith("poisoned worms ->")))
|
||||
{
|
||||
// Poison should only be used on healers
|
||||
if (config.removeUnusedMenus() && !target.contains("penance healer"))
|
||||
if (this.removeUnusedMenus && !target.contains("penance healer"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (config.controlHealer() && controlDown && identifier == lastHealerPoisoned && target.contains("penance healer"))
|
||||
else if (this.controlHealer && controlDown && identifier == lastHealerPoisoned && target.contains("penance healer"))
|
||||
{
|
||||
selected.add(entry);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (config.shiftOverstock() && target.equals("healer item machine") && shiftDown)
|
||||
else if (this.shiftOverstock && target.equals("healer item machine") && shiftDown)
|
||||
{
|
||||
if (option.contains(listen))
|
||||
{
|
||||
@@ -996,7 +1095,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (config.removeUnusedMenus())
|
||||
else if (this.removeUnusedMenus)
|
||||
{
|
||||
// Vials that are empty should only be used on spring
|
||||
if (target.startsWith("healing vial ->") && !target.endsWith("healer spring"))
|
||||
@@ -1312,12 +1411,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
private void validateWidgets()
|
||||
{
|
||||
if (!config.showTimer())
|
||||
if (!this.showTimer)
|
||||
{
|
||||
showRoleSprite();
|
||||
}
|
||||
|
||||
if (config.showDefTimer() && getRole() == Role.DEFENDER)
|
||||
if (this.showDefTimer && getRole() == Role.DEFENDER)
|
||||
{
|
||||
addTickTimer();
|
||||
}
|
||||
@@ -1326,9 +1425,9 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
removeTickTimer();
|
||||
}
|
||||
|
||||
if (config.showDeathTimes()
|
||||
&& (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX
|
||||
|| config.showDeathTimesMode() == DeathTimesMode.BOTH))
|
||||
if (this.showDeathTimes
|
||||
&& (this.showDeathTimesMode == DeathTimesMode.INFO_BOX
|
||||
|| this.showDeathTimesMode == DeathTimesMode.BOTH))
|
||||
{
|
||||
addAllDeathTimes();
|
||||
}
|
||||
@@ -1388,7 +1487,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
deathTimes.add(box);
|
||||
|
||||
if (config.showDeathTimes() && (config.showDeathTimesMode() == DeathTimesMode.INFO_BOX || config.showDeathTimesMode() == DeathTimesMode.BOTH))
|
||||
if (this.showDeathTimes && (this.showDeathTimesMode == DeathTimesMode.INFO_BOX || this.showDeathTimesMode == DeathTimesMode.BOTH))
|
||||
{
|
||||
infoBoxManager.addInfoBox(box);
|
||||
}
|
||||
@@ -1454,7 +1553,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
private void announceWaveTime()
|
||||
{
|
||||
if (config.waveTimes() && wave != null)
|
||||
if (this.waveTimes && wave != null)
|
||||
{
|
||||
announceTime("Wave " + getStage() + " duration: ", wave.getWaveTimer().getElapsedTimeFormatted());
|
||||
}
|
||||
@@ -1462,7 +1561,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
|
||||
private void announceGameTime()
|
||||
{
|
||||
if (config.waveTimes() && gameTimer != null)
|
||||
if (this.waveTimes && gameTimer != null)
|
||||
{
|
||||
announceTime("Game finished, duration: ", gameTimer.getElapsedTimeFormatted());
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public class Scorecard
|
||||
{
|
||||
private BarbarianAssaultPlugin game;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.Duration;
|
||||
@@ -33,7 +34,7 @@ import java.time.format.DateTimeFormatter;
|
||||
|
||||
class Timer
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Instant startTime;
|
||||
|
||||
Timer()
|
||||
|
||||
@@ -26,12 +26,14 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TimerBox extends InfoBox
|
||||
{
|
||||
|
||||
@@ -37,7 +37,6 @@ import net.runelite.client.chat.ChatMessageBuilder;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
|
||||
@Data
|
||||
public class Wave
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Varbits;
|
||||
@@ -43,13 +44,14 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
public class BarrowsBrotherSlainOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BarrowsBrotherSlainOverlay(BarrowsPlugin plugin, Client client)
|
||||
private BarrowsBrotherSlainOverlay(final BarrowsPlugin plugin, final Client client)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barrows;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.Varbits;
|
||||
@@ -39,10 +40,10 @@ public enum BarrowsBrothers
|
||||
TORAG("Torag", new WorldPoint(3553, 3283, 0), Varbits.BARROWS_KILLED_TORAG),
|
||||
VERAC("Verac", new WorldPoint(3557, 3298, 0), Varbits.BARROWS_KILLED_VERAC);
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final String name;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WorldPoint location;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Varbits killedVarbit;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -44,22 +45,21 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
@Singleton
|
||||
class BarrowsOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_DISTANCE = 2350;
|
||||
|
||||
private final Client client;
|
||||
private final BarrowsPlugin plugin;
|
||||
private final BarrowsConfig config;
|
||||
|
||||
@Inject
|
||||
private BarrowsOverlay(Client client, BarrowsPlugin plugin, BarrowsConfig config)
|
||||
private BarrowsOverlay(final Client client, final BarrowsPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,7 +71,7 @@ class BarrowsOverlay extends Overlay
|
||||
Widget puzzleAnswer = plugin.getPuzzleAnswer();
|
||||
|
||||
// tunnels are only on z=0
|
||||
if (!plugin.getWalls().isEmpty() && client.getPlane() == 0 && config.showMinimap())
|
||||
if (!plugin.getWalls().isEmpty() && client.getPlane() == 0 && plugin.isShowMinimap())
|
||||
{
|
||||
// NPC dots
|
||||
graphics.setColor(npcColor);
|
||||
@@ -117,12 +117,12 @@ class BarrowsOverlay extends Overlay
|
||||
graphics.setColor(playerColor);
|
||||
graphics.fillRect(local.getMinimapLocation().getX(), local.getMinimapLocation().getY(), 3, 3);
|
||||
}
|
||||
else if (config.showBrotherLoc())
|
||||
else if (plugin.isShowBrotherLoc())
|
||||
{
|
||||
renderBarrowsBrothers(graphics);
|
||||
}
|
||||
|
||||
if (puzzleAnswer != null && config.showPuzzleAnswer() && !puzzleAnswer.isHidden())
|
||||
if (puzzleAnswer != null && plugin.isShowPuzzleAnswer() && !puzzleAnswer.isHidden())
|
||||
{
|
||||
Rectangle answerRect = puzzleAnswer.getBounds();
|
||||
graphics.setColor(Color.GREEN);
|
||||
@@ -230,11 +230,11 @@ class BarrowsOverlay extends Overlay
|
||||
|
||||
if (client.getVar(brother.getKilledVarbit()) > 0)
|
||||
{
|
||||
graphics.setColor(config.deadBrotherLocColor());
|
||||
graphics.setColor(plugin.getDeadBrotherLocColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.setColor(config.brotherLocColor());
|
||||
graphics.setColor(plugin.getBrotherLocColor());
|
||||
}
|
||||
|
||||
graphics.drawString(brotherLetter, minimapText.getX(), minimapText.getY());
|
||||
|
||||
@@ -27,10 +27,12 @@ package net.runelite.client.plugins.barrows;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Sets;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -77,6 +79,7 @@ import net.runelite.client.util.StackFormatter;
|
||||
description = "Show helpful information for the Barrows minigame",
|
||||
tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"}
|
||||
)
|
||||
@Singleton
|
||||
public class BarrowsPlugin extends Plugin
|
||||
{
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@@ -144,9 +147,23 @@ public class BarrowsPlugin extends Plugin
|
||||
return configManager.getConfig(BarrowsConfig.class);
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showMinimap;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showBrotherLoc;
|
||||
private boolean showChestValue;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color brotherLocColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color deadBrotherLocColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showPuzzleAnswer;
|
||||
private boolean showPrayerDrainTimer;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
overlayManager.add(barrowsOverlay);
|
||||
overlayManager.add(brotherOverlay);
|
||||
}
|
||||
@@ -179,12 +196,28 @@ public class BarrowsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("barrows") && !config.showPrayerDrainTimer())
|
||||
if (event.getGroup().equals("barrows"))
|
||||
{
|
||||
stopPrayerDrainTimer();
|
||||
updateConfig();
|
||||
|
||||
if (!this.showPrayerDrainTimer)
|
||||
{
|
||||
stopPrayerDrainTimer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.showMinimap = config.showMinimap();
|
||||
this.showBrotherLoc = config.showBrotherLoc();
|
||||
this.showChestValue = config.showChestValue();
|
||||
this.brotherLocColor = config.brotherLocColor();
|
||||
this.deadBrotherLocColor = config.deadBrotherLocColor();
|
||||
this.showPuzzleAnswer = config.showPuzzleAnswer();
|
||||
this.showPrayerDrainTimer = config.showPrayerDrainTimer();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWallObjectSpawned(WallObjectSpawned event)
|
||||
{
|
||||
@@ -276,10 +309,14 @@ public class BarrowsPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.BARROWS_REWARD_GROUP_ID && config.showChestValue())
|
||||
if (event.getGroupId() == WidgetID.BARROWS_REWARD_GROUP_ID && this.showChestValue)
|
||||
{
|
||||
ItemContainer barrowsRewardContainer = client.getItemContainer(InventoryID.BARROWS_REWARD);
|
||||
Item[] items = barrowsRewardContainer.getItems();
|
||||
Item[] items = new Item[0];
|
||||
if (barrowsRewardContainer != null)
|
||||
{
|
||||
items = barrowsRewardContainer.getItems();
|
||||
}
|
||||
long chestPrice = 0;
|
||||
|
||||
for (Item item : items)
|
||||
@@ -320,7 +357,7 @@ public class BarrowsPlugin extends Plugin
|
||||
|
||||
private void startPrayerDrainTimer()
|
||||
{
|
||||
if (config.showPrayerDrainTimer())
|
||||
if (this.showPrayerDrainTimer)
|
||||
{
|
||||
final LoopTimer loopTimer = new LoopTimer(
|
||||
PRAYER_DRAIN_INTERVAL_MS,
|
||||
|
||||
@@ -35,10 +35,10 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
@@ -56,7 +56,6 @@ import org.apache.commons.lang3.RandomUtils;
|
||||
type = PluginType.SKILLING,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class BlackjackPlugin extends Plugin
|
||||
@@ -68,10 +67,9 @@ public class BlackjackPlugin extends Plugin
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
@Inject
|
||||
private BlackjackConfig config;
|
||||
|
||||
private boolean pickpocketOnAggro;
|
||||
|
||||
@Provides
|
||||
BlackjackConfig getConfig(ConfigManager configManager)
|
||||
@@ -79,6 +77,20 @@ public class BlackjackPlugin extends Plugin
|
||||
return configManager.getConfig(BlackjackConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
this.pickpocketOnAggro = config.pickpocketOnAggro();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("blackjack"))
|
||||
{
|
||||
this.pickpocketOnAggro = config.pickpocketOnAggro();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||
@@ -107,7 +119,7 @@ public class BlackjackPlugin extends Plugin
|
||||
{
|
||||
if (event.getType() == ChatMessageType.SPAM)
|
||||
{
|
||||
if (event.getMessage().equals(SUCCESS_BLACKJACK) ^ (event.getMessage().equals(FAILED_BLACKJACK) && config.pickpocketOnAggro()))
|
||||
if (event.getMessage().equals(SUCCESS_BLACKJACK) ^ (event.getMessage().equals(FAILED_BLACKJACK) && this.pickpocketOnAggro))
|
||||
{
|
||||
nextKnockOutTick = client.getTickCount() + RandomUtils.nextInt(3, 4);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.geom.Area;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.GameObject;
|
||||
@@ -42,21 +43,20 @@ import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
@Singleton
|
||||
class BlastFurnaceClickBoxOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_DISTANCE = 2350;
|
||||
|
||||
private final Client client;
|
||||
private final BlastFurnacePlugin plugin;
|
||||
private final BlastFurnaceConfig config;
|
||||
|
||||
@Inject
|
||||
private BlastFurnaceClickBoxOverlay(Client client, BlastFurnacePlugin plugin, BlastFurnaceConfig config)
|
||||
private BlastFurnaceClickBoxOverlay(final Client client, final BlastFurnacePlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,13 +64,13 @@ class BlastFurnaceClickBoxOverlay extends Overlay
|
||||
{
|
||||
int dispenserState = client.getVar(Varbits.BAR_DISPENSER);
|
||||
|
||||
if (config.showConveyorBelt() && plugin.getConveyorBelt() != null)
|
||||
if (plugin.isShowConveyorBelt() && plugin.getConveyorBelt() != null)
|
||||
{
|
||||
Color color = dispenserState == 1 ? Color.RED : Color.GREEN;
|
||||
renderObject(plugin.getConveyorBelt(), graphics, color);
|
||||
}
|
||||
|
||||
if (config.showBarDispenser() && plugin.getBarDispenser() != null)
|
||||
if (plugin.isShowBarDispenser() && plugin.getBarDispenser() != null)
|
||||
{
|
||||
boolean hasIceGloves = hasIceGloves();
|
||||
Color color = dispenserState == 2 && hasIceGloves ? Color.GREEN : (dispenserState == 3 ? Color.GREEN : Color.RED);
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.blastfurnace;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import static net.runelite.api.Varbits.BLAST_FURNACE_COFFER;
|
||||
@@ -41,6 +42,7 @@ import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
|
||||
@Singleton
|
||||
class BlastFurnaceCofferOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
@@ -48,7 +50,7 @@ class BlastFurnaceCofferOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BlastFurnaceCofferOverlay(Client client, BlastFurnacePlugin plugin)
|
||||
private BlastFurnaceCofferOverlay(final Client client, final BlastFurnacePlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -39,6 +40,7 @@ import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
@Singleton
|
||||
class BlastFurnaceOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
@@ -49,7 +51,7 @@ class BlastFurnaceOverlay extends Overlay
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
BlastFurnaceOverlay(Client client, BlastFurnacePlugin plugin)
|
||||
BlastFurnaceOverlay(final Client client, final BlastFurnacePlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -29,6 +29,7 @@ import com.google.inject.Provides;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
@@ -37,6 +38,7 @@ import net.runelite.api.GameState;
|
||||
import static net.runelite.api.NullObjectID.NULL_9092;
|
||||
import static net.runelite.api.ObjectID.CONVEYOR_BELT;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameObjectDespawned;
|
||||
import net.runelite.api.events.GameObjectSpawned;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
@@ -57,6 +59,7 @@ import net.runelite.client.util.Text;
|
||||
description = "Show helpful information for the Blast Furnace minigame",
|
||||
tags = {"minigame", "overlay", "skilling", "smithing"}
|
||||
)
|
||||
@Singleton
|
||||
public class BlastFurnacePlugin extends Plugin
|
||||
{
|
||||
private static final int BAR_DISPENSER = NULL_9092;
|
||||
@@ -91,9 +94,19 @@ public class BlastFurnacePlugin extends Plugin
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
|
||||
@Inject
|
||||
private BlastFurnaceConfig config;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showConveyorBelt;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showBarDispenser;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(cofferOverlay);
|
||||
overlayManager.add(clickBoxOverlay);
|
||||
@@ -117,6 +130,15 @@ public class BlastFurnacePlugin extends Plugin
|
||||
return configManager.getConfig(BlastFurnaceConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("blastfurnace"))
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
@@ -187,4 +209,10 @@ public class BlastFurnacePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
{
|
||||
this.showBarDispenser = config.showBarDispenser();
|
||||
this.showConveyorBelt = config.showConveyorBelt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
@@ -43,20 +44,21 @@ import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
@Singleton
|
||||
class BlastMineOreCountOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final BlastMinePluginConfig config;
|
||||
private final BlastMinePlugin plugin;
|
||||
private final ItemManager itemManager;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private BlastMineOreCountOverlay(BlastMinePlugin plugin, Client client, BlastMinePluginConfig config, ItemManager itemManager)
|
||||
private BlastMineOreCountOverlay(final BlastMinePlugin plugin, final Client client, final ItemManager itemManager)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.itemManager = itemManager;
|
||||
panelComponent.setOrientation(ComponentOrientation.HORIZONTAL);
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Blast mine overlay"));
|
||||
@@ -74,7 +76,7 @@ class BlastMineOreCountOverlay extends Overlay
|
||||
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
if (config.showOreOverlay())
|
||||
if (plugin.isShowOreOverlay())
|
||||
{
|
||||
blastMineWidget.setHidden(true);
|
||||
panelComponent.getChildren().add(new ImageComponent(getImage(ItemID.COAL, client.getVar(Varbits.BLAST_MINE_COAL))));
|
||||
|
||||
@@ -25,9 +25,12 @@
|
||||
package net.runelite.client.plugins.blastmine;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
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.GameObject;
|
||||
@@ -49,9 +52,10 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
description = "Show helpful information for the Blast Mine minigame",
|
||||
tags = {"explode", "explosive", "mining", "minigame", "skilling"}
|
||||
)
|
||||
@Singleton
|
||||
public class BlastMinePlugin extends Plugin
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, BlastMineRock> rocks = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
@@ -66,15 +70,33 @@ public class BlastMinePlugin extends Plugin
|
||||
@Inject
|
||||
private BlastMineOreCountOverlay blastMineOreCountOverlay;
|
||||
|
||||
@Inject
|
||||
private BlastMinePluginConfig config;
|
||||
|
||||
@Provides
|
||||
BlastMinePluginConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BlastMinePluginConfig.class);
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showOreOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showRockIconOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showTimerOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showWarningOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color timerColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color warningColor;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(blastMineRockOverlay);
|
||||
overlayManager.add(blastMineOreCountOverlay);
|
||||
}
|
||||
@@ -132,4 +154,14 @@ public class BlastMinePlugin extends Plugin
|
||||
(rock.getRemainingTimeRelative() == 1 && rock.getType() != BlastMineRockType.NORMAL) ||
|
||||
(rock.getRemainingFuseTimeRelative() == 1 && rock.getType() == BlastMineRockType.LIT));
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.showOreOverlay = config.showOreOverlay();
|
||||
this.showRockIconOverlay = config.showRockIconOverlay();
|
||||
this.showTimerOverlay = config.showTimerOverlay();
|
||||
this.showWarningOverlay = config.showWarningOverlay();
|
||||
this.timerColor = config.getTimerColor();
|
||||
this.warningColor = config.getWarningColor();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.blastmine;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.GameObject;
|
||||
|
||||
@@ -34,10 +35,10 @@ class BlastMineRock
|
||||
private static final Duration PLANT_TIME = Duration.ofSeconds(30);
|
||||
private static final Duration FUSE_TIME = Duration.ofMillis(4200);
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final GameObject gameObject;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final BlastMineRockType type;
|
||||
|
||||
private final Instant creationTime = Instant.now();
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.ItemID;
|
||||
@@ -49,6 +50,7 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
|
||||
@Singleton
|
||||
public class BlastMineRockOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_DISTANCE = 16;
|
||||
@@ -62,20 +64,18 @@ public class BlastMineRockOverlay extends Overlay
|
||||
|
||||
private final Client client;
|
||||
private final BlastMinePlugin plugin;
|
||||
private final BlastMinePluginConfig config;
|
||||
|
||||
private final BufferedImage chiselIcon;
|
||||
private final BufferedImage dynamiteIcon;
|
||||
private final BufferedImage tinderboxIcon;
|
||||
|
||||
@Inject
|
||||
private BlastMineRockOverlay(Client client, BlastMinePlugin plugin, BlastMinePluginConfig config, ItemManager itemManager)
|
||||
private BlastMineRockOverlay(final Client client, final BlastMinePlugin plugin, final ItemManager itemManager)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
chiselIcon = itemManager.getImage(ItemID.CHISEL);
|
||||
dynamiteIcon = itemManager.getImage(ItemID.DYNAMITE);
|
||||
tinderboxIcon = itemManager.getImage(ItemID.TINDERBOX);
|
||||
@@ -114,8 +114,8 @@ public class BlastMineRockOverlay extends Overlay
|
||||
drawIconOnRock(graphics, rock, tinderboxIcon);
|
||||
break;
|
||||
case LIT:
|
||||
drawTimerOnRock(graphics, rock, config.getTimerColor());
|
||||
drawAreaWarning(graphics, rock, config.getWarningColor(), tiles);
|
||||
drawTimerOnRock(graphics, rock, plugin.getTimerColor());
|
||||
drawAreaWarning(graphics, rock, plugin.getWarningColor(), tiles);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class BlastMineRockOverlay extends Overlay
|
||||
|
||||
private void drawIconOnRock(Graphics2D graphics, BlastMineRock rock, BufferedImage icon)
|
||||
{
|
||||
if (!config.showRockIconOverlay())
|
||||
if (!plugin.isShowRockIconOverlay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -140,7 +140,7 @@ public class BlastMineRockOverlay extends Overlay
|
||||
|
||||
private void drawTimerOnRock(Graphics2D graphics, BlastMineRock rock, Color color)
|
||||
{
|
||||
if (!config.showTimerOverlay())
|
||||
if (!plugin.isShowTimerOverlay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class BlastMineRockOverlay extends Overlay
|
||||
|
||||
private void drawAreaWarning(Graphics2D graphics, BlastMineRock rock, Color color, Tile[][][] tiles)
|
||||
{
|
||||
if (!config.showWarningOverlay())
|
||||
if (!plugin.isShowWarningOverlay())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.blastmine;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ObjectID;
|
||||
|
||||
@@ -54,7 +55,7 @@ public enum BlastMineRockType
|
||||
rockTypes = builder.build();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int[] objectIds;
|
||||
|
||||
BlastMineRockType(int... objectIds)
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.boosts;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -35,17 +36,15 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
|
||||
public class BoostIndicator extends InfoBox
|
||||
{
|
||||
private final BoostsPlugin plugin;
|
||||
private final BoostsConfig config;
|
||||
private final Client client;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Skill skill;
|
||||
|
||||
BoostIndicator(Skill skill, BufferedImage image, BoostsPlugin plugin, Client client, BoostsConfig config)
|
||||
BoostIndicator(final Skill skill, final BufferedImage image, final BoostsPlugin plugin, final Client client)
|
||||
{
|
||||
super(image, plugin);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.skill = skill;
|
||||
setTooltip(skill.getName() + " boost");
|
||||
@@ -55,7 +54,7 @@ public class BoostIndicator extends InfoBox
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
if (!config.useRelativeBoost())
|
||||
if (!plugin.isUseRelativeBoost())
|
||||
{
|
||||
return String.valueOf(client.getBoostedSkillLevel(skill));
|
||||
}
|
||||
@@ -81,13 +80,13 @@ public class BoostIndicator extends InfoBox
|
||||
return new Color(238, 51, 51);
|
||||
}
|
||||
|
||||
return boosted - base <= config.boostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
return boosted - base <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render()
|
||||
{
|
||||
if (config.displayInfoboxes() && plugin.canShowBoosts() && plugin.getShownSkills().contains(getSkill()))
|
||||
if (plugin.isDisplayInfoboxes() && plugin.canShowBoosts() && plugin.getShownSkills().contains(getSkill()))
|
||||
{
|
||||
return client.getBoostedSkillLevel(skill) != client.getRealSkillLevel(skill);
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -41,20 +42,19 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
class BoostsOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final BoostsConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final BoostsPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private BoostsOverlay(Client client, BoostsConfig config, BoostsPlugin plugin)
|
||||
private BoostsOverlay(final Client client, final BoostsPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.MED);
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Boosts overlay"));
|
||||
@@ -63,7 +63,7 @@ class BoostsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.displayInfoboxes() || config.displayIcons())
|
||||
if (plugin.isDisplayInfoboxes() || plugin.isDisplayIcons())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -103,7 +103,7 @@ class BoostsOverlay extends Overlay
|
||||
final Color strColor = getTextColor(boost);
|
||||
String str;
|
||||
|
||||
if (config.useRelativeBoost())
|
||||
if (plugin.isUseRelativeBoost())
|
||||
{
|
||||
str = String.valueOf(boost);
|
||||
if (boost > 0)
|
||||
@@ -133,7 +133,7 @@ class BoostsOverlay extends Overlay
|
||||
return new Color(238, 51, 51);
|
||||
}
|
||||
|
||||
return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
return boost <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
@@ -107,6 +108,21 @@ public class BoostsPlugin extends Plugin
|
||||
private long lastTickMillis;
|
||||
private List<String> boostedSkillsChanged = new ArrayList<>();
|
||||
|
||||
private boolean enableSkill;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean useRelativeBoost;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean displayInfoboxes;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean displayIcons;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean boldIconFont;
|
||||
private BoostsConfig.DisplayChangeMode displayNextBuffChange;
|
||||
private BoostsConfig.DisplayChangeMode displayNextDebuffChange;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int boostThreshold;
|
||||
private boolean groupNotifications;
|
||||
|
||||
@Provides
|
||||
BoostsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -116,6 +132,8 @@ public class BoostsPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(boostsOverlay);
|
||||
overlayManager.add(combatIconsOverlay);
|
||||
updateShownSkills();
|
||||
@@ -130,7 +148,7 @@ public class BoostsPlugin extends Plugin
|
||||
{
|
||||
if (skill != Skill.OVERALL)
|
||||
{
|
||||
infoBoxManager.addInfoBox(new BoostIndicator(skill, skillIconManager.getSkillImage(skill), this, client, config));
|
||||
infoBoxManager.addInfoBox(new BoostIndicator(skill, skillIconManager.getSkillImage(skill), this, client));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -169,14 +187,15 @@ public class BoostsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
updateShownSkills();
|
||||
|
||||
if (config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.NEVER)
|
||||
if (this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.NEVER)
|
||||
{
|
||||
lastChangeDown = -1;
|
||||
}
|
||||
|
||||
if (config.displayNextDebuffChange() == BoostsConfig.DisplayChangeMode.NEVER)
|
||||
if (this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.NEVER)
|
||||
{
|
||||
lastChangeUp = -1;
|
||||
}
|
||||
@@ -211,7 +230,7 @@ public class BoostsPlugin extends Plugin
|
||||
lastSkillLevels[skillIdx] = cur;
|
||||
updateBoostedStats();
|
||||
|
||||
int boostThreshold = config.boostThreshold();
|
||||
int boostThreshold = this.boostThreshold;
|
||||
|
||||
if (boostThreshold != 0)
|
||||
{
|
||||
@@ -220,7 +239,7 @@ public class BoostsPlugin extends Plugin
|
||||
int boost = cur - real;
|
||||
if (boost <= boostThreshold && boostThreshold < lastBoost)
|
||||
{
|
||||
if (config.groupNotifications())
|
||||
if (this.groupNotifications)
|
||||
{
|
||||
boostedSkillsChanged.add(skill.getName());
|
||||
}
|
||||
@@ -237,7 +256,7 @@ public class BoostsPlugin extends Plugin
|
||||
{
|
||||
lastTickMillis = System.currentTimeMillis();
|
||||
|
||||
if (config.groupNotifications() && !boostedSkillsChanged.isEmpty())
|
||||
if (this.groupNotifications && !boostedSkillsChanged.isEmpty())
|
||||
{
|
||||
if (boostedSkillsChanged.size() == 1)
|
||||
{
|
||||
@@ -268,7 +287,7 @@ public class BoostsPlugin extends Plugin
|
||||
|
||||
if (getChangeUpTicks() <= 0)
|
||||
{
|
||||
switch (config.displayNextDebuffChange())
|
||||
switch (this.displayNextDebuffChange)
|
||||
{
|
||||
case ALWAYS:
|
||||
if (lastChangeUp != -1)
|
||||
@@ -286,7 +305,7 @@ public class BoostsPlugin extends Plugin
|
||||
|
||||
if (getChangeDownTicks() <= 0)
|
||||
{
|
||||
switch (config.displayNextBuffChange())
|
||||
switch (this.displayNextBuffChange)
|
||||
{
|
||||
case ALWAYS:
|
||||
if (lastChangeDown != -1)
|
||||
@@ -305,7 +324,7 @@ public class BoostsPlugin extends Plugin
|
||||
|
||||
private void updateShownSkills()
|
||||
{
|
||||
if (config.enableSkill())
|
||||
if (this.enableSkill)
|
||||
{
|
||||
shownSkills.addAll(BOOSTABLE_NON_COMBAT_SKILLS);
|
||||
}
|
||||
@@ -368,8 +387,8 @@ public class BoostsPlugin extends Plugin
|
||||
int getChangeDownTicks()
|
||||
{
|
||||
if (lastChangeDown == -1 ||
|
||||
config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.NEVER ||
|
||||
(config.displayNextBuffChange() == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedUp))
|
||||
this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.NEVER ||
|
||||
(this.displayNextBuffChange == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedUp))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -396,8 +415,8 @@ public class BoostsPlugin extends Plugin
|
||||
int getChangeUpTicks()
|
||||
{
|
||||
if (lastChangeUp == -1 ||
|
||||
config.displayNextDebuffChange() == BoostsConfig.DisplayChangeMode.NEVER ||
|
||||
(config.displayNextDebuffChange() == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedDown))
|
||||
this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.NEVER ||
|
||||
(this.displayNextDebuffChange == BoostsConfig.DisplayChangeMode.BOOSTED && !isChangedDown))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
@@ -418,4 +437,17 @@ public class BoostsPlugin extends Plugin
|
||||
final long diff = System.currentTimeMillis() - lastTickMillis;
|
||||
return time != -1 ? (int) ((time * Constants.GAME_TICK_LENGTH - diff) / 1000d) : time;
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.enableSkill = config.enableSkill();
|
||||
this.useRelativeBoost = config.useRelativeBoost();
|
||||
this.displayInfoboxes = config.displayInfoboxes();
|
||||
this.displayIcons = config.displayIcons();
|
||||
this.boldIconFont = config.boldIconFont();
|
||||
this.displayNextBuffChange = config.displayNextDebuffChange();
|
||||
this.displayNextDebuffChange = config.displayNextDebuffChange();
|
||||
this.boostThreshold = config.boostThreshold();
|
||||
this.groupNotifications = config.groupNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -23,21 +24,20 @@ import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@Singleton
|
||||
class CombatIconsOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final BoostsConfig config;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final SkillIconManager iconManager;
|
||||
private final BoostsPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private CombatIconsOverlay(Client client, BoostsConfig config, BoostsPlugin plugin, SkillIconManager iconManager)
|
||||
private CombatIconsOverlay(final Client client, final BoostsPlugin plugin, final SkillIconManager iconManager)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.iconManager = iconManager;
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.MED);
|
||||
@@ -47,12 +47,12 @@ class CombatIconsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.displayInfoboxes() || !config.displayIcons())
|
||||
if (plugin.isDisplayInfoboxes() || !plugin.isDisplayIcons())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (config.boldIconFont())
|
||||
if (plugin.isBoldIconFont())
|
||||
{
|
||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class CombatIconsOverlay extends Overlay
|
||||
final Color strColor = getTextColor(boost);
|
||||
String str;
|
||||
|
||||
if (config.useRelativeBoost())
|
||||
if (plugin.isUseRelativeBoost())
|
||||
{
|
||||
str = String.valueOf(boost);
|
||||
if (boost > 0)
|
||||
@@ -137,7 +137,7 @@ class CombatIconsOverlay extends Overlay
|
||||
return new Color(238, 51, 51);
|
||||
}
|
||||
|
||||
return boost <= config.boostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
return boost <= plugin.getBoostThreshold() ? Color.YELLOW : Color.GREEN;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.bosstimer;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
@@ -40,6 +41,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
description = "Show boss spawn timer overlays",
|
||||
tags = {"combat", "pve", "overlay", "spawn"}
|
||||
)
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class BossTimersPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -33,7 +33,7 @@ class RespawnTimer extends Timer
|
||||
{
|
||||
private final Boss boss;
|
||||
|
||||
public RespawnTimer(Boss boss, BufferedImage bossImage, Plugin plugin)
|
||||
RespawnTimer(Boss boss, BufferedImage bossImage, Plugin plugin)
|
||||
{
|
||||
super(boss.getSpawnTime().toMillis(), ChronoUnit.MILLIS, bossImage, plugin);
|
||||
this.boss = boss;
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import static net.runelite.api.Perspective.LOCAL_TILE_SIZE;
|
||||
@@ -40,22 +41,21 @@ import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||
|
||||
@Singleton
|
||||
class CannonOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_DISTANCE = 2500;
|
||||
|
||||
private final Client client;
|
||||
private final CannonConfig config;
|
||||
private final CannonPlugin plugin;
|
||||
private final TextComponent textComponent = new TextComponent();
|
||||
|
||||
@Inject
|
||||
CannonOverlay(Client client, CannonConfig config, CannonPlugin plugin)
|
||||
CannonOverlay(final Client client, final CannonPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ class CannonOverlay extends Overlay
|
||||
textComponent.render(graphics);
|
||||
}
|
||||
|
||||
if (config.showDoubleHitSpot())
|
||||
if (plugin.isShowDoubleHitSpot())
|
||||
{
|
||||
Color color = config.highlightDoubleHitColor();
|
||||
Color color = plugin.getHighlightDoubleHitColor();
|
||||
drawDoubleHitSpots(graphics, cannonPoint, color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -80,19 +81,19 @@ public class CannonPlugin extends Plugin
|
||||
private CannonCounter counter;
|
||||
private boolean skipProjectileCheckThisTick;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int cballsLeft;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean cannonPlaced;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private WorldPoint cannonPosition;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private GameObject cannon;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> spotPoints = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
@@ -124,6 +125,17 @@ public class CannonPlugin extends Plugin
|
||||
|
||||
private boolean lock;
|
||||
|
||||
private boolean showEmptyCannonNotification;
|
||||
private boolean showInfobox;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showDoubleHitSpot;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color highlightDoubleHitColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showCannonSpots;
|
||||
private int ammoAmount;
|
||||
private boolean notifyAmmoLeft;
|
||||
|
||||
@Provides
|
||||
CannonConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -133,6 +145,8 @@ public class CannonPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(cannonOverlay);
|
||||
overlayManager.add(cannonSpotOverlay);
|
||||
lock = false;
|
||||
@@ -169,7 +183,9 @@ public class CannonPlugin extends Plugin
|
||||
{
|
||||
if (event.getGroup().equals("cannon"))
|
||||
{
|
||||
if (!config.showInfobox())
|
||||
updateConfig();
|
||||
|
||||
if (!this.showInfobox)
|
||||
{
|
||||
removeCounter();
|
||||
}
|
||||
@@ -190,7 +206,7 @@ public class CannonPlugin extends Plugin
|
||||
)
|
||||
public void checkSpots()
|
||||
{
|
||||
if (!config.showCannonSpots())
|
||||
if (!this.showCannonSpots)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -318,7 +334,7 @@ public class CannonPlugin extends Plugin
|
||||
// extra check is a good idea.
|
||||
cballsLeft = 0;
|
||||
|
||||
if (config.showEmptyCannonNotification())
|
||||
if (this.showEmptyCannonNotification)
|
||||
{
|
||||
notifier.notify("Your cannon is out of ammo!");
|
||||
}
|
||||
@@ -350,11 +366,11 @@ public class CannonPlugin extends Plugin
|
||||
{
|
||||
return Color.orange;
|
||||
}
|
||||
else if (cballsLeft <= config.ammoAmount())
|
||||
else if (cballsLeft <= this.ammoAmount)
|
||||
{
|
||||
if (config.notifyAmmoLeft() && !lock)
|
||||
if (this.notifyAmmoLeft && !lock)
|
||||
{
|
||||
notifier.notify("Your cannon has " + config.ammoAmount() + " balls left!");
|
||||
notifier.notify("Your cannon has " + this.ammoAmount + " balls left!");
|
||||
lock = true;
|
||||
}
|
||||
}
|
||||
@@ -364,7 +380,7 @@ public class CannonPlugin extends Plugin
|
||||
|
||||
private void addCounter()
|
||||
{
|
||||
if (!config.showInfobox() || counter != null)
|
||||
if (!this.showInfobox || counter != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -385,4 +401,15 @@ public class CannonPlugin extends Plugin
|
||||
infoBoxManager.removeInfoBox(counter);
|
||||
counter = null;
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.showEmptyCannonNotification = config.showEmptyCannonNotification();
|
||||
this.showInfobox = config.showInfobox();
|
||||
this.showDoubleHitSpot = config.showDoubleHitSpot();
|
||||
this.highlightDoubleHitColor = config.highlightDoubleHitColor();
|
||||
this.showCannonSpots = config.showCannonSpots();
|
||||
this.ammoAmount = config.ammoAmount();
|
||||
this.notifyAmmoLeft = config.notifyAmmoLeft();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
@@ -43,13 +44,13 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
@Singleton
|
||||
public class CannonSpotOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_DISTANCE = 2350;
|
||||
|
||||
private final Client client;
|
||||
private final CannonPlugin plugin;
|
||||
private final CannonConfig config;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
@@ -58,18 +59,17 @@ public class CannonSpotOverlay extends Overlay
|
||||
private boolean hidden;
|
||||
|
||||
@Inject
|
||||
CannonSpotOverlay(Client client, CannonPlugin plugin, CannonConfig config)
|
||||
CannonSpotOverlay(final Client client, final CannonPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (hidden || !config.showCannonSpots() || plugin.isCannonPlaced())
|
||||
if (hidden || !plugin.isShowCannonSpots() || plugin.isCannonPlaced())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -27,13 +27,14 @@ package net.runelite.client.plugins.cerberus;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@RequiredArgsConstructor
|
||||
public enum CerberusGhost
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.chatboxperformance;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.WidgetPositioned;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -40,6 +41,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
name = "Chatbox performance",
|
||||
hidden = true
|
||||
)
|
||||
@Singleton
|
||||
public class ChatboxPerformancePlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.chatcommands;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.vars.AccountType;
|
||||
import com.google.inject.Provides;
|
||||
import java.io.IOException;
|
||||
@@ -81,6 +82,7 @@ import org.apache.commons.text.WordUtils;
|
||||
description = "Enable chat commands",
|
||||
tags = {"grand", "exchange", "level", "prices"}
|
||||
)
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class ChatCommandsPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -34,6 +34,9 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
@@ -53,6 +56,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||
description = "Censor user configurable words or patterns from chat",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Singleton
|
||||
public class ChatFilterPlugin extends Plugin
|
||||
{
|
||||
private static final Splitter NEWLINE_SPLITTER = Splitter
|
||||
@@ -71,6 +75,17 @@ public class ChatFilterPlugin extends Plugin
|
||||
@Inject
|
||||
private ChatFilterConfig config;
|
||||
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private ChatFilterType filterType;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private String filteredWords;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private String filteredRegex;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean filterFriends;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean filterClan;
|
||||
|
||||
@Provides
|
||||
ChatFilterConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -80,6 +95,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
updateFilteredPatterns();
|
||||
}
|
||||
|
||||
@@ -122,8 +138,8 @@ public class ChatFilterPlugin extends Plugin
|
||||
MessageNode messageNode = (MessageNode) client.getMessages().get(messageId);
|
||||
|
||||
if (client.getLocalPlayer().getName().equals(messageNode.getName()) ||
|
||||
!config.filterFriends() && messageNode.isFromFriend() ||
|
||||
!config.filterClan() && messageNode.isFromClanMate())
|
||||
!this.filterFriends && messageNode.isFromFriend() ||
|
||||
!this.filterClan && messageNode.isFromClanMate())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -168,8 +184,8 @@ public class ChatFilterPlugin extends Plugin
|
||||
{
|
||||
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
|
||||
return !isMessageFromSelf &&
|
||||
(config.filterFriends() || !client.isFriended(playerName, false)) &&
|
||||
(config.filterClan() || !client.isClanMember(playerName));
|
||||
(this.filterFriends || !client.isFriended(playerName, false)) &&
|
||||
(this.filterClan || !client.isClanMember(playerName));
|
||||
}
|
||||
|
||||
String censorMessage(final String message)
|
||||
@@ -185,7 +201,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
|
||||
while (m.find())
|
||||
{
|
||||
switch (config.filterType())
|
||||
switch (this.filterType)
|
||||
{
|
||||
case CENSOR_WORDS:
|
||||
m.appendReplacement(sb, StringUtils.repeat("*", m.group(0).length()));
|
||||
@@ -209,11 +225,11 @@ public class ChatFilterPlugin extends Plugin
|
||||
{
|
||||
filteredPatterns.clear();
|
||||
|
||||
Text.fromCSV(config.filteredWords()).stream()
|
||||
Text.fromCSV(this.filteredWords).stream()
|
||||
.map(s -> Pattern.compile(Pattern.quote(s), Pattern.CASE_INSENSITIVE))
|
||||
.forEach(filteredPatterns::add);
|
||||
|
||||
NEWLINE_SPLITTER.splitToList(config.filteredRegex()).stream()
|
||||
NEWLINE_SPLITTER.splitToList(this.filteredRegex).stream()
|
||||
.map(s ->
|
||||
{
|
||||
try
|
||||
@@ -237,6 +253,16 @@ public class ChatFilterPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
updateFilteredPatterns();
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.filterType = config.filterType();
|
||||
this.filteredWords = config.filteredWords();
|
||||
this.filteredRegex = config.filteredRegex();
|
||||
this.filterFriends = config.filterFriends();
|
||||
this.filterClan = config.filterClan();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,14 @@ import java.util.Deque;
|
||||
import java.util.Iterator;
|
||||
import java.util.Queue;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.vars.InputType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
@@ -56,6 +58,7 @@ import net.runelite.client.util.Text;
|
||||
description = "Retain your chat history when logging in/out or world hopping",
|
||||
tags = {"chat", "history", "retain", "cycle", "pm"}
|
||||
)
|
||||
@Singleton
|
||||
public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
private static final String WELCOME_MESSAGE = "Welcome to Old School RuneScape.";
|
||||
@@ -82,6 +85,9 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
private boolean retainChatHistory;
|
||||
private boolean pmTargetCycling;
|
||||
|
||||
@Provides
|
||||
ChatHistoryConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -91,6 +97,8 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
messageQueue = EvictingQueue.create(100);
|
||||
friends = new ArrayDeque<>(FRIENDS_MAX_SIZE + 1);
|
||||
keyManager.registerKeyListener(this);
|
||||
@@ -113,7 +121,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
// of information that chat history was reset
|
||||
if (chatMessage.getMessage().equals(WELCOME_MESSAGE))
|
||||
{
|
||||
if (!config.retainChatHistory())
|
||||
if (!this.retainChatHistory)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -204,7 +212,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() != CYCLE_HOTKEY || !config.pmTargetCycling())
|
||||
if (e.getKeyCode() != CYCLE_HOTKEY || !this.pmTargetCycling)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -260,4 +268,21 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
|
||||
|
||||
return friends.getLast();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!"chathistory".equals(event.getGroup()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.retainChatHistory = config.retainChatHistory();
|
||||
this.pmTargetCycling = config.pmTargetCycling();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ import java.util.regex.Pattern;
|
||||
import static java.util.regex.Pattern.quote;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
@@ -57,6 +58,7 @@ import net.runelite.client.util.Text;
|
||||
tags = {"duel", "messages", "notifications", "trade", "username"},
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Singleton
|
||||
public class ChatNotificationsPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
@@ -82,6 +84,14 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
// Private message cache used to avoid duplicate notifications from ChatHistory.
|
||||
private Set<Integer> privateMessageHashes = new HashSet<>();
|
||||
|
||||
private boolean highlightOwnName;
|
||||
private String highlightWordsString;
|
||||
private boolean notifyOnOwnName;
|
||||
private boolean notifyOnHighlight;
|
||||
private boolean notifyOnTrade;
|
||||
private boolean notifyOnDuel;
|
||||
private boolean notifyOnPm;
|
||||
|
||||
@Provides
|
||||
ChatNotificationsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -91,6 +101,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
updateHighlights();
|
||||
}
|
||||
|
||||
@@ -117,6 +128,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
{
|
||||
if (event.getGroup().equals("chatnotification"))
|
||||
{
|
||||
updateConfig();
|
||||
updateHighlights();
|
||||
}
|
||||
}
|
||||
@@ -125,9 +137,9 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
{
|
||||
highlightMatcher = null;
|
||||
|
||||
if (!config.highlightWordsString().trim().equals(""))
|
||||
if (!this.highlightWordsString.trim().equals(""))
|
||||
{
|
||||
List<String> items = Text.fromCSV(config.highlightWordsString());
|
||||
List<String> items = Text.fromCSV(this.highlightWordsString);
|
||||
String joined = items.stream()
|
||||
.map(Text::escapeJagex) // we compare these strings to the raw Jagex ones
|
||||
.map(Pattern::quote)
|
||||
@@ -147,13 +159,13 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
switch (chatMessage.getType())
|
||||
{
|
||||
case TRADEREQ:
|
||||
if (chatMessage.getMessage().contains("wishes to trade with you.") && config.notifyOnTrade())
|
||||
if (chatMessage.getMessage().contains("wishes to trade with you.") && this.notifyOnTrade)
|
||||
{
|
||||
notifier.notify(chatMessage.getMessage());
|
||||
}
|
||||
break;
|
||||
case CHALREQ_TRADE:
|
||||
if (chatMessage.getMessage().contains("wishes to duel with you.") && config.notifyOnDuel())
|
||||
if (chatMessage.getMessage().contains("wishes to duel with you.") && this.notifyOnDuel)
|
||||
{
|
||||
notifier.notify(chatMessage.getMessage());
|
||||
}
|
||||
@@ -167,7 +179,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
break;
|
||||
case PRIVATECHAT:
|
||||
case MODPRIVATECHAT:
|
||||
if (config.notifyOnPm())
|
||||
if (this.notifyOnPm)
|
||||
{
|
||||
int messageHash = this.buildMessageHash(chatMessage);
|
||||
if (this.privateMessageHashes.contains(messageHash))
|
||||
@@ -187,7 +199,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
usernameReplacer = "<col" + ChatColorType.HIGHLIGHT.name() + "><u>" + username + "</u><col" + ChatColorType.NORMAL.name() + ">";
|
||||
}
|
||||
|
||||
if (config.highlightOwnName() && usernameMatcher != null)
|
||||
if (this.highlightOwnName && usernameMatcher != null)
|
||||
{
|
||||
Matcher matcher = usernameMatcher.matcher(messageNode.getValue());
|
||||
if (matcher.find())
|
||||
@@ -195,7 +207,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
messageNode.setValue(matcher.replaceAll(usernameReplacer));
|
||||
update = true;
|
||||
|
||||
if (config.notifyOnOwnName())
|
||||
if (this.notifyOnOwnName)
|
||||
{
|
||||
sendNotification(chatMessage);
|
||||
}
|
||||
@@ -222,7 +234,7 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
matcher.appendTail(stringBuffer);
|
||||
messageNode.setValue(stringBuffer.toString());
|
||||
|
||||
if (config.notifyOnHighlight())
|
||||
if (this.notifyOnHighlight)
|
||||
{
|
||||
sendNotification(chatMessage);
|
||||
}
|
||||
@@ -261,4 +273,15 @@ public class ChatNotificationsPlugin extends Plugin
|
||||
String notification = stringBuilder.toString();
|
||||
notifier.notify(notification);
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.highlightOwnName = config.highlightOwnName();
|
||||
this.highlightWordsString = config.highlightWordsString();
|
||||
this.notifyOnOwnName = config.notifyOnOwnName();
|
||||
this.notifyOnHighlight = config.notifyOnHighlight();
|
||||
this.notifyOnTrade = config.notifyOnTrade();
|
||||
this.notifyOnDuel = config.notifyOnDuel();
|
||||
this.notifyOnPm = config.notifyOnPm();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package net.runelite.client.plugins.chattranslation;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
@@ -34,6 +35,7 @@ import java.util.ArrayList;
|
||||
tags = {"translate", "language", "english", "spanish", "dutch", "french"},
|
||||
type = PluginType.UTILITY
|
||||
)
|
||||
@Singleton
|
||||
public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
|
||||
@@ -64,6 +66,13 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
@Inject
|
||||
private ChatTranslationConfig config;
|
||||
|
||||
private boolean translateOptionVisable;
|
||||
private boolean publicChat;
|
||||
private String getPlayerNames;
|
||||
private Languages publicTargetLanguage;
|
||||
private boolean playerChat;
|
||||
private Languages playerTargetLanguage;
|
||||
|
||||
@Provides
|
||||
ChatTranslationConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -73,9 +82,11 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
if (client != null)
|
||||
{
|
||||
if (config.translateOptionVisable())
|
||||
if (this.translateOptionVisable)
|
||||
{
|
||||
menuManager.get().addPlayerMenuItem(TRANSLATE);
|
||||
}
|
||||
@@ -90,7 +101,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
if (client != null)
|
||||
{
|
||||
if (config.translateOptionVisable())
|
||||
if (this.translateOptionVisable)
|
||||
{
|
||||
menuManager.get().removePlayerMenuItem(TRANSLATE);
|
||||
}
|
||||
@@ -105,9 +116,10 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
if (event.getGroup().equals("chattranslation"))
|
||||
{
|
||||
updateConfig();
|
||||
if (event.getKey().equals("playerNames"))
|
||||
{
|
||||
for (String names : Text.fromCSV(config.getPlayerNames()))
|
||||
for (String names : Text.fromCSV(this.getPlayerNames))
|
||||
{
|
||||
if (!playerNames.contains(Text.toJagexName(names)))
|
||||
{
|
||||
@@ -121,7 +133,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!config.translateOptionVisable())
|
||||
if (!this.translateOptionVisable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -181,7 +193,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
case PUBLICCHAT:
|
||||
case MODCHAT:
|
||||
case FRIENDSCHAT:
|
||||
if (!config.publicChat())
|
||||
if (!this.publicChat)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -201,7 +213,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
try
|
||||
{
|
||||
//Automatically check language of message and translate to selected language.
|
||||
String translation = translator.translate("auto", config.publicTargetLanguage().toString(), message);
|
||||
String translation = translator.translate("auto", this.publicTargetLanguage.toString(), message);
|
||||
if (translation != null)
|
||||
{
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
@@ -227,7 +239,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.playerChat())
|
||||
if (!this.playerChat)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -259,7 +271,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
try
|
||||
{
|
||||
//Automatically check language of message and translate to selected language.
|
||||
String translation = translator.translate("auto", config.playerTargetLanguage().toString(), message);
|
||||
String translation = translator.translate("auto", this.playerTargetLanguage.toString(), message);
|
||||
if (translation != null)
|
||||
{
|
||||
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translation);
|
||||
@@ -291,4 +303,13 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
||||
// Nothing.
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.publicChat = config.publicChat();
|
||||
this.getPlayerNames = config.getPlayerNames();
|
||||
this.translateOptionVisable = config.translateOptionVisable();
|
||||
this.publicTargetLanguage = config.publicTargetLanguage();
|
||||
this.playerChat = config.playerChat();
|
||||
this.playerTargetLanguage = config.playerTargetLanguage();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,13 +26,15 @@ package net.runelite.client.plugins.clanchat;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
|
||||
@Singleton
|
||||
class ClanChatIndicator extends Counter
|
||||
{
|
||||
private final ClanChatPlugin plugin;
|
||||
|
||||
ClanChatIndicator(BufferedImage image, ClanChatPlugin plugin)
|
||||
ClanChatIndicator(final BufferedImage image, final ClanChatPlugin plugin)
|
||||
{
|
||||
super(image, plugin, plugin.getClanAmount());
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -40,6 +40,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ClanMember;
|
||||
@@ -68,7 +69,6 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
@@ -87,6 +87,7 @@ import net.runelite.client.util.Text;
|
||||
description = "Add rank icons to users talking in clan chat",
|
||||
tags = {"icons", "rank", "recent"}
|
||||
)
|
||||
@Singleton
|
||||
public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
private static final int MAX_CHATS = 20;
|
||||
@@ -112,9 +113,6 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
private List<String> chats = new ArrayList<>();
|
||||
|
||||
@@ -132,6 +130,17 @@ public class ClanChatPlugin extends Plugin
|
||||
private Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
|
||||
private int clanJoinedTick;
|
||||
|
||||
private boolean clanChatIcons;
|
||||
private boolean recentChats;
|
||||
private boolean showClanCounter;
|
||||
private String chatsData;
|
||||
private boolean showJoinLeave;
|
||||
private ClanMemberRank joinLeaveRank;
|
||||
private boolean privateMessageIcons;
|
||||
private boolean publicChatIcons;
|
||||
private boolean clanTabChat;
|
||||
private String clanname;
|
||||
|
||||
@Provides
|
||||
ClanChatConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -141,6 +150,7 @@ public class ClanChatPlugin extends Plugin
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
chats = new ArrayList<>(Text.fromCSV(config.chatsData()));
|
||||
}
|
||||
|
||||
@@ -157,12 +167,14 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
if (configChanged.getGroup().equals("clanchat"))
|
||||
{
|
||||
if (!config.recentChats())
|
||||
updateConfig();
|
||||
|
||||
if (!this.recentChats)
|
||||
{
|
||||
resetClanChats();
|
||||
}
|
||||
|
||||
if (config.showClanCounter())
|
||||
if (this.showClanCounter)
|
||||
{
|
||||
clientThread.invoke(this::addClanCounter);
|
||||
}
|
||||
@@ -200,8 +212,8 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave() ||
|
||||
member.getRank().getValue() < config.joinLeaveRank().getValue())
|
||||
if (!this.showJoinLeave ||
|
||||
member.getRank().getValue() < this.joinLeaveRank.getValue())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -245,8 +257,8 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave() ||
|
||||
member.getRank().getValue() < config.joinLeaveRank().getValue())
|
||||
if (!this.showJoinLeave ||
|
||||
member.getRank().getValue() < this.joinLeaveRank.getValue())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -271,7 +283,7 @@ public class ClanChatPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
client.setVar(VarClientStr.RECENT_CLAN_CHAT, config.clanname());
|
||||
client.setVar(VarClientStr.RECENT_CLAN_CHAT, this.clanname);
|
||||
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatTitleWidget != null)
|
||||
@@ -282,7 +294,7 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
clanChatTitleWidget.setText(CLAN_CHAT_TITLE + " (" + client.getClanChatCount() + "/100)");
|
||||
}
|
||||
else if (config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
|
||||
else if (this.recentChats && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
|
||||
{
|
||||
clanChatTitleWidget.setText(RECENT_TITLE);
|
||||
|
||||
@@ -290,7 +302,7 @@ public class ClanChatPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave())
|
||||
if (!this.showJoinLeave)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +385,7 @@ public class ClanChatPlugin extends Plugin
|
||||
channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
|
||||
}
|
||||
|
||||
if (config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
if (this.clanChatIcons && rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
{
|
||||
rankIcon = clanManager.getIconNumber(rank);
|
||||
}
|
||||
@@ -405,7 +417,7 @@ public class ClanChatPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onVarClientStrChanged(VarClientStrChanged strChanged)
|
||||
{
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && config.recentChats())
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.recentChats)
|
||||
{
|
||||
updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT));
|
||||
}
|
||||
@@ -428,20 +440,20 @@ public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
case PRIVATECHAT:
|
||||
case MODPRIVATECHAT:
|
||||
if (!config.privateMessageIcons())
|
||||
if (!this.privateMessageIcons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case PUBLICCHAT:
|
||||
case MODCHAT:
|
||||
if (!config.publicChatIcons())
|
||||
if (!this.publicChatIcons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case FRIENDSCHAT:
|
||||
if (!config.clanChatIcons())
|
||||
if (!this.clanChatIcons)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -515,7 +527,7 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
final int[] intStack = client.getIntStack();
|
||||
final int size = client.getIntStackSize();
|
||||
intStack[size - 1] = config.clanTabChat() ? 1 : 0;
|
||||
intStack[size - 1] = this.clanTabChat ? 1 : 0;
|
||||
}
|
||||
|
||||
int getClanAmount()
|
||||
@@ -617,7 +629,10 @@ public class ClanChatPlugin extends Plugin
|
||||
chats.remove(0);
|
||||
}
|
||||
|
||||
config.chatsData(Text.toCSV(chats));
|
||||
String csvText = Text.toCSV(chats);
|
||||
|
||||
config.chatsData(csvText);
|
||||
this.chatsData = csvText;
|
||||
}
|
||||
|
||||
private void removeClanCounter()
|
||||
@@ -628,7 +643,7 @@ public class ClanChatPlugin extends Plugin
|
||||
|
||||
private void addClanCounter()
|
||||
{
|
||||
if (!config.showClanCounter() || clanMemberCounter != null || clanMembers.isEmpty())
|
||||
if (!this.showClanCounter || clanMemberCounter != null || clanMembers.isEmpty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -637,4 +652,18 @@ public class ClanChatPlugin extends Plugin
|
||||
clanMemberCounter = new ClanChatIndicator(image, this);
|
||||
infoBoxManager.addInfoBox(clanMemberCounter);
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.clanChatIcons = config.clanChatIcons();
|
||||
this.recentChats = config.recentChats();
|
||||
this.showClanCounter = config.showClanCounter();
|
||||
this.chatsData = config.chatsData();
|
||||
this.showJoinLeave = config.showJoinLeave();
|
||||
this.joinLeaveRank = config.joinLeaveRank();
|
||||
this.privateMessageIcons = config.privateMessageIcons();
|
||||
this.publicChatIcons = config.publicChatIcons();
|
||||
this.clanTabChat = config.clanTabChat();
|
||||
this.clanname = config.clanname();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ClanManModeMinimapOverlay extends Overlay
|
||||
private final ClanManModeConfig config;
|
||||
|
||||
@Inject
|
||||
private ClanManModeMinimapOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService)
|
||||
private ClanManModeMinimapOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService)
|
||||
{
|
||||
this.config = config;
|
||||
this.ClanManModeService = ClanManModeService;
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ClanManModeOverlay extends Overlay
|
||||
private final ClanManModeConfig config;
|
||||
|
||||
@Inject
|
||||
private ClanManModeOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService)
|
||||
private ClanManModeOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService)
|
||||
{
|
||||
this.config = config;
|
||||
this.ClanManModeService = ClanManModeService;
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Player;
|
||||
@@ -27,7 +28,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
type = PluginType.PVP,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
public class ClanManModePlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
|
||||
@@ -20,7 +20,7 @@ public class ClanManModeService
|
||||
private final ClanManModePlugin plugin;
|
||||
|
||||
@Inject
|
||||
private ClanManModeService(Client client, ClanManModeConfig config, ClanManModePlugin plugin)
|
||||
private ClanManModeService(final Client client, final ClanManModeConfig config, final ClanManModePlugin plugin)
|
||||
{
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
|
||||
@@ -4,19 +4,21 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
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;
|
||||
|
||||
@Singleton
|
||||
public class ClanManModeTileOverlay extends Overlay
|
||||
{
|
||||
private final ClanManModeService ClanManModeService;
|
||||
private final ClanManModeConfig config;
|
||||
|
||||
@Inject
|
||||
private ClanManModeTileOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService)
|
||||
private ClanManModeTileOverlay(final ClanManModeConfig config, final ClanManModeService ClanManModeService)
|
||||
{
|
||||
this.config = config;
|
||||
this.ClanManModeService = ClanManModeService;
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.cluescrolls;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -36,6 +37,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
@Singleton
|
||||
class ClueScrollEmoteOverlay extends Overlay
|
||||
{
|
||||
private final ClueScrollPlugin plugin;
|
||||
@@ -44,7 +46,7 @@ class ClueScrollEmoteOverlay extends Overlay
|
||||
private boolean hasScrolled;
|
||||
|
||||
@Inject
|
||||
private ClueScrollEmoteOverlay(ClueScrollPlugin plugin, Client client)
|
||||
private ClueScrollEmoteOverlay(final ClueScrollPlugin plugin, final Client client)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -37,6 +38,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
@Singleton
|
||||
class ClueScrollMusicOverlay extends Overlay
|
||||
{
|
||||
private static final Rectangle PADDING = new Rectangle(2, 1, 0, 1);
|
||||
@@ -47,7 +49,7 @@ class ClueScrollMusicOverlay extends Overlay
|
||||
private boolean hasScrolled;
|
||||
|
||||
@Inject
|
||||
private ClueScrollMusicOverlay(ClueScrollPlugin plugin, Client client)
|
||||
private ClueScrollMusicOverlay(final ClueScrollPlugin plugin, final Client client)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import static net.runelite.api.ItemID.SPADE;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
||||
@@ -43,6 +44,7 @@ import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
@Singleton
|
||||
public class ClueScrollOverlay extends Overlay
|
||||
{
|
||||
private static final ItemRequirement HAS_SPADE = new SingleItemRequirement(SPADE);
|
||||
@@ -53,7 +55,7 @@ public class ClueScrollOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private ClueScrollOverlay(ClueScrollPlugin plugin)
|
||||
private ClueScrollOverlay(final ClueScrollPlugin plugin)
|
||||
{
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -41,6 +41,7 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
@@ -108,6 +109,7 @@ import net.runelite.client.util.Text;
|
||||
tags = {"arrow", "hints", "world", "map", "coordinates", "emotes"}
|
||||
)
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class ClueScrollPlugin extends Plugin
|
||||
{
|
||||
private static final Color HIGHLIGHT_BORDER_COLOR = Color.ORANGE;
|
||||
@@ -164,6 +166,8 @@ public class ClueScrollPlugin extends Plugin
|
||||
|
||||
private final TextComponent textComponent = new TextComponent();
|
||||
|
||||
private boolean displayHintArrows;
|
||||
|
||||
@Provides
|
||||
ClueScrollConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -179,6 +183,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
this.displayHintArrows = config.displayHintArrows();
|
||||
overlayManager.add(clueScrollOverlay);
|
||||
overlayManager.add(clueScrollEmoteOverlay);
|
||||
overlayManager.add(clueScrollWorldOverlay);
|
||||
@@ -274,7 +279,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
worldMapPointsSet = false;
|
||||
npcsToMark.clear();
|
||||
|
||||
if (config.displayHintArrows())
|
||||
if (this.displayHintArrows)
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
@@ -313,9 +318,13 @@ public class ClueScrollPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("cluescroll") && !config.displayHintArrows())
|
||||
if (event.getGroup().equals("cluescroll"))
|
||||
{
|
||||
client.clearHintArrow();
|
||||
this.displayHintArrows = config.displayHintArrows();
|
||||
if (!this.displayHintArrows)
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -366,7 +375,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
if (location != null)
|
||||
{
|
||||
// Only set the location hint arrow if we do not already have more accurate location
|
||||
if (config.displayHintArrows()
|
||||
if (this.displayHintArrows
|
||||
&& (client.getHintArrowNpc() == null
|
||||
|| !npcsToMark.contains(client.getHintArrowNpc())))
|
||||
{
|
||||
@@ -455,7 +464,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
worldMapPointsSet = false;
|
||||
npcsToMark.clear();
|
||||
|
||||
if (config.displayHintArrows())
|
||||
if (this.displayHintArrows)
|
||||
{
|
||||
client.clearHintArrow();
|
||||
}
|
||||
@@ -698,7 +707,7 @@ public class ClueScrollPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
if (!npcsToMark.isEmpty() && config.displayHintArrows())
|
||||
if (!npcsToMark.isEmpty() && this.displayHintArrows)
|
||||
{
|
||||
// Always set hint arrow to first seen NPC
|
||||
client.setHintArrow(npcsToMark.get(0));
|
||||
|
||||
@@ -35,7 +35,7 @@ class ClueScrollServiceImpl implements ClueScrollService
|
||||
private final ClueScrollPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private ClueScrollServiceImpl(ClueScrollPlugin plugin)
|
||||
private ClueScrollServiceImpl(final ClueScrollPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class ClueScrollWorldMapPoint extends WorldMapPoint
|
||||
private final BufferedImage clueScrollWorldImage;
|
||||
private final Point clueScrollWorldImagePoint;
|
||||
|
||||
ClueScrollWorldMapPoint(final WorldPoint worldPoint, ClueScrollPlugin plugin)
|
||||
ClueScrollWorldMapPoint(final WorldPoint worldPoint, final ClueScrollPlugin plugin)
|
||||
{
|
||||
super(worldPoint, null);
|
||||
|
||||
|
||||
@@ -28,11 +28,13 @@ import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
@Singleton
|
||||
public class ClueScrollWorldOverlay extends Overlay
|
||||
{
|
||||
public static final int IMAGE_Z_OFFSET = 30;
|
||||
@@ -44,7 +46,7 @@ public class ClueScrollWorldOverlay extends Overlay
|
||||
private final ClueScrollPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private ClueScrollWorldOverlay(ClueScrollPlugin plugin)
|
||||
private ClueScrollWorldOverlay(final ClueScrollPlugin plugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
|
||||
@@ -25,6 +25,9 @@
|
||||
package net.runelite.client.plugins.combatcounter;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Actor;
|
||||
@@ -35,6 +38,7 @@ import net.runelite.api.NPCDefinition;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.kit.KitType;
|
||||
@@ -59,7 +63,7 @@ import java.util.Map;
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
@Singleton
|
||||
public class CombatCounter extends Plugin
|
||||
{
|
||||
|
||||
@@ -79,16 +83,30 @@ public class CombatCounter extends Plugin
|
||||
private CombatCounterConfig config;
|
||||
|
||||
private boolean instanced = false;
|
||||
private boolean prevInstance = false;
|
||||
@Setter
|
||||
@Getter
|
||||
private Map<String, Long> counter = new HashMap<String, Long>();
|
||||
private long BLOWPIPE_ID = 5061;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Map<String, Long> counter = new HashMap<>();
|
||||
|
||||
private Map<String, Long> blowpipe = new HashMap<>();
|
||||
|
||||
public Map<NPC, NPCDamageCounter> npcDamageMap = new HashMap<NPC, NPCDamageCounter>();
|
||||
public Map<String, Double> playerDamage = new HashMap<String, Double>();
|
||||
private Map<NPC, NPCDamageCounter> npcDamageMap = new HashMap<>();
|
||||
Map<String, Double> playerDamage = new HashMap<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showTickCounter;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showDamageCounter;
|
||||
private boolean resetOnNewInstance;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color selfColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color totalColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color otherColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color bgColor;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color titleColor;
|
||||
|
||||
@Provides
|
||||
CombatCounterConfig provideConfig(ConfigManager configManager)
|
||||
@@ -96,8 +114,6 @@ public class CombatCounter extends Plugin
|
||||
return configManager.getConfig(CombatCounterConfig.class);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private Map<Integer, Integer> variables = new HashMap<Integer, Integer>()
|
||||
{
|
||||
{
|
||||
@@ -157,7 +173,7 @@ public class CombatCounter extends Plugin
|
||||
}
|
||||
};
|
||||
|
||||
public List<Integer> MELEE_ANIMATIONS = new ArrayList<Integer>()
|
||||
private List<Integer> MELEE_ANIMATIONS = new ArrayList<Integer>()
|
||||
{
|
||||
{
|
||||
this.add(422); // Unarmed Punch, Block
|
||||
@@ -201,7 +217,7 @@ public class CombatCounter extends Plugin
|
||||
}
|
||||
};
|
||||
|
||||
public List<Integer> RANGE_ANIMATIONS = new ArrayList<Integer>()
|
||||
private List<Integer> RANGE_ANIMATIONS = new ArrayList<Integer>()
|
||||
{
|
||||
{
|
||||
this.add(7552); // Armadyl Crossbow Accurate, Rapid, Longrange, Special
|
||||
@@ -214,7 +230,7 @@ public class CombatCounter extends Plugin
|
||||
}
|
||||
};
|
||||
|
||||
public List<Integer> MAGE_ANIMATIONS = new ArrayList<Integer>()
|
||||
private List<Integer> MAGE_ANIMATIONS = new ArrayList<Integer>()
|
||||
{
|
||||
{
|
||||
this.add(1167); // Trident Accurate, Accurate, Longrange
|
||||
@@ -226,6 +242,8 @@ public class CombatCounter extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(tickOverlay);
|
||||
overlayManager.add(damageOverlay);
|
||||
|
||||
@@ -252,7 +270,7 @@ public class CombatCounter extends Plugin
|
||||
{
|
||||
Actor actor = event.getActor();
|
||||
|
||||
if (actor != null && actor instanceof Player)
|
||||
if (actor instanceof Player)
|
||||
{
|
||||
Player p = (Player) actor;
|
||||
String name = actor.getName();
|
||||
@@ -276,6 +294,7 @@ public class CombatCounter extends Plugin
|
||||
counter.put(name, ticks);
|
||||
counter = sortByValue(counter);
|
||||
|
||||
long BLOWPIPE_ID = 5061;
|
||||
if (animation == BLOWPIPE_ID)
|
||||
{
|
||||
this.blowpipe.put(name, -4L);
|
||||
@@ -285,11 +304,11 @@ public class CombatCounter extends Plugin
|
||||
* This part handles the Damage Counter.
|
||||
*/
|
||||
Actor interacting = actor.getInteracting();
|
||||
if (interacting != null && interacting instanceof NPC)
|
||||
if (interacting instanceof NPC)
|
||||
{
|
||||
NPC npc = (NPC) interacting;
|
||||
|
||||
List<NPC> actives = new ArrayList<NPC>();
|
||||
List<NPC> actives = new ArrayList<>();
|
||||
actives.add(npc);
|
||||
|
||||
if (animation == 1979 || animation == 7618)
|
||||
@@ -340,7 +359,7 @@ public class CombatCounter extends Plugin
|
||||
|
||||
if (delay != -1)
|
||||
{
|
||||
List<Integer> ticksToAdd = new ArrayList<Integer>();
|
||||
List<Integer> ticksToAdd = new ArrayList<>();
|
||||
ticksToAdd.add(delay);
|
||||
|
||||
if (canFarcast && delay > 2)
|
||||
@@ -348,7 +367,7 @@ public class CombatCounter extends Plugin
|
||||
ticksToAdd.add(delay - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* Dragon Claw Specials are 2 ticks long.
|
||||
*/
|
||||
if (animation == 7514)
|
||||
@@ -364,7 +383,7 @@ public class CombatCounter extends Plugin
|
||||
|
||||
for (Integer tick : ticksToAdd)
|
||||
{
|
||||
List<String> attackers = new ArrayList<String>();
|
||||
List<String> attackers = new ArrayList<>();
|
||||
if (dc.attackers.containsKey(tick))
|
||||
attackers = dc.attackers.get(tick);
|
||||
|
||||
@@ -389,9 +408,9 @@ public class CombatCounter extends Plugin
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (config.resetOnNewInstance())
|
||||
if (this.resetOnNewInstance)
|
||||
{
|
||||
prevInstance = instanced;
|
||||
boolean prevInstance = instanced;
|
||||
instanced = client.isInInstancedRegion();
|
||||
if (!prevInstance && instanced)
|
||||
{
|
||||
@@ -402,19 +421,19 @@ public class CombatCounter extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Player> visible = new HashMap<String, Player>();
|
||||
Map<String, Player> visible = new HashMap<>();
|
||||
for (Player p : this.client.getPlayers())
|
||||
{
|
||||
if (p.getName() != null)
|
||||
visible.put(p.getName(), p);
|
||||
}
|
||||
|
||||
for (NPC npc : new ArrayList<NPC>(this.npcDamageMap.keySet()))
|
||||
for (NPC npc : new ArrayList<>(this.npcDamageMap.keySet()))
|
||||
{
|
||||
NPCDamageCounter counter = this.npcDamageMap.get(npc);
|
||||
|
||||
Map<Integer, List<String>> attackers = counter.attackers;
|
||||
for (Integer i : new ArrayList<Integer>(attackers.keySet()))
|
||||
for (Integer i : new ArrayList<>(attackers.keySet()))
|
||||
{
|
||||
List<String> p = attackers.get(i);
|
||||
attackers.put(i - 1, p);
|
||||
@@ -455,7 +474,7 @@ public class CombatCounter extends Plugin
|
||||
// this.playerDamage.put(name, count);
|
||||
// }
|
||||
|
||||
for (Integer i : new ArrayList<Integer>(attackers.keySet()))
|
||||
for (Integer i : new ArrayList<>(attackers.keySet()))
|
||||
if (i <= -1)
|
||||
attackers.remove(i);
|
||||
|
||||
@@ -465,7 +484,7 @@ public class CombatCounter extends Plugin
|
||||
|
||||
this.playerDamage = sortByValue(this.playerDamage);
|
||||
|
||||
for (String user : new ArrayList<String>(blowpipe.keySet()))
|
||||
for (String user : new ArrayList<>(blowpipe.keySet()))
|
||||
{
|
||||
if (visible.containsKey(user))
|
||||
{
|
||||
@@ -481,7 +500,7 @@ public class CombatCounter extends Plugin
|
||||
|
||||
Player p = visible.get(user);
|
||||
Actor interacting = p.getInteracting();
|
||||
if (interacting != null && interacting instanceof NPC)
|
||||
if (interacting instanceof NPC)
|
||||
{
|
||||
NPC npc = (NPC) interacting;
|
||||
|
||||
@@ -493,14 +512,14 @@ public class CombatCounter extends Plugin
|
||||
|
||||
int delay = this.calculateBPDelay(distance);
|
||||
|
||||
List<Integer> counts = new ArrayList<Integer>();
|
||||
List<Integer> counts = new ArrayList<>();
|
||||
counts.add(delay);
|
||||
if (delay > 2)
|
||||
counts.add(delay - 1);
|
||||
|
||||
for (int tick : counts)
|
||||
{
|
||||
List<String> attackers = new ArrayList<String>();
|
||||
List<String> attackers = new ArrayList<>();
|
||||
if (dc.attackers.containsKey(tick))
|
||||
attackers = dc.attackers.get(tick);
|
||||
|
||||
@@ -553,7 +572,7 @@ public class CombatCounter extends Plugin
|
||||
return result;
|
||||
}
|
||||
|
||||
public int calculateDistance(Player p, NPC npc)
|
||||
private int calculateDistance(Player p, NPC npc)
|
||||
{
|
||||
int size = 1;
|
||||
NPCDefinition comp = npc.getTransformedDefinition();
|
||||
@@ -582,23 +601,44 @@ public class CombatCounter extends Plugin
|
||||
return distance;
|
||||
}
|
||||
|
||||
public int calculateBPDelay(double distance)
|
||||
private int calculateBPDelay(double distance)
|
||||
{
|
||||
return 2 + (int) Math.floor(distance / 6d);
|
||||
}
|
||||
|
||||
public int calculateChinDelay(double distance)
|
||||
private int calculateChinDelay(double distance)
|
||||
{
|
||||
return 2 + (int) Math.floor(distance / 6d);
|
||||
}
|
||||
|
||||
public int calculateMageDelay(double distance)
|
||||
private int calculateMageDelay(double distance)
|
||||
{
|
||||
return 2 + (int) Math.floor((1d + distance) / 3d);
|
||||
}
|
||||
|
||||
public int calculateRangedDelay(double distance)
|
||||
private int calculateRangedDelay(double distance)
|
||||
{
|
||||
return 2 + (int) Math.floor((3d + distance) / 6d);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("combatcounter"))
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.showTickCounter = config.showTickCounter();
|
||||
this.showDamageCounter = config.showDamageCounter();
|
||||
this.resetOnNewInstance = config.resetOnNewInstance();
|
||||
this.selfColor = config.selfColor();
|
||||
this.totalColor = config.totalColor();
|
||||
this.otherColor = config.otherColor();
|
||||
this.bgColor = config.bgColor();
|
||||
this.titleColor = config.titleColor();
|
||||
}
|
||||
}
|
||||
@@ -26,9 +26,9 @@ package net.runelite.client.plugins.combatcounter;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Player;
|
||||
@@ -42,17 +42,16 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
class CombatOverlay extends Overlay
|
||||
{
|
||||
|
||||
private final Client client;
|
||||
private final CombatCounter plugin;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private final CombatCounterConfig config;
|
||||
private HashMap<String, Long> ticks = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
public CombatOverlay(Client client, CombatCounter plugin, CombatCounterConfig config)
|
||||
public CombatOverlay(final Client client, final CombatCounter plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
||||
@@ -60,7 +59,6 @@ class CombatOverlay extends Overlay
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -70,7 +68,7 @@ class CombatOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.showTickCounter())
|
||||
if (plugin.isShowTickCounter())
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
@@ -79,8 +77,8 @@ class CombatOverlay extends Overlay
|
||||
{
|
||||
return null;
|
||||
}
|
||||
panelComponent.setBackgroundColor(config.bgColor());
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Tick Counter").color(config.titleColor()).build());
|
||||
panelComponent.setBackgroundColor(plugin.getBgColor());
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Tick Counter").color(plugin.getTitleColor()).build());
|
||||
int total = 0;
|
||||
|
||||
TableComponent tableComponent = new TableComponent();
|
||||
@@ -102,22 +100,22 @@ class CombatOverlay extends Overlay
|
||||
{
|
||||
if (client.getLocalPlayer().getName().contains(name))
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, config.selfColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), config.selfColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), plugin.getSelfColor()));
|
||||
}
|
||||
else
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, config.otherColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), config.otherColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), plugin.getOtherColor()));
|
||||
}
|
||||
total += map.get(name);
|
||||
}
|
||||
|
||||
if (!map.containsKey(local.getName()))
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), config.selfColor()), ColorUtil.prependColorTag("0", config.selfColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), plugin.getSelfColor()), ColorUtil.prependColorTag("0", plugin.getSelfColor()));
|
||||
}
|
||||
}
|
||||
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Total:", config.totalColor()), ColorUtil.prependColorTag(String.valueOf(total), config.totalColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag("Total:", plugin.getTotalColor()), ColorUtil.prependColorTag(String.valueOf(total), plugin.getTotalColor()));
|
||||
|
||||
if (!tableComponent.isEmpty())
|
||||
{
|
||||
|
||||
@@ -28,6 +28,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Player;
|
||||
@@ -41,6 +42,7 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
class DamageOverlay extends Overlay
|
||||
{
|
||||
|
||||
@@ -48,12 +50,10 @@ class DamageOverlay extends Overlay
|
||||
|
||||
private final CombatCounter plugin;
|
||||
|
||||
private final CombatCounterConfig config;
|
||||
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
public DamageOverlay(Client client, CombatCounter plugin, CombatCounterConfig config)
|
||||
public DamageOverlay(final Client client, final CombatCounter plugin)
|
||||
{
|
||||
super(plugin);
|
||||
|
||||
@@ -61,7 +61,6 @@ class DamageOverlay extends Overlay
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
|
||||
@@ -71,7 +70,7 @@ class DamageOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (config.showDamageCounter())
|
||||
if (plugin.isShowDamageCounter())
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
@@ -80,8 +79,8 @@ class DamageOverlay extends Overlay
|
||||
{
|
||||
return null;
|
||||
}
|
||||
panelComponent.setBackgroundColor(config.bgColor());
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Damage Counter").color(config.titleColor()).build());
|
||||
panelComponent.setBackgroundColor(plugin.getBgColor());
|
||||
panelComponent.getChildren().add(TitleComponent.builder().text("Damage Counter").color(plugin.getTitleColor()).build());
|
||||
|
||||
TableComponent tableComponent = new TableComponent();
|
||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||
@@ -103,17 +102,17 @@ class DamageOverlay extends Overlay
|
||||
String val = String.format("%.1f", map.get(name));
|
||||
if (client.getLocalPlayer().getName().contains(name))
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, config.selfColor()), ColorUtil.prependColorTag(val, config.selfColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getSelfColor()), ColorUtil.prependColorTag(val, plugin.getSelfColor()));
|
||||
}
|
||||
else
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, config.otherColor()), ColorUtil.prependColorTag(val, config.otherColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(name, plugin.getOtherColor()), ColorUtil.prependColorTag(val, plugin.getOtherColor()));
|
||||
}
|
||||
}
|
||||
|
||||
if (!map.containsKey(local.getName()))
|
||||
{
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), config.selfColor()), ColorUtil.prependColorTag("0", config.selfColor()));
|
||||
tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), plugin.getSelfColor()), ColorUtil.prependColorTag("0", plugin.getSelfColor()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,17 +4,19 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
public class NPCDamageCounter
|
||||
@Singleton
|
||||
class NPCDamageCounter
|
||||
{
|
||||
|
||||
public Map<Integer, List<String>> attackers;
|
||||
Map<Integer, List<String>> attackers;
|
||||
|
||||
public List<Integer> damage;
|
||||
List<Integer> damage;
|
||||
|
||||
public NPCDamageCounter()
|
||||
NPCDamageCounter()
|
||||
{
|
||||
this.attackers = new TreeMap<Integer, List<String>>();
|
||||
this.damage = new ArrayList<Integer>();
|
||||
this.attackers = new TreeMap<>();
|
||||
this.damage = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -39,19 +40,20 @@ import net.runelite.client.ui.overlay.tooltip.Tooltip;
|
||||
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
class CombatLevelOverlay extends Overlay
|
||||
{
|
||||
private static final Color COMBAT_LEVEL_COLOUR = new Color(0xff981f);
|
||||
|
||||
private final Client client;
|
||||
private final CombatLevelConfig config;
|
||||
private final CombatLevelPlugin plugin;
|
||||
private final TooltipManager tooltipManager;
|
||||
|
||||
@Inject
|
||||
private CombatLevelOverlay(Client client, CombatLevelConfig config, TooltipManager tooltipManager)
|
||||
private CombatLevelOverlay(final Client client, final CombatLevelPlugin plugin, final TooltipManager tooltipManager)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.tooltipManager = tooltipManager;
|
||||
}
|
||||
|
||||
@@ -59,7 +61,7 @@ class CombatLevelOverlay extends Overlay
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
Widget combatLevelWidget = client.getWidget(WidgetInfo.COMBAT_LEVEL);
|
||||
if (!config.showLevelsUntil()
|
||||
if (!plugin.isShowLevelsUntil()
|
||||
|| client.getLocalPlayer().getCombatLevel() == Experience.MAX_COMBAT_LEVEL
|
||||
|| combatLevelWidget == null || combatLevelWidget.isHidden())
|
||||
{
|
||||
|
||||
@@ -30,6 +30,9 @@ import java.text.DecimalFormat;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.GameState;
|
||||
@@ -52,6 +55,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
description = "Show a more accurate combat level in Combat Options panel and other combat level functions",
|
||||
tags = {"wilderness", "attack", "range"}
|
||||
)
|
||||
@Singleton
|
||||
public class CombatLevelPlugin extends Plugin
|
||||
{
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("#.###");
|
||||
@@ -80,6 +84,10 @@ public class CombatLevelPlugin extends Plugin
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showLevelsUntil;
|
||||
private boolean wildernessAttackLevelRange;
|
||||
|
||||
@Provides
|
||||
CombatLevelConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -89,9 +97,11 @@ public class CombatLevelPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(overlay);
|
||||
|
||||
if (config.wildernessAttackLevelRange())
|
||||
if (this.wildernessAttackLevelRange)
|
||||
{
|
||||
appendAttackLevelRangeText();
|
||||
}
|
||||
@@ -151,7 +161,9 @@ public class CombatLevelPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (config.wildernessAttackLevelRange())
|
||||
updateConfig();
|
||||
|
||||
if (this.wildernessAttackLevelRange)
|
||||
{
|
||||
appendAttackLevelRangeText();
|
||||
}
|
||||
@@ -164,7 +176,7 @@ public class CombatLevelPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (config.wildernessAttackLevelRange()
|
||||
if (this.wildernessAttackLevelRange
|
||||
&& "wildernessWidgetTextSet".equals(event.getEventName()))
|
||||
{
|
||||
appendAttackLevelRangeText();
|
||||
@@ -241,4 +253,10 @@ public class CombatLevelPlugin extends Plugin
|
||||
{
|
||||
return Math.max(MIN_COMBAT_LEVEL, combatLevel - wildernessLevel) + "-" + Math.min(Experience.MAX_COMBAT_LEVEL, combatLevel + wildernessLevel);
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.showLevelsUntil = config.showLevelsUntil();
|
||||
this.wildernessAttackLevelRange = config.showLevelsUntil();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
@@ -113,6 +114,7 @@ import net.runelite.client.util.Text;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class ConfigPanel extends PluginPanel
|
||||
{
|
||||
private static final int SPINNER_FIELD_WIDTH = 6;
|
||||
|
||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.config;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.SwingUtilities;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
@@ -39,7 +40,6 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.ClientUI;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
@@ -50,10 +50,9 @@ import net.runelite.client.util.ImageUtil;
|
||||
loadWhenOutdated = true,
|
||||
hidden = true // prevent users from disabling
|
||||
)
|
||||
@Singleton
|
||||
public class ConfigPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private ClientUI clientUI;
|
||||
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@@ -26,17 +26,20 @@ package net.runelite.client.plugins.config;
|
||||
|
||||
import java.awt.event.KeyAdapter;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.JButton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.config.ModifierlessKeybind;
|
||||
|
||||
@Singleton
|
||||
public class HotkeyButton extends JButton
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Keybind value;
|
||||
|
||||
public HotkeyButton(Keybind value, boolean modifierless)
|
||||
HotkeyButton(Keybind value, boolean modifierless)
|
||||
{
|
||||
setValue(value);
|
||||
addActionListener(e ->
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Singleton;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
@@ -47,6 +48,7 @@ import net.runelite.client.ui.components.IconButton;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import org.apache.commons.text.similarity.JaroWinklerDistance;
|
||||
|
||||
@Singleton
|
||||
public class PluginListItem extends JPanel
|
||||
{
|
||||
private static final JaroWinklerDistance DISTANCE = new JaroWinklerDistance();
|
||||
@@ -74,10 +76,10 @@ public class PluginListItem extends JPanel
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public final ConfigDescriptor configDescriptor;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final String name;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final String description;
|
||||
|
||||
private final List<String> keywords = new ArrayList<>();
|
||||
|
||||
@@ -32,6 +32,7 @@ import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.Duration;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import static net.runelite.api.AnimationID.COOKING_FIRE;
|
||||
import static net.runelite.api.AnimationID.COOKING_RANGE;
|
||||
import net.runelite.api.Client;
|
||||
@@ -47,6 +48,7 @@ import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
|
||||
@Singleton
|
||||
class CookingOverlay extends Overlay
|
||||
{
|
||||
private static final int COOK_TIMEOUT = 3;
|
||||
@@ -58,7 +60,7 @@ class CookingOverlay extends Overlay
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private CookingOverlay(Client client, CookingPlugin plugin, XpTrackerService xpTrackerService)
|
||||
private CookingOverlay(final Client client, final CookingPlugin plugin, final XpTrackerService xpTrackerService)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
|
||||
@@ -30,14 +30,17 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Optional;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GraphicID;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.SpotAnimationChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -55,6 +58,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
description = "Show cooking statistics",
|
||||
tags = {"overlay", "skilling", "cook"}
|
||||
)
|
||||
@Singleton
|
||||
@PluginDependency(XpTrackerPlugin.class)
|
||||
public class CookingPlugin extends Plugin
|
||||
{
|
||||
@@ -79,6 +83,10 @@ public class CookingPlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private CookingSession session;
|
||||
|
||||
private int statTimeout;
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private boolean fermentTimer;
|
||||
|
||||
@Provides
|
||||
CookingConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -88,6 +96,7 @@ public class CookingPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
session = null;
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
@@ -103,12 +112,12 @@ public class CookingPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (session == null || config.statTimeout() == 0)
|
||||
if (session == null || this.statTimeout == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Duration statTimeout = Duration.ofMinutes(config.statTimeout());
|
||||
Duration statTimeout = Duration.ofMinutes(this.statTimeout);
|
||||
Duration sinceCut = Duration.between(session.getLastCookingAction(), Instant.now());
|
||||
|
||||
if (sinceCut.compareTo(statTimeout) >= 0)
|
||||
@@ -127,7 +136,7 @@ public class CookingPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getSpotAnimation() == GraphicID.WINE_MAKE && config.fermentTimer())
|
||||
if (player.getSpotAnimation() == GraphicID.WINE_MAKE && this.fermentTimer)
|
||||
{
|
||||
Optional<FermentTimer> fermentTimerOpt = infoBoxManager.getInfoBoxes().stream()
|
||||
.filter(FermentTimer.class::isInstance)
|
||||
@@ -184,4 +193,19 @@ public class CookingPlugin extends Plugin
|
||||
session.increaseBurnAmount();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if (configChanged.getGroup().equals("cooking"))
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.statTimeout = config.statTimeout();
|
||||
this.fermentTimer = config.fermentTimer();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,11 @@
|
||||
package net.runelite.client.plugins.cooking;
|
||||
|
||||
import java.time.Instant;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
@Singleton
|
||||
class CookingSession
|
||||
{
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
|
||||
@@ -28,9 +28,11 @@ import java.awt.Color;
|
||||
import java.awt.Image;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
@Singleton
|
||||
final class FermentTimer extends InfoBox
|
||||
{
|
||||
private static final Duration FERMENT_TIME = Duration.ofMillis(13_800);
|
||||
|
||||
@@ -29,24 +29,23 @@ import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.NPC;
|
||||
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;
|
||||
|
||||
@Singleton
|
||||
class CoreOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final CorpPlugin corpPlugin;
|
||||
|
||||
@Inject
|
||||
private CoreOverlay(Client client, CorpPlugin corpPlugin)
|
||||
private CoreOverlay(final CorpPlugin corpPlugin)
|
||||
{
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.client = client;
|
||||
this.corpPlugin = corpPlugin;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,7 @@ 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 static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.NPC;
|
||||
@@ -48,16 +49,16 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@Singleton
|
||||
class CorpDamageOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
private final CorpPlugin corpPlugin;
|
||||
private final CorpConfig config;
|
||||
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private CorpDamageOverlay(Client client, CorpPlugin corpPlugin, CorpConfig config)
|
||||
private CorpDamageOverlay(final Client client, final CorpPlugin corpPlugin)
|
||||
{
|
||||
super(corpPlugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
@@ -65,7 +66,6 @@ class CorpDamageOverlay extends Overlay
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
this.corpPlugin = corpPlugin;
|
||||
this.config = config;
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Corp overlay"));
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ class CorpDamageOverlay extends Overlay
|
||||
}
|
||||
}
|
||||
|
||||
if (config.showDamage())
|
||||
if (corpPlugin.isShowDamage())
|
||||
{
|
||||
tableComponent.addRow("Your damage", ColorUtil.prependColorTag(Integer.toString(myDamage), damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED));
|
||||
tableComponent.addRow("Total damage:", Integer.toString(totalDamage));
|
||||
|
||||
@@ -41,6 +41,7 @@ import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.InteractingChanged;
|
||||
@@ -101,6 +102,10 @@ public class CorpPlugin extends Plugin
|
||||
@Inject
|
||||
private CorpConfig config;
|
||||
|
||||
private boolean leftClickCore;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showDamage;
|
||||
|
||||
@Provides
|
||||
CorpConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -110,6 +115,8 @@ public class CorpPlugin extends Plugin
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
overlayManager.add(corpOverlay);
|
||||
overlayManager.add(coreOverlay);
|
||||
}
|
||||
@@ -229,7 +236,7 @@ public class CorpPlugin extends Plugin
|
||||
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
|
||||
{
|
||||
if (menuEntryAdded.getType() != NPC_SECTION_ACTION
|
||||
|| !config.leftClickCore() || !menuEntryAdded.getOption().equals(ATTACK))
|
||||
|| !this.leftClickCore || !menuEntryAdded.getOption().equals(ATTACK))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -248,4 +255,19 @@ public class CorpPlugin extends Plugin
|
||||
menuEntry.setType(NPC_SECTION_ACTION + MENU_ACTION_DEPRIORITIZE_OFFSET);
|
||||
client.setMenuEntries(menuEntries);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if (configChanged.getGroup().equals("corp"))
|
||||
{
|
||||
updateConfig();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.leftClickCore = config.leftClickCore();
|
||||
this.showDamage = config.showDamage();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user