api: deprecate getVar(int) and use getVarbitValue(int)
getVarbitValue was originally for external plugins which could not modify the varbits enum, but now ints are used everywhere it is no longer necessary for two separate methods
This commit is contained in:
@@ -128,7 +128,7 @@ public class AttackStylesPluginTest
|
||||
when(strWidget.isHidden()).thenAnswer(x -> isStrHidden());
|
||||
|
||||
// equip type_4 weapon type on player
|
||||
when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal());
|
||||
when(client.getVarbitValue(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_4.ordinal());
|
||||
attackPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
// Verify there is a warned skill
|
||||
|
||||
@@ -216,10 +216,10 @@ public class ClueScrollPluginTest
|
||||
when(container.getItems()).thenReturn(inventory);
|
||||
when(container.contains(ItemID.RUNE_POUCH)).thenReturn(true);
|
||||
|
||||
when(client.getVar(Varbits.RUNE_POUCH_RUNE1)).thenReturn(9); // Cosmic Rune
|
||||
when(client.getVar(Varbits.RUNE_POUCH_AMOUNT1)).thenReturn(20);
|
||||
when(client.getVar(Varbits.RUNE_POUCH_RUNE3)).thenReturn(4); // Fire Rune
|
||||
when(client.getVar(Varbits.RUNE_POUCH_AMOUNT3)).thenReturn(4000);
|
||||
when(client.getVarbitValue(Varbits.RUNE_POUCH_RUNE1)).thenReturn(9); // Cosmic Rune
|
||||
when(client.getVarbitValue(Varbits.RUNE_POUCH_AMOUNT1)).thenReturn(20);
|
||||
when(client.getVarbitValue(Varbits.RUNE_POUCH_RUNE3)).thenReturn(4); // Fire Rune
|
||||
when(client.getVarbitValue(Varbits.RUNE_POUCH_AMOUNT3)).thenReturn(4000);
|
||||
|
||||
plugin.onItemContainerChanged(event);
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ public class MotherlodePluginTest
|
||||
motherlodePlugin.onGameStateChanged(gameStateChanged);
|
||||
|
||||
// Initial sack count
|
||||
when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(42);
|
||||
when(client.getVarbitValue(Varbits.SACK_NUMBER)).thenReturn(42);
|
||||
motherlodePlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
// Create before inventory
|
||||
@@ -129,7 +129,7 @@ public class MotherlodePluginTest
|
||||
when(client.getItemContainer(InventoryID.INVENTORY)).thenReturn(inventory);
|
||||
|
||||
// Withdraw 20
|
||||
when(client.getVar(Varbits.SACK_NUMBER)).thenReturn(22);
|
||||
when(client.getVarbitValue(Varbits.SACK_NUMBER)).thenReturn(22);
|
||||
motherlodePlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
inventory = mock(ItemContainer.class);
|
||||
|
||||
@@ -427,13 +427,13 @@ public class ScreenshotPluginTest
|
||||
{
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", COLLECTION_LOG_CHAT, null, 0);
|
||||
|
||||
when(client.getVar(Varbits.COLLECTION_LOG_NOTIFICATION)).thenReturn(1);
|
||||
when(client.getVarbitValue(Varbits.COLLECTION_LOG_NOTIFICATION)).thenReturn(1);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(screenshotPlugin).takeScreenshot("Collection log (Chompy bird hat)", "Collection Log");
|
||||
reset(screenshotPlugin);
|
||||
|
||||
when(client.getVar(Varbits.COLLECTION_LOG_NOTIFICATION)).thenReturn(3);
|
||||
when(client.getVarbitValue(Varbits.COLLECTION_LOG_NOTIFICATION)).thenReturn(3);
|
||||
screenshotPlugin.onChatMessage(chatMessageEvent);
|
||||
|
||||
verify(screenshotPlugin, never()).takeScreenshot(anyString(), anyString());
|
||||
@@ -490,7 +490,7 @@ public class ScreenshotPluginTest
|
||||
{
|
||||
when(screenshotConfig.screenshotCombatAchievements()).thenReturn(true);
|
||||
|
||||
when(client.getVar(Varbits.COMBAT_ACHIEVEMENTS_POPUP)).thenReturn(1);
|
||||
when(client.getVarbitValue(Varbits.COMBAT_ACHIEVEMENTS_POPUP)).thenReturn(1);
|
||||
|
||||
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "",
|
||||
"Congratulations, you've completed an easy combat task: <col=06600c>Handyman</col>.", null, 0);
|
||||
|
||||
@@ -454,7 +454,7 @@ public class TimersPluginTest
|
||||
public void testCorruptionCooldown()
|
||||
{
|
||||
when(timersConfig.showArceuusCooldown()).thenReturn(true);
|
||||
when(client.getVar(Varbits.CORRUPTION_COOLDOWN)).thenReturn(1);
|
||||
when(client.getVarbitValue(Varbits.CORRUPTION_COOLDOWN)).thenReturn(1);
|
||||
timersPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||
@@ -539,7 +539,7 @@ public class TimersPluginTest
|
||||
public void testImbuedHeartStart()
|
||||
{
|
||||
when(timersConfig.showImbuedHeart()).thenReturn(true);
|
||||
when(client.getVar(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(70);
|
||||
when(client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(70);
|
||||
timersPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||
@@ -554,7 +554,7 @@ public class TimersPluginTest
|
||||
{
|
||||
when(timersConfig.showImbuedHeart()).thenReturn(true);
|
||||
|
||||
when(client.getVar(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(70);
|
||||
when(client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(70);
|
||||
timersPlugin.onVarbitChanged(new VarbitChanged()); // Calls removeIf once (on createGameTimer)
|
||||
|
||||
ArgumentCaptor<Predicate<InfoBox>> prcaptor = ArgumentCaptor.forClass(Predicate.class);
|
||||
@@ -564,7 +564,7 @@ public class TimersPluginTest
|
||||
Predicate<InfoBox> pred = prcaptor.getValue();
|
||||
assertTrue(pred.test(imbuedHeartInfoBox));
|
||||
|
||||
when(client.getVar(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(0);
|
||||
when(client.getVarbitValue(Varbits.IMBUED_HEART_COOLDOWN)).thenReturn(0);
|
||||
timersPlugin.onVarbitChanged(new VarbitChanged()); // Calls removeIf once
|
||||
|
||||
verify(infoBoxManager, times(1)).addInfoBox(any());
|
||||
|
||||
@@ -80,10 +80,10 @@ public class WintertodtPluginTest
|
||||
{
|
||||
when(config.roundNotification()).thenReturn(15);
|
||||
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(35);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(35);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
//(15 * 50) / 30 = ~25
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(25);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(25);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
verify(notifier, times(1)).notify("Wintertodt round is about to start");
|
||||
@@ -94,10 +94,10 @@ public class WintertodtPluginTest
|
||||
{
|
||||
when(config.roundNotification()).thenReturn(10);
|
||||
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(20);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(20);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
//(10 * 50) / 30 = ~16
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(16);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(16);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
verify(notifier, times(1)).notify("Wintertodt round is about to start");
|
||||
@@ -108,10 +108,10 @@ public class WintertodtPluginTest
|
||||
{
|
||||
when(config.roundNotification()).thenReturn(5);
|
||||
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(10);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(10);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
//(5 * 50) / 30 = ~8
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(8);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(8);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
verify(notifier, times(1)).notify("Wintertodt round is about to start");
|
||||
@@ -122,17 +122,17 @@ public class WintertodtPluginTest
|
||||
{
|
||||
when(config.roundNotification()).thenReturn(5);
|
||||
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(0);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(0);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(10);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(10);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(8);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(8);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(6);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(6);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(5);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(5);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(4);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(4);
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
|
||||
verify(notifier, times(1)).notify("Wintertodt round is about to start");
|
||||
@@ -142,7 +142,7 @@ public class WintertodtPluginTest
|
||||
public void matchStartingNotification_shouldNotNotify_whenNoneOptionSelected()
|
||||
{
|
||||
when(config.roundNotification()).thenReturn(5);
|
||||
when(client.getVar(Varbits.WINTERTODT_TIMER)).thenReturn(25);
|
||||
when(client.getVarbitValue(Varbits.WINTERTODT_TIMER)).thenReturn(25);
|
||||
|
||||
wintertodtPlugin.onVarbitChanged(new VarbitChanged());
|
||||
verify(notifier, times(0)).notify("Wintertodt round is about to start");
|
||||
|
||||
Reference in New Issue
Block a user