Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 8 additions & 20 deletions src/main/java/dinkplugin/DinkPlugin.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
package dinkplugin;

import com.google.inject.Provides;
import dinkplugin.notifiers.ChatNotifier;
import dinkplugin.notifiers.ClueNotifier;
import dinkplugin.notifiers.CollectionNotifier;
import dinkplugin.notifiers.CombatTaskNotifier;
import dinkplugin.notifiers.DeathNotifier;
import dinkplugin.notifiers.DiaryNotifier;
import dinkplugin.notifiers.ExternalPluginNotifier;
import dinkplugin.notifiers.GambleNotifier;
import dinkplugin.notifiers.GrandExchangeNotifier;
import dinkplugin.notifiers.GroupStorageNotifier;
import dinkplugin.notifiers.KillCountNotifier;
import dinkplugin.notifiers.LevelNotifier;
import dinkplugin.notifiers.LootNotifier;
import dinkplugin.notifiers.MetaNotifier;
import dinkplugin.notifiers.PetNotifier;
import dinkplugin.notifiers.PlayerKillNotifier;
import dinkplugin.notifiers.QuestNotifier;
import dinkplugin.notifiers.SlayerNotifier;
import dinkplugin.notifiers.SpeedrunNotifier;
import dinkplugin.notifiers.TradeNotifier;
import dinkplugin.notifiers.*;
import dinkplugin.util.AccountTypeTracker;
import dinkplugin.util.KillCountService;
import dinkplugin.util.Utils;
Expand Down Expand Up @@ -106,6 +87,7 @@ public class DinkPlugin extends Plugin {
private @Inject MetaNotifier metaNotifier;
private @Inject TradeNotifier tradeNotifier;
private @Inject ChatNotifier chatNotifier;
private @Inject BingoNotifier bingoNotifier;
private @Inject ExternalPluginNotifier externalNotifier;

private final AtomicReference<GameState> gameState = new AtomicReference<>();
Expand Down Expand Up @@ -133,6 +115,7 @@ protected void startUp() {
lootNotifier.init();
deathNotifier.init();
chatNotifier.init();
bingoNotifier.init();
// leaguesNotifier.init();
}

Expand Down Expand Up @@ -189,6 +172,7 @@ public void onConfigChanged(ConfigChanged event) {
lootNotifier.onConfigChanged(event.getKey(), event.getNewValue());
deathNotifier.onConfigChanged(event.getKey(), event.getNewValue());
chatNotifier.onConfig(event.getKey(), event.getNewValue());
bingoNotifier.onConfigChanged(event.getKey(), event.getNewValue());

if ("false".equals(event.getNewValue())) {
Runnable task = configDisabledTasks.get(event.getKey());
Expand Down Expand Up @@ -270,6 +254,7 @@ public void onChatMessage(ChatMessage message) {
combatTaskNotifier.onGameMessage(chatMessage);
deathNotifier.onGameMessage(chatMessage);
speedrunNotifier.onGameMessage(chatMessage);
bingoNotifier.onGameMessage(chatMessage);
// leaguesNotifier.onGameMessage(chatMessage);
break;

Expand Down Expand Up @@ -336,6 +321,7 @@ public void onServerNpcLoot(ServerNpcLoot event) {

killCountService.onServerNpcLoot(event);
lootNotifier.onServerNpcLoot(event);
bingoNotifier.onServerNpcLoot(event);
}

@Subscribe(priority = 1) // run before the base loot tracker plugin
Expand All @@ -347,6 +333,7 @@ public void onNpcLootReceived(NpcLootReceived npcLootReceived) {

killCountService.onNpcKill(npcLootReceived);
lootNotifier.onNpcLootReceived(npcLootReceived);
bingoNotifier.onNpcLootReceived(npcLootReceived);
}

@Subscribe
Expand All @@ -364,6 +351,7 @@ public void onProfileChanged(ProfileChanged event) {
public void onLootReceived(LootReceived lootReceived) {
killCountService.onLoot(lootReceived);
lootNotifier.onLootReceived(lootReceived);
bingoNotifier.onLootReceived(lootReceived);
}

@Subscribe
Expand Down
110 changes: 88 additions & 22 deletions src/main/java/dinkplugin/DinkPluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,18 @@ public interface DinkPluginConfig extends Config {
)
String chatSection = "Custom Chat Messages";

@ConfigSection(
name = "Bingo",
description = "Settings for notifying when bingo items are dropped",
position = 180,
closedByDefault = true
)
String bingoSection = "Bingo";

@ConfigSection(
name = "External Plugin Requests",
description = "Settings for notifying when other plugins request Dink notifications to be fired",
position = 180,
position = 190,
closedByDefault = true
)
String externalSection = "External Plugin Requests";
Expand Down Expand Up @@ -530,7 +538,7 @@ default boolean useSlayerWidgetKc() {
name = "Primary Webhook URLs",
description = "The default webhook URL to send notifications to, if no override is specified.<br/>" +
"You can target multiple webhooks by specifying their URLs on separate lines",
position = -20
position = -21
)
default String primaryWebhook() {
return "";
Expand All @@ -540,7 +548,7 @@ default String primaryWebhook() {
keyName = "collectionWebhook",
name = "Collection Webhook Override",
description = "If non-empty, collection messages are sent to this URL, instead of the primary URL",
position = -19,
position = -20,
section = webhookSection
)
default String collectionWebhook() {
Expand All @@ -551,7 +559,7 @@ default String collectionWebhook() {
keyName = "petWebhook",
name = "Pet Webhook Override",
description = "If non-empty, pet messages are sent to this URL, instead of the primary URL",
position = -18,
position = -19,
section = webhookSection
)
default String petWebhook() {
Expand All @@ -562,7 +570,7 @@ default String petWebhook() {
keyName = "levelWebhook",
name = "Level Webhook Override",
description = "If non-empty, level up messages are sent to this URL, instead of the primary URL",
position = -17,
position = -18,
section = webhookSection
)
default String levelWebhook() {
Expand All @@ -573,7 +581,7 @@ default String levelWebhook() {
keyName = "lootWebhook",
name = "Loot Webhook Override",
description = "If non-empty, loot messages are sent to this URL, instead of the primary URL",
position = -16,
position = -17,
section = webhookSection
)
default String lootWebhook() {
Expand All @@ -584,7 +592,7 @@ default String lootWebhook() {
keyName = "deathWebhook",
name = "Death Webhook Override",
description = "If non-empty, death messages are sent to this URL, instead of the primary URL",
position = -15,
position = -16,
section = webhookSection
)
default String deathWebhook() {
Expand All @@ -595,7 +603,7 @@ default String deathWebhook() {
keyName = "slayerWebhook",
name = "Slayer Webhook Override",
description = "If non-empty, slayer messages are sent to this URL, instead of the primary URL",
position = -14,
position = -15,
section = webhookSection
)
default String slayerWebhook() {
Expand All @@ -606,7 +614,7 @@ default String slayerWebhook() {
keyName = "questWebhook",
name = "Quest Webhook Override",
description = "If non-empty, quest messages are sent to this URL, instead of the primary URL",
position = -13,
position = -14,
section = webhookSection
)
default String questWebhook() {
Expand All @@ -617,7 +625,7 @@ default String questWebhook() {
keyName = "clueWebhook",
name = "Clue Webhook Override",
description = "If non-empty, clue messages are sent to this URL, instead of the primary URL",
position = -12,
position = -13,
section = webhookSection
)
default String clueWebhook() {
Expand All @@ -628,7 +636,7 @@ default String clueWebhook() {
keyName = "speedrunWebhook",
name = "Speedrun Webhook Override",
description = "If non-empty, speedrun messages are sent to this URL, instead of the primary URL",
position = -11,
position = -12,
section = webhookSection
)
default String speedrunWebhook() {
Expand All @@ -639,7 +647,7 @@ default String speedrunWebhook() {
keyName = "killCountWebhook",
name = "Kill Count Webhook Override",
description = "If non-empty, kill count messages are sent to this URL, instead of the primary URL",
position = -10,
position = -11,
section = webhookSection
)
default String killCountWebhook() {
Expand All @@ -650,7 +658,7 @@ default String killCountWebhook() {
keyName = "combatTaskWebhook",
name = "Combat Task Webhook Override",
description = "If non-empty, combat task messages are sent to this URL, instead of the primary URL",
position = -9,
position = -10,
section = webhookSection
)
default String combatTaskWebhook() {
Expand All @@ -661,7 +669,7 @@ default String combatTaskWebhook() {
keyName = "diaryWebhook",
name = "Diary Webhook Override",
description = "If non-empty, achievement diary messages are sent to this URL, instead of the primary URL",
position = -8,
position = -9,
section = webhookSection
)
default String diaryWebhook() {
Expand All @@ -672,7 +680,7 @@ default String diaryWebhook() {
keyName = "gambleWebhook",
name = "BA Gamble Webhook Override",
description = "If non-empty, BA gamble messages are sent to this URL, instead of the primary URL",
position = -7,
position = -8,
section = webhookSection
)
default String gambleWebhook() {
Expand All @@ -683,7 +691,7 @@ default String gambleWebhook() {
keyName = "pkWebhook",
name = "Player Kill Webhook Override",
description = "If non-empty, PK messages are sent to this URL, instead of the primary URL",
position = -6,
position = -7,
section = webhookSection
)
default String pkWebhook() {
Expand All @@ -694,7 +702,7 @@ default String pkWebhook() {
keyName = "groupStorageWebhook",
name = "Group Storage Webhook Override",
description = "If non-empty, Group Storage messages are sent to this URL, instead of the primary URL",
position = -5,
position = -6,
section = webhookSection
)
default String groupStorageWebhook() {
Expand All @@ -705,7 +713,7 @@ default String groupStorageWebhook() {
keyName = "grandExchangeWebhook",
name = "Grand Exchange Webhook Override",
description = "If non-empty, Grand Exchange messages are sent to this URL, instead of the primary URL",
position = -4,
position = -5,
section = webhookSection
)
default String grandExchangeWebhook() {
Expand All @@ -716,7 +724,7 @@ default String grandExchangeWebhook() {
keyName = "tradeWebhook",
name = "Trade Webhook Override",
description = "If non-empty, Trading messages are sent to this URL, instead of the primary URL",
position = -3,
position = -4,
section = webhookSection
)
default String tradeWebhook() {
Expand All @@ -727,13 +735,24 @@ default String tradeWebhook() {
keyName = "chatWebhook",
name = "Chat Webhook Override",
description = "If non-empty, filtered chat messages are sent to this URL, instead of the primary URL",
position = -2,
position = -3,
section = webhookSection
)
default String chatWebhook() {
return "";
}

@ConfigItem(
keyName = "bingoWebhook",
name = "Bingo Webhook Override",
description = "If non-empty, Bingo messages are sent to this URL, instead of the primary URL",
position = -2,
section = webhookSection
)
default String bingoWebhook() {
return "";
}

@ConfigItem(
keyName = "externalWebhook",
name = "External Webhook Override",
Expand Down Expand Up @@ -2082,11 +2101,58 @@ default String chatNotifyMessage() {
return "%USERNAME% received a chat message:\n\n```\n%MESSAGE%\n```";
}

@ConfigItem(
keyName = "notifyBingo",
name = "Enable Bingo",
description = "Enable notifications for obtaining Bingo items",
position = 180,
section = bingoSection
)
default boolean notifyBingo() {
return false;
}

@ConfigItem(
keyName = "bingoSendImage",
name = "Send Image",
description = "Send image with the notification",
position = 181,
section = bingoSection
)
default boolean bingoSendImage() {
return false;
}

@ConfigItem(
keyName = "bingoItemAllowlist",
name = "Bingo Item Allowlist",
description = "Only notify for these items if Bingo is enabled (One item name per line; asterisks are wildcards)",
position = 182,
section = bingoSection
)
default String bingoItemAllowlist() {
return "";
}

@ConfigItem(
keyName = "bingoNotifyMessage",
name = "Bingo Notification Message",
description = "The message to be sent through the webhook.<br/>" +
"Use %USERNAME% to insert your username<br/>" +
"Use %LOOT% to insert the loot<br/>" +
"Use %SOURCE% to show the source of the loot",
position = 183,
section = bingoSection
)
default String bingoNotifyMessage() {
return "%USERNAME% has looted bingo item: \n\n%LOOT%\nFrom: %SOURCE%";
}

@ConfigItem(
keyName = "notifyExternal",
name = "Enable External Plugin Notifications",
description = "Enable notifications upon requests by other plugins",
position = 180,
position = 190,
section = externalSection
)
default boolean notifyExternal() {
Expand All @@ -2097,7 +2163,7 @@ default boolean notifyExternal() {
keyName = "externalSendImage",
name = "Send Image",
description = "Controls whether screenshots should be included with the notification",
position = 181,
position = 191,
section = externalSection
)
default ExternalScreenshotPolicy externalSendImage() {
Expand Down
Loading