Merge remote-tracking branch 'upstream/master' into maven-plugin-upgrades
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
<parent>
|
||||
<groupId>net.runelite</groupId>
|
||||
<artifactId>runelite-parent</artifactId>
|
||||
<version>1.5.24-SNAPSHOT</version>
|
||||
<version>1.5.25-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>client</artifactId>
|
||||
@@ -197,12 +197,6 @@
|
||||
<artifactId>runelite-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.runelite.rs</groupId>
|
||||
<artifactId>runescape-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.runelite</groupId>
|
||||
<artifactId>client-patch</artifactId>
|
||||
@@ -309,12 +303,6 @@
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>net.runelite.rs:runescape-api</artifact>
|
||||
<includes>
|
||||
<include>**</include>
|
||||
</includes>
|
||||
</filter>
|
||||
<filter>
|
||||
<artifact>net.runelite.pushingpixels:*</artifact>
|
||||
<includes>
|
||||
|
||||
@@ -39,8 +39,7 @@ class SessionClient
|
||||
{
|
||||
UUID open() throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
||||
.addPathSegment("session")
|
||||
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
@@ -62,8 +61,7 @@ class SessionClient
|
||||
|
||||
void ping(UUID uuid) throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
||||
.addPathSegment("session")
|
||||
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||
.addPathSegment("ping")
|
||||
.addQueryParameter("session", uuid.toString())
|
||||
.build();
|
||||
@@ -83,8 +81,7 @@ class SessionClient
|
||||
|
||||
void delete(UUID uuid) throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
||||
.addPathSegment("session")
|
||||
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||
.addQueryParameter("session", uuid.toString())
|
||||
.build();
|
||||
|
||||
|
||||
@@ -98,6 +98,7 @@ public class ChatCommandManager implements ChatboxInputListener
|
||||
case MODCHAT:
|
||||
case FRIENDSCHAT:
|
||||
case PRIVATECHAT:
|
||||
case MODPRIVATECHAT:
|
||||
case PRIVATECHATOUT:
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -101,8 +101,8 @@ public enum ItemMapping
|
||||
ITEM_ANGUISH_ORNAMENT_KIT(ANGUISH_ORNAMENT_KIT, NECKLACE_OF_ANGUISH_OR),
|
||||
ITEM_OCCULT_NECKLACE(OCCULT_NECKLACE, OCCULT_NECKLACE_OR),
|
||||
ITEM_OCCULT_ORNAMENT_KIT(OCCULT_ORNAMENT_KIT, OCCULT_NECKLACE_OR),
|
||||
ITE_AMULET_OF_FURY(AMULET_OF_FURY, AMULET_OF_FURY_OR),
|
||||
ITE_FURY_ORNAMENT_KIT(FURY_ORNAMENT_KIT, AMULET_OF_FURY_OR),
|
||||
ITEM_AMULET_OF_FURY(AMULET_OF_FURY, AMULET_OF_FURY_OR),
|
||||
ITEM_FURY_ORNAMENT_KIT(FURY_ORNAMENT_KIT, AMULET_OF_FURY_OR),
|
||||
ITEM_TORMENTED_BRACELET(TORMENTED_BRACELET, TORMENTED_BRACELET_OR),
|
||||
ITEM_TORMENTED_ORNAMENT_KIT(TORMENTED_ORNAMENT_KIT, TORMENTED_BRACELET_OR),
|
||||
|
||||
|
||||
@@ -30,20 +30,7 @@ import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Multimap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import static net.runelite.api.NullObjectID.NULL_10872;
|
||||
import static net.runelite.api.NullObjectID.NULL_10873;
|
||||
import static net.runelite.api.NullObjectID.NULL_12945;
|
||||
import static net.runelite.api.NullObjectID.NULL_18083;
|
||||
import static net.runelite.api.NullObjectID.NULL_18116;
|
||||
import static net.runelite.api.NullObjectID.NULL_18122;
|
||||
import static net.runelite.api.NullObjectID.NULL_18124;
|
||||
import static net.runelite.api.NullObjectID.NULL_18129;
|
||||
import static net.runelite.api.NullObjectID.NULL_18130;
|
||||
import static net.runelite.api.NullObjectID.NULL_18132;
|
||||
import static net.runelite.api.NullObjectID.NULL_18133;
|
||||
import static net.runelite.api.NullObjectID.NULL_18135;
|
||||
import static net.runelite.api.NullObjectID.NULL_18136;
|
||||
import static net.runelite.api.NullObjectID.NULL_3550;
|
||||
import static net.runelite.api.NullObjectID.*;
|
||||
import static net.runelite.api.ObjectID.*;
|
||||
import net.runelite.client.game.AgilityShortcut;
|
||||
|
||||
@@ -57,15 +44,15 @@ class Obstacles
|
||||
PLANK_3572, PLANK_3571, PLANK_3570, ROPE_SWING, PILLAR_3578, LOW_WALL, LOG_BALANCE, LOG_BALANCE_3557,
|
||||
BALANCING_LEDGE_3561, BALANCING_LEDGE, MONKEY_BARS_3564, BALANCING_ROPE, HAND_HOLDS_3583,
|
||||
// Draynor
|
||||
ROUGH_WALL, TIGHTROPE, TIGHTROPE_10075, NARROW_WALL, WALL_10084, GAP_10085, CRATE_10086, STILE_7527,
|
||||
ROUGH_WALL, TIGHTROPE, TIGHTROPE_11406, NARROW_WALL, WALL_11630, GAP_11631, CRATE_11632, STILE_7527,
|
||||
// Al-Kharid
|
||||
ROUGH_WALL_10093, TIGHTROPE_10284, CABLE, ZIP_LINE, TROPICAL_TREE_10357, ROOF_TOP_BEAMS,
|
||||
TIGHTROPE_10583, GAP_10352,
|
||||
ROUGH_WALL_11633, TIGHTROPE_14398, CABLE, ZIP_LINE, TROPICAL_TREE_14404, ROOF_TOP_BEAMS,
|
||||
TIGHTROPE_14409, GAP_14399,
|
||||
// Pyramid
|
||||
STAIRS_10857, LOW_WALL_10865, LEDGE_10860, PLANK_10868, GAP_10882, LEDGE_10886, STAIRS_10857, GAP_10884,
|
||||
GAP_10859, GAP_10861, LOW_WALL_10865, GAP_10859, LEDGE_10888, PLANK_10868, CLIMBING_ROCKS_10851, DOORWAY_10855,
|
||||
// Varrock
|
||||
ROUGH_WALL_10586, CLOTHES_LINE, GAP_10642, WALL_10777, GAP_10778, GAP_10779, GAP_10780, LEDGE_10781, EDGE,
|
||||
ROUGH_WALL_14412, CLOTHES_LINE, GAP_14414, WALL_14832, GAP_14833, GAP_14834, GAP_14835, LEDGE_14836, EDGE,
|
||||
// Penguin
|
||||
STEPPING_STONE_21120, STEPPING_STONE_21126, STEPPING_STONE_21128, STEPPING_STONE_21129,
|
||||
STEPPING_STONE_21130, STEPPING_STONE_21131, STEPPING_STONE_21132, STEPPING_STONE_21133,
|
||||
@@ -73,26 +60,26 @@ class Obstacles
|
||||
// Barbarian
|
||||
ROPESWING_23131, LOG_BALANCE_23144, OBSTACLE_NET_20211, BALANCING_LEDGE_23547, LADDER_16682, CRUMBLING_WALL_1948,
|
||||
// Canifis
|
||||
TALL_TREE_10819, GAP_10820, GAP_10821, GAP_10828, GAP_10822, POLEVAULT, GAP_10823, GAP_10832,
|
||||
TALL_TREE_14843, GAP_14844, GAP_14845, GAP_14848, GAP_14846, POLEVAULT, GAP_14847, GAP_14897,
|
||||
// Ape atoll
|
||||
STEPPING_STONE_15412, TROPICAL_TREE_15414, MONKEYBARS_15417, SKULL_SLOPE_15483, ROPE_15487, TROPICAL_TREE_16062,
|
||||
// Falador
|
||||
ROUGH_WALL_10833, TIGHTROPE_10834, HAND_HOLDS_10836, GAP_11161, GAP_11360, TIGHTROPE_11361,
|
||||
TIGHTROPE_11364, GAP_11365, LEDGE_11366, LEDGE_11367, LEDGE_11369, LEDGE_11370, EDGE_11371,
|
||||
ROUGH_WALL_14898, TIGHTROPE_14899, HAND_HOLDS_14901, GAP_14903, GAP_14904, TIGHTROPE_14905,
|
||||
TIGHTROPE_14911, GAP_14919, LEDGE_14920, LEDGE_14921, LEDGE_14922, LEDGE_14924, EDGE_14925,
|
||||
// Wilderness
|
||||
OBSTACLE_PIPE_23137, ROPESWING_23132, STEPPING_STONE_23556, LOG_BALANCE_23542, ROCKS_23640,
|
||||
// Seers
|
||||
WALL_11373, GAP_11374, TIGHTROPE_11378, GAP_11375, GAP_11376, EDGE_11377,
|
||||
WALL_14927, GAP_14928, TIGHTROPE_14932, GAP_14929, GAP_14930, EDGE_14931,
|
||||
// Dorgesh-Kaan
|
||||
CABLE_22569, CABLE_22572, LADDER_22564, JUTTING_WALL_22552, TUNNEL_22557, PYLON_22664,
|
||||
CONSOLE, BOILER_22635, STAIRS_22650, STAIRS_22651, STAIRS_22609, STAIRS_22608,
|
||||
// Pollniveach
|
||||
BASKET_11380, MARKET_STALL_11381, BANNER_11382, GAP_11383, TREE_11384, ROUGH_WALL_11385,
|
||||
MONKEYBARS, TREE_11389, DRYING_LINE,
|
||||
BASKET_14935, MARKET_STALL_14936, BANNER_14937, GAP_14938, TREE_14939, ROUGH_WALL_14940,
|
||||
MONKEYBARS, TREE_14944, DRYING_LINE,
|
||||
// Rellaka
|
||||
ROUGH_WALL_11391, GAP_11392, TIGHTROPE_11393, GAP_11395, GAP_11396, TIGHTROPE_11397, PILE_OF_FISH,
|
||||
ROUGH_WALL_14946, GAP_14947, TIGHTROPE_14987, GAP_14990, GAP_14991, TIGHTROPE_14992, PILE_OF_FISH,
|
||||
// Ardougne
|
||||
GAP_11406, GAP_11429, GAP_11430, STEEP_ROOF, GAP_11630, PLANK_11631, WOODEN_BEAMS,
|
||||
WOODEN_BEAMS, GAP_15609, PLANK_26635, GAP_15610, GAP_15611, STEEP_ROOF, GAP_15612,
|
||||
// Meiyerditch
|
||||
NULL_12945, ROCK_17958, ROCK_17959, ROCK_17960, BOAT_17961, NULL_18122, NULL_18124, WALL_RUBBLE,
|
||||
WALL_RUBBLE_18038, FLOORBOARDS, FLOORBOARDS_18071, FLOORBOARDS_18072, FLOORBOARDS_18073, NULL_18129, NULL_18130,
|
||||
@@ -103,7 +90,7 @@ class Obstacles
|
||||
FLOORBOARDS_18110, FLOORBOARDS_18112, FLOORBOARDS_18111, FLOORBOARDS_18114, FLOORBOARDS_18113,
|
||||
NULL_18116, FLOORBOARDS_18117, FLOORBOARDS_18118, STAIRS_DOWN, WALL_17980,
|
||||
// Werewolf
|
||||
STEPPING_STONE_11643, HURDLE, HURDLE_11639, HURDLE_11640, PIPE_11657, SKULL_SLOPE, ZIP_LINE_11644,
|
||||
STEPPING_STONE_11643, HURDLE, HURDLE_11639, HURDLE_11640, PIPE_11657, SKULL_SLOPE, ZIP_LINE,
|
||||
ZIP_LINE_11645, ZIP_LINE_11646
|
||||
);
|
||||
|
||||
|
||||
@@ -295,7 +295,8 @@ public class CannonPlugin extends Plugin
|
||||
cballsLeft = 0;
|
||||
}
|
||||
|
||||
if (event.getMessage().contains("You pick up the cannon"))
|
||||
if (event.getMessage().contains("You pick up the cannon")
|
||||
|| event.getMessage().contains("Your cannon has decayed. Speak to Nulodion to get a new one!"))
|
||||
{
|
||||
cannonPlaced = false;
|
||||
cballsLeft = 0;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Magic fTail
|
||||
* Copyright (c) 2019, osrs-music-map <osrs-music-map@users.noreply.github.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -63,4 +64,26 @@ public interface ChatFilterConfig extends Config
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "filterFriends",
|
||||
name = "Filter Friends",
|
||||
description = "Filter your friends' messages",
|
||||
position = 4
|
||||
)
|
||||
default boolean filterFriends()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "filterClan",
|
||||
name = "Filter Clan Chat Members",
|
||||
description = "Filter your clan chat members' messages",
|
||||
position = 5
|
||||
)
|
||||
default boolean filterClan()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Magic fTail
|
||||
* Copyright (c) 2019, osrs-music-map <osrs-music-map@users.noreply.github.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -35,6 +36,7 @@ import java.util.regex.PatternSyntaxException;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.OverheadTextChanged;
|
||||
@@ -97,7 +99,10 @@ public class ChatFilterPlugin extends Plugin
|
||||
|
||||
int[] intStack = client.getIntStack();
|
||||
int intStackSize = client.getIntStackSize();
|
||||
ChatMessageType chatMessageType = ChatMessageType.of(intStack[intStackSize - 1]);
|
||||
int messageType = intStack[intStackSize - 2];
|
||||
int messageId = intStack[intStackSize - 1];
|
||||
|
||||
ChatMessageType chatMessageType = ChatMessageType.of(messageType);
|
||||
|
||||
// Only filter public chat and private messages
|
||||
switch (chatMessageType)
|
||||
@@ -113,6 +118,13 @@ public class ChatFilterPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
MessageNode messageNode = (MessageNode) client.getMessages().get(messageId);
|
||||
String name = messageNode.getName();
|
||||
if (!shouldFilterPlayerMessage(name))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String[] stringStack = client.getStringStack();
|
||||
int stringStackSize = client.getStringStackSize();
|
||||
|
||||
@@ -122,7 +134,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
if (censoredMessage == null)
|
||||
{
|
||||
// Block the message
|
||||
intStack[intStackSize - 2] = 0;
|
||||
intStack[intStackSize - 3] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -134,7 +146,7 @@ public class ChatFilterPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onOverheadTextChanged(OverheadTextChanged event)
|
||||
{
|
||||
if (!(event.getActor() instanceof Player))
|
||||
if (!(event.getActor() instanceof Player) || !shouldFilterPlayerMessage(event.getActor().getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -149,6 +161,14 @@ public class ChatFilterPlugin extends Plugin
|
||||
event.getActor().setOverheadText(message);
|
||||
}
|
||||
|
||||
boolean shouldFilterPlayerMessage(String playerName)
|
||||
{
|
||||
boolean isMessageFromSelf = playerName.equals(client.getLocalPlayer().getName());
|
||||
return !isMessageFromSelf &&
|
||||
(config.filterFriends() || !client.isFriended(playerName, false)) &&
|
||||
(config.filterClan() || !client.isClanMember(playerName));
|
||||
}
|
||||
|
||||
String censorMessage(final String message)
|
||||
{
|
||||
String strippedMessage = jagexPrintableCharMatcher.retainFrom(message)
|
||||
|
||||
@@ -126,4 +126,15 @@ public interface ClanChatConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanTabChat",
|
||||
name = "Clan Tab Chat",
|
||||
description = "Allows clan chat without prepending '/' to messages when on clan tab",
|
||||
position = 8
|
||||
)
|
||||
default boolean clanTabChat()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,6 +60,7 @@ import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarClientStrChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -491,6 +492,19 @@ public class ClanChatPlugin extends Plugin
|
||||
activityBuffer.clear();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
|
||||
{
|
||||
if (!scriptCallbackEvent.getEventName().equalsIgnoreCase("clanchatInput"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final int[] intStack = client.getIntStack();
|
||||
final int size = client.getIntStackSize();
|
||||
intStack[size - 1] = config.clanTabChat() ? 1 : 0;
|
||||
}
|
||||
|
||||
int getClanAmount()
|
||||
{
|
||||
return clanMembers.size();
|
||||
|
||||
@@ -68,7 +68,9 @@ import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -76,6 +78,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.AnagramClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.BeginnerMapClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.CipherClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.ClueScroll;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.CoordinateClue;
|
||||
@@ -389,6 +392,18 @@ public class ClueScrollPlugin extends Plugin
|
||||
updateClue(findClueScroll());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() < WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD
|
||||
|| event.getGroupId() > WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateClue(BeginnerMapClue.forWidgetID(event.getGroupId()));
|
||||
}
|
||||
|
||||
public BufferedImage getClueScrollImage()
|
||||
{
|
||||
return itemManager.getImage(ItemID.CLUE_SCROLL_MASTER);
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Hydrox6 <ikada@protonmail.ch>
|
||||
* 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.cluescrolls.clues;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
|
||||
@Getter
|
||||
public class BeginnerMapClue extends MapClue implements LocationClueScroll
|
||||
{
|
||||
private static final ImmutableList<BeginnerMapClue> CLUES = ImmutableList.of(
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_CHAMPIONS_GUILD, new WorldPoint(3166, 3361, 0), "South West of the Champion's Guild"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_VARROCK_EAST_MINE, new WorldPoint(3290, 3374, 0), "Outside Varrock East Mine"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_DRAYNOR, new WorldPoint(3093, 3226, 0), "South of Draynor Village Bank"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_NORTH_OF_FALADOR, new WorldPoint(3043, 3398, 0), "In the standing stones north of Falador"),
|
||||
new BeginnerMapClue(WidgetID.BEGINNER_CLUE_MAP_WIZARDS_TOWER, new WorldPoint(3110, 3152, 0), "On the south side of the Wizard's Tower")
|
||||
);
|
||||
|
||||
private final int widgetGroupID;
|
||||
|
||||
private BeginnerMapClue(int widgetGroupID, WorldPoint location, String description)
|
||||
{
|
||||
super(-1, location, description);
|
||||
this.widgetGroupID = widgetGroupID;
|
||||
setRequiresSpade(true);
|
||||
}
|
||||
|
||||
// Beginner Map Clues all use the same ItemID, but the WidgetID used to display them is unique
|
||||
public static BeginnerMapClue forWidgetID(int widgetGroupID)
|
||||
{
|
||||
for (BeginnerMapClue clue : CLUES)
|
||||
{
|
||||
if (clue.widgetGroupID == widgetGroupID)
|
||||
{
|
||||
return clue;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
new CrypticClue("I am the one who watches the giants. The giants in turn watch me. I watch with two while they watch with one. Come seek where I may be.", "Kamfreena", new WorldPoint(2845, 3539, 0), "Speak to Kamfreena on the top floor of the Warriors' Guild."),
|
||||
new CrypticClue("In a town where wizards are known to gather, search upstairs in a large house to the north.", "Man", 375, new WorldPoint(2593, 3108, 1), "Search the chest upstairs in the house north of Yanille Wizard's Guild. Kill a man for the key."),
|
||||
new CrypticClue("Probably filled with wizards socks.", "Wizard", DRAWERS_350, new WorldPoint(3116, 9562, 0), "Search the drawers in the basement of the Wizard's Tower south of Draynor Village. Kill one of the Wizards for the key. Fairy ring DIS"),
|
||||
new CrypticClue("Even the seers say this clue goes right over their heads.", CRATE_26635, new WorldPoint(2707, 3488, 2), "Search the crate on the Seers Agility Course in Seers Village"),
|
||||
new CrypticClue("Even the seers say this clue goes right over their heads.", CRATE_14934, new WorldPoint(2707, 3488, 2), "Search the crate on the Seers Agility Course in Seers Village"),
|
||||
new CrypticClue("Speak to a Wyse man.", "Wyson the gardener", new WorldPoint(3026, 3378, 0), "Talk to Wyson the gardener at Falador Park."),
|
||||
new CrypticClue("You'll need to look for a town with a central fountain. Look for a locked chest in the town's chapel.", "Monk" , CLOSED_CHEST_5108, new WorldPoint(3256, 3487, 0), "Search the chest by the stairs in the Varrock church. Kill a Monk in Ardougne Monastery to obtain the key."),
|
||||
new CrypticClue("Talk to Ambassador Spanfipple in the White Knights Castle.", "Ambassador Spanfipple", new WorldPoint(2979, 3340, 0), "Ambassador Spanfipple can be found roaming on the first floor of the White Knights Castle."),
|
||||
|
||||
@@ -27,15 +27,19 @@ package net.runelite.client.plugins.cluescrolls.clues;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nonnull;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import static net.runelite.api.EquipmentInventorySlot.*;
|
||||
import static net.runelite.api.EquipmentInventorySlot.LEGS;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemID;
|
||||
import static net.runelite.api.ItemID.*;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import static net.runelite.client.plugins.cluescrolls.ClueScrollOverlay.TITLED_CONTENT_COLOR;
|
||||
@@ -47,6 +51,7 @@ import static net.runelite.client.plugins.cluescrolls.clues.emote.Emote.*;
|
||||
import static net.runelite.client.plugins.cluescrolls.clues.emote.Emote.BULL_ROARER;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.emote.ItemRequirement;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.emote.RangeItemRequirement;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit;
|
||||
import static net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit.*;
|
||||
import static net.runelite.client.plugins.cluescrolls.clues.emote.STASHUnit.SHANTAY_PASS;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.emote.SingleItemRequirement;
|
||||
@@ -175,6 +180,9 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
new EmoteClue("Panic at Al Kharid mine.", null, new WorldPoint(3300, 3314, 0), PANIC),
|
||||
new EmoteClue("Spin at Flynn's Mace Shop.", null, new WorldPoint(2950, 3387, 0), SPIN));
|
||||
|
||||
private static final String UNICODE_CHECK_MARK = "\u2713";
|
||||
private static final String UNICODE_BALLOT_X = "\u2717";
|
||||
|
||||
private static SingleItemRequirement item(int itemId)
|
||||
{
|
||||
return new SingleItemRequirement(itemId);
|
||||
@@ -206,19 +214,18 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
}
|
||||
|
||||
private final String text;
|
||||
private final Integer stashUnit;
|
||||
private final STASHUnit stashUnit;
|
||||
private final WorldPoint location;
|
||||
private final Emote firstEmote;
|
||||
private final Emote secondEmote;
|
||||
@Nonnull
|
||||
private final ItemRequirement[] itemRequirements;
|
||||
|
||||
private EmoteClue(String text, Integer stashUnit, WorldPoint location, Emote firstEmote, @Nonnull ItemRequirement... itemRequirements)
|
||||
private EmoteClue(String text, STASHUnit stashUnit, WorldPoint location, Emote firstEmote, @Nonnull ItemRequirement... itemRequirements)
|
||||
{
|
||||
this(text, stashUnit, location, firstEmote, null, itemRequirements);
|
||||
}
|
||||
|
||||
private EmoteClue(String text, Integer stashUnit, WorldPoint location, Emote firstEmote, Emote secondEmote, @Nonnull ItemRequirement... itemRequirements)
|
||||
private EmoteClue(String text, STASHUnit stashUnit, WorldPoint location, Emote firstEmote, Emote secondEmote, @Nonnull ItemRequirement... itemRequirements)
|
||||
{
|
||||
this.text = text;
|
||||
this.stashUnit = stashUnit;
|
||||
@@ -248,6 +255,17 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
|
||||
if (itemRequirements.length > 0)
|
||||
{
|
||||
Client client = plugin.getClient();
|
||||
client.runScript(ScriptID.WATSON_STASH_UNIT_CHECK, stashUnit.getObjectId(), 0, 0, 0);
|
||||
int[] intStack = client.getIntStack();
|
||||
boolean stashUnitBuilt = intStack[0] == 1;
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("STASH Unit:")
|
||||
.right(stashUnitBuilt ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X)
|
||||
.rightColor(stashUnitBuilt ? Color.GREEN : Color.RED)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder().left("Equip:").build());
|
||||
|
||||
Item[] equipment = plugin.getEquippedItems();
|
||||
@@ -275,9 +293,9 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
boolean combinedFulfilled = requirement.fulfilledBy(combined);
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(requirement.getCollectiveName(plugin.getClient()))
|
||||
.left(requirement.getCollectiveName(client))
|
||||
.leftColor(TITLED_CONTENT_COLOR)
|
||||
.right(combinedFulfilled ? "\u2713" : "\u2717")
|
||||
.right(combinedFulfilled ? UNICODE_CHECK_MARK : UNICODE_BALLOT_X)
|
||||
.rightColor(equipmentFulfilled ? Color.GREEN : (combinedFulfilled ? Color.ORANGE : Color.RED))
|
||||
.build());
|
||||
}
|
||||
@@ -287,14 +305,28 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
|
||||
@Override
|
||||
public void makeWorldOverlayHint(Graphics2D graphics, ClueScrollPlugin plugin)
|
||||
{
|
||||
LocalPoint localLocation = LocalPoint.fromWorld(plugin.getClient(), getLocation());
|
||||
LocalPoint localPoint = LocalPoint.fromWorld(plugin.getClient(), getLocation());
|
||||
|
||||
if (localLocation == null)
|
||||
if (localPoint != null)
|
||||
{
|
||||
return;
|
||||
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localPoint, plugin.getEmoteImage(), Color.ORANGE);
|
||||
}
|
||||
|
||||
OverlayUtil.renderTileOverlay(plugin.getClient(), graphics, localLocation, plugin.getEmoteImage(), Color.ORANGE);
|
||||
final WorldPoint[] worldPoints = stashUnit.getWorldPoints();
|
||||
|
||||
for (final WorldPoint worldPoint : worldPoints)
|
||||
{
|
||||
final LocalPoint stashUnitLocalPoint = LocalPoint.fromWorld(plugin.getClient(), worldPoint);
|
||||
|
||||
if (stashUnitLocalPoint != null)
|
||||
{
|
||||
final Polygon poly = Perspective.getCanvasTilePoly(plugin.getClient(), stashUnitLocalPoint);
|
||||
if (poly != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static EmoteClue forText(String text)
|
||||
|
||||
@@ -102,7 +102,7 @@ public class MapClue extends ClueScroll implements ObjectClueScroll
|
||||
this(itemId, location, objectId, null);
|
||||
}
|
||||
|
||||
private MapClue(int itemId, WorldPoint location, String description)
|
||||
MapClue(int itemId, WorldPoint location, String description)
|
||||
{
|
||||
this(itemId, location, -1, description);
|
||||
}
|
||||
|
||||
@@ -24,115 +24,127 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.cluescrolls.clues.emote;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NullObjectID;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public final class STASHUnit
|
||||
@Getter
|
||||
public enum STASHUnit
|
||||
{
|
||||
public static final int NEAR_A_SHED_IN_LUMBRIDGE_SWAMP = NullObjectID.NULL_28958;
|
||||
public static final int ON_THE_BRIDGE_TO_THE_MISTHALIN_WIZARDS_TOWER = NullObjectID.NULL_28959;
|
||||
public static final int DRAYNOR_VILLAGE_MARKET = NullObjectID.NULL_28960;
|
||||
public static final int LIMESTONE_MINE = NullObjectID.NULL_28961;
|
||||
public static final int OUTSIDE_THE_LEGENDS_GUILD_GATES = NullObjectID.NULL_28962;
|
||||
public static final int MUDSKIPPER_POINT = NullObjectID.NULL_28963;
|
||||
public static final int NEAR_THE_ENTRANA_FERRY_IN_PORT_SARIM = NullObjectID.NULL_28964;
|
||||
public static final int AL_KHARID_SCORPION_MINE = NullObjectID.NULL_28965;
|
||||
public static final int DRAYNOR_MANOR_BY_THE_FOUNTAIN = NullObjectID.NULL_28966;
|
||||
public static final int WHEAT_FIELD_NEAR_THE_LUMBRIDGE_WINDMILL = NullObjectID.NULL_28967;
|
||||
public static final int CROSSROADS_NORTH_OF_DRAYNOR_VILLAGE = NullObjectID.NULL_28968;
|
||||
public static final int RIMMINGTON_MINE = NullObjectID.NULL_28969;
|
||||
public static final int VARROCK_PALACE_LIBRARY = NullObjectID.NULL_28970;
|
||||
public static final int UPSTAIRS_IN_THE_ARDOUGNE_WINDMILL = NullObjectID.NULL_28971;
|
||||
public static final int OUTSIDE_THE_FALADOR_PARTY_ROOM = NullObjectID.NULL_28972;
|
||||
public static final int TAVERLEY_STONE_CIRCLE = NullObjectID.NULL_28973;
|
||||
public static final int CATHERBY_BEEHIVE_FIELD = NullObjectID.NULL_28974;
|
||||
public static final int NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO = NullObjectID.NULL_28975;
|
||||
public static final int ROAD_JUNCTION_NORTH_OF_RIMMINGTON = NullObjectID.NULL_28976;
|
||||
public static final int OUTSIDE_THE_FISHING_GUILD = NullObjectID.NULL_28977;
|
||||
public static final int OUTSIDE_KEEP_LE_FAYE = NullObjectID.NULL_28978;
|
||||
public static final int ROAD_JUNCTION_SOUTH_OF_SINCLAIR_MANSION = NullObjectID.NULL_28979;
|
||||
public static final int OUTSIDE_THE_DIGSITE_EXAM_CENTRE = NullObjectID.NULL_28980;
|
||||
public static final int NEAR_THE_SAWMILL_OPERATORS_BOOTH = NullObjectID.NULL_28981;
|
||||
public static final int MUBARIZS_ROOM_AT_THE_DUEL_ARENA = NullObjectID.NULL_28982;
|
||||
public static final int OUTSIDE_VARROCK_PALACE_COURTYARD = NullObjectID.NULL_28983;
|
||||
public static final int NEAR_HERQUINS_SHOP_IN_FALADOR = NullObjectID.NULL_28984;
|
||||
public static final int SOUTH_OF_THE_GRAND_EXCHANGE = NullObjectID.NULL_28985;
|
||||
public static final int AUBURYS_SHOP_IN_VARROCK = NullObjectID.NULL_28986;
|
||||
public static final int CENTRE_OF_CANIFIS = NullObjectID.NULL_28987;
|
||||
public static final int MAUSOLEUM_OFF_THE_MORYTANIA_COAST = NullObjectID.NULL_28988;
|
||||
public static final int EAST_OF_THE_BARBARIAN_VILLAGE_BRIDGE = NullObjectID.NULL_28989;
|
||||
public static final int SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE = NullObjectID.NULL_28990;
|
||||
public static final int CASTLE_WARS_BANK = NullObjectID.NULL_28991;
|
||||
public static final int BARBARIAN_OUTPOST_OBSTACLE_COURSE = NullObjectID.NULL_28992;
|
||||
public static final int GNOME_STRONGHOLD_BALANCING_ROPE = NullObjectID.NULL_28993;
|
||||
public static final int OUTSIDE_YANILLE_BANK = NullObjectID.NULL_28994;
|
||||
public static final int OBSERVATORY = NullObjectID.NULL_28995;
|
||||
public static final int OGRE_CAGE_IN_KING_LATHAS_TRAINING_CAMP = NullObjectID.NULL_28996;
|
||||
public static final int DIGSITE = NullObjectID.NULL_28997;
|
||||
public static final int HICKTONS_ARCHERY_EMPORIUM = NullObjectID.NULL_28998;
|
||||
public static final int SHANTAY_PASS = NullObjectID.NULL_28999;
|
||||
public static final int LUMBRIDGE_SWAMP_CAVES = NullObjectID.NULL_29000;
|
||||
public static final int OUTSIDE_CATHERBY_BANK = NullObjectID.NULL_29001;
|
||||
public static final int OUTSIDE_THE_SEERS_VILLAGE_COURTHOUSE = NullObjectID.NULL_29002;
|
||||
public static final int OUTSIDE_HARRYS_FISHING_SHOP_IN_CATHERBY = NullObjectID.NULL_29003;
|
||||
public static final int TZHAAR_WEAPONS_STORE = NullObjectID.NULL_29004;
|
||||
public static final int NORTH_OF_EVIL_DAVES_HOUSE_IN_EDGEVILLE = NullObjectID.NULL_29005;
|
||||
public static final int WEST_OF_THE_SHAYZIEN_COMBAT_RING = NullObjectID.NULL_29006;
|
||||
public static final int ENTRANCE_OF_THE_ARCEUUS_LIBRARY = NullObjectID.NULL_29007;
|
||||
public static final int OUTSIDE_DRAYNOR_VILLAGE_JAIL = NullObjectID.NULL_29008;
|
||||
public static final int CHAOS_TEMPLE_IN_THE_SOUTHEASTERN_WILDERNESS = NullObjectID.NULL_29009;
|
||||
public static final int FISHING_GUILD_BANK = NullObjectID.NULL_29010;
|
||||
public static final int TOP_FLOOR_OF_THE_LIGHTHOUSE = NullObjectID.NULL_29011;
|
||||
public static final int OUTSIDE_THE_GREAT_PYRAMID_OF_SOPHANEM = NullObjectID.NULL_29012;
|
||||
public static final int NOTERAZZOS_SHOP_IN_THE_WILDERNESS = NullObjectID.NULL_29013;
|
||||
public static final int WEST_SIDE_OF_THE_KARAMJA_BANANA_PLANTATION = NullObjectID.NULL_29014;
|
||||
public static final int MOUNTAIN_CAMP_GOAT_ENCLOSURE = NullObjectID.NULL_29015;
|
||||
public static final int GNOME_GLIDER_ON_WHITE_WOLF_MOUNTAIN = NullObjectID.NULL_29016;
|
||||
public static final int SHILO_VILLAGE_BANK = NullObjectID.NULL_29017;
|
||||
public static final int INSIDE_THE_DIGSITE_EXAM_CENTRE = NullObjectID.NULL_29018;
|
||||
public static final int NORTHEAST_CORNER_OF_THE_KHARAZI_JUNGLE = NullObjectID.NULL_29019;
|
||||
public static final int VOLCANO_IN_THE_NORTHEASTERN_WILDERNESS = NullObjectID.NULL_29020;
|
||||
public static final int IN_THE_MIDDLE_OF_JIGGIG = NullObjectID.NULL_29021;
|
||||
public static final int AGILITY_PYRAMID = NullObjectID.NULL_29022;
|
||||
public static final int HOSIDIUS_MESS = NullObjectID.NULL_29023;
|
||||
public static final int CHAPEL_IN_WEST_ARDOUGNE = NullObjectID.NULL_29024;
|
||||
public static final int NEAR_A_RUNITE_ROCK_IN_THE_FREMENNIK_ISLES = NullObjectID.NULL_29025;
|
||||
public static final int NEAR_A_LADDER_IN_THE_WILDERNESS_LAVA_MAZE = NullObjectID.NULL_29026;
|
||||
public static final int ENTRANCE_OF_THE_CAVE_OF_DAMIS = NullObjectID.NULL_29027;
|
||||
public static final int WARRIORS_GUILD_BANK = NullObjectID.NULL_29028;
|
||||
public static final int SOUTHEAST_CORNER_OF_THE_MONASTERY = NullObjectID.NULL_29029;
|
||||
public static final int SOUTHEAST_CORNER_OF_THE_FISHING_PLATFORM = NullObjectID.NULL_29030;
|
||||
public static final int OUTSIDE_THE_SLAYER_TOWER_GARGOYLE_ROOM = NullObjectID.NULL_29031;
|
||||
public static final int ON_TOP_OF_TROLLHEIM_MOUNTAIN = NullObjectID.NULL_29032;
|
||||
public static final int FOUNTAIN_OF_HEROES = NullObjectID.NULL_29033;
|
||||
public static final int ENTRANCE_OF_THE_CAVERN_UNDER_THE_WHIRLPOOL = NullObjectID.NULL_29034;
|
||||
public static final int HALFWAY_DOWN_TROLLWEISS_MOUNTAIN = NullObjectID.NULL_29035;
|
||||
public static final int SHAYZIEN_WAR_TENT = NullObjectID.NULL_29036;
|
||||
public static final int OUTSIDE_THE_LEGENDS_GUILD_DOOR = NullObjectID.NULL_29037;
|
||||
public static final int NEAR_THE_GEM_STALL_IN_ARDOUGNE_MARKET = NullObjectID.NULL_29038;
|
||||
public static final int OUTSIDE_THE_BAR_BY_THE_FIGHT_ARENA = NullObjectID.NULL_29039;
|
||||
public static final int SOUTHEAST_CORNER_OF_LAVA_DRAGON_ISLE = NullObjectID.NULL_29040;
|
||||
public static final int NEAR_THE_PIER_IN_ZULANDRA = NullObjectID.NULL_29041;
|
||||
public static final int BARROWS_CHEST = NullObjectID.NULL_29042;
|
||||
public static final int WELL_OF_VOYAGE = NullObjectID.NULL_29043;
|
||||
public static final int NORTHERN_WALL_OF_CASTLE_DRAKAN = NullObjectID.NULL_29044;
|
||||
public static final int _7TH_CHAMBER_OF_JALSAVRAH = NullObjectID.NULL_29045;
|
||||
public static final int SOUL_ALTAR = NullObjectID.NULL_29046;
|
||||
public static final int WARRIORS_GUILD_BANK_29047 = NullObjectID.NULL_29047;
|
||||
public static final int ENTRANA_CHAPEL = NullObjectID.NULL_29048;
|
||||
public static final int TZHAAR_GEM_STORE = NullObjectID.NULL_29049;
|
||||
public static final int TENT_IN_LORD_IORWERTHS_ENCAMPMENT = NullObjectID.NULL_29050;
|
||||
public static final int OUTSIDE_MUDKNUCKLES_HUT = NullObjectID.NULL_29051;
|
||||
public static final int CENTRE_OF_THE_CATACOMBS_OF_KOUREND = NullObjectID.NULL_29052;
|
||||
public static final int KING_BLACK_DRAGONS_LAIR = NullObjectID.NULL_29053;
|
||||
public static final int OUTSIDE_KRIL_TSUTSAROTHS_ROOM = NullObjectID.NULL_29054;
|
||||
public static final int BY_THE_BEAR_CAGE_IN_VARROCK_PALACE_GARDENS = NullObjectID.NULL_29055;
|
||||
public static final int OUTSIDE_THE_WILDERNESS_AXE_HUT = NullObjectID.NULL_29056;
|
||||
public static final int TOP_FLOOR_OF_THE_YANILLE_WATCHTOWER = NullObjectID.NULL_29057;
|
||||
public static final int DEATH_ALTAR = NullObjectID.NULL_29058;
|
||||
public static final int BEHIND_MISS_SCHISM_IN_DRAYNOR_VILLAGE = NullObjectID.NULL_29059;
|
||||
public static final int NORTHWESTERN_CORNER_OF_THE_ENCHANTED_VALLEY = NullObjectID.NULL_29060;
|
||||
public static final int NORTH_OF_MOUNT_KARUULM = NullObjectID.NULL_34647;
|
||||
public static final int GYPSY_TENT_ENTRANCE = NullObjectID.NULL_34736;
|
||||
public static final int FINE_CLOTHES_ENTRANCE = NullObjectID.NULL_34737;
|
||||
public static final int BOB_AXES_ENTRANCE = NullObjectID.NULL_34738;
|
||||
NEAR_A_SHED_IN_LUMBRIDGE_SWAMP(NullObjectID.NULL_28958, new WorldPoint(3201, 3171, 0)),
|
||||
ON_THE_BRIDGE_TO_THE_MISTHALIN_WIZARDS_TOWER(NullObjectID.NULL_28959, new WorldPoint(3115, 3194, 1)),
|
||||
DRAYNOR_VILLAGE_MARKET(NullObjectID.NULL_28960, new WorldPoint(3083, 3254, 0)),
|
||||
LIMESTONE_MINE(NullObjectID.NULL_28961, new WorldPoint(3373, 3498, 0)),
|
||||
OUTSIDE_THE_LEGENDS_GUILD_GATES(NullObjectID.NULL_28962, new WorldPoint(2735, 3350, 0)),
|
||||
MUDSKIPPER_POINT(NullObjectID.NULL_28963, new WorldPoint(2988, 3111, 0)),
|
||||
NEAR_THE_ENTRANA_FERRY_IN_PORT_SARIM(NullObjectID.NULL_28964, new WorldPoint(3050, 3237, 1)),
|
||||
AL_KHARID_SCORPION_MINE(NullObjectID.NULL_28965, new WorldPoint(3303, 3289, 0)),
|
||||
DRAYNOR_MANOR_BY_THE_FOUNTAIN(NullObjectID.NULL_28966, new WorldPoint(3089, 3331, 0)),
|
||||
WHEAT_FIELD_NEAR_THE_LUMBRIDGE_WINDMILL(NullObjectID.NULL_28967, new WorldPoint(3163, 3297, 0)),
|
||||
CROSSROADS_NORTH_OF_DRAYNOR_VILLAGE(NullObjectID.NULL_28968, new WorldPoint(3111, 3289, 0)),
|
||||
RIMMINGTON_MINE(NullObjectID.NULL_28969, new WorldPoint(2976, 3239, 0)),
|
||||
VARROCK_PALACE_LIBRARY(NullObjectID.NULL_28970, new WorldPoint(3214, 3490, 0)),
|
||||
UPSTAIRS_IN_THE_ARDOUGNE_WINDMILL(NullObjectID.NULL_28971, new WorldPoint(2635, 3386, 2)),
|
||||
OUTSIDE_THE_FALADOR_PARTY_ROOM(NullObjectID.NULL_28972, new WorldPoint(3043, 3371, 0)),
|
||||
TAVERLEY_STONE_CIRCLE(NullObjectID.NULL_28973, new WorldPoint(2924, 3477, 0)),
|
||||
CATHERBY_BEEHIVE_FIELD(NullObjectID.NULL_28974, new WorldPoint(2764, 3438, 0)),
|
||||
NEAR_THE_PARROTS_IN_ARDOUGNE_ZOO(NullObjectID.NULL_28975, new WorldPoint(2608, 3284, 0)),
|
||||
ROAD_JUNCTION_NORTH_OF_RIMMINGTON(NullObjectID.NULL_28976, new WorldPoint(2981, 3278, 0)),
|
||||
OUTSIDE_THE_FISHING_GUILD(NullObjectID.NULL_28977, new WorldPoint(2608, 3393, 0)),
|
||||
OUTSIDE_KEEP_LE_FAYE(NullObjectID.NULL_28978, new WorldPoint(2756, 3399, 0)),
|
||||
ROAD_JUNCTION_SOUTH_OF_SINCLAIR_MANSION(NullObjectID.NULL_28979, new WorldPoint(2735, 3534, 0)),
|
||||
OUTSIDE_THE_DIGSITE_EXAM_CENTRE(NullObjectID.NULL_28980, new WorldPoint(3353, 3343, 0)),
|
||||
NEAR_THE_SAWMILL_OPERATORS_BOOTH(NullObjectID.NULL_28981, new WorldPoint(3298, 3490, 0)),
|
||||
MUBARIZS_ROOM_AT_THE_DUEL_ARENA(NullObjectID.NULL_28982, new WorldPoint(3316, 3242, 0)),
|
||||
OUTSIDE_VARROCK_PALACE_COURTYARD(NullObjectID.NULL_28983, new WorldPoint(3211, 3456, 0)),
|
||||
NEAR_HERQUINS_SHOP_IN_FALADOR(NullObjectID.NULL_28984, new WorldPoint(2941, 3339, 0)),
|
||||
SOUTH_OF_THE_GRAND_EXCHANGE(NullObjectID.NULL_28985, new WorldPoint(3159, 3464, 0)),
|
||||
AUBURYS_SHOP_IN_VARROCK(NullObjectID.NULL_28986, new WorldPoint(3252, 3404, 0)),
|
||||
CENTRE_OF_CANIFIS(NullObjectID.NULL_28987, new WorldPoint(3491, 3489, 0)),
|
||||
MAUSOLEUM_OFF_THE_MORYTANIA_COAST(NullObjectID.NULL_28988, new WorldPoint(3500, 3575, 0)),
|
||||
EAST_OF_THE_BARBARIAN_VILLAGE_BRIDGE(NullObjectID.NULL_28989, new WorldPoint(3110, 3422, 0)),
|
||||
SOUTH_OF_THE_SHRINE_IN_TAI_BWO_WANNAI_VILLAGE(NullObjectID.NULL_28990, new WorldPoint(2802, 3081, 0)),
|
||||
CASTLE_WARS_BANK(NullObjectID.NULL_28991, new WorldPoint(2444, 3093, 0)),
|
||||
BARBARIAN_OUTPOST_OBSTACLE_COURSE(NullObjectID.NULL_28992, new WorldPoint(2541, 3550, 0)),
|
||||
GNOME_STRONGHOLD_BALANCING_ROPE(NullObjectID.NULL_28993, new WorldPoint(2473, 3418, 2)),
|
||||
OUTSIDE_YANILLE_BANK(NullObjectID.NULL_28994, new WorldPoint(2603, 3091, 0)),
|
||||
OBSERVATORY(NullObjectID.NULL_28995, new WorldPoint(2439, 3166, 0)),
|
||||
OGRE_CAGE_IN_KING_LATHAS_TRAINING_CAMP(NullObjectID.NULL_28996, new WorldPoint(2533, 3377, 0)),
|
||||
DIGSITE(NullObjectID.NULL_28997, new WorldPoint(3370, 3420, 0)),
|
||||
HICKTONS_ARCHERY_EMPORIUM(NullObjectID.NULL_28998, new WorldPoint(2825, 3441, 0)),
|
||||
SHANTAY_PASS(NullObjectID.NULL_28999, new WorldPoint(3308, 3125, 0)),
|
||||
LUMBRIDGE_SWAMP_CAVES(NullObjectID.NULL_29000, new WorldPoint(3222, 9584, 0), new WorldPoint(3167, 9570, 0)),
|
||||
OUTSIDE_CATHERBY_BANK(NullObjectID.NULL_29001, new WorldPoint(2807, 3437, 0)),
|
||||
OUTSIDE_THE_SEERS_VILLAGE_COURTHOUSE(NullObjectID.NULL_29002, new WorldPoint(2731, 3475, 0)),
|
||||
OUTSIDE_HARRYS_FISHING_SHOP_IN_CATHERBY(NullObjectID.NULL_29003, new WorldPoint(2837, 3436, 0)),
|
||||
TZHAAR_WEAPONS_STORE(NullObjectID.NULL_29004, new WorldPoint(2479, 5146, 0)),
|
||||
NORTH_OF_EVIL_DAVES_HOUSE_IN_EDGEVILLE(NullObjectID.NULL_29005, new WorldPoint(3077, 3503, 0)),
|
||||
WEST_OF_THE_SHAYZIEN_COMBAT_RING(NullObjectID.NULL_29006, new WorldPoint(1534, 3591, 0)),
|
||||
ENTRANCE_OF_THE_ARCEUUS_LIBRARY(NullObjectID.NULL_29007, new WorldPoint(1642, 3809, 0)),
|
||||
OUTSIDE_DRAYNOR_VILLAGE_JAIL(NullObjectID.NULL_29008, new WorldPoint(3130, 3250, 0)),
|
||||
CHAOS_TEMPLE_IN_THE_SOUTHEASTERN_WILDERNESS(NullObjectID.NULL_29009, new WorldPoint(3245, 3609, 0)),
|
||||
FISHING_GUILD_BANK(NullObjectID.NULL_29010, new WorldPoint(2593, 3409, 0)),
|
||||
TOP_FLOOR_OF_THE_LIGHTHOUSE(NullObjectID.NULL_29011, new WorldPoint(2512, 3640, 2)),
|
||||
OUTSIDE_THE_GREAT_PYRAMID_OF_SOPHANEM(NullObjectID.NULL_29012, new WorldPoint(3291, 2780, 0)),
|
||||
NOTERAZZOS_SHOP_IN_THE_WILDERNESS(NullObjectID.NULL_29013, new WorldPoint(3027, 3699, 0)),
|
||||
WEST_SIDE_OF_THE_KARAMJA_BANANA_PLANTATION(NullObjectID.NULL_29014, new WorldPoint(2909, 3169, 0)),
|
||||
MOUNTAIN_CAMP_GOAT_ENCLOSURE(NullObjectID.NULL_29015, new WorldPoint(2810, 3677, 0)),
|
||||
GNOME_GLIDER_ON_WHITE_WOLF_MOUNTAIN(NullObjectID.NULL_29016, new WorldPoint(2849, 3496, 0)),
|
||||
SHILO_VILLAGE_BANK(NullObjectID.NULL_29017, new WorldPoint(2853, 2952, 0)),
|
||||
INSIDE_THE_DIGSITE_EXAM_CENTRE(NullObjectID.NULL_29018, new WorldPoint(3356, 3333, 0)),
|
||||
NORTHEAST_CORNER_OF_THE_KHARAZI_JUNGLE(NullObjectID.NULL_29019, new WorldPoint(2952, 2932, 0)),
|
||||
VOLCANO_IN_THE_NORTHEASTERN_WILDERNESS(NullObjectID.NULL_29020, new WorldPoint(3368, 3930, 0)),
|
||||
IN_THE_MIDDLE_OF_JIGGIG(NullObjectID.NULL_29021, new WorldPoint(2478, 3048, 0)),
|
||||
AGILITY_PYRAMID(NullObjectID.NULL_29022, new WorldPoint(3357, 2830, 0)),
|
||||
HOSIDIUS_MESS(NullObjectID.NULL_29023, new WorldPoint(1648, 3631, 0)),
|
||||
CHAPEL_IN_WEST_ARDOUGNE(NullObjectID.NULL_29024, new WorldPoint(2527, 3294, 0)),
|
||||
NEAR_A_RUNITE_ROCK_IN_THE_FREMENNIK_ISLES(NullObjectID.NULL_29025, new WorldPoint(2374, 3847, 0)),
|
||||
NEAR_A_LADDER_IN_THE_WILDERNESS_LAVA_MAZE(NullObjectID.NULL_29026, new WorldPoint(3069, 3862, 0)),
|
||||
ENTRANCE_OF_THE_CAVE_OF_DAMIS(NullObjectID.NULL_29027, new WorldPoint(2629, 5070, 0)),
|
||||
WARRIORS_GUILD_BANK(NullObjectID.NULL_29028, new WorldPoint(2844, 3537, 0)),
|
||||
SOUTHEAST_CORNER_OF_THE_MONASTERY(NullObjectID.NULL_29029, new WorldPoint(3056, 3482, 0)),
|
||||
SOUTHEAST_CORNER_OF_THE_FISHING_PLATFORM(NullObjectID.NULL_29030, new WorldPoint(2787, 3277, 1)),
|
||||
OUTSIDE_THE_SLAYER_TOWER_GARGOYLE_ROOM(NullObjectID.NULL_29031, new WorldPoint(3423, 3534, 2)),
|
||||
ON_TOP_OF_TROLLHEIM_MOUNTAIN(NullObjectID.NULL_29032, new WorldPoint(2886, 3676, 0)),
|
||||
FOUNTAIN_OF_HEROES(NullObjectID.NULL_29033, new WorldPoint(2916, 9891, 0)),
|
||||
ENTRANCE_OF_THE_CAVERN_UNDER_THE_WHIRLPOOL(NullObjectID.NULL_29034, new WorldPoint(1764, 5367, 1), new WorldPoint(1636, 5367, 1)),
|
||||
HALFWAY_DOWN_TROLLWEISS_MOUNTAIN(NullObjectID.NULL_29035, new WorldPoint(2782, 3787, 0)),
|
||||
SHAYZIEN_WAR_TENT(NullObjectID.NULL_29036, new WorldPoint(1550, 3541, 0)),
|
||||
OUTSIDE_THE_LEGENDS_GUILD_DOOR(NullObjectID.NULL_29037, new WorldPoint(2727, 3371, 0)),
|
||||
NEAR_THE_GEM_STALL_IN_ARDOUGNE_MARKET(NullObjectID.NULL_29038, new WorldPoint(2672, 3302, 0)),
|
||||
OUTSIDE_THE_BAR_BY_THE_FIGHT_ARENA(NullObjectID.NULL_29039, new WorldPoint(2571, 3150, 0)),
|
||||
SOUTHEAST_CORNER_OF_LAVA_DRAGON_ISLE(NullObjectID.NULL_29040, new WorldPoint(3228, 3830, 0)),
|
||||
NEAR_THE_PIER_IN_ZULANDRA(NullObjectID.NULL_29041, new WorldPoint(2203, 3059, 0)),
|
||||
BARROWS_CHEST(NullObjectID.NULL_29042, new WorldPoint(3547, 9690, 0)),
|
||||
WELL_OF_VOYAGE(NullObjectID.NULL_29043, new WorldPoint(2006, 4709, 1)),
|
||||
NORTHERN_WALL_OF_CASTLE_DRAKAN(NullObjectID.NULL_29044, new WorldPoint(3559, 3385, 1)),
|
||||
_7TH_CHAMBER_OF_JALSAVRAH(NullObjectID.NULL_29045, new WorldPoint(1951, 4431, 0)),
|
||||
SOUL_ALTAR(NullObjectID.NULL_29046, new WorldPoint(1810, 3855, 0)),
|
||||
WARRIORS_GUILD_BANK_29047(NullObjectID.NULL_29047, new WorldPoint(2845, 3545, 0)),
|
||||
ENTRANA_CHAPEL(NullObjectID.NULL_29048, new WorldPoint(2851, 3355, 0)),
|
||||
TZHAAR_GEM_STORE(NullObjectID.NULL_29049, new WorldPoint(2466, 5150, 0)),
|
||||
TENT_IN_LORD_IORWERTHS_ENCAMPMENT(NullObjectID.NULL_29050, new WorldPoint(2198, 3257, 0)),
|
||||
OUTSIDE_MUDKNUCKLES_HUT(NullObjectID.NULL_29051, new WorldPoint(2959, 3502, 0)),
|
||||
CENTRE_OF_THE_CATACOMBS_OF_KOUREND(NullObjectID.NULL_29052, new WorldPoint(1661, 10045, 0)),
|
||||
KING_BLACK_DRAGONS_LAIR(NullObjectID.NULL_29053, new WorldPoint(2286, 4680, 0)),
|
||||
OUTSIDE_KRIL_TSUTSAROTHS_ROOM(NullObjectID.NULL_29054, new WorldPoint(2931, 5337, 2)),
|
||||
BY_THE_BEAR_CAGE_IN_VARROCK_PALACE_GARDENS(NullObjectID.NULL_29055, new WorldPoint(3232, 3494, 0)),
|
||||
OUTSIDE_THE_WILDERNESS_AXE_HUT(NullObjectID.NULL_29056, new WorldPoint(3186, 3958, 0)),
|
||||
TOP_FLOOR_OF_THE_YANILLE_WATCHTOWER(NullObjectID.NULL_29057, new WorldPoint(2930, 4718, 2)),
|
||||
DEATH_ALTAR(NullObjectID.NULL_29058, new WorldPoint(2210, 4842, 0)),
|
||||
BEHIND_MISS_SCHISM_IN_DRAYNOR_VILLAGE(NullObjectID.NULL_29059, new WorldPoint(3095, 3254, 0)),
|
||||
NORTHWESTERN_CORNER_OF_THE_ENCHANTED_VALLEY(NullObjectID.NULL_29060, new WorldPoint(3022, 4517, 0)),
|
||||
NORTH_OF_MOUNT_KARUULM(NullObjectID.NULL_34647, new WorldPoint(1308, 3840, 0)),
|
||||
GYPSY_TENT_ENTRANCE(NullObjectID.NULL_34736, new WorldPoint(3206, 3422, 0)),
|
||||
FINE_CLOTHES_ENTRANCE(NullObjectID.NULL_34737, new WorldPoint(3209, 3416, 0)),
|
||||
BOB_AXES_ENTRANCE(NullObjectID.NULL_34738, new WorldPoint(3233, 3200, 0));
|
||||
|
||||
private final int objectId;
|
||||
private final WorldPoint[] worldPoints;
|
||||
|
||||
STASHUnit(int objectId, WorldPoint... worldPoints)
|
||||
{
|
||||
this.objectId = objectId;
|
||||
this.worldPoints = worldPoints;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.combatlevel;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Experience;
|
||||
import net.runelite.api.Skill;
|
||||
@@ -43,11 +42,6 @@ import java.awt.Rectangle;
|
||||
class CombatLevelOverlay extends Overlay
|
||||
{
|
||||
private static final Color COMBAT_LEVEL_COLOUR = new Color(0xff981f);
|
||||
private static final double PRAY_MULT = 0.125;
|
||||
static final double ATT_STR_MULT = 0.325;
|
||||
static final double DEF_HP_MULT = 0.25;
|
||||
static final double RANGE_MAGIC_LEVEL_MULT = 1.5;
|
||||
static final double RANGE_MAGIC_MULT = 0.325;
|
||||
|
||||
private final Client client;
|
||||
private final CombatLevelConfig config;
|
||||
@@ -95,23 +89,20 @@ class CombatLevelOverlay extends Overlay
|
||||
int defenceLevel = client.getRealSkillLevel(Skill.DEFENCE);
|
||||
int hitpointsLevel = client.getRealSkillLevel(Skill.HITPOINTS);
|
||||
int magicLevel = client.getRealSkillLevel(Skill.MAGIC);
|
||||
int rangedLevel = client.getRealSkillLevel(Skill.RANGED);
|
||||
int rangeLevel = client.getRealSkillLevel(Skill.RANGED);
|
||||
int prayerLevel = client.getRealSkillLevel(Skill.PRAYER);
|
||||
|
||||
// calculate initial required numbers
|
||||
double base = DEF_HP_MULT * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2));
|
||||
double melee = ATT_STR_MULT * (attackLevel + strengthLevel);
|
||||
double range = RANGE_MAGIC_MULT * Math.floor(rangedLevel * RANGE_MAGIC_LEVEL_MULT);
|
||||
double mage = RANGE_MAGIC_MULT * Math.floor(magicLevel * RANGE_MAGIC_LEVEL_MULT);
|
||||
double max = Math.max(melee, Math.max(range, mage));
|
||||
|
||||
// find the needed levels until level up
|
||||
int next = client.getLocalPlayer().getCombatLevel() + 1;
|
||||
int meleeNeed = calcLevels(base + melee, next, ATT_STR_MULT);
|
||||
int hpdefNeed = calcLevels(base + max, next, DEF_HP_MULT);
|
||||
int prayNeed = calcLevelsPray(base + max, next, prayerLevel);
|
||||
int rangeNeed = calcLevelsRM(rangedLevel, next, base);
|
||||
int magicNeed = calcLevelsRM(magicLevel, next, base);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// create tooltip string
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -121,11 +112,11 @@ class CombatLevelOverlay extends Overlay
|
||||
{
|
||||
sb.append(meleeNeed).append(" Attack/Strength</br>");
|
||||
}
|
||||
if ((hitpointsLevel + defenceLevel + hpdefNeed) <= Experience.MAX_REAL_LEVEL * 2)
|
||||
if ((hitpointsLevel + defenceLevel + hpDefNeed) <= Experience.MAX_REAL_LEVEL * 2)
|
||||
{
|
||||
sb.append(hpdefNeed).append(" Defence/Hitpoints</br>");
|
||||
sb.append(hpDefNeed).append(" Defence/Hitpoints</br>");
|
||||
}
|
||||
if ((rangedLevel + rangeNeed) <= Experience.MAX_REAL_LEVEL)
|
||||
if ((rangeLevel + rangeNeed) <= Experience.MAX_REAL_LEVEL)
|
||||
{
|
||||
sb.append(rangeNeed).append(" Ranged</br>");
|
||||
}
|
||||
@@ -133,73 +124,11 @@ class CombatLevelOverlay extends Overlay
|
||||
{
|
||||
sb.append(magicNeed).append(" Magic</br>");
|
||||
}
|
||||
if ((prayerLevel + prayNeed) <= Experience.MAX_REAL_LEVEL)
|
||||
if ((prayerLevel + prayerNeed) <= Experience.MAX_REAL_LEVEL)
|
||||
{
|
||||
sb.append(prayNeed).append(" Prayer");
|
||||
sb.append(prayerNeed).append(" Prayer");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate skill levels required for increasing combat level, meant
|
||||
* for all combat skills besides prayer, ranged, and magic.
|
||||
* @param start initial value
|
||||
* @param end ending value (combat level + 1)
|
||||
* @param multiple how much adding one skill level will change combat
|
||||
* @return levels required for a specific skill to level up combat
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static int calcLevels(double start, int end, double multiple)
|
||||
{
|
||||
return (int) Math.ceil(calcMultipliedLevels(start, end, multiple));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate skill levels for increasing combat level, meant ONLY for the Prayer skill.
|
||||
* <p>
|
||||
* Note: Prayer is a special case, only leveling up upon even level numbers. This is accounted
|
||||
* for in this function.
|
||||
* </p>
|
||||
* @param start current combat level
|
||||
* @param end ending value (combat level + 1)
|
||||
* @param prayerLevel the player's current prayer level
|
||||
* @return Prayer levels required to level up combat
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static int calcLevelsPray(double start, int end, int prayerLevel)
|
||||
{
|
||||
int neededLevels = (int) Math.ceil(calcMultipliedLevels(start, end, PRAY_MULT));
|
||||
|
||||
if (prayerLevel % 2 != 0)
|
||||
{
|
||||
neededLevels--;
|
||||
}
|
||||
|
||||
if ((prayerLevel + neededLevels) % 2 != 0)
|
||||
{
|
||||
return neededLevels + 1;
|
||||
}
|
||||
|
||||
return neededLevels;
|
||||
}
|
||||
|
||||
private static double calcMultipliedLevels(double start, int end, double multiple)
|
||||
{
|
||||
return (end - start) / multiple;
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate skill levels required for increasing combat level, meant
|
||||
* ONLY for Ranged and Magic skills.
|
||||
* @param start either the current ranged or magic level
|
||||
* @param end ending value (combat level + 1)
|
||||
* @param dhp defence, hitpoints, and prayer; this is the initial calculated "base" value
|
||||
* @return levels required for a specific skill to level up combat
|
||||
*/
|
||||
@VisibleForTesting
|
||||
static int calcLevelsRM(double start, int end, double dhp)
|
||||
{
|
||||
start = Math.floor(start * RANGE_MAGIC_LEVEL_MULT) * RANGE_MAGIC_MULT;
|
||||
return (int) Math.ceil((end - dhp - start) / (RANGE_MAGIC_MULT * RANGE_MAGIC_LEVEL_MULT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,11 @@ import java.time.Instant;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import static net.runelite.api.AnimationID.COOKING_WINE;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -50,7 +54,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@PluginDependency(XpTrackerPlugin.class)
|
||||
public class CookingPlugin extends Plugin
|
||||
{
|
||||
private static final String WINE_MESSAGE = "You squeeze the grapes into the jug";
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private CookingConfig config;
|
||||
@@ -124,6 +129,27 @@ public class CookingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onAnimationChanged(AnimationChanged animationChanged)
|
||||
{
|
||||
Player localPlayer = client.getLocalPlayer();
|
||||
|
||||
if (localPlayer != animationChanged.getActor())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (localPlayer.getAnimation() == COOKING_WINE && config.fermentTimer())
|
||||
{
|
||||
if (fermentTimerSession == null)
|
||||
{
|
||||
fermentTimerSession = new FermentTimerSession();
|
||||
}
|
||||
|
||||
fermentTimerSession.updateLastWineMakingAction();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
@@ -134,22 +160,11 @@ public class CookingPlugin extends Plugin
|
||||
|
||||
final String message = event.getMessage();
|
||||
|
||||
if (message.startsWith(WINE_MESSAGE) && config.fermentTimer())
|
||||
{
|
||||
if (fermentTimerSession == null)
|
||||
{
|
||||
fermentTimerSession = new FermentTimerSession();
|
||||
}
|
||||
|
||||
fermentTimerSession.updateLastWineMakingAction();
|
||||
}
|
||||
|
||||
if (message.startsWith("You successfully cook")
|
||||
|| message.startsWith("You successfully bake")
|
||||
|| message.startsWith("You manage to cook")
|
||||
|| message.startsWith("You roast a")
|
||||
|| message.startsWith("You cook")
|
||||
|| message.startsWith(WINE_MESSAGE))
|
||||
|| message.startsWith("You cook"))
|
||||
{
|
||||
if (cookingSession == null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||
* Copyright (c) 2019, Aleios <https://github.com/aleios>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -244,11 +245,40 @@ public interface ItemChargeConfig extends Config
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showExplorerRingCharges",
|
||||
name = "Show Explorer's Ring Alch Charges",
|
||||
description = "Configures if explorer's ring alchemy charges are shown",
|
||||
position = 17
|
||||
)
|
||||
default boolean showExplorerRingCharges()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "explorerRing",
|
||||
name = "",
|
||||
description = "",
|
||||
hidden = true
|
||||
)
|
||||
default int explorerRing()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "explorerRing",
|
||||
name = "",
|
||||
description = ""
|
||||
)
|
||||
void explorerRing(int explorerRing);
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showInfoboxes",
|
||||
name = "Show Infoboxes",
|
||||
description = "Configures whether to show an infobox equipped charge items",
|
||||
position = 17
|
||||
position = 18
|
||||
)
|
||||
default boolean showInfoboxes()
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
|
||||
* Copyright (c) 2019, Aleios <https://github.com/aleios>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -84,6 +85,15 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
|
||||
charges = config.bindingNecklace();
|
||||
}
|
||||
else if (itemId >= ItemID.EXPLORERS_RING_1 && itemId <= ItemID.EXPLORERS_RING_4)
|
||||
{
|
||||
if (!config.showExplorerRingCharges())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
charges = config.explorerRing();
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemWithCharge chargeItem = ItemWithCharge.findItem(itemId);
|
||||
@@ -119,6 +129,6 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
||||
{
|
||||
return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges()
|
||||
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
||||
|| config.showBellowCharges() || config.showAbyssalBraceletCharges();
|
||||
|| config.showBellowCharges() || config.showAbyssalBraceletCharges() || config.showExplorerRingCharges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Seth <Sethtroll3@gmail.com>
|
||||
* Copyright (c) 2018, Hydrox6 <ikada@protonmail.ch>
|
||||
* Copyright (c) 2019, Aleios <https://github.com/aleios>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -38,10 +39,12 @@ import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.Notifier;
|
||||
@@ -75,6 +78,9 @@ public class ItemChargePlugin extends Plugin
|
||||
|
||||
private static final int MAX_DODGY_CHARGES = 10;
|
||||
private static final int MAX_BINDING_CHARGES = 16;
|
||||
private static final int MAX_EXPLORER_RING_CHARGES = 30;
|
||||
|
||||
private int lastExplorerRingCharge = -1;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -153,6 +159,11 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
removeInfobox(ItemWithSlot.BINDING_NECKLACE);
|
||||
}
|
||||
|
||||
if (!config.showExplorerRingCharges())
|
||||
{
|
||||
removeInfobox(ItemWithSlot.EXPLORER_RING);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -246,6 +257,11 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.BINDING_NECKLACE, items);
|
||||
}
|
||||
|
||||
if (config.showExplorerRingCharges())
|
||||
{
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, items);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -263,6 +279,16 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
int explorerRingCharge = client.getVar(Varbits.EXPLORER_RING_ALCHS);
|
||||
if (lastExplorerRingCharge != explorerRingCharge)
|
||||
{
|
||||
updateExplorerRingCharges(explorerRingCharge);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateDodgyNecklaceCharges(final int value)
|
||||
{
|
||||
config.dodgyNecklace(value);
|
||||
@@ -297,6 +323,24 @@ public class ItemChargePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void updateExplorerRingCharges(final int value)
|
||||
{
|
||||
// Note: Varbit counts upwards. We count down from the maximum charges.
|
||||
config.explorerRing(MAX_EXPLORER_RING_CHARGES - value);
|
||||
|
||||
if (config.showInfoboxes() && config.showExplorerRingCharges())
|
||||
{
|
||||
final ItemContainer itemContainer = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateJewelleryInfobox(ItemWithSlot.EXPLORER_RING, itemContainer.getItems());
|
||||
}
|
||||
}
|
||||
|
||||
private void checkDestroyWidget()
|
||||
{
|
||||
final int currentTick = client.getTickCount();
|
||||
@@ -359,6 +403,10 @@ public class ItemChargePlugin extends Plugin
|
||||
{
|
||||
charges = config.bindingNecklace();
|
||||
}
|
||||
else if ((id >= ItemID.EXPLORERS_RING_1 && id <= ItemID.EXPLORERS_RING_4) && type == ItemWithSlot.EXPLORER_RING)
|
||||
{
|
||||
charges = config.explorerRing();
|
||||
}
|
||||
}
|
||||
else if (itemWithCharge.getType() == type.getType())
|
||||
{
|
||||
|
||||
@@ -34,5 +34,6 @@ enum ItemChargeType
|
||||
WATERCAN,
|
||||
WATERSKIN,
|
||||
DODGY_NECKLACE,
|
||||
BINDING_NECKLACE
|
||||
BINDING_NECKLACE,
|
||||
EXPLORER_RING
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Tomas Slusny <slusnucky@gmail.com>
|
||||
* Copyright (c) 2019, Aleios <https://github.com/aleios>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -35,6 +36,7 @@ enum ItemWithSlot
|
||||
ABYSSAL_BRACELET(ItemChargeType.ABYSSAL_BRACELET, EquipmentInventorySlot.GLOVES),
|
||||
DODGY_NECKLACE(ItemChargeType.DODGY_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
BINDING_NECKLACE(ItemChargeType.BINDING_NECKLACE, EquipmentInventorySlot.AMULET),
|
||||
EXPLORER_RING(ItemChargeType.EXPLORER_RING, EquipmentInventorySlot.RING),
|
||||
TELEPORT(ItemChargeType.TELEPORT, EquipmentInventorySlot.WEAPON, EquipmentInventorySlot.AMULET, EquipmentInventorySlot.GLOVES, EquipmentInventorySlot.RING);
|
||||
|
||||
private final ItemChargeType type;
|
||||
|
||||
@@ -162,6 +162,16 @@ public interface MenuEntrySwapperConfig extends Config
|
||||
return FairyRingMode.LAST_DESTINATION;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "swapHardWoodGrove",
|
||||
name = "Hardwood Grove",
|
||||
description = "Swap Quick-Pay(100) and Send-Parcel at Hardwood Grove"
|
||||
)
|
||||
default boolean swapHardWoodGrove()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "swapHarpoon",
|
||||
name = "Harpoon",
|
||||
|
||||
@@ -383,6 +383,11 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
swap("teleport", option, target, true);
|
||||
}
|
||||
|
||||
if (config.swapHardWoodGrove() && target.contains("rionasta"))
|
||||
{
|
||||
swap("send-parcel", option, target, true);
|
||||
}
|
||||
|
||||
if (config.swapBank())
|
||||
{
|
||||
swap("bank", option, target, true);
|
||||
@@ -458,6 +463,10 @@ public class MenuEntrySwapperPlugin extends Plugin
|
||||
{
|
||||
swap("pay-toll(10gp)", option, target, true);
|
||||
}
|
||||
else if (config.swapHardWoodGrove() && option.equals("open") && target.equals("hardwood grove doors"))
|
||||
{
|
||||
swap("quick-pay(100)", option, target, true);
|
||||
}
|
||||
else if (config.swapTravel() && option.equals("inspect") && target.equals("trapdoor"))
|
||||
{
|
||||
swap("travel", option, target, true);
|
||||
|
||||
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Anthony Chen <https://github.com/achencoms>
|
||||
* 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.musiclist;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxTextInput;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Music List",
|
||||
description = "Adds search and filter for the music list"
|
||||
)
|
||||
public class MusicListPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private ChatboxPanelManager chatboxPanelManager;
|
||||
|
||||
private ChatboxTextInput searchInput;
|
||||
|
||||
private Widget musicSearchButton;
|
||||
private Widget musicFilterButton;
|
||||
|
||||
private Collection<Widget> tracks;
|
||||
|
||||
private MusicState currentMusicFilter;
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
clientThread.invoke(this::addMusicButtons);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
Widget header = client.getWidget(WidgetInfo.MUSIC_WINDOW);
|
||||
if (header != null)
|
||||
{
|
||||
header.deleteAllChildren();
|
||||
}
|
||||
|
||||
tracks = null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
{
|
||||
if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
currentMusicFilter = MusicState.ALL;
|
||||
tracks = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
{
|
||||
if (widgetLoaded.getGroupId() == WidgetID.MUSIC_GROUP_ID)
|
||||
{
|
||||
addMusicButtons();
|
||||
}
|
||||
}
|
||||
|
||||
private void addMusicButtons()
|
||||
{
|
||||
Widget header = client.getWidget(WidgetInfo.MUSIC_WINDOW);
|
||||
|
||||
if (header == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Creation of the search and toggle status buttons
|
||||
musicSearchButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
musicSearchButton.setSpriteId(SpriteID.GE_SEARCH);
|
||||
musicSearchButton.setOriginalWidth(18);
|
||||
musicSearchButton.setOriginalHeight(17);
|
||||
musicSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
musicSearchButton.setOriginalX(5);
|
||||
musicSearchButton.setOriginalY(32);
|
||||
musicSearchButton.setHasListener(true);
|
||||
musicSearchButton.setAction(1, "Open");
|
||||
musicSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
musicSearchButton.setName("Search");
|
||||
musicSearchButton.revalidate();
|
||||
|
||||
musicFilterButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
musicFilterButton.setSpriteId(SpriteID.MINIMAP_ORB_HITPOINTS);
|
||||
musicFilterButton.setOriginalWidth(15);
|
||||
musicFilterButton.setOriginalHeight(15);
|
||||
musicFilterButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
musicFilterButton.setOriginalX(25);
|
||||
musicFilterButton.setOriginalY(34);
|
||||
musicFilterButton.setHasListener(true);
|
||||
musicFilterButton.setAction(1, "Toggle");
|
||||
musicFilterButton.setOnOpListener((JavaScriptCallback) e -> toggleStatus());
|
||||
musicFilterButton.setName("All");
|
||||
musicFilterButton.revalidate();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarClientIntChanged(VarClientIntChanged varClientIntChanged)
|
||||
{
|
||||
if (isChatboxOpen() && !isOnMusicTab())
|
||||
{
|
||||
chatboxPanelManager.close();
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOnMusicTab()
|
||||
{
|
||||
return client.getVar(VarClientInt.INVENTORY_TAB) == 13;
|
||||
}
|
||||
|
||||
private boolean isChatboxOpen()
|
||||
{
|
||||
return searchInput != null && chatboxPanelManager.getCurrentInput() == searchInput;
|
||||
}
|
||||
|
||||
private String getChatboxInput()
|
||||
{
|
||||
return isChatboxOpen() ? searchInput.getValue() : "";
|
||||
}
|
||||
|
||||
private void toggleStatus()
|
||||
{
|
||||
MusicState[] states = MusicState.values();
|
||||
currentMusicFilter = states[(currentMusicFilter.ordinal() + 1) % states.length];
|
||||
musicFilterButton.setSpriteId(currentMusicFilter.getSpriteID());
|
||||
musicFilterButton.setName(currentMusicFilter.getName());
|
||||
updateFilter(getChatboxInput());
|
||||
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||
}
|
||||
|
||||
private void openSearch()
|
||||
{
|
||||
updateFilter("");
|
||||
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||
musicSearchButton.setAction(1, "Close");
|
||||
musicSearchButton.setOnOpListener((JavaScriptCallback) e -> closeSearch());
|
||||
searchInput = chatboxPanelManager.openTextInput("Search music list")
|
||||
.onChanged(s -> clientThread.invokeLater(() -> updateFilter(s.trim())))
|
||||
.onClose(() ->
|
||||
{
|
||||
clientThread.invokeLater(() -> updateFilter(""));
|
||||
musicSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
musicSearchButton.setAction(1, "Open");
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
private void closeSearch()
|
||||
{
|
||||
updateFilter("");
|
||||
chatboxPanelManager.close();
|
||||
client.playSoundEffect(SoundEffectID.UI_BOOP);
|
||||
}
|
||||
|
||||
private void updateFilter(String input)
|
||||
{
|
||||
final Widget container = client.getWidget(WidgetInfo.MUSIC_WINDOW);
|
||||
final Widget musicList = client.getWidget(WidgetInfo.MUSIC_TRACK_LIST);
|
||||
|
||||
if (container == null || musicList == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String filter = input.toLowerCase();
|
||||
updateList(musicList, filter);
|
||||
}
|
||||
|
||||
private void updateList(Widget musicList, String filter)
|
||||
{
|
||||
if (tracks == null)
|
||||
{
|
||||
tracks = Arrays.stream(musicList.getDynamicChildren())
|
||||
.sorted(Comparator.comparing(Widget::getRelativeY))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
tracks.forEach(w -> w.setHidden(true));
|
||||
|
||||
Collection<Widget> relevantTracks = tracks.stream()
|
||||
.filter(w -> w.getText().toLowerCase().contains(filter))
|
||||
.filter(w -> currentMusicFilter == MusicState.ALL || w.getTextColor() == currentMusicFilter.getColor())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// Original music track list has a little offset
|
||||
int y = 3;
|
||||
|
||||
for (Widget track : relevantTracks)
|
||||
{
|
||||
track.setHidden(false);
|
||||
track.setOriginalY(y);
|
||||
track.revalidate();
|
||||
|
||||
y += track.getHeight();
|
||||
}
|
||||
|
||||
y += 3;
|
||||
|
||||
int newHeight = 0;
|
||||
|
||||
if (musicList.getScrollHeight() > 0)
|
||||
{
|
||||
newHeight = (musicList.getScrollY() * y) / musicList.getScrollHeight();
|
||||
}
|
||||
|
||||
musicList.setScrollHeight(y);
|
||||
musicList.revalidateScroll();
|
||||
|
||||
client.runScript(
|
||||
ScriptID.UPDATE_SCROLLBAR,
|
||||
WidgetInfo.MUSIC_TRACK_SCROLLBAR.getId(),
|
||||
WidgetInfo.MUSIC_TRACK_LIST.getId(),
|
||||
newHeight
|
||||
);
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
private enum MusicState
|
||||
{
|
||||
NOT_FOUND(0xff0000, "Locked", SpriteID.MINIMAP_ORB_HITPOINTS),
|
||||
FOUND(0xdc10d, "Unlocked", SpriteID.MINIMAP_ORB_HITPOINTS_POISON),
|
||||
ALL(0, "All", SpriteID.MINIMAP_ORB_PRAYER);
|
||||
|
||||
private final int color;
|
||||
private final String name;
|
||||
private final int spriteID;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Sean Dewar <https://github.com/seandewar>
|
||||
* 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.opponentinfo;
|
||||
|
||||
public enum HitpointsDisplayStyle
|
||||
{
|
||||
HITPOINTS,
|
||||
PERCENTAGE,
|
||||
BOTH;
|
||||
}
|
||||
@@ -43,14 +43,14 @@ public interface OpponentInfoConfig extends Config
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showPercent",
|
||||
name = "Show percent",
|
||||
description = "Shows hitpoints as a percentage even if hitpoints are known",
|
||||
keyName = "hitpointsDisplayStyle",
|
||||
name = "Hitpoints display style",
|
||||
description = "Show opponent's hitpoints as a value (if known), percentage, or both",
|
||||
position = 1
|
||||
)
|
||||
default boolean showPercent()
|
||||
default HitpointsDisplayStyle hitpointsDisplayStyle()
|
||||
{
|
||||
return false;
|
||||
return HitpointsDisplayStyle.HITPOINTS;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
|
||||
@@ -164,7 +164,10 @@ class OpponentInfoOverlay extends Overlay
|
||||
progressBarComponent.setBackgroundColor(HP_RED);
|
||||
progressBarComponent.setForegroundColor(HP_GREEN);
|
||||
|
||||
if (lastMaxHealth != null && !opponentInfoConfig.showPercent())
|
||||
final HitpointsDisplayStyle displayStyle = opponentInfoConfig.hitpointsDisplayStyle();
|
||||
|
||||
if ((displayStyle == HitpointsDisplayStyle.HITPOINTS || displayStyle == HitpointsDisplayStyle.BOTH)
|
||||
&& lastMaxHealth != null)
|
||||
{
|
||||
// This is the reverse of the calculation of healthRatio done by the server
|
||||
// which is: healthRatio = 1 + (healthScale - 1) * health / maxHealth (if health > 0, 0 otherwise)
|
||||
@@ -194,11 +197,15 @@ class OpponentInfoOverlay extends Overlay
|
||||
// so we know nothing about the upper limit except that it can't be higher than maxHealth
|
||||
maxHealth = lastMaxHealth;
|
||||
}
|
||||
// Take the average of min and max possible healts
|
||||
// Take the average of min and max possible healths
|
||||
health = (minHealth + maxHealth + 1) / 2;
|
||||
}
|
||||
|
||||
progressBarComponent.setLabelDisplayMode(ProgressBarComponent.LabelDisplayMode.FULL);
|
||||
// Show both the hitpoint and percentage values if enabled in the config
|
||||
final ProgressBarComponent.LabelDisplayMode progressBarDisplayMode = displayStyle == HitpointsDisplayStyle.BOTH ?
|
||||
ProgressBarComponent.LabelDisplayMode.BOTH : ProgressBarComponent.LabelDisplayMode.FULL;
|
||||
|
||||
progressBarComponent.setLabelDisplayMode(progressBarDisplayMode);
|
||||
progressBarComponent.setMaximum(lastMaxHealth);
|
||||
progressBarComponent.setValue(health);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,13 @@
|
||||
package net.runelite.client.plugins.questlist;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
@@ -51,13 +58,6 @@ import net.runelite.client.game.chatbox.ChatboxTextInput;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.util.Text;
|
||||
import javax.inject.Inject;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Quest List",
|
||||
@@ -93,6 +93,22 @@ public class QuestListPlugin extends Plugin
|
||||
|
||||
private QuestState currentFilterState;
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
clientThread.invoke(this::addQuestButtons);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
header.deleteAllChildren();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged e)
|
||||
{
|
||||
@@ -110,6 +126,11 @@ public class QuestListPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
addQuestButtons();
|
||||
}
|
||||
|
||||
private void addQuestButtons()
|
||||
{
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
|
||||
@@ -187,6 +187,11 @@ public class FarmingTracker
|
||||
|
||||
PatchState state = patch.getImplementation().forVarbitValue(value);
|
||||
|
||||
if (state == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int stage = state.getStage();
|
||||
int stages = state.getStages();
|
||||
int tickrate = state.getTickRate() * 60;
|
||||
|
||||
@@ -139,28 +139,28 @@ class FarmingWorld
|
||||
new FarmingPatch("", Varbits.FARMING_4772, PatchImplementation.HERB)
|
||||
));
|
||||
|
||||
add(new FarmingRegion("Kourend", 7222,
|
||||
add(new FarmingRegion("Kourend", 6967,
|
||||
new FarmingPatch("North East", Varbits.FARMING_4771, PatchImplementation.ALLOTMENT),
|
||||
new FarmingPatch("South West", Varbits.FARMING_4772, PatchImplementation.ALLOTMENT),
|
||||
new FarmingPatch("", Varbits.FARMING_4773, PatchImplementation.FLOWER),
|
||||
new FarmingPatch("", Varbits.FARMING_4774, PatchImplementation.HERB)
|
||||
));
|
||||
add(new FarmingRegion("Kourend", 6711,
|
||||
new FarmingPatch("", Varbits.FARMING_4771, PatchImplementation.SPIRIT_TREE)
|
||||
new FarmingPatch("", Varbits.FARMING_7904, PatchImplementation.SPIRIT_TREE)
|
||||
));
|
||||
add(new FarmingRegion("Kourend", 7223,
|
||||
new FarmingPatch("West 1", Varbits.GRAPES_4953, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 2", Varbits.GRAPES_4954, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 3", Varbits.GRAPES_4955, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 4", Varbits.GRAPES_4956, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 5", Varbits.GRAPES_4957, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 6", Varbits.GRAPES_4958, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 1", Varbits.GRAPES_4959, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 2", Varbits.GRAPES_4960, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 3", Varbits.GRAPES_4961, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 4", Varbits.GRAPES_4962, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 5", Varbits.GRAPES_4963, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 6", Varbits.GRAPES_4964, PatchImplementation.GRAPES)
|
||||
new FarmingPatch("East 1", Varbits.GRAPES_4953, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 2", Varbits.GRAPES_4954, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 3", Varbits.GRAPES_4955, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 4", Varbits.GRAPES_4956, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 5", Varbits.GRAPES_4957, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("East 6", Varbits.GRAPES_4958, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 1", Varbits.GRAPES_4959, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 2", Varbits.GRAPES_4960, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 3", Varbits.GRAPES_4961, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 4", Varbits.GRAPES_4962, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 5", Varbits.GRAPES_4963, PatchImplementation.GRAPES),
|
||||
new FarmingPatch("West 6", Varbits.GRAPES_4964, PatchImplementation.GRAPES)
|
||||
));
|
||||
|
||||
add(new FarmingRegion("Lletya", 9265,
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.timetracking.farming;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.client.plugins.timetracking.Tab;
|
||||
@@ -2576,6 +2577,7 @@ public enum PatchImplementation
|
||||
}
|
||||
};
|
||||
|
||||
@Nullable
|
||||
abstract PatchState forVarbitValue(int value);
|
||||
|
||||
private final Tab tab;
|
||||
|
||||
@@ -115,7 +115,7 @@ enum TeleportLocationData
|
||||
|
||||
// Misc
|
||||
XERICS_LOOKOUT(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Lookout", new WorldPoint(1576, 3528, 0), "xerics_talisman_teleport_icon.png"),
|
||||
XERICS_GLADE(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Glade", new WorldPoint(1773, 3502, 0), "xerics_talisman_teleport_icon.png"),
|
||||
XERICS_GLADE(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Glade", new WorldPoint(1754, 3564, 0), "xerics_talisman_teleport_icon.png"),
|
||||
XERICS_INFERNO(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Inferno", new WorldPoint(1504, 3819, 0), "xerics_talisman_teleport_icon.png"),
|
||||
XERICS_HEART(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Heart", new WorldPoint(1641, 3670, 0), "xerics_talisman_teleport_icon.png"),
|
||||
XERICS_HONOUR(TeleportType.OTHER, "Xeric's Talisman", "Xeric's Honour", new WorldPoint(1254, 3559, 0), "xerics_talisman_teleport_icon.png"),
|
||||
|
||||
@@ -125,14 +125,30 @@ class XpInfoBoxOverlay extends Overlay
|
||||
.right(StackFormatter.quantityToRSDecimalStack(rightNum, true))
|
||||
.build();
|
||||
|
||||
final LineComponent xpHour = LineComponent.builder()
|
||||
.left("XP/Hour:")
|
||||
.right(StackFormatter.quantityToRSDecimalStack(snapshot.getXpPerHour(), true))
|
||||
final String bottemLeftStr;
|
||||
final int bottomRightNum;
|
||||
|
||||
switch (config.onScreenDisplayModeBottom())
|
||||
{
|
||||
case ACTIONS_HOUR:
|
||||
bottemLeftStr = snapshot.getActionType().getLabel() + "/Hour";
|
||||
bottomRightNum = snapshot.getActionsPerHour();
|
||||
break;
|
||||
case XP_HOUR:
|
||||
default:
|
||||
bottemLeftStr = "XP/Hour";
|
||||
bottomRightNum = snapshot.getXpPerHour();
|
||||
break;
|
||||
}
|
||||
|
||||
final LineComponent xpLineBottom = LineComponent.builder()
|
||||
.left(bottemLeftStr + ":")
|
||||
.right(StackFormatter.quantityToRSDecimalStack(bottomRightNum, true))
|
||||
.build();
|
||||
|
||||
final SplitComponent xpSplit = SplitComponent.builder()
|
||||
.first(xpLine)
|
||||
.second(xpHour)
|
||||
.second(xpLineBottom)
|
||||
.orientation(ComponentOrientation.VERTICAL)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -41,6 +41,13 @@ public interface XpTrackerConfig extends Config
|
||||
ACTIONS_LEFT
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
enum OnScreenDisplayModeBottom
|
||||
{
|
||||
XP_HOUR,
|
||||
ACTIONS_HOUR,
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hideMaxed",
|
||||
@@ -88,11 +95,22 @@ public interface XpTrackerConfig extends Config
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "onScreenDisplayMode",
|
||||
name = "On-screen tracker display mode",
|
||||
name = "On-screen tracker display mode (top)",
|
||||
description = "Configures the information displayed in the first line of on-screen XP overlays"
|
||||
)
|
||||
default OnScreenDisplayMode onScreenDisplayMode()
|
||||
{
|
||||
return OnScreenDisplayMode.XP_GAINED;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "onScreenDisplayModeBottom",
|
||||
name = "On-screen tracker display mode (bottom)",
|
||||
description = "Configures the information displayed in the second line of on-screen XP overlays"
|
||||
)
|
||||
default OnScreenDisplayModeBottom onScreenDisplayModeBottom()
|
||||
{
|
||||
return OnScreenDisplayModeBottom.XP_HOUR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.NONE;
|
||||
import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA;
|
||||
@@ -220,6 +221,12 @@ public class ClientLoader
|
||||
|
||||
Applet rs = (Applet) clientClass.newInstance();
|
||||
rs.setStub(new RSAppletStub(config));
|
||||
|
||||
if (rs instanceof Client)
|
||||
{
|
||||
log.info("client-patch {}", ((Client) rs).getBuildID());
|
||||
}
|
||||
|
||||
return rs;
|
||||
}
|
||||
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
|
||||
|
||||
@@ -40,7 +40,8 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||
public enum LabelDisplayMode
|
||||
{
|
||||
PERCENTAGE,
|
||||
FULL
|
||||
FULL,
|
||||
BOTH
|
||||
}
|
||||
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("0.0");
|
||||
@@ -79,10 +80,13 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||
switch (labelDisplayMode)
|
||||
{
|
||||
case PERCENTAGE:
|
||||
textToWrite = DECIMAL_FORMAT.format(pc * 100d) + "%";
|
||||
textToWrite = formatPercentageProgress(pc);
|
||||
break;
|
||||
case BOTH:
|
||||
textToWrite = formatFullProgress(currentValue, maximum) + " (" + formatPercentageProgress(pc) + ")";
|
||||
break;
|
||||
default:
|
||||
textToWrite = DECIMAL_FORMAT_ABS.format(Math.floor(currentValue)) + "/" + maximum;
|
||||
textToWrite = formatFullProgress(currentValue, maximum);
|
||||
}
|
||||
|
||||
final int width = preferredSize.width;
|
||||
@@ -126,4 +130,14 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
||||
bounds.setSize(dimension);
|
||||
return dimension;
|
||||
}
|
||||
|
||||
private static String formatFullProgress(double current, long maximum)
|
||||
{
|
||||
return DECIMAL_FORMAT_ABS.format(Math.floor(current)) + "/" + maximum;
|
||||
}
|
||||
|
||||
private static String formatPercentageProgress(double ratio)
|
||||
{
|
||||
return DECIMAL_FORMAT.format(ratio * 100d) + "%";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -460,7 +460,7 @@
|
||||
"level": 60,
|
||||
"sprite": 354,
|
||||
"name": "Bones To Peaches",
|
||||
"xp": 65
|
||||
"xp": 35.5
|
||||
},
|
||||
{
|
||||
"level": 61,
|
||||
|
||||
@@ -189,8 +189,10 @@ CHAT_FILTER:
|
||||
sload 11 ; Load the message
|
||||
iconst 1 ; Gets changed to 0 if message is blocked
|
||||
iload 10 ; Load the messageType
|
||||
iload 9 ; Load the id of the messageNode
|
||||
sconst "chatFilterCheck"
|
||||
runelite_callback
|
||||
pop_int ; Pop the id of the messageNode
|
||||
pop_int ; Pop the messageType
|
||||
iconst 1 ; 2nd half of conditional
|
||||
sstore 11 ; Override the message with our filtered message
|
||||
|
||||
@@ -359,9 +359,11 @@ CHAT_FILTER:
|
||||
sload 0 ; Load the message
|
||||
iconst 1 ; Gets changed to 0 if message is blocked
|
||||
iload 15 ; Load the messageType
|
||||
iload 12 ; Load the id of the messageNode
|
||||
sconst "chatFilterCheck"
|
||||
runelite_callback
|
||||
pop_int ; Pop the messageType
|
||||
runelite_callback
|
||||
pop_int ; Pop the id of the messageNode
|
||||
pop_int ; Pop the messageType
|
||||
iconst 1 ; 2nd half of conditional
|
||||
sstore 0 ; Override the message with our filtered message
|
||||
if_icmpeq LABEL327 ; Check if we are building this message
|
||||
|
||||
@@ -37,6 +37,11 @@ LABEL20:
|
||||
invoke 1972
|
||||
iconst 1
|
||||
if_icmpeq LABEL31
|
||||
iconst 0 ; Modified to enable clanchat input
|
||||
sconst "clanchatInput"
|
||||
runelite_callback
|
||||
iconst 1
|
||||
if_icmpeq LABEL31 ; Compare to 1
|
||||
jump LABEL37
|
||||
LABEL31:
|
||||
get_varc_int 41
|
||||
|
||||
@@ -38,6 +38,7 @@ import java.applet.Applet;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -48,6 +49,8 @@ import net.runelite.api.Client;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.RuneLiteModule;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.rs.ClientUpdateCheckMode;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Before;
|
||||
@@ -75,6 +78,7 @@ public class PluginManagerTest
|
||||
public Client client;
|
||||
|
||||
private Set<Class> pluginClasses;
|
||||
private Set<Class> configClasses;
|
||||
|
||||
@Before
|
||||
public void before() throws IOException
|
||||
@@ -85,8 +89,9 @@ public class PluginManagerTest
|
||||
|
||||
RuneLite.setInjector(injector);
|
||||
|
||||
// Find plugins we expect to have
|
||||
// Find plugins and configs we expect to have
|
||||
pluginClasses = new HashSet<>();
|
||||
configClasses = new HashSet<>();
|
||||
Set<ClassInfo> classes = ClassPath.from(getClass().getClassLoader()).getTopLevelClassesRecursive(PLUGIN_PACKAGE);
|
||||
for (ClassInfo classInfo : classes)
|
||||
{
|
||||
@@ -95,6 +100,12 @@ public class PluginManagerTest
|
||||
if (pluginDescriptor != null)
|
||||
{
|
||||
pluginClasses.add(clazz);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Config.class.isAssignableFrom(clazz))
|
||||
{
|
||||
configClasses.add(clazz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,4 +166,37 @@ public class PluginManagerTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ensureNoDuplicateConfigKeyNames()
|
||||
{
|
||||
for (final Class clazz : configClasses)
|
||||
{
|
||||
final Set<String> configKeyNames = new HashSet<>();
|
||||
|
||||
for (final Method method : clazz.getMethods())
|
||||
{
|
||||
if (!method.isDefault())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final ConfigItem annotation = method.getAnnotation(ConfigItem.class);
|
||||
|
||||
if (annotation == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final String configKeyName = annotation.keyName();
|
||||
|
||||
if (configKeyNames.contains(configKeyName))
|
||||
{
|
||||
throw new IllegalArgumentException("keyName " + configKeyName + " is duplicated in " + clazz);
|
||||
}
|
||||
|
||||
configKeyNames.add(configKeyName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
||||
* Copyright (c) 2019, osrs-music-map <osrs-music-map@users.noreply.github.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -29,8 +30,11 @@ import com.google.inject.testing.fieldbinder.Bind;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
@@ -49,6 +53,10 @@ public class ChatFilterPluginTest
|
||||
@Bind
|
||||
private ChatFilterConfig chatFilterConfig;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private Player localPlayer;
|
||||
|
||||
@Inject
|
||||
private ChatFilterPlugin chatFilterPlugin;
|
||||
|
||||
@@ -60,6 +68,7 @@ public class ChatFilterPluginTest
|
||||
when(chatFilterConfig.filterType()).thenReturn(ChatFilterType.CENSOR_WORDS);
|
||||
when(chatFilterConfig.filteredWords()).thenReturn("");
|
||||
when(chatFilterConfig.filteredRegex()).thenReturn("");
|
||||
when(client.getLocalPlayer()).thenReturn(localPlayer);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -110,4 +119,51 @@ public class ChatFilterPluginTest
|
||||
chatFilterPlugin.updateFilteredPatterns();
|
||||
assertNull(chatFilterPlugin.censorMessage("te\u008Cst"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromFriendIsFiltered()
|
||||
{
|
||||
when(client.isFriended("Iron Mammal", false)).thenReturn(true);
|
||||
when(chatFilterConfig.filterFriends()).thenReturn(true);
|
||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromFriendIsNotFiltered()
|
||||
{
|
||||
when(client.isFriended("Iron Mammal", false)).thenReturn(true);
|
||||
when(chatFilterConfig.filterFriends()).thenReturn(false);
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Iron Mammal"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromClanIsFiltered()
|
||||
{
|
||||
when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
when(chatFilterConfig.filterClan()).thenReturn(true);
|
||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromClanIsNotFiltered()
|
||||
{
|
||||
when(client.isClanMember("B0aty")).thenReturn(true);
|
||||
when(chatFilterConfig.filterClan()).thenReturn(false);
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("B0aty"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromSelfIsNotFiltered()
|
||||
{
|
||||
when(localPlayer.getName()).thenReturn("Swampletics");
|
||||
assertFalse(chatFilterPlugin.shouldFilterPlayerMessage("Swampletics"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMessageFromNonFriendNonClanIsFiltered()
|
||||
{
|
||||
when(client.isFriended("Woox", false)).thenReturn(false);
|
||||
when(client.isClanMember("Woox")).thenReturn(false);
|
||||
assertTrue(chatFilterPlugin.shouldFilterPlayerMessage("Woox"));
|
||||
}
|
||||
}
|
||||
@@ -24,209 +24,184 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.combatlevel;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.calcLevels;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.calcLevelsPray;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.calcLevelsRM;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.ATT_STR_MULT;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.DEF_HP_MULT;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.RANGE_MAGIC_LEVEL_MULT;
|
||||
import static net.runelite.client.plugins.combatlevel.CombatLevelOverlay.RANGE_MAGIC_MULT;
|
||||
import net.runelite.api.Experience;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
import java.util.HashMap;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CombatLevelPluginTest
|
||||
{
|
||||
@Mock
|
||||
@Bind
|
||||
private Client client;
|
||||
|
||||
@Mock
|
||||
private Player player;
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
|
||||
when(client.getLocalPlayer()).thenReturn(player);
|
||||
}
|
||||
|
||||
private HashMap<String, Double> getBaseValues()
|
||||
{
|
||||
int attackLevel = client.getRealSkillLevel(Skill.ATTACK);
|
||||
int strengthLevel = client.getRealSkillLevel(Skill.STRENGTH);
|
||||
int defenceLevel = client.getRealSkillLevel(Skill.DEFENCE);
|
||||
int hitpointsLevel = client.getRealSkillLevel(Skill.HITPOINTS);
|
||||
int magicLevel = client.getRealSkillLevel(Skill.MAGIC);
|
||||
int rangedLevel = client.getRealSkillLevel(Skill.RANGED);
|
||||
int prayerLevel = client.getRealSkillLevel(Skill.PRAYER);
|
||||
|
||||
double base = DEF_HP_MULT * (defenceLevel + hitpointsLevel + Math.floor(prayerLevel / 2));
|
||||
double melee = ATT_STR_MULT * (attackLevel + strengthLevel);
|
||||
double range = RANGE_MAGIC_MULT * Math.floor(rangedLevel * RANGE_MAGIC_LEVEL_MULT);
|
||||
double mage = RANGE_MAGIC_MULT * Math.floor(magicLevel * RANGE_MAGIC_LEVEL_MULT);
|
||||
double max = Math.max(melee, Math.max(range, mage));
|
||||
|
||||
HashMap<String, Double> result = new HashMap<>();
|
||||
result.put("base", base);
|
||||
result.put("melee", melee);
|
||||
result.put("max", max);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNewPlayer()
|
||||
{
|
||||
when(player.getCombatLevel()).thenReturn(3);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(10);
|
||||
int attackLevel = 1;
|
||||
int strengthLevel = 1;
|
||||
int defenceLevel = 1;
|
||||
int hitpointsLevel = 10;
|
||||
int magicLevel = 1;
|
||||
int rangeLevel = 1;
|
||||
int prayerLevel = 1;
|
||||
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(3, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("melee"),
|
||||
player.getCombatLevel() + 1, ATT_STR_MULT));
|
||||
assertEquals(2, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(3, calcLevels(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, DEF_HP_MULT));
|
||||
|
||||
// test prayer
|
||||
assertEquals(5, calcLevelsPray(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, client.getRealSkillLevel(Skill.PRAYER)));
|
||||
assertEquals(3, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(2, calcLevelsRM(client.getRealSkillLevel(Skill.RANGED),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(2, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(2, calcLevelsRM(client.getRealSkillLevel(Skill.MAGIC),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(2, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(5, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAll10()
|
||||
{
|
||||
when(player.getCombatLevel()).thenReturn(12);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(10);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(10);
|
||||
int attackLevel = 10;
|
||||
int strengthLevel = 10;
|
||||
int defenceLevel = 10;
|
||||
int hitpointsLevel = 10;
|
||||
int magicLevel = 10;
|
||||
int rangeLevel = 10;
|
||||
int prayerLevel = 10;
|
||||
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(12, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(1, calcLevels(baseValues.get("base") + baseValues.get("melee"),
|
||||
player.getCombatLevel() + 1, ATT_STR_MULT));
|
||||
assertEquals(1, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(1, calcLevels(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, DEF_HP_MULT));
|
||||
|
||||
// test prayer
|
||||
assertEquals(2, calcLevelsPray(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, client.getRealSkillLevel(Skill.PRAYER)));
|
||||
assertEquals(1, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(4, calcLevelsRM(client.getRealSkillLevel(Skill.RANGED),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(4, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(4, calcLevelsRM(client.getRealSkillLevel(Skill.MAGIC),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(4, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(2, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlayerBmid()
|
||||
{
|
||||
// snapshot of current stats 2018-10-2
|
||||
when(player.getCombatLevel()).thenReturn(83);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(65);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(70);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(60);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(56);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(75);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(73);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(71);
|
||||
int attackLevel = 65;
|
||||
int strengthLevel = 70;
|
||||
int defenceLevel = 60;
|
||||
int hitpointsLevel = 71;
|
||||
int magicLevel = 73;
|
||||
int rangeLevel = 75;
|
||||
int prayerLevel = 56;
|
||||
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(83, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("melee"),
|
||||
player.getCombatLevel() + 1, ATT_STR_MULT));
|
||||
assertEquals(2, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, DEF_HP_MULT));
|
||||
|
||||
// test prayer
|
||||
assertEquals(4, calcLevelsPray(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, client.getRealSkillLevel(Skill.PRAYER)));
|
||||
assertEquals(2, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(17, calcLevelsRM(client.getRealSkillLevel(Skill.RANGED),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(17, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(19, calcLevelsRM(client.getRealSkillLevel(Skill.MAGIC),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(19, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(4, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPlayerRunelite()
|
||||
{
|
||||
// snapshot of current stats 2018-10-2
|
||||
when(player.getCombatLevel()).thenReturn(43);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(43);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(36);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(1);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(15);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(51);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(64);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(42);
|
||||
int attackLevel = 43;
|
||||
int strengthLevel = 36;
|
||||
int defenceLevel = 1;
|
||||
int hitpointsLevel = 42;
|
||||
int magicLevel = 64;
|
||||
int rangeLevel = 51;
|
||||
int prayerLevel = 15;
|
||||
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(43, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(18, calcLevels(baseValues.get("base") + baseValues.get("melee"),
|
||||
player.getCombatLevel() + 1, ATT_STR_MULT));
|
||||
assertEquals(18, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, DEF_HP_MULT));
|
||||
|
||||
// test prayer
|
||||
assertEquals(3, calcLevelsPray(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, client.getRealSkillLevel(Skill.PRAYER)));
|
||||
assertEquals(2, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(14, calcLevelsRM(client.getRealSkillLevel(Skill.RANGED),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(14, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(1, calcLevelsRM(client.getRealSkillLevel(Skill.MAGIC),
|
||||
player.getCombatLevel() + 1, baseValues.get("base")));
|
||||
assertEquals(1, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(3, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -234,83 +209,188 @@ public class CombatLevelPluginTest
|
||||
{
|
||||
// snapshot of current stats 2018-10-3
|
||||
// Zezima cannot earn a combat level from ranged/magic anymore, so it won't show as the result is too high
|
||||
when(player.getCombatLevel()).thenReturn(90);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(74);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(74);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(72);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(52);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(44);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(60);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(72);
|
||||
int attackLevel = 74;
|
||||
int strengthLevel = 74;
|
||||
int defenceLevel = 72;
|
||||
int hitpointsLevel = 72;
|
||||
int magicLevel = 60;
|
||||
int rangeLevel = 44;
|
||||
int prayerLevel = 52;
|
||||
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(90, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("melee"),
|
||||
player.getCombatLevel() + 1, ATT_STR_MULT));
|
||||
assertEquals(2, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(2, calcLevels(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, DEF_HP_MULT));
|
||||
assertEquals(2, hpDefNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(4, calcLevelsPray(baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1, client.getRealSkillLevel(Skill.PRAYER)));
|
||||
assertEquals(4, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPrayerLevelsNeeded()
|
||||
{
|
||||
when(player.getCombatLevel()).thenReturn(124);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(99);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(99);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(99);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(89);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(99);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(99);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(99);
|
||||
int attackLevel = 99;
|
||||
int strengthLevel = 99;
|
||||
int defenceLevel = 99;
|
||||
int hitpointsLevel = 99;
|
||||
int magicLevel = 99;
|
||||
int rangeLevel = 99;
|
||||
int prayerLevel = 89;
|
||||
|
||||
assertEquals(1, neededPrayerLevels());
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(124, combatLevel);
|
||||
|
||||
// test prayer
|
||||
assertEquals(1, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEvenPrayerLevelsNeededWhenNearNextCombatLevel()
|
||||
{
|
||||
when(player.getCombatLevel()).thenReturn(90);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(74);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(75);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(72);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(52);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(44);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(60);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(72);
|
||||
int attackLevel = 74;
|
||||
int strengthLevel = 75;
|
||||
int defenceLevel = 72;
|
||||
int hitpointsLevel = 72;
|
||||
int magicLevel = 60;
|
||||
int rangeLevel = 44;
|
||||
int prayerLevel = 52;
|
||||
|
||||
assertEquals(2, neededPrayerLevels());
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(90, combatLevel);
|
||||
|
||||
// test prayer
|
||||
assertEquals(2, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOddPrayerLevelsNeededWhenNearNextCombatLevel()
|
||||
{
|
||||
when(player.getCombatLevel()).thenReturn(90);
|
||||
when(client.getRealSkillLevel(Skill.ATTACK)).thenReturn(74);
|
||||
when(client.getRealSkillLevel(Skill.STRENGTH)).thenReturn(75);
|
||||
when(client.getRealSkillLevel(Skill.DEFENCE)).thenReturn(72);
|
||||
when(client.getRealSkillLevel(Skill.PRAYER)).thenReturn(53);
|
||||
when(client.getRealSkillLevel(Skill.RANGED)).thenReturn(44);
|
||||
when(client.getRealSkillLevel(Skill.MAGIC)).thenReturn(60);
|
||||
when(client.getRealSkillLevel(Skill.HITPOINTS)).thenReturn(72);
|
||||
int attackLevel = 74;
|
||||
int strengthLevel = 75;
|
||||
int defenceLevel = 72;
|
||||
int hitpointsLevel = 72;
|
||||
int magicLevel = 60;
|
||||
int rangeLevel = 44;
|
||||
int prayerLevel = 53;
|
||||
|
||||
assertEquals(1, neededPrayerLevels());
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(90, combatLevel);
|
||||
|
||||
// test prayer
|
||||
assertEquals(1, prayerNeed);
|
||||
}
|
||||
|
||||
private int neededPrayerLevels()
|
||||
@Test
|
||||
public void testNextMagicLevelBarelyReachesNextCombatLevel()
|
||||
{
|
||||
HashMap<String, Double> baseValues = getBaseValues();
|
||||
int attackLevel = 40;
|
||||
int strengthLevel = 44;
|
||||
int defenceLevel = 46;
|
||||
int hitpointsLevel = 39;
|
||||
int magicLevel = 57;
|
||||
int rangeLevel = 40;
|
||||
int prayerLevel = 29;
|
||||
|
||||
return calcLevelsPray(
|
||||
baseValues.get("base") + baseValues.get("max"),
|
||||
player.getCombatLevel() + 1,
|
||||
client.getRealSkillLevel(Skill.PRAYER)
|
||||
);
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(52, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(3, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(3, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(18, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(1, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(5, prayerNeed);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRangeMagicLevelsNeeded()
|
||||
{
|
||||
int attackLevel = 60;
|
||||
int strengthLevel = 69;
|
||||
int defenceLevel = 1;
|
||||
int hitpointsLevel = 78;
|
||||
int magicLevel = 85;
|
||||
int rangeLevel = 85;
|
||||
int prayerLevel = 52;
|
||||
|
||||
int combatLevel = Experience.getCombatLevel(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int meleeNeed = Experience.getNextCombatLevelMelee(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int hpDefNeed = Experience.getNextCombatLevelHpDef(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int rangeNeed = Experience.getNextCombatLevelRange(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int magicNeed = Experience.getNextCombatLevelMagic(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
int prayerNeed = Experience.getNextCombatLevelPrayer(attackLevel, strengthLevel, defenceLevel, hitpointsLevel,
|
||||
magicLevel, rangeLevel, prayerLevel);
|
||||
|
||||
// test combat level
|
||||
assertEquals(68, combatLevel);
|
||||
|
||||
// test attack/strength
|
||||
assertEquals(3, meleeNeed);
|
||||
|
||||
// test defence/hitpoints
|
||||
assertEquals(4, hpDefNeed);
|
||||
|
||||
// test ranged
|
||||
assertEquals(3, rangeNeed);
|
||||
|
||||
// test magic
|
||||
assertEquals(3, magicNeed);
|
||||
|
||||
// test prayer
|
||||
assertEquals(8, prayerNeed);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,12 +29,11 @@ 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.events.ChatMessage;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
@@ -52,13 +51,16 @@ public class CookingPluginTest
|
||||
"You cook the karambwan. It looks delicious.",
|
||||
"You roast a lobster.",
|
||||
"You cook a bass.",
|
||||
"You squeeze the grapes into the jug. The wine begins to ferment.",
|
||||
"You successfully bake a tasty garden pie."
|
||||
};
|
||||
|
||||
@Inject
|
||||
CookingPlugin cookingPlugin;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
Client client;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
CookingConfig config;
|
||||
@@ -94,26 +96,4 @@ public class CookingPluginTest
|
||||
assertNotNull(cookingSession);
|
||||
assertEquals(COOKING_MESSAGES.length, cookingSession.getCookAmount());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFermentTimerOnChatMessage()
|
||||
{
|
||||
when(config.fermentTimer()).thenReturn(true);
|
||||
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", COOKING_MESSAGES[6], "", 0);
|
||||
cookingPlugin.onChatMessage(chatMessage);
|
||||
FermentTimerSession fermentTimerSession = cookingPlugin.getFermentTimerSession();
|
||||
|
||||
assertNotNull(fermentTimerSession);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFermentTimerOnChatMessage_pluginDisabled()
|
||||
{
|
||||
when(config.fermentTimer()).thenReturn(false);
|
||||
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", COOKING_MESSAGES[6], "", 0);
|
||||
cookingPlugin.onChatMessage(chatMessage);
|
||||
FermentTimerSession fermentTimerSession = cookingPlugin.getFermentTimerSession();
|
||||
|
||||
assertNull(fermentTimerSession);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user