Refactor ClanManMode
This commit is contained in:
@@ -31,10 +31,10 @@ public interface ClanManModeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 2,
|
position = 2,
|
||||||
keyName = "highlightattacked",
|
keyName = "highlightattacked",
|
||||||
name = "Highlight clan targets",
|
name = "Highlight clan targets",
|
||||||
description = "Highlights people being attacked by your clan"
|
description = "Highlights people being attacked by your clan"
|
||||||
)
|
)
|
||||||
default boolean highlightAttacked()
|
default boolean highlightAttacked()
|
||||||
{
|
{
|
||||||
@@ -42,10 +42,10 @@ public interface ClanManModeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 3,
|
position = 3,
|
||||||
keyName = "attackedcolor",
|
keyName = "attackedcolor",
|
||||||
name = "Clan target color",
|
name = "Clan target color",
|
||||||
description = "Color of players being attacked by clan"
|
description = "Color of players being attacked by clan"
|
||||||
)
|
)
|
||||||
default Color getClanAttackableColor()
|
default Color getClanAttackableColor()
|
||||||
{
|
{
|
||||||
@@ -86,10 +86,10 @@ public interface ClanManModeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 7,
|
position = 7,
|
||||||
keyName = "showtargets",
|
keyName = "showtargets",
|
||||||
name = "Highlight My Attackers",
|
name = "Highlight My Attackers",
|
||||||
description = "Shows players interacting with you"
|
description = "Shows players interacting with you"
|
||||||
)
|
)
|
||||||
default boolean showAttackers()
|
default boolean showAttackers()
|
||||||
{
|
{
|
||||||
@@ -97,10 +97,10 @@ public interface ClanManModeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 8,
|
position = 8,
|
||||||
keyName = "attackcolor",
|
keyName = "attackcolor",
|
||||||
name = "Attacker Color",
|
name = "Attacker Color",
|
||||||
description = "Color of attackers"
|
description = "Color of attackers"
|
||||||
)
|
)
|
||||||
default Color getAttackerColor()
|
default Color getAttackerColor()
|
||||||
{
|
{
|
||||||
@@ -108,58 +108,76 @@ public interface ClanManModeConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 9,
|
position = 9,
|
||||||
keyName = "showbold",
|
keyName = "showbold",
|
||||||
name = "Bold names of clan targets",
|
name = "Bold names of clan targets",
|
||||||
description = "Turns names of clan targets bold"
|
description = "Turns names of clan targets bold"
|
||||||
)
|
)
|
||||||
default boolean ShowBold() { return false; }
|
default boolean ShowBold()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 10,
|
position = 10,
|
||||||
keyName = "hideafter",
|
keyName = "hideafter",
|
||||||
name = "Hide attackable targets after login",
|
name = "Hide attackable targets after login",
|
||||||
description = "Automatically disables attackable player highlighting after login"
|
description = "Automatically disables attackable player highlighting after login"
|
||||||
)
|
)
|
||||||
default boolean hideAttackable() { return false; }
|
default boolean hideAttackable()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 11,
|
position = 11,
|
||||||
keyName = "hidetime",
|
keyName = "hidetime",
|
||||||
name = "Ticks to hide",
|
name = "Ticks to hide",
|
||||||
description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)"
|
description = "How many ticks after you are logged in that attackbles are hidden (1 tick = 0.6 seconds)"
|
||||||
)
|
)
|
||||||
default int hideTime() { return 5; }
|
default int hideTime()
|
||||||
|
{
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 12,
|
position = 12,
|
||||||
keyName = "mycblvl",
|
keyName = "mycblvl",
|
||||||
name = "Calc targets on my own combat level",
|
name = "Calc targets on my own combat level",
|
||||||
description = "Calculates potential targets based off your own combat lvl instead of clans"
|
description = "Calculates potential targets based off your own combat lvl instead of clans"
|
||||||
)
|
)
|
||||||
default boolean CalcSelfCB() { return false; }
|
default boolean CalcSelfCB()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 13,
|
position = 13,
|
||||||
keyName = "hideatkopt",
|
keyName = "hideatkopt",
|
||||||
name = "Hide attack option for clan members",
|
name = "Hide attack option for clan members",
|
||||||
description = "Disables attack option for clan members"
|
description = "Disables attack option for clan members"
|
||||||
)
|
)
|
||||||
default boolean hideAtkOpt() { return false; }
|
default boolean hideAtkOpt()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 14,
|
position = 14,
|
||||||
keyName = "showclanmembers",
|
keyName = "showclanmembers",
|
||||||
name = "Persistent Clan Members",
|
name = "Persistent Clan Members",
|
||||||
description = "Will highlight clan members even when not in clan chat"
|
description = "Will highlight clan members even when not in clan chat"
|
||||||
)
|
)
|
||||||
default boolean PersistentClan() { return false; }
|
default boolean PersistentClan()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 15,
|
position = 15,
|
||||||
keyName = "clancolor",
|
keyName = "clancolor",
|
||||||
name = "Clan Member Color",
|
name = "Clan Member Color",
|
||||||
description = "Color of clan members"
|
description = "Color of clan members"
|
||||||
)
|
)
|
||||||
default Color getClanMemberColor()
|
default Color getClanMemberColor()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,10 +3,8 @@ package net.runelite.client.plugins.clanmanmode;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.ClanMemberRank;
|
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.client.game.ClanManager;
|
import net.runelite.client.game.ClanManager;
|
||||||
@@ -21,15 +19,12 @@ public class ClanManModeOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
private final ClanManModeService ClanManModeService;
|
private final ClanManModeService ClanManModeService;
|
||||||
private final ClanManModeConfig config;
|
private final ClanManModeConfig config;
|
||||||
private final ClanManager clanManager;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClanManModeOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService,
|
private ClanManModeOverlay(ClanManModeConfig config, ClanManModeService ClanManModeService)
|
||||||
ClanManager clanManager)
|
|
||||||
{
|
{
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.ClanManModeService = ClanManModeService;
|
this.ClanManModeService = ClanManModeService;
|
||||||
this.clanManager = clanManager;
|
|
||||||
setPosition(OverlayPosition.DYNAMIC);
|
setPosition(OverlayPosition.DYNAMIC);
|
||||||
setPriority(OverlayPriority.MED);
|
setPriority(OverlayPriority.MED);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package net.runelite.client.plugins.clanmanmode;
|
package net.runelite.client.plugins.clanmanmode;
|
||||||
|
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -8,12 +7,17 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.*;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.game.ClanManager;
|
import net.runelite.client.game.ClanManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
@@ -123,8 +127,8 @@ public class ClanManModePlugin extends Plugin
|
|||||||
if (option.equals("attack")) {
|
if (option.equals("attack")) {
|
||||||
final Pattern ppattern = Pattern.compile("<col=ffffff>(.+?)<col=");
|
final Pattern ppattern = Pattern.compile("<col=ffffff>(.+?)<col=");
|
||||||
final Matcher pmatch = ppattern.matcher(event.getTarget());
|
final Matcher pmatch = ppattern.matcher(event.getTarget());
|
||||||
pmatch.find();
|
|
||||||
if (pmatch.matches()) {
|
if (pmatch.find() && pmatch.matches()) {
|
||||||
if (pmatch.group(1) != null) {
|
if (pmatch.group(1) != null) {
|
||||||
if (clan.containsKey(pmatch.group(1).replace(" ", " "))) {
|
if (clan.containsKey(pmatch.group(1).replace(" ", " "))) {
|
||||||
MenuEntry[] entries = client.getMenuEntries();
|
MenuEntry[] entries = client.getMenuEntries();
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.util.Map;
|
|||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
@@ -28,7 +27,7 @@ public class ClanManModeService
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, String> interactors = new HashMap<>();
|
private Map<String, String> interactors = new HashMap<>();
|
||||||
|
|
||||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||||
{
|
{
|
||||||
@@ -102,7 +101,7 @@ public class ClanManModeService
|
|||||||
if (config.highlightAttacked()) {
|
if (config.highlightAttacked()) {
|
||||||
if (interactors.containsKey(player.getName())) {
|
if (interactors.containsKey(player.getName())) {
|
||||||
String attackername = interactors.get(player.getName());
|
String attackername = interactors.get(player.getName());
|
||||||
Boolean found = false;
|
boolean found = false;
|
||||||
for (Player attacker : client.getPlayers()) {
|
for (Player attacker : client.getPlayers()) {
|
||||||
if (attacker == null || attacker.getName() == null) {
|
if (attacker == null || attacker.getName() == null) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user