Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-10-28 11:01:49 +02:00
16 changed files with 918 additions and 593 deletions

View File

@@ -28,9 +28,8 @@ package net.runelite.cache.script;
import java.util.HashMap;
import java.util.Map;
import static net.runelite.cache.script.Opcodes.*;
public class Instructions
public class Instructions implements Opcodes
{
private final Map<Integer, Instruction> instructions = new HashMap<>();
private final Map<String, Instruction> instructionsByName = new HashMap<>();

File diff suppressed because it is too large Load Diff

View File

@@ -22,12 +22,9 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.script;
package net.runelite.cache.script;
import static net.runelite.api.Opcodes.RUNELITE_EXECUTE;
import net.runelite.cache.script.Instructions;
public class RuneLiteInstructions extends Instructions
public class RuneLiteInstructions extends Instructions implements RuneLiteOpcodes
{
@Override
public void init()

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,25 +22,12 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
package net.runelite.cache.script;
/**
* Utility class containing ASM opcodes used by the RuneLite client.
*/
public class Opcodes
public interface RuneLiteOpcodes extends Opcodes
{
/**
* opcode used to return from scripts.
*/
public static final int RETURN = 21;
/**
* opcode used to invoke scripts.
*/
public static final int INVOKE = 40;
/**
* RuneLite execution opcode used to inject scripts.
*/
public static final int RUNELITE_EXECUTE = 6599;
int RUNELITE_EXECUTE = 6599;
}

View File

@@ -32,7 +32,6 @@ dependencies {
compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion)
implementation(project(":runelite-api"))
implementation(group = "com.google.code.gson", name = "gson", version = "2.8.5")
implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre")
implementation(group = "com.squareup.okhttp3", name = "okhttp", version = "4.9.1")

View File

@@ -30,6 +30,8 @@ dependencies {
compileOnly(group = "org.projectlombok", name = "lombok", version = ProjectVersions.lombokVersion)
api(project(":cache"))
implementation(group = "com.google.code.findbugs", name = "jsr305", version = "3.0.2")
implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre")
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")

View File

@@ -776,6 +776,12 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
final Scene scene = client.getScene();
scene.setDrawDistance(getDrawDistance());
// Only reset the target buffer offset right before drawing the scene. That way if there are frames
// after this that don't involve a scene draw, like during LOADING/HOPPING/CONNECTION_LOST, we can
// still redraw the previous frame's scene to emulate the client behavior of not painting over the
// viewport buffer.
targetBufferOffset = 0;
invokeOnMainThread(() ->
{
// UBO. Only the first 32 bytes get modified here, the rest is the constant sin/cos table.
@@ -1028,22 +1034,10 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
}
private void drawFrame(int overlayColor)
{
if (jawtWindow.getAWTComponent() != client.getCanvas())
{
// We inject code in the game engine mixin to prevent the client from doing canvas replacement,
// so this should not ever be hit
log.warn("Canvas invalidated!");
shutDown();
startUp();
return;
}
if (client.getGameState() == GameState.LOADING || client.getGameState() == GameState.HOPPING)
{
// While the client is loading it doesn't draw
return;
}
// so this should not ever be tripped
assert jawtWindow.getAWTComponent() == client.getCanvas() : "canvas invalidated";
final int canvasHeight = client.getCanvasHeight();
final int canvasWidth = client.getCanvasWidth();
@@ -1105,7 +1099,8 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
// Draw 3d scene
final TextureProvider textureProvider = client.getTextureProvider();
if (textureProvider != null)
final GameState gameState = client.getGameState();
if (textureProvider != null && gameState.getState() >= GameState.LOADING.getState())
{
if (textureArrayId == -1)
{
@@ -1265,7 +1260,6 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
modelBufferSmall.clear();
modelBufferUnordered.clear();
targetBufferOffset = 0;
smallModels = largeModels = unorderedModels = 0;
tempOffset = 0;
tempUvOffset = 0;

View File

@@ -272,19 +272,15 @@ class SkillCalculator extends JPanel
private void adjustCheckboxes(JCheckBox target, SkillBonus bonus)
{
adjustXPBonus(0);
bonusCheckBoxes.forEach(otherSelectedCheckbox ->
for (JCheckBox otherSelectedCheckbox : bonusCheckBoxes)
{
if (otherSelectedCheckbox != target)
{
otherSelectedCheckbox.setSelected(false);
}
});
if (target.isSelected())
{
adjustXPBonus(bonus.getValue());
}
adjustXPBonus(target.isSelected() ? bonus.getValue() : 0f);
}
private void renderActionSlots()
@@ -347,7 +343,8 @@ class SkillCalculator extends JPanel
int actionCount = 0;
int neededXP = targetXP - currentXP;
SkillAction action = slot.getAction();
double xp = (action.isIgnoreBonus()) ? action.getXp() : action.getXp() * xpFactor;
final float bonus = action.isIgnoreBonus() ? 1f : xpFactor;
final double xp = Math.round(action.getXp() * bonus * 10f) / 10d;
if (neededXP > 0)
{

View File

@@ -86,4 +86,15 @@ public interface SpecialCounterConfig extends Config
{
return 0;
}
@ConfigItem(
position = 5,
keyName = "bulwarkThreshold",
name = "Dinh's Bulwark",
description = "Threshold for Dinh's Bulwark (0 to disable)"
)
default int bulwarkThreshold()
{
return 0;
}
}

View File

@@ -40,7 +40,7 @@ enum SpecialWeapon
BARRELCHEST_ANCHOR("Barrelchest Anchor", new int[]{ItemID.BARRELCHEST_ANCHOR}, true, (c) -> 0),
BONE_DAGGER("Bone Dagger", new int[]{ItemID.BONE_DAGGER, ItemID.BONE_DAGGER_P, ItemID.BONE_DAGGER_P_8876, ItemID.BONE_DAGGER_P_8878}, true, (c) -> 0),
DORGESHUUN_CROSSBOW("Dorgeshuun Crossbow", new int[]{ItemID.DORGESHUUN_CROSSBOW}, true, (c) -> 0),
BULWARK("Dinh's Bulwark", new int[]{ItemID.DINHS_BULWARK}, false, c -> 0);
BULWARK("Dinh's Bulwark", new int[]{ItemID.DINHS_BULWARK}, false, SpecialCounterConfig::bulwarkThreshold);
private final String name;
private final int[] itemID;

View File

@@ -28,6 +28,7 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Units;
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
@ConfigGroup("woodcutting")
public interface WoodcuttingConfig extends Config
@@ -57,6 +58,17 @@ public interface WoodcuttingConfig extends Config
@ConfigItem(
position = 3,
keyName = "clueNestNotifyTier",
name = "Clue nest notification",
description = "Configures the clue tier from which to start notifying of a clue nest spawn"
)
default ClueNestTier clueNestNotifyTier()
{
return ClueNestTier.BEGINNER;
}
@ConfigItem(
position = 4,
keyName = "showWoodcuttingStats",
name = "Show session stats",
description = "Configures whether to display woodcutting session stats"
@@ -67,7 +79,7 @@ public interface WoodcuttingConfig extends Config
}
@ConfigItem(
position = 4,
position = 5,
keyName = "showRedwoods",
name = "Show Redwood trees",
description = "Configures whether to show a indicator for redwood trees"
@@ -78,7 +90,7 @@ public interface WoodcuttingConfig extends Config
}
@ConfigItem(
position = 5,
position = 6,
keyName = "showRespawnTimers",
name = "Show respawn timers",
description = "Configures whether to display the respawn timer overlay"

View File

@@ -51,6 +51,7 @@ import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemSpawned;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -58,6 +59,7 @@ import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.woodcutting.config.ClueNestTier;
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
@@ -107,6 +109,7 @@ public class WoodcuttingPlugin extends Plugin
private final List<TreeRespawn> respawns = new ArrayList<>();
private boolean recentlyLoggedIn;
private int currentPlane;
private ClueNestTier clueTierSpawned;
@Provides
WoodcuttingConfig getConfig(ConfigManager configManager)
@@ -130,6 +133,7 @@ public class WoodcuttingPlugin extends Plugin
treeObjects.clear();
session = null;
axe = null;
clueTierSpawned = null;
}
@Subscribe
@@ -148,6 +152,7 @@ public class WoodcuttingPlugin extends Plugin
public void onGameTick(GameTick gameTick)
{
recentlyLoggedIn = false;
clueTierSpawned = null;
currentPlane = client.getPlane();
respawns.removeIf(TreeRespawn::isExpired);
@@ -189,9 +194,24 @@ public class WoodcuttingPlugin extends Plugin
}
if (event.getMessage().contains("A bird's nest falls out of the tree") && config.showNestNotification())
{
if (clueTierSpawned == null || clueTierSpawned.ordinal() >= config.clueNestNotifyTier().ordinal())
{
notifier.notify("A bird nest has spawned!");
}
// Clear the clue tier that has previously spawned
clueTierSpawned = null;
}
}
}
@Subscribe
public void onItemSpawned(ItemSpawned itemSpawned)
{
if (clueTierSpawned == null)
{
// This will be set only if one of the clue nests has spawned. It will then be reset the next game tick.
clueTierSpawned = ClueNestTier.getTierFromItem(itemSpawned.getItem().getId());
}
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2021, Tal <https://github.com/talsk>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.woodcutting.config;
import com.google.common.collect.ImmutableMap;
import net.runelite.api.ItemID;
public enum ClueNestTier
{
BEGINNER,
EASY,
MEDIUM,
HARD,
ELITE,
DISABLED;
private static final ImmutableMap<Integer, ClueNestTier> CLUE_NEST_ID_TO_TIER = new ImmutableMap.Builder<Integer, ClueNestTier>()
.put(ItemID.CLUE_NEST_ELITE, ClueNestTier.ELITE)
.put(ItemID.CLUE_NEST_HARD, ClueNestTier.HARD)
.put(ItemID.CLUE_NEST_MEDIUM, ClueNestTier.MEDIUM)
.put(ItemID.CLUE_NEST_EASY, ClueNestTier.EASY)
.put(ItemID.CLUE_NEST_BEGINNER, ClueNestTier.BEGINNER)
.build();
static public ClueNestTier getTierFromItem(int itemId)
{
return CLUE_NEST_ID_TO_TIER.get(itemId);
}
}

View File

@@ -0,0 +1,252 @@
/*
* Copyright (c) 2020, Jordan Zomerlei <https://github.com/JZomerlei>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.woodcutting;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
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;
@RunWith(MockitoJUnitRunner.class)
public class WoodcuttingPluginTest
{
private static final String BIRDS_NEST_MESSAGE = "A bird's nest falls out of the tree.";
@Inject
WoodcuttingPlugin woodcuttingPlugin;
@Mock
@Bind
WoodcuttingConfig woodcuttingConfig;
@Mock
@Bind
Notifier notifier;
@Mock
@Bind
Client client;
@Mock
@Bind
WoodcuttingOverlay woodcuttingOverlay;
@Mock
@Bind
WoodcuttingTreesOverlay woodcuttingTreesOverlay;
@Mock
@Bind
OverlayManager overlayManager;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
}
@Test
public void testLogs()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some logs.", "", 0);
woodcuttingPlugin.onChatMessage(chatMessage);
assertNotNull(woodcuttingPlugin.getSession());
}
@Test
public void testOakLogs()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some oak logs.", "", 0);
woodcuttingPlugin.onChatMessage(chatMessage);
assertNotNull(woodcuttingPlugin.getSession());
}
@Test
public void testArcticLogs()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get an arctic log.", "", 0);
woodcuttingPlugin.onChatMessage(chatMessage);
assertNotNull(woodcuttingPlugin.getSession());
}
@Test
public void testMushrooms()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", "You get some mushrooms.", "", 0);
woodcuttingPlugin.onChatMessage(chatMessage);
assertNotNull(woodcuttingPlugin.getSession());
}
@Test
public void testBirdsNest()
{
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.GAMEMESSAGE, "", BIRDS_NEST_MESSAGE, "", 0);
when(woodcuttingConfig.showNestNotification()).thenReturn(true);
woodcuttingPlugin.onChatMessage(chatMessage);
verify(notifier).notify("A bird nest has spawned!");
when(woodcuttingConfig.showNestNotification()).thenReturn(false);
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!");
}
}

View File

@@ -27,7 +27,6 @@ package net.runelite.mixins;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static net.runelite.api.Opcodes.*;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.ScriptPostFired;
import net.runelite.api.events.ScriptPreFired;
@@ -37,6 +36,9 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.api.widgets.JavaScriptCallback;
import static net.runelite.cache.script.Opcodes.INVOKE;
import static net.runelite.cache.script.Opcodes.RETURN;
import static net.runelite.cache.script.RuneLiteOpcodes.RUNELITE_EXECUTE;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSScript;
import net.runelite.rs.api.RSScriptEvent;

View File

@@ -33,6 +33,7 @@ import java.io.IOException;
import net.runelite.cache.IndexType;
import net.runelite.cache.definitions.ScriptDefinition;
import net.runelite.cache.definitions.savers.ScriptSaver;
import net.runelite.cache.script.RuneLiteInstructions;
import net.runelite.cache.script.assembler.Assembler;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;