Skip to content

Commit

Permalink
Daily Task Indicators: delay the varbit check to allow them to initia…
Browse files Browse the repository at this point in the history
…lize
  • Loading branch information
leguaan authored and Adam- committed May 23, 2018
1 parent a56c32f commit da55841
Showing 1 changed file with 37 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Varbits;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.client.chat.ChatColor;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
Expand All @@ -61,7 +61,7 @@ public class DailyTasksPlugin extends Plugin
@Inject
private ChatMessageManager chatMessageManager;

private boolean hasSentHerbMsg, hasSentStavesMsg, hasSentEssenceMsg;
private boolean hasSentHerbMsg, hasSentStavesMsg, hasSentEssenceMsg, check;

@Provides
DailyTasksConfig provideConfig(ConfigManager configManager)
Expand Down Expand Up @@ -105,23 +105,42 @@ else if (event.getKey().equals("showEssence"))
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState().equals(GameState.LOGGED_IN))
switch (event.getGameState())
{
if (config.showHerbBoxes() && !hasSentHerbMsg && checkCanCollectHerbBox())
{
sendChatMessage("You have herb boxes waiting to be collected at NMZ.");
hasSentHerbMsg = true;
}
if (config.showStaves() && !hasSentStavesMsg && checkCanCollectStaves())
{
sendChatMessage("You have staves waiting to be collected from Zaff.");
hasSentStavesMsg = true;
}
if (config.showEssence() && !hasSentEssenceMsg && checkCanCollectEssence())
{
sendChatMessage("You have pure essence waiting to be collected from Wizard Cromperty.");
hasSentEssenceMsg = true;
}
case HOPPING:
case LOGGED_IN:
//load the varbits on first available tick
check = true;
break;
}
}

@Subscribe
public void onGameTick(GameTick event)
{
if (!check)
{
return;
}

check = false;

if (config.showHerbBoxes() && !hasSentHerbMsg && checkCanCollectHerbBox())
{
sendChatMessage("You have herb boxes waiting to be collected at NMZ.");
hasSentHerbMsg = true;
}

if (config.showStaves() && !hasSentStavesMsg && checkCanCollectStaves())
{
sendChatMessage("You have staves waiting to be collected from Zaff.");
hasSentStavesMsg = true;
}

if (config.showEssence() && !hasSentEssenceMsg && checkCanCollectEssence())
{
sendChatMessage("You have pure essence waiting to be collected from Wizard Cromperty.");
hasSentEssenceMsg = true;
}
}

Expand Down

0 comments on commit da55841

Please sign in to comment.