Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-04-06 23:28:41 +02:00
9 changed files with 162 additions and 112 deletions

View File

@@ -94,7 +94,7 @@ public enum HiscoreSkill
KALPHITE_QUEEN("Kalphite Queen", BOSS),
KING_BLACK_DRAGON("King Black Dragon", BOSS),
KRAKEN("Kraken", BOSS),
KREEARRA("Kree'Arra", BOSS),
KREEARRA("Kree'arra", BOSS),
KRIL_TSUTSAROTH("K'ril Tsutsaroth", BOSS),
MIMIC("Mimic", BOSS),
NEX("Nex", BOSS),

View File

@@ -54,7 +54,7 @@ public interface BoostsConfig extends Config
)
default DisplayBoosts displayBoosts()
{
return DisplayBoosts.BOTH;
return DisplayBoosts.COMBAT;
}
@ConfigItem(
@@ -76,7 +76,7 @@ public interface BoostsConfig extends Config
)
default boolean displayInfoboxes()
{
return false;
return true;
}
@ConfigItem(

View File

@@ -1339,13 +1339,8 @@ public class ChatCommandsPlugin extends Plugin
search = message.substring(LEVEL_COMMAND_STRING.length() + 1);
}
search = SkillAbbreviations.getFullName(search);
final HiscoreSkill skill;
try
{
skill = HiscoreSkill.valueOf(search.toUpperCase());
}
catch (IllegalArgumentException i)
final HiscoreSkill skill = findHiscoreSkill(search);
if (skill == null)
{
return;
}
@@ -1967,11 +1962,6 @@ public class ChatCommandsPlugin extends Plugin
case "hmt":
return "Theatre of Blood Hard Mode";
// agility course
case "prif":
case "prifddinas":
return "Prifddinas Agility Course";
// The Gauntlet
case "gaunt":
case "gauntlet":
@@ -2022,6 +2012,26 @@ public class ChatCommandsPlugin extends Plugin
case "hs 5":
return "Hallowed Sepulchre Floor 5";
// Prifddinas Agility Course
case "prif":
case "prifddinas":
return "Prifddinas Agility Course";
// Shayzien Basic Agility Course
case "shayb":
case "sbac":
case "shayzienbasic":
case "shayzien basic":
return "Shayzien Basic Agility Course";
// Shayzien Advanced Agility Course
case "shaya":
case "saac":
case "shayadv":
case "shayadvanced":
case "shayzien advanced":
return "Shayzien Advanced Agility Course";
// Ape Atoll Agility
case "aa":
case "ape atoll":
@@ -2156,4 +2166,94 @@ public class ChatCommandsPlugin extends Plugin
return WordUtils.capitalize(boss);
}
}
private static String longSkillName(String skill)
{
switch (skill.toUpperCase())
{
case "ATK":
case "ATT":
return net.runelite.api.Skill.ATTACK.getName();
case "DEF":
return net.runelite.api.Skill.DEFENCE.getName();
case "STR":
return net.runelite.api.Skill.STRENGTH.getName();
case "HEALTH":
case "HIT":
case "HITPOINT":
case "HP":
return net.runelite.api.Skill.HITPOINTS.getName();
case "RANGE":
case "RANGING":
case "RNG":
return net.runelite.api.Skill.RANGED.getName();
case "PRAY":
return net.runelite.api.Skill.PRAYER.getName();
case "MAG":
case "MAGE":
return net.runelite.api.Skill.MAGIC.getName();
case "COOK":
return net.runelite.api.Skill.COOKING.getName();
case "WC":
case "WOOD":
case "WOODCUT":
return net.runelite.api.Skill.WOODCUTTING.getName();
case "FLETCH":
return net.runelite.api.Skill.FLETCHING.getName();
case "FISH":
return net.runelite.api.Skill.FISHING.getName();
case "FM":
case "FIRE":
return net.runelite.api.Skill.FIREMAKING.getName();
case "CRAFT":
return net.runelite.api.Skill.CRAFTING.getName();
case "SMITH":
return net.runelite.api.Skill.SMITHING.getName();
case "MINE":
return net.runelite.api.Skill.MINING.getName();
case "HL":
case "HERB":
return net.runelite.api.Skill.HERBLORE.getName();
case "AGI":
case "AGIL":
return net.runelite.api.Skill.AGILITY.getName();
case "THIEF":
return net.runelite.api.Skill.THIEVING.getName();
case "SLAY":
return net.runelite.api.Skill.SLAYER.getName();
case "FARM":
return net.runelite.api.Skill.FARMING.getName();
case "RC":
case "RUNE":
case "RUNECRAFTING":
return net.runelite.api.Skill.RUNECRAFT.getName();
case "HUNT":
return net.runelite.api.Skill.HUNTER.getName();
case "CON":
case "CONSTRUCT":
return net.runelite.api.Skill.CONSTRUCTION.getName();
case "ALL":
case "TOTAL":
return net.runelite.api.Skill.OVERALL.getName();
default:
return skill;
}
}
private static HiscoreSkill findHiscoreSkill(String search)
{
String s = longSkillName(search);
if (s == search)
{
s = longBossName(search);
}
for (HiscoreSkill skill : HiscoreSkill.values())
{
if (skill.getName().equals(s))
{
return skill;
}
}
return null;
}
}

