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