woodcutting: Add clue nest notification config (#14132)
This commit is contained in:
@@ -31,15 +31,22 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.verifyNoInteractions;
|
||||
import static org.mockito.Mockito.verifyNoMoreInteractions;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
@@ -127,4 +134,119 @@ public class WoodcuttingPluginTest
|
||||
woodcuttingPlugin.onChatMessage(chatMessage);
|
||||
verifyNoMoreInteractions(notifier);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestConfigSameAsSpawn()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem beginnerTileItem = mock(TileItem.class);
|
||||
when(beginnerTileItem.getId()).thenReturn(ItemID.CLUE_NEST_BEGINNER);
|
||||
ItemSpawned beginnerClueSpawned = new ItemSpawned(tile, beginnerTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
when(woodcuttingConfig.clueNestNotifyTier()).thenReturn(ClueNestTier.BEGINNER);
|
||||
woodcuttingPlugin.onItemSpawned(beginnerClueSpawned);
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verify(notifier).notify("A bird nest has spawned!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestConfigSmallerThanSpawn()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem eliteTileItem = mock(TileItem.class);
|
||||
when(eliteTileItem.getId()).thenReturn(ItemID.CLUE_NEST_ELITE);
|
||||
ItemSpawned eliteClueSpawned = new ItemSpawned(tile, eliteTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
when(woodcuttingConfig.clueNestNotifyTier()).thenReturn(ClueNestTier.BEGINNER);
|
||||
woodcuttingPlugin.onItemSpawned(eliteClueSpawned);
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verify(notifier).notify("A bird nest has spawned!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestDisabledConfig()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem eliteTileItem = mock(TileItem.class);
|
||||
when(eliteTileItem.getId()).thenReturn(ItemID.CLUE_NEST_ELITE);
|
||||
ItemSpawned eliteClueSpawned = new ItemSpawned(tile, eliteTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
when(woodcuttingConfig.clueNestNotifyTier()).thenReturn(ClueNestTier.DISABLED);
|
||||
woodcuttingPlugin.onItemSpawned(eliteClueSpawned);
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verifyNoInteractions(notifier);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestConfigLargerThanSpawn()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem beginnerTileItem = mock(TileItem.class);
|
||||
when(beginnerTileItem.getId()).thenReturn(ItemID.CLUE_NEST_BEGINNER);
|
||||
ItemSpawned beginnerClueSpawned = new ItemSpawned(tile, beginnerTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
when(woodcuttingConfig.clueNestNotifyTier()).thenReturn(ClueNestTier.HARD);
|
||||
woodcuttingPlugin.onItemSpawned(beginnerClueSpawned);
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verifyNoInteractions(notifier);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestPlayerDrop()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem beginnerTileItem = mock(TileItem.class);
|
||||
when(beginnerTileItem.getId()).thenReturn(ItemID.CLUE_NEST_BEGINNER);
|
||||
ItemSpawned beginnerClueSpawned = new ItemSpawned(tile, beginnerTileItem);
|
||||
TileItem nestTileItem = mock(TileItem.class);
|
||||
when(nestTileItem.getId()).thenReturn(ItemID.BIRD_NEST_22798);
|
||||
ItemSpawned regularNestSpawned = new ItemSpawned(tile, nestTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
|
||||
// Player drops clue nest
|
||||
woodcuttingPlugin.onItemSpawned(beginnerClueSpawned);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verifyNoInteractions(notifier);
|
||||
// A regular nest has spawned
|
||||
woodcuttingPlugin.onItemSpawned(regularNestSpawned);
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verify(notifier).notify("A bird nest has spawned!");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClueNestOtherItemSpawn()
|
||||
{
|
||||
ChatMessage nestChatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
|
||||
Tile tile = mock(Tile.class);
|
||||
TileItem beginnerTileItem = mock(TileItem.class);
|
||||
when(beginnerTileItem.getId()).thenReturn(ItemID.CLUE_NEST_BEGINNER);
|
||||
ItemSpawned beginnerClueSpawned = new ItemSpawned(tile, beginnerTileItem);
|
||||
TileItem anotherItemTileItem = mock(TileItem.class);
|
||||
ItemSpawned anotherItemSpawned = new ItemSpawned(tile, anotherItemTileItem);
|
||||
|
||||
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
|
||||
when(woodcuttingConfig.clueNestNotifyTier()).thenReturn(ClueNestTier.BEGINNER);
|
||||
|
||||
woodcuttingPlugin.onItemSpawned(beginnerClueSpawned);
|
||||
woodcuttingPlugin.onItemSpawned(anotherItemSpawned);
|
||||
|
||||
woodcuttingPlugin.onChatMessage(nestChatMessage);
|
||||
woodcuttingPlugin.onGameTick(null);
|
||||
verify(notifier).notify("A bird nest has spawned!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user