View File

@@ -1,92 +0,0 @@
/*
* Copyright (c) 2017, 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.chatcommands;
import com.google.common.collect.ImmutableMap;
import java.util.Map;
import net.runelite.api.Skill;
class SkillAbbreviations
{
private static final Map<String, String> MAP;
static
{
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>();
builder.put("ATK", Skill.ATTACK.getName());
builder.put("ATT", Skill.ATTACK.getName());
builder.put("DEF", Skill.DEFENCE.getName());
builder.put("STR", Skill.STRENGTH.getName());
builder.put("HEALTH", Skill.HITPOINTS.getName());
builder.put("HIT", Skill.HITPOINTS.getName());
builder.put("HITPOINT", Skill.HITPOINTS.getName());
builder.put("HP", Skill.HITPOINTS.getName());
builder.put("RANGE", Skill.RANGED.getName());
builder.put("RANGING", Skill.RANGED.getName());
builder.put("RNG", Skill.RANGED.getName());
builder.put("PRAY", Skill.PRAYER.getName());
builder.put("MAG", Skill.MAGIC.getName());
builder.put("MAGE", Skill.MAGIC.getName());
builder.put("COOK", Skill.COOKING.getName());
builder.put("WC", Skill.WOODCUTTING.getName());
builder.put("WOOD", Skill.WOODCUTTING.getName());
builder.put("WOODCUT", Skill.WOODCUTTING.getName());
builder.put("FLETCH", Skill.FLETCHING.getName());
builder.put("FISH", Skill.FISHING.getName());
builder.put("FM", Skill.FIREMAKING.getName());
builder.put("FIRE", Skill.FIREMAKING.getName());
builder.put("CRAFT", Skill.CRAFTING.getName());
builder.put("SMITH", Skill.SMITHING.getName());
builder.put("MINE", Skill.MINING.getName());
builder.put("HL", Skill.HERBLORE.getName());
builder.put("HERB", Skill.HERBLORE.getName());
builder.put("AGI", Skill.AGILITY.getName());
builder.put("AGIL", Skill.AGILITY.getName());
builder.put("THIEF", Skill.THIEVING.getName());
builder.put("SLAY", Skill.SLAYER.getName());
builder.put("FARM", Skill.FARMING.getName());
builder.put("RC", Skill.RUNECRAFT.getName());
builder.put("RUNE", Skill.RUNECRAFT.getName());
builder.put("RUNECRAFTING", Skill.RUNECRAFT.getName());
builder.put("HUNT", Skill.HUNTER.getName());
builder.put("CON", Skill.CONSTRUCTION.getName());
builder.put("CONSTRUCT", Skill.CONSTRUCTION.getName());
builder.put("ALL", Skill.OVERALL.getName());
builder.put("TOTAL", Skill.OVERALL.getName());
MAP = builder.build();
}
/**
* Takes a string representing the name of a skill, and if abbreviated,
* expands it into its full canonical name. Case-insensitive.
*
* @param abbrev Skill name that may be abbreviated.
* @return Full skill name if recognized, else the original string.
*/
static String getFullName(String abbrev)
{
return MAP.getOrDefault(abbrev.toUpperCase(), abbrev);
}
}

View File

@@ -52,7 +52,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
new CipherClue("OVEXON", "Eluned", new WorldPoint(2289, 3144, 0), "Outside Lletya or in Prifddinas after Song of the Elves", "A question on elven crystal math. I have 5 and 3 crystals, large and small respectively. A large crystal is worth 10,000 coins and a small is worth but 1,000. How much are all my crystals worth?", "53,000"),
new CipherClue("VTYR APCNTGLW", "King Percival", new WorldPoint(2634, 4682, 1), "Fisher Realm, first floor. Fairy ring BJR", "How many cannons are on this here castle?", "5"),
new CipherClue("UZZU MUJHRKYYKJ", "Otto Godblessed", new WorldPoint(2501, 3487, 0), "Otto's Grotto", "How many pyre sites are found around this lake?", "3"),
new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower. Fairy ring DIS", "How many air runes would I need to cast 630 wind waves?", "3150"),
new CipherClue("USBJCPSO", "Wizard Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower. Fairy ring DIS", "How many air runes would I need to cast 630 wind waves?", "3150"),
new CipherClue("HCKTA IQFHCVJGT", "Fairy Godfather", new WorldPoint(2446, 4428, 0), "Zanaris throne room", "There are 3 inputs and 4 letters on each ring How many total individual fairy ring codes are possible?", "64"),
new CipherClue("ZSBKDO ZODO", "Pirate Pete", new WorldPoint(3680, 3537, 0), "Dock northeast of the Ectofunctus"),
new CipherClue("GBJSZ RVFFO", "Fairy Queen", new WorldPoint(2347, 4435, 0), "Fairy Resistance Hideout"),

