idle notifier: add spec regen notifier
Co-authored-by: Justin Kufro <kufroj@gmail.com>
This commit is contained in:
@@ -35,6 +35,7 @@ import net.runelite.api.Hitsplat;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -44,9 +45,11 @@ import net.runelite.client.Notifier;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Matchers;
|
||||
import static org.mockito.Matchers.any;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
@@ -255,4 +258,18 @@ public class IdleNotifierPluginTest
|
||||
plugin.onGameTick(new GameTick());
|
||||
verify(notifier, times(1)).notify(any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSpecRegen()
|
||||
{
|
||||
when(config.getSpecEnergyThreshold()).thenReturn(50);
|
||||
|
||||
when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(400); // 40%
|
||||
plugin.onGameTick(new GameTick()); // once to set lastSpecEnergy to 400
|
||||
verify(notifier, never()).notify(any());
|
||||
|
||||
when(client.getVar(Matchers.eq(VarPlayer.SPECIAL_ATTACK_PERCENT))).thenReturn(500); // 50%
|
||||
plugin.onGameTick(new GameTick());
|
||||
verify(notifier).notify(Matchers.eq("[" + PLAYER_NAME + "] has restored spec energy!"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user