Add daily runes to Daily Notifications plugin (#5219)

This commit is contained in:
astaninger
2018-09-17 02:27:26 -07:00
committed by Tomas Slusny
parent 73bb4648d6
commit 45cb0bcde7
3 changed files with 31 additions and 3 deletions

View File

@@ -352,6 +352,7 @@ public enum Varbits
DAILY_HERB_BOX(3961),
DAILY_STAVES(4539),
DAILY_ESSENCE(4547),
DAILY_RUNES(4540),
/**
* Fairy Ring

View File

@@ -66,4 +66,16 @@ public interface DailyTasksConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "showRunes",
name = "Show Claimable Random Runes",
description = "Configures whether or not to show a message when you can" +
" collect your daily random runes from Lundail",
position = 4
)
default boolean showRunes()
{
return true;
}
}

View File

@@ -59,7 +59,7 @@ public class DailyTasksPlugin extends Plugin
@Inject
private ChatMessageManager chatMessageManager;
private boolean hasSentHerbMsg, hasSentStavesMsg, hasSentEssenceMsg, check;
private boolean hasSentHerbMsg, hasSentStavesMsg, hasSentEssenceMsg, hasSentRunesMsg, check;
@Provides
DailyTasksConfig provideConfig(ConfigManager configManager)
@@ -70,13 +70,13 @@ public class DailyTasksPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
hasSentHerbMsg = hasSentStavesMsg = hasSentEssenceMsg = false;
hasSentHerbMsg = hasSentStavesMsg = hasSentEssenceMsg = hasSentRunesMsg = false;
}
@Override
protected void shutDown() throws Exception
{
hasSentHerbMsg = hasSentStavesMsg = hasSentEssenceMsg = false;
hasSentHerbMsg = hasSentStavesMsg = hasSentEssenceMsg = hasSentRunesMsg = false;
}
@Subscribe
@@ -95,6 +95,9 @@ public class DailyTasksPlugin extends Plugin
case "showEssence":
hasSentEssenceMsg = false;
break;
case "showRunes":
hasSentRunesMsg = false;
break;
}
}
}
@@ -139,6 +142,12 @@ public class DailyTasksPlugin extends Plugin
sendChatMessage("You have pure essence waiting to be collected from Wizard Cromperty.");
hasSentEssenceMsg = true;
}
if (config.showRunes() && !hasSentRunesMsg && checkCanCollectRunes())
{
sendChatMessage("You have random runes waiting to be collected from Lundail.");
hasSentRunesMsg = true;
}
}
private boolean checkCanCollectHerbBox()
@@ -160,6 +169,12 @@ public class DailyTasksPlugin extends Plugin
return value == 0; // 1 = can't claim
}
private boolean checkCanCollectRunes()
{
return client.getVar(Varbits.DIARY_WILDERNESS_EASY) == 1
&& client.getVar(Varbits.DAILY_RUNES) == 0;
}
private void sendChatMessage(String chatMessage)
{
final String message = new ChatMessageBuilder()