View File

@@ -103,8 +103,8 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
private static final List<EmoteClue> CLUES = ImmutableList.of(
new EmoteClue("Beckon on the east coast of the Kharazi Jungle. Beware of double agents! Equip any vestment stole and a heraldic rune shield.", "Kharazi Jungle", NORTHEAST_CORNER_OF_THE_KHARAZI_JUNGLE, new WorldPoint(2954, 2933, 0), DOUBLE_AGENT_108, BECKON, any("Any stole", item(GUTHIX_STOLE), item(SARADOMIN_STOLE), item(ZAMORAK_STOLE), item(ARMADYL_STOLE), item(BANDOS_STOLE), item(ANCIENT_STOLE)), any("Any heraldic rune shield", item(RUNE_SHIELD_H1), item(RUNE_SHIELD_H2), item(RUNE_SHIELD_H3), item(RUNE_SHIELD_H4), item(RUNE_SHIELD_H5))),
new EmoteClue("Cheer in the Barbarian Agility Arena. Headbang before you talk to me. Equip a steel platebody, maple shortbow and a Wilderness cape.", "Barbarian Outpost", BARBARIAN_OUTPOST_OBSTACLE_COURSE, new WorldPoint(2552, 3556, 0), CHEER, HEADBANG, item(STEEL_PLATEBODY), item(MAPLE_SHORTBOW), range("Any team cape", TEAM1_CAPE, TEAM50_CAPE)),
new EmoteClue("Bow upstairs in the Edgeville Monastery. Equip a completed prayer book.", "Edgeville Monastery", SOUTHEAST_CORNER_OF_THE_MONASTERY, new WorldPoint(3056, 3484, 1), BOW, any("Any god book", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))),
new EmoteClue("Cheer in the Shadow dungeon. Equip a rune crossbow, climbing boots and any mitre.", "Shadow dungeon", ENTRANCE_OF_THE_CAVE_OF_DAMIS, new WorldPoint(2629, 5071, 0), CHEER, any("Any mitre", item(GUTHIX_MITRE), item(SARADOMIN_MITRE), item(ZAMORAK_MITRE), item(ANCIENT_MITRE), item(BANDOS_MITRE), item(ARMADYL_MITRE)), item(RUNE_CROSSBOW), item(CLIMBING_BOOTS), item(RING_OF_VISIBILITY)),
new EmoteClue("Bow upstairs in the Edgeville Monastery. Equip a completed prayer book.", "Edgeville Monastery", SOUTHEAST_CORNER_OF_THE_MONASTERY, new WorldPoint(3056, 3484, 1), BOW, any("Any god book", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS), item(HOLY_BOOK_OR), item(BOOK_OF_BALANCE_OR), item(UNHOLY_BOOK_OR), item(BOOK_OF_LAW_OR), item(BOOK_OF_WAR_OR), item(BOOK_OF_DARKNESS_OR))),
new EmoteClue("Cheer in the Shadow dungeon. Equip a rune crossbow, climbing boots and any mitre.", "Shadow dungeon", ENTRANCE_OF_THE_CAVE_OF_DAMIS, new WorldPoint(2629, 5071, 0), CHEER, any("Any mitre", item(GUTHIX_MITRE), item(SARADOMIN_MITRE), item(ZAMORAK_MITRE), item(ANCIENT_MITRE), item(BANDOS_MITRE), item(ARMADYL_MITRE)), any("Rune crossbow", item(RUNE_CROSSBOW), item(RUNE_CROSSBOW_OR)), item(CLIMBING_BOOTS), item(RING_OF_VISIBILITY)),
new EmoteClue("Cheer at the top of the agility pyramid. Beware of double agents! Equip a blue mystic robe top, and any rune heraldic shield.", "Agility Pyramid", AGILITY_PYRAMID, new WorldPoint(3043, 4697, 3), DOUBLE_AGENT_108, CHEER, item(MYSTIC_ROBE_TOP), any("Any rune heraldic shield", item(RUNE_SHIELD_H1), item(RUNE_SHIELD_H2), item(RUNE_SHIELD_H3), item(RUNE_SHIELD_H4), item(RUNE_SHIELD_H5))),
new EmoteClue("Dance in Iban's temple. Beware of double agents! Equip Iban's staff, a black mystic top and a black mystic bottom.", "Iban's temple", WELL_OF_VOYAGE, new WorldPoint(2011, 4712, 0), DOUBLE_AGENT_141, DANCE, any("Any iban's staff", item(IBANS_STAFF), item(IBANS_STAFF_U)), item(MYSTIC_ROBE_TOP_DARK), item(MYSTIC_ROBE_BOTTOM_DARK)),
new EmoteClue("Dance on the Fishing Platform. Equip barrows gloves, an amulet of glory and a dragon med helm.", "Fishing Platform", SOUTHEAST_CORNER_OF_THE_FISHING_PLATFORM, new WorldPoint(2782, 3273, 0), DANCE, any("Any amulet of glory", item(AMULET_OF_GLORY), item(AMULET_OF_GLORY1), item(AMULET_OF_GLORY2), item(AMULET_OF_GLORY3), item(AMULET_OF_GLORY4), item(AMULET_OF_GLORY5), item(AMULET_OF_GLORY6)), item(BARROWS_GLOVES), item(DRAGON_MED_HELM)),

