Add sand to daily task indicator

This commit is contained in:
ShaunDreclin
2018-09-02 12:59:36 -04:00
parent f00a2aac39
commit e207106e29
3 changed files with 40 additions and 0 deletions

View File

@@ -76,4 +76,15 @@ public interface DailyTasksConfig extends Config
{
return true;
}
@ConfigItem(
position = 5,
keyName = "showSand",
name = "Show Claimable Sand",
description = "Show a message when you can collect your daily sand from Bert."
)
default boolean showSand()
{
return true;
}
}

View File

@@ -64,6 +64,9 @@ public class DailyTasksPlugin extends Plugin
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 RELOG_MESSAGE = " (Requires relog)";
@Inject
@@ -133,6 +136,11 @@ public class DailyTasksPlugin extends Plugin
{
checkRunes(dailyReset);
}
if (config.showSand())
{
checkSand(dailyReset);
}
}
}
@@ -197,6 +205,21 @@ public class DailyTasksPlugin extends Plugin
}
}
private void checkSand(boolean dailyReset)
{
if (client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE)
{
if (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0)
{
sendChatMessage(SAND_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(SAND_MESSAGE + RELOG_MESSAGE);
}
}
}
private void sendChatMessage(String chatMessage)
{
final String message = new ChatMessageBuilder()