banlist: add tob functionality, config options (#945)
* banlist add tob functionality, config options * Checkstyle Fixes * Widget Info * Various White spaces removed.
This commit is contained in:
committed by
Lucwousin
parent
b861ce4121
commit
aaaa7845ef
@@ -667,6 +667,7 @@ public class WidgetID
|
|||||||
|
|
||||||
static class TheatreOfBlood
|
static class TheatreOfBlood
|
||||||
{
|
{
|
||||||
|
static final int RAIDING_PARTY = 9;
|
||||||
static final int ORB_BOX = 10;
|
static final int ORB_BOX = 10;
|
||||||
static final int BOSS_HEALTH_BAR = 35;
|
static final int BOSS_HEALTH_BAR = 35;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ public enum WidgetInfo
|
|||||||
|
|
||||||
THEATRE_OF_BLOOD_HEALTH_ORBS(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.ORB_BOX),
|
THEATRE_OF_BLOOD_HEALTH_ORBS(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.ORB_BOX),
|
||||||
THEATRE_OF_BLOOD_BOSS_HEALTH(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.BOSS_HEALTH_BAR),
|
THEATRE_OF_BLOOD_BOSS_HEALTH(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.BOSS_HEALTH_BAR),
|
||||||
|
THEATRE_OF_BLOOD_RAIDING_PARTY(WidgetID.THEATRE_OF_BLOOD_GROUP_ID, WidgetID.TheatreOfBlood.RAIDING_PARTY),
|
||||||
|
|
||||||
BLAST_FURNACE_COFFER(WidgetID.BLAST_FURNACE_GROUP_ID, 2),
|
BLAST_FURNACE_COFFER(WidgetID.BLAST_FURNACE_GROUP_ID, 2),
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,10 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
public interface BanListConfig extends Config
|
public interface BanListConfig extends Config
|
||||||
{
|
{
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "bannedPlayers",
|
keyName = "bannedPlayers",
|
||||||
name = "Manual Scammer List",
|
name = "Manual Scammer List",
|
||||||
description = "Players you add to this list will be shown when you join a clan.",
|
description = "Manually add players seperated by commas that you wish to be warned about while in a clan/cox/tob party",
|
||||||
position = 0
|
position = 0
|
||||||
|
|
||||||
)
|
)
|
||||||
default String getBannedPlayers()
|
default String getBannedPlayers()
|
||||||
{
|
{
|
||||||
@@ -21,28 +20,39 @@ public interface BanListConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "bannedPlayers",
|
keyName = "bannedPlayers",
|
||||||
name = "",
|
name = "",
|
||||||
description = ""
|
description = ""
|
||||||
)
|
)
|
||||||
void setBannedPlayers(String key);
|
void setBannedPlayers(String key);
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 1,
|
position = 1,
|
||||||
keyName = "enableWDR",
|
keyName = "enableWDRScam",
|
||||||
name = "Enable WDR Scammer List",
|
name = "Enable WDR Scammer List",
|
||||||
description = "Incorporate WDR Scammer list"
|
description = "Incorporate WDR Scammer list"
|
||||||
)
|
)
|
||||||
default boolean enableWDR()
|
default boolean enableWDRScam()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 2,
|
position = 2,
|
||||||
keyName = "enableRuneWatch",
|
keyName = "enableWDRToxic",
|
||||||
name = "Enable RuneWatch Scammer List",
|
name = "Enable WDR Toxic List",
|
||||||
description = "Incorporate RuneWatch Scammer list"
|
description = "Incorporate WDR Toxic list"
|
||||||
|
)
|
||||||
|
default boolean enableWDRToxic()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 3,
|
||||||
|
keyName = "enableRuneWatch",
|
||||||
|
name = "Enable RuneWatch List",
|
||||||
|
description = "Incorporate RuneWatch potential scammer list"
|
||||||
)
|
)
|
||||||
default boolean enableRuneWatch()
|
default boolean enableRuneWatch()
|
||||||
{
|
{
|
||||||
@@ -50,10 +60,10 @@ public interface BanListConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 3,
|
position = 4,
|
||||||
keyName = "highlightInClan",
|
keyName = "highlightInClan",
|
||||||
name = "Highlight red in Clan Chat",
|
name = "Highlight red in Clan Chat",
|
||||||
description = "Highlights Scammer\'s name in your current clan chat."
|
description = "Highlights Scammer\'s name in your current clan chat."
|
||||||
)
|
)
|
||||||
default boolean highlightInClan()
|
default boolean highlightInClan()
|
||||||
{
|
{
|
||||||
@@ -61,14 +71,13 @@ public interface BanListConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
position = 4,
|
position = 5,
|
||||||
keyName = "highlightInTrade",
|
keyName = "highlightInTrade",
|
||||||
name = "Highlight red in trade screen",
|
name = "Highlight red in trade screen",
|
||||||
description = "Highlights Scammer\'s name in your trade window"
|
description = "Highlights Scammer\'s name in your trade window"
|
||||||
)
|
)
|
||||||
default boolean highlightInTrade()
|
default boolean highlightInTrade()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -41,8 +41,10 @@ import net.runelite.api.ChatMessageType;
|
|||||||
import net.runelite.api.ClanMember;
|
import net.runelite.api.ClanMember;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.GameState;
|
import net.runelite.api.GameState;
|
||||||
|
import net.runelite.api.Varbits;
|
||||||
import net.runelite.api.events.ClanMemberJoined;
|
import net.runelite.api.events.ClanMemberJoined;
|
||||||
import net.runelite.api.events.ConfigChanged;
|
import net.runelite.api.events.ConfigChanged;
|
||||||
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.WidgetHiddenChanged;
|
import net.runelite.api.events.WidgetHiddenChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
@@ -77,22 +79,24 @@ import okhttp3.Response;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class BanListPlugin extends Plugin
|
public class BanListPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@Inject
|
|
||||||
private Client client;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ClientThread clientThread;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private BanListConfig config;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ChatMessageManager chatMessageManager;
|
|
||||||
|
|
||||||
private final Set<String> wdrScamSet = new HashSet<>();
|
private final Set<String> wdrScamSet = new HashSet<>();
|
||||||
private final Set<String> wdrToxicSet = new HashSet<>();
|
private final Set<String> wdrToxicSet = new HashSet<>();
|
||||||
private final Set<String> runeWatchSet = new HashSet<>();
|
private final Set<String> runeWatchSet = new HashSet<>();
|
||||||
private final Set<String> manualBans = new HashSet<>();
|
private final Set<String> manualBans = new HashSet<>();
|
||||||
|
@Inject
|
||||||
|
private Client client;
|
||||||
|
@Inject
|
||||||
|
private ClientThread clientThread;
|
||||||
|
@Inject
|
||||||
|
private BanListConfig config;
|
||||||
|
@Inject
|
||||||
|
private ChatMessageManager chatMessageManager;
|
||||||
|
private String tobNames = "";
|
||||||
|
private boolean enableWDRScam;
|
||||||
|
private boolean enableWDRToxic;
|
||||||
|
private boolean enableRuneWatch;
|
||||||
|
private boolean highlightInClan;
|
||||||
|
private boolean highlightInTrade;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
BanListConfig getConfig(ConfigManager configManager)
|
BanListConfig getConfig(ConfigManager configManager)
|
||||||
@@ -100,12 +104,6 @@ public class BanListPlugin extends Plugin
|
|||||||
return configManager.getConfig(BanListConfig.class);
|
return configManager.getConfig(BanListConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save config values
|
|
||||||
private boolean enableWDR;
|
|
||||||
private boolean enableRuneWatch;
|
|
||||||
private boolean highlightInClan;
|
|
||||||
private boolean highlightInTrade;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -151,7 +149,8 @@ public class BanListPlugin extends Plugin
|
|||||||
|
|
||||||
private void updateConfig()
|
private void updateConfig()
|
||||||
{
|
{
|
||||||
this.enableWDR = config.enableWDR();
|
this.enableWDRScam = config.enableWDRScam();
|
||||||
|
this.enableWDRToxic = config.enableWDRToxic();
|
||||||
this.enableRuneWatch = config.enableRuneWatch();
|
this.enableRuneWatch = config.enableRuneWatch();
|
||||||
this.highlightInClan = config.highlightInClan();
|
this.highlightInClan = config.highlightInClan();
|
||||||
this.highlightInTrade = config.highlightInTrade();
|
this.highlightInTrade = config.highlightInTrade();
|
||||||
@@ -234,12 +233,63 @@ public class BanListPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameTick(GameTick event)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY) == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY);
|
||||||
|
String allNames = raidingParty.getText();
|
||||||
|
|
||||||
|
if (allNames.equalsIgnoreCase(tobNames))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tobNames = allNames;
|
||||||
|
|
||||||
|
String[] split = allNames.split("<br>");
|
||||||
|
|
||||||
|
for (int i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
String name = split[i];
|
||||||
|
if (!name.equalsIgnoreCase("-"))
|
||||||
|
{
|
||||||
|
ListType scamList = checkScamList(Text.standardize(name));
|
||||||
|
|
||||||
|
if (scamList != null)
|
||||||
|
{
|
||||||
|
sendWarning(name, scamList);
|
||||||
|
}
|
||||||
|
|
||||||
|
ListType toxicList = checkToxicList(Text.standardize(name));
|
||||||
|
|
||||||
|
if (toxicList != null)
|
||||||
|
{
|
||||||
|
sendWarning(name, toxicList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
boolean inTobParty()
|
||||||
|
{
|
||||||
|
return client.getVar(Varbits.THEATRE_OF_BLOOD) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compares player name to everything in the ban lists
|
* Compares player name to everything in the ban lists
|
||||||
*/
|
*/
|
||||||
private ListType checkScamList(String nameToBeChecked)
|
private ListType checkScamList(String nameToBeChecked)
|
||||||
{
|
{
|
||||||
if (wdrScamSet.size() > 0 && this.enableWDR && wdrScamSet.contains(nameToBeChecked))
|
if (wdrScamSet.size() > 0 && this.enableWDRScam && wdrScamSet.contains(nameToBeChecked))
|
||||||
{
|
{
|
||||||
return ListType.WEDORAIDSSCAM_LIST;
|
return ListType.WEDORAIDSSCAM_LIST;
|
||||||
}
|
}
|
||||||
@@ -260,7 +310,7 @@ public class BanListPlugin extends Plugin
|
|||||||
private ListType checkToxicList(String nameToBeChecked)
|
private ListType checkToxicList(String nameToBeChecked)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (wdrToxicSet.size() > 0 && this.enableWDR && wdrToxicSet.contains(nameToBeChecked))
|
if (wdrToxicSet.size() > 0 && this.enableWDRToxic && wdrToxicSet.contains(nameToBeChecked))
|
||||||
{
|
{
|
||||||
return ListType.WEDORAIDSTOXIC_LIST;
|
return ListType.WEDORAIDSTOXIC_LIST;
|
||||||
}
|
}
|
||||||
@@ -304,7 +354,7 @@ public class BanListPlugin extends Plugin
|
|||||||
case RUNEWATCH_LIST:
|
case RUNEWATCH_LIST:
|
||||||
final String rw_message = new ChatMessageBuilder()
|
final String rw_message = new ChatMessageBuilder()
|
||||||
.append(ChatColorType.HIGHLIGHT)
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
.append("Warning! " + playerName + " is on the Runewatch\'s scammer list!")
|
.append("Warning! " + playerName + " is on the Runewatch\'s potential scammer list!")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
chatMessageManager.queue(
|
chatMessageManager.queue(
|
||||||
|
|||||||
Reference in New Issue
Block a user