View File

@@ -52,7 +52,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl
{
private static final List<FaloTheBardClue> CLUES = ImmutableList.of(
new FaloTheBardClue("A blood red weapon, a strong curved sword, found on the island of primate lords.", any("Dragon scimitar", item(DRAGON_SCIMITAR), item(DRAGON_SCIMITAR_OR))),
new FaloTheBardClue("A book that preaches of some great figure, lending strength, might and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS))),
new FaloTheBardClue("A book that preaches of some great figure, lending strength, might and vigour.", any("Any god book (must be complete)", item(HOLY_BOOK), item(BOOK_OF_BALANCE), item(UNHOLY_BOOK), item(BOOK_OF_LAW), item(BOOK_OF_WAR), item(BOOK_OF_DARKNESS), item(HOLY_BOOK_OR), item(BOOK_OF_BALANCE_OR), item(UNHOLY_BOOK_OR), item(BOOK_OF_LAW_OR), item(BOOK_OF_WAR_OR), item(BOOK_OF_DARKNESS_OR))),
new FaloTheBardClue("A bow of elven craft was made, it shimmers bright, but will soon fade.", any("Crystal Bow", item(CRYSTAL_BOW), item(CRYSTAL_BOW_24123))),
new FaloTheBardClue("A fiery axe of great inferno, when you use it, you'll wonder where the logs go.", any("Infernal axe", item(INFERNAL_AXE), item(INFERNAL_AXE_OR))),
new FaloTheBardClue("A mark used to increase one's grace, found atop a seer's place.", item(MARK_OF_GRACE)),

View File

@@ -36,6 +36,7 @@ import net.runelite.api.Item;
import net.runelite.api.ItemComposition;
import net.runelite.api.ItemContainer;
import net.runelite.api.VarClientInt;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -75,7 +76,8 @@ class InventoryViewerOverlay extends OverlayPanel
return null;
}
if (client.getVar(VarClientInt.INVENTORY_TAB) == 3 && config.hideIfInventoryActive())
if ((client.getVar(VarClientInt.INVENTORY_TAB) == 3 || client.getWidget(WidgetInfo.BANK_CONTAINER) != null)
&& config.hideIfInventoryActive())
{
return null;
}

View File

@@ -389,6 +389,46 @@ public class ChatCommandsPluginTest
verify(configManager).setRSProfileConfiguration("personalbest", "prifddinas agility course", 61.2);
}
@Test
public void testShayzienAdvancedAgilityLap()
{
// This sets lastBoss
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Shayzien Advanced Agility Course lap count is: <col=ff0000>2</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Lap duration: <col=ff0000>1:01</col> (new personal best).", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "shayzien advanced agility course", 61.0);
verify(configManager).setRSProfileConfiguration("killcount", "shayzien advanced agility course", 2);
// Precise times
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Lap duration: <col=ff0000>1:01.20</col> (new personal best).", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "shayzien advanced agility course", 61.2);
}
@Test
public void testShayzienBasicAgilityLap()
{
// This sets lastBoss
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your Shayzien Basic Agility Course lap count is: <col=ff0000>2</col>.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Lap duration: <col=ff0000>1:01</col> (new personal best).", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "shayzien basic agility course", 61.0);
verify(configManager).setRSProfileConfiguration("killcount", "shayzien basic agility course", 2);
// Precise times
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Lap duration: <col=ff0000>1:01.20</col> (new personal best).", null, 0);
chatCommandsPlugin.onChatMessage(chatMessage);
verify(configManager).setRSProfileConfiguration("personalbest", "shayzien basic agility course", 61.2);
}
@Test
public void testZukNewPb()
{