Add Flax and Bonemeal options to Daily Task plugin

This commit is contained in:
Hydrox6
2018-12-19 17:43:52 +00:00
parent e8d0d03d3e
commit 3c5d48cc87
3 changed files with 81 additions and 5 deletions

View File

@@ -359,6 +359,12 @@ public enum Varbits
DAILY_ESSENCE_COLLECTED(4547),
DAILY_RUNES_COLLECTED(4540),
DAILY_SAND_COLLECTED(4549),
DAILY_FLAX_STATE(4559),
/**
* This varbit tracks how much bonemeal has been redeemed from Robin
* The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39
*/
DAILY_BONEMEAL_STATE(4543),
/**
* Fairy Ring

View File

@@ -87,4 +87,26 @@ public interface DailyTasksConfig extends Config
{
return true;
}
@ConfigItem(
position = 6,
keyName = "showFlax",
name = "Show Claimable Bow Strings",
description = "Show a message when you can convert noted flax to bow strings with the Flax keeper."
)
default boolean showFlax()
{
return true;
}
@ConfigItem(
position = 7,
keyName = "showBonemeal",
name = "Show Claimable Bonemeal & Slime",
description = "Show a message when you can collect bonemeal & slime from Robin."
)
default boolean showBonemeal()
{
return true;
}
}

View File

@@ -57,16 +57,14 @@ public class DailyTasksPlugin extends Plugin
private static final String HERB_BOX_MESSAGE = "You have herb boxes waiting to be collected at NMZ.";
private static final int HERB_BOX_MAX = 15;
private static final int HERB_BOX_COST = 9500;
private static final String STAVES_MESSAGE = "You have battlestaves waiting to be collected from Zaff.";
private static final String ESSENCE_MESSAGE = "You have essence waiting to be collected from Wizard Cromperty.";
private static final String RUNES_MESSAGE = "You have random runes waiting to be collected from Lundail.";
private static final String SAND_MESSAGE = "You have sand waiting to be collected from Bert.";
private static final int SAND_QUEST_COMPLETE = 160;
private static final String FLAX_MESSAGE = "You have bowstrings waiting to be converted from flax from the Flax keeper.";
private static final String BONEMEAL_MESSAGE = "You have bonemeal and slime waiting to be collected from Robin.";
private static final int BONEMEAL_PER_DIARY = 13;
private static final String RELOG_MESSAGE = " (Requires relog)";
@Inject
@@ -141,6 +139,16 @@ public class DailyTasksPlugin extends Plugin
{
checkSand(dailyReset);
}
if (config.showFlax())
{
checkFlax(dailyReset);
}
if (config.showBonemeal())
{
checkBonemeal(dailyReset);
}
}
}
@@ -220,6 +228,46 @@ public class DailyTasksPlugin extends Plugin
}
}
private void checkFlax(boolean dailyReset)
{
if (client.getVar(Varbits.DIARY_KANDARIN_EASY) == 1)
{
if (client.getVar(Varbits.DAILY_FLAX_STATE) == 0)
{
sendChatMessage(FLAX_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(FLAX_MESSAGE + RELOG_MESSAGE);
}
}
}
private void checkBonemeal(boolean dailyReset)
{
if (client.getVar(Varbits.DIARY_MORYTANIA_MEDIUM) == 1)
{
int collected = client.getVar(Varbits.DAILY_BONEMEAL_STATE);
int max = BONEMEAL_PER_DIARY;
if (client.getVar(Varbits.DIARY_MORYTANIA_HARD) == 1)
{
max += BONEMEAL_PER_DIARY;
if (client.getVar(Varbits.DIARY_MORYTANIA_ELITE) == 1)
{
max += BONEMEAL_PER_DIARY;
}
}
if (collected < max)
{
sendChatMessage(BONEMEAL_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(BONEMEAL_MESSAGE + RELOG_MESSAGE);
}
}
}
private void sendChatMessage(String chatMessage)
{
final String message = new ChatMessageBuilder()