Merge branch 'upstream-master' into runelite

# Conflicts:
#	cache-client/pom.xml
#	cache-updater/pom.xml
#	cache/pom.xml
#	http-api/pom.xml
#	http-service/pom.xml
#	pom.xml
#	runelite-api/pom.xml
#	runelite-api/src/main/java/net/runelite/api/Client.java
#	runelite-api/src/main/java/net/runelite/api/events/MenuEntryAdded.java
#	runelite-api/src/main/java/net/runelite/api/events/NpcActionChanged.java
#	runelite-api/src/main/java/net/runelite/api/events/PlayerMenuOptionClicked.java
#	runelite-client/pom.xml
#	runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldSwitcherPanel.java
#	runelite-client/src/test/java/net/runelite/client/plugins/slayer/SlayerPluginTest.java
#	runelite-script-assembler-plugin/pom.xml
This commit is contained in:
zeruth
2021-01-29 21:19:28 -05:00
55 changed files with 1763 additions and 395 deletions
+1 -1
View File
@@ -25,7 +25,7 @@
object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.6.37"
const val rlVersion = "1.6.38"
const val openosrsVersion = "3.5.4"
@@ -117,7 +117,7 @@ public enum ChatMessageType
*/
MODAUTOTYPER(91),
/**
* A game message (ie. when a setting is changed).
* A game message. (ie. when a setting is changed)
*/
CONSOLE(99),
/**
@@ -47,7 +47,7 @@ import org.slf4j.Logger;
/**
* Represents the RuneScape client.
*/
public interface Client extends GameShell
public interface Client extends GameEngine
{
/**
* The injected client invokes these callbacks to send events to us
@@ -68,6 +68,8 @@ public interface Client extends GameShell
*/
Logger getLogger();
String getBuildID();
/**
* Gets a list of all valid players from the player cache.
*
@@ -457,7 +459,7 @@ public interface Client extends GameShell
int getMouseCurrentButton();
/**
* Gets the currently selected tile (ie. last right clicked tile).
* Gets the currently selected tile. (ie. last right clicked tile)
*
* @return the selected tile
*/
@@ -1543,8 +1545,8 @@ public interface Client extends GameShell
void setPlayersHidden(boolean state);
/**
* Sets whether 2D sprites (ie. overhead prayers, PK skull) related to
* the other players are hidden.
* Sets whether 2D sprites related to the other players are hidden.
* (ie. overhead prayers, PK skull)
*
* @param state the new player 2D hidden state
*/
@@ -1572,8 +1574,8 @@ public interface Client extends GameShell
void setLocalPlayerHidden(boolean state);
/**
* Sets whether 2D sprites (ie. overhead prayers, PK skull) related to
* the local player are hidden.
* Sets whether 2D sprites related to the local player are hidden.
* (ie. overhead prayers, PK skull)
*
* @param state new local player 2D hidden state
*/
@@ -30,7 +30,7 @@ import java.awt.Canvas;
/**
* Represents the client game engine.
*/
public interface GameShell
public interface GameEngine
{
/**
* Gets the canvas that contains everything.
@@ -54,7 +54,7 @@ public enum HeadIcon
*/
REDEMPTION,
/**
* Protect from range and mage (ie. used by Kalphite Queen).
* Protect from range and mage. (ie. used by Kalphite Queen)
*/
RANGE_MAGE
}
@@ -11656,8 +11656,6 @@ public final class ItemID
public static final int GIANT_BOULDER = 25314;
public static final int GOBLIN_DECORATIONS = 25316;
public static final int GNOME_CHILD_ICON = 25319;
public static final int GNOME_CHILD = 25320;
public static final int GNOME_CHILD_25321 = 25321;
public static final int _20TH_ANNIVERSARY_HAT = 25322;
public static final int _20TH_ANNIVERSARY_TOP = 25324;
public static final int _20TH_ANNIVERSARY_BOTTOM = 25326;
@@ -11698,5 +11696,60 @@ public final class ItemID
public static final int TRAILBLAZER_RELIC_HUNTER_T1_ARMOUR_SET = 25380;
public static final int TRAILBLAZER_RELIC_HUNTER_T2_ARMOUR_SET = 25383;
public static final int TRAILBLAZER_RELIC_HUNTER_T3_ARMOUR_SET = 25386;
public static final int SWAMPBARK_BODY = 25389;
public static final int SWAMPBARK_GAUNTLETS = 25392;
public static final int SWAMPBARK_BOOTS = 25395;
public static final int SWAMPBARK_HELM = 25398;
public static final int SWAMPBARK_LEGS = 25401;
public static final int BLOODBARK_BODY = 25404;
public static final int BLOODBARK_GAUNTLETS = 25407;
public static final int BLOODBARK_BOOTS = 25410;
public static final int BLOODBARK_HELM = 25413;
public static final int BLOODBARK_LEGS = 25416;
public static final int URIUM_REMAINS = 25419;
public static final int BLEACHED_BONES = 25422;
public static final int GOLD_KEY_RED = 25424;
public static final int GOLD_KEY_BROWN = 25426;
public static final int GOLD_KEY_CRIMSON = 25428;
public static final int GOLD_KEY_BLACK = 25430;
public static final int GOLD_KEY_PURPLE = 25432;
public static final int ZEALOTS_ROBE_TOP = 25434;
public static final int ZEALOTS_ROBE_BOTTOM = 25436;
public static final int ZEALOTS_HELM = 25438;
public static final int ZEALOTS_BOOTS = 25440;
public static final int BRONZE_LOCKS = 25442;
public static final int STEEL_LOCKS = 25445;
public static final int BLACK_LOCKS = 25448;
public static final int SILVER_LOCKS = 25451;
public static final int GOLD_LOCKS = 25454;
public static final int BROKEN_COFFIN = 25457;
public static final int BRONZE_COFFIN = 25459;
public static final int STEEL_COFFIN = 25461;
public static final int BLACK_COFFIN = 25463;
public static final int SILVER_COFFIN = 25465;
public static final int GOLD_COFFIN = 25467;
public static final int OPEN_BRONZE_COFFIN = 25469;
public static final int OPEN_STEEL_COFFIN = 25470;
public static final int OPEN_BLACK_COFFIN = 25471;
public static final int OPEN_SILVER_COFFIN = 25472;
public static final int OPEN_GOLD_COFFIN = 25473;
public static final int TREE_WIZARDS_JOURNAL = 25474;
public static final int BLOODY_NOTES = 25476;
public static final int RUNESCROLL_OF_SWAMPBARK = 25478;
public static final int RUNESCROLL_OF_BLOODBARK = 25481;
public static final int TOXIC_BLOWPIPE_BETA__BRONZE = 25484;
public static final int TOXIC_BLOWPIPE_BETA__IRON = 25485;
public static final int TOXIC_BLOWPIPE_BETA__STEEL = 25486;
public static final int TOXIC_BLOWPIPE_BETA__BLACK = 25487;
public static final int TOXIC_BLOWPIPE_BETA__MITHRIL = 25488;
public static final int TOXIC_BLOWPIPE_BETA__ADAMANT = 25489;
public static final int TOXIC_BLOWPIPE_BETA__RUNE = 25490;
public static final int TOXIC_BLOWPIPE_BETA__DRAGON = 25491;
public static final int BLACK_DHIDE_BODY_BETA = 25492;
public static final int BLACK_DHIDE_CHAPS_BETA = 25493;
public static final int BLACK_DHIDE_VAMBRACES_BETA = 25494;
public static final int CRYSTAL_HELM_BETA = 25495;
public static final int CRYSTAL_BODY_BETA = 25496;
public static final int CRYSTAL_LEGS_BETA = 25497;
/* This file is automatically generated. Do not edit. */
}
@@ -35,11 +35,11 @@ import lombok.NoArgsConstructor;
public class MenuEntry implements Cloneable
{
/**
* The option text added to the menu (ie. "Walk here", "Use").
* The option text added to the menu. (ie. "Walk here", "Use")
*/
private String option;
/**
* The target of the action (ie. Item or Actor name).
* The target of the action. (ie. Item or Actor name)
* <p>
* If the option does not apply to any target, this field
* will be set to empty string.
@@ -58,7 +58,7 @@ public interface MessageNode extends Node
void setName(String name);
/**
* Gets the sender of the message (ie. friends chat name).
* Gets the sender of the message. (ie. friends chat name)
*
* @return the message sender
*/
@@ -2657,6 +2657,7 @@ public final class NpcID
public static final int DRYAD = 2828;
public static final int FAIRY_2829 = 2829;
public static final int MYSTERIOUS_OLD_MAN = 2830;
public static final int CHAIR = 2832;
public static final int LIL_CREATOR = 2833;
public static final int GIANT_BAT = 2834;
public static final int CAMEL = 2835;
@@ -5716,6 +5717,7 @@ public final class NpcID
public static final int THE_INADEQUACY_HARD = 6119;
public static final int THE_EVERLASTING_HARD = 6120;
public static final int THE_UNTOUCHABLE_HARD = 6121;
public static final int URIUM_SHADOW = 6143;
public static final int SCION_6177 = 6177;
public static final int JUNGLE_SPIDER_6267 = 6267;
public static final int JUNGLE_SPIDER_6271 = 6271;
@@ -8920,37 +8922,14 @@ public final class NpcID
public static final int DUCK_10546 = 10546;
public static final int DUCK_10547 = 10547;
public static final int CHICKEN_10556 = 10556;
public static final int GNOME_CHILD_10557 = 10557;
public static final int GNOME_CHILD_10558 = 10558;
public static final int SCRUBFOOT = 10559;
public static final int GNOME_CHILD_10560 = 10560;
public static final int RED_FIREFLIES = 10561;
public static final int GNOME_CHILD_10562 = 10562;
public static final int THRANDER = 10563;
public static final int GREEN_FIREFLIES = 10564;
public static final int CHUCK_10565 = 10565;
public static final int GOBLIN_10566 = 10566;
public static final int GOBLIN_10567 = 10567;
public static final int PIOUS_PETE = 10568;
public static final int MYSTERIOUS_WATCHER = 10569;
public static final int MYSTERIOUS_WATCHER_10570 = 10570;
public static final int MYSTERIOUS_WATCHER_10571 = 10571;
public static final int BIG_MO = 10572;
public static final int CHEERLEADER_10573 = 10573;
public static final int CHEERLEADER_10574 = 10574;
public static final int CHEERLEADER_10575 = 10575;
public static final int BLACK_DRAGON_10576 = 10576;
public static final int RED_DRAGON_10577 = 10577;
public static final int BLUE_DRAGON_10578 = 10578;
public static final int KING_BLACK_DRAGON_10579 = 10579;
public static final int BABY_BLUE_DRAGON_10580 = 10580;
public static final int LESSER_DEMON_10581 = 10581;
public static final int GREATER_DEMON_10582 = 10582;
public static final int BLACK_DEMON_10583 = 10583;
public static final int SCORPION_10584 = 10584;
public static final int KING_SCORPION_10585 = 10585;
public static final int ORC = 10586;
public static final int LIZARD_MAN = 10587;
public static final int TROLL_10588 = 10588;
public static final int URIUM_SHADE = 10589;
public static final int DAMPE = 10590;
public static final int UNDEAD_ZEALOT = 10591;
public static final int UNDEAD_ZEALOT_10592 = 10592;
/* This file is automatically generated. Do not edit. */
}
@@ -13453,6 +13453,8 @@ public final class NullItemID
public static final int NULL_25315 = 25315;
public static final int NULL_25317 = 25317;
public static final int NULL_25318 = 25318;
public static final int NULL_25320 = 25320;
public static final int NULL_25321 = 25321;
public static final int NULL_25323 = 25323;
public static final int NULL_25325 = 25325;
public static final int NULL_25327 = 25327;
@@ -13480,5 +13482,59 @@ public final class NullItemID
public static final int NULL_25385 = 25385;
public static final int NULL_25387 = 25387;
public static final int NULL_25388 = 25388;
public static final int NULL_25390 = 25390;
public static final int NULL_25391 = 25391;
public static final int NULL_25393 = 25393;
public static final int NULL_25394 = 25394;
public static final int NULL_25396 = 25396;
public static final int NULL_25397 = 25397;
public static final int NULL_25399 = 25399;
public static final int NULL_25400 = 25400;
public static final int NULL_25402 = 25402;
public static final int NULL_25403 = 25403;
public static final int NULL_25405 = 25405;
public static final int NULL_25406 = 25406;
public static final int NULL_25408 = 25408;
public static final int NULL_25409 = 25409;
public static final int NULL_25411 = 25411;
public static final int NULL_25412 = 25412;
public static final int NULL_25414 = 25414;
public static final int NULL_25415 = 25415;
public static final int NULL_25417 = 25417;
public static final int NULL_25418 = 25418;
public static final int NULL_25420 = 25420;
public static final int NULL_25421 = 25421;
public static final int NULL_25423 = 25423;
public static final int NULL_25425 = 25425;
public static final int NULL_25427 = 25427;
public static final int NULL_25429 = 25429;
public static final int NULL_25431 = 25431;
public static final int NULL_25433 = 25433;
public static final int NULL_25435 = 25435;
public static final int NULL_25437 = 25437;
public static final int NULL_25439 = 25439;
public static final int NULL_25441 = 25441;
public static final int NULL_25443 = 25443;
public static final int NULL_25444 = 25444;
public static final int NULL_25446 = 25446;
public static final int NULL_25447 = 25447;
public static final int NULL_25449 = 25449;
public static final int NULL_25450 = 25450;
public static final int NULL_25452 = 25452;
public static final int NULL_25453 = 25453;
public static final int NULL_25455 = 25455;
public static final int NULL_25456 = 25456;
public static final int NULL_25458 = 25458;
public static final int NULL_25460 = 25460;
public static final int NULL_25462 = 25462;
public static final int NULL_25464 = 25464;
public static final int NULL_25466 = 25466;
public static final int NULL_25468 = 25468;
public static final int NULL_25475 = 25475;
public static final int NULL_25477 = 25477;
public static final int NULL_25479 = 25479;
public static final int NULL_25480 = 25480;
public static final int NULL_25482 = 25482;
public static final int NULL_25483 = 25483;
/* This file is automatically generated. Do not edit. */
}
@@ -174,7 +174,6 @@ public final class NullNpcID
public static final int NULL_2780 = 2780;
public static final int NULL_2781 = 2781;
public static final int NULL_2831 = 2831;
public static final int NULL_2832 = 2832;
public static final int NULL_2934 = 2934;
public static final int NULL_2935 = 2935;
public static final int NULL_2936 = 2936;
@@ -879,7 +879,6 @@ public final class NullObjectID
public static final int NULL_1793 = 1793;
public static final int NULL_1794 = 1794;
public static final int NULL_1795 = 1795;
public static final int NULL_1796 = 1796;
public static final int NULL_1798 = 1798;
public static final int NULL_1799 = 1799;
public static final int NULL_1800 = 1800;
@@ -890,7 +889,6 @@ public final class NullObjectID
public static final int NULL_1807 = 1807;
public static final int NULL_1808 = 1808;
public static final int NULL_1809 = 1809;
public static final int NULL_1812 = 1812;
public static final int NULL_1815 = 1815;
public static final int NULL_1818 = 1818;
public static final int NULL_1819 = 1819;
@@ -19747,6 +19745,7 @@ public final class NullObjectID
public static final int NULL_40427 = 40427;
public static final int NULL_40428 = 40428;
public static final int NULL_40429 = 40429;
public static final int NULL_40470 = 40470;
public static final int NULL_40477 = 40477;
public static final int NULL_40478 = 40478;
public static final int NULL_40479 = 40479;
@@ -20009,84 +20008,6 @@ public final class NullObjectID
public static final int NULL_40934 = 40934;
public static final int NULL_40935 = 40935;
public static final int NULL_40936 = 40936;
public static final int NULL_40942 = 40942;
public static final int NULL_40943 = 40943;
public static final int NULL_40944 = 40944;
public static final int NULL_40945 = 40945;
public static final int NULL_40946 = 40946;
public static final int NULL_40947 = 40947;
public static final int NULL_40948 = 40948;
public static final int NULL_40949 = 40949;
public static final int NULL_40950 = 40950;
public static final int NULL_40951 = 40951;
public static final int NULL_40952 = 40952;
public static final int NULL_40953 = 40953;
public static final int NULL_40954 = 40954;
public static final int NULL_40955 = 40955;
public static final int NULL_40956 = 40956;
public static final int NULL_40957 = 40957;
public static final int NULL_40958 = 40958;
public static final int NULL_40959 = 40959;
public static final int NULL_40960 = 40960;
public static final int NULL_40961 = 40961;
public static final int NULL_40962 = 40962;
public static final int NULL_40963 = 40963;
public static final int NULL_40964 = 40964;
public static final int NULL_40965 = 40965;
public static final int NULL_40966 = 40966;
public static final int NULL_40967 = 40967;
public static final int NULL_40968 = 40968;
public static final int NULL_40969 = 40969;
public static final int NULL_40970 = 40970;
public static final int NULL_40971 = 40971;
public static final int NULL_40972 = 40972;
public static final int NULL_40973 = 40973;
public static final int NULL_40974 = 40974;
public static final int NULL_40975 = 40975;
public static final int NULL_40976 = 40976;
public static final int NULL_40977 = 40977;
public static final int NULL_40978 = 40978;
public static final int NULL_40979 = 40979;
public static final int NULL_40980 = 40980;
public static final int NULL_40981 = 40981;
public static final int NULL_40982 = 40982;
public static final int NULL_40983 = 40983;
public static final int NULL_40984 = 40984;
public static final int NULL_40985 = 40985;
public static final int NULL_40987 = 40987;
public static final int NULL_40988 = 40988;
public static final int NULL_40989 = 40989;
public static final int NULL_40990 = 40990;
public static final int NULL_40991 = 40991;
public static final int NULL_40992 = 40992;
public static final int NULL_40993 = 40993;
public static final int NULL_40994 = 40994;
public static final int NULL_40995 = 40995;
public static final int NULL_40996 = 40996;
public static final int NULL_40997 = 40997;
public static final int NULL_40998 = 40998;
public static final int NULL_40999 = 40999;
public static final int NULL_41000 = 41000;
public static final int NULL_41001 = 41001;
public static final int NULL_41002 = 41002;
public static final int NULL_41003 = 41003;
public static final int NULL_41004 = 41004;
public static final int NULL_41005 = 41005;
public static final int NULL_41006 = 41006;
public static final int NULL_41007 = 41007;
public static final int NULL_41008 = 41008;
public static final int NULL_41009 = 41009;
public static final int NULL_41010 = 41010;
public static final int NULL_41011 = 41011;
public static final int NULL_41012 = 41012;
public static final int NULL_41013 = 41013;
public static final int NULL_41014 = 41014;
public static final int NULL_41015 = 41015;
public static final int NULL_41016 = 41016;
public static final int NULL_41018 = 41018;
public static final int NULL_41019 = 41019;
public static final int NULL_41020 = 41020;
public static final int NULL_41021 = 41021;
public static final int NULL_41022 = 41022;
public static final int NULL_41191 = 41191;
public static final int NULL_41192 = 41192;
@@ -20096,5 +20017,15 @@ public final class NullObjectID
public static final int NULL_41196 = 41196;
public static final int NULL_41197 = 41197;
public static final int NULL_41198 = 41198;
public static final int NULL_41201 = 41201;
public static final int NULL_41202 = 41202;
public static final int NULL_41203 = 41203;
public static final int NULL_41204 = 41204;
public static final int NULL_41205 = 41205;
public static final int NULL_41206 = 41206;
public static final int NULL_41207 = 41207;
public static final int NULL_41208 = 41208;
public static final int NULL_41209 = 41209;
public static final int NULL_41211 = 41211;
/* This file is automatically generated. Do not edit. */
}
@@ -18582,7 +18582,7 @@ public final class ObjectID
public static final int RUBBLE_34803 = 34803;
public static final int RUBBLE_34804 = 34804;
public static final int RUBBLE_34805 = 34805;
public static final int JADFEST_PORTAL = 34826;
public static final int HANDY_PORTAL = 34826;
public static final int LARRANS_SMALL_CHEST_34828 = 34828;
public static final int LARRANS_BIG_CHEST = 34829;
public static final int LARRANS_BIG_CHEST_34830 = 34830;
@@ -19619,7 +19619,7 @@ public final class ObjectID
public static final int GATE_37954 = 37954;
public static final int LADDER_37955 = 37955;
public static final int LADDER_37956 = 37956;
public static final int HANDY_PORTAL = 37957;
public static final int HANDY_PORTAL_37957 = 37957;
public static final int BANK_BOOTH_37959 = 37959;
public static final int DOOR_37961 = 37961;
public static final int DOOR_37963 = 37963;
@@ -20709,6 +20709,8 @@ public final class ObjectID
public static final int EXPLOSIVE_POTION_TABLE_40467 = 40467;
public static final int POTION_OF_POWER_TABLE_40468 = 40468;
public static final int POTION_OF_POWER_TABLE_40469 = 40469;
public static final int GRAVESTONE_40471 = 40471;
public static final int COFFIN_40472 = 40472;
public static final int BANK_CHEST_40473 = 40473;
public static final int SOUL_WARS_PORTAL = 40474;
public static final int SOUL_WARS_PORTAL_40475 = 40475;
@@ -20899,25 +20901,8 @@ public final class ObjectID
public static final int STATUE_40915 = 40915;
public static final int STATUE_40916 = 40916;
public static final int STATUE_40917 = 40917;
public static final int INERT_PORTAL = 40918;
public static final int PORTAL_40919 = 40919;
public static final int ODD_FEATHERS = 40920;
public static final int PORTAL_40921 = 40921;
public static final int BARRIER_40922 = 40922;
public static final int SLEEPING_BAG_40923 = 40923;
public static final int STATUE_40924 = 40924;
public static final int ARCHWAY_40929 = 40929;
public static final int LIGHT_40930 = 40930;
public static final int LIGHT_40931 = 40931;
public static final int EVERGREEN_40932 = 40932;
public static final int EVERGREEN_40933 = 40933;
public static final int LIGHT_40937 = 40937;
public static final int LIGHT_40938 = 40938;
public static final int LIGHT_40939 = 40939;
public static final int LIGHT_40940 = 40940;
public static final int FIREWORKS = 40941;
public static final int POST_40986 = 40986;
public static final int PARTY_TABLE = 41017;
public static final int POTION_OF_POWER_TABLE_41023 = 41023;
public static final int PEDESTAL_SPACE = 41024;
public static final int PEDESTAL_SPACE_41025 = 41025;
@@ -21088,5 +21073,17 @@ public final class ObjectID
public static final int ANCIENT_BRAZIER_41190 = 41190;
public static final int BARRIER_41199 = 41199;
public static final int BARRIER_41200 = 41200;
public static final int SOLID_GOLD_DOOR = 41210;
public static final int GOLD_CHEST = 41212;
public static final int GOLD_CHEST_41213 = 41213;
public static final int GOLD_CHEST_41214 = 41214;
public static final int GOLD_CHEST_41215 = 41215;
public static final int GOLD_CHEST_41216 = 41216;
public static final int GOLD_CHEST_41217 = 41217;
public static final int GOLD_CHEST_41218 = 41218;
public static final int GOLD_CHEST_41219 = 41219;
public static final int GOLD_CHEST_41220 = 41220;
public static final int GOLD_CHEST_41221 = 41221;
public static final int ALTAR_41222 = 41222;
/* This file is automatically generated. Do not edit. */
}
@@ -25,7 +25,7 @@
package net.runelite.api;
/**
* Represents a projectile entity (ie. cannonball, arrow).
* Represents a projectile entity. (ie. cannonball, arrow)
*/
public interface Projectile extends Renderable
{
@@ -27,7 +27,7 @@ package net.runelite.api.events;
import net.runelite.api.Client;
/**
* Posted when the game world the client wants to connect to has changed
* Posted when the game world the client wants to connect to has changed.
* This is posted after the world ID and type have updated, but before a new
* connection is established
*
@@ -237,7 +237,7 @@ public enum AgilityShortcut
@Getter
private final int level;
/**
* Brief description of the shortcut (e.g. 'Rocks', 'Stepping Stones', 'Jump')
* Brief description of the shortcut. (e.g. 'Rocks', 'Stepping Stones', 'Jump')
*/
@Getter
private final String description;
@@ -26,33 +26,25 @@ package net.runelite.client.menus;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Pattern;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.IconID;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.NPCComposition;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.NpcActionChanged;
import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.events.PlayerMenuOptionsChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.util.Text;
@Singleton
@Slf4j
@@ -64,16 +56,13 @@ public class MenuManager
private static final int IDX_LOWER = 4;
private static final int IDX_UPPER = 8;
private static final Pattern BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP = Pattern.compile(String.format("%s[1-9]0?", IconID.BOUNTY_HUNTER_EMBLEM.toString()));
private final Client client;
private final EventBus eventBus;
//Maps the indexes that are being used to the menu option.
private final Map<Integer, String> playerMenuIndexMap = new HashMap<>();
//Used to manage custom non-player menu options
private final Multimap<Integer, WidgetMenuOption> managedMenuOptions = HashMultimap.create();
private final Set<String> npcMenuOptions = new HashSet<>();
private final Multimap<Integer, WidgetMenuOption> managedMenuOptions = LinkedHashMultimap.create();
@Inject
@VisibleForTesting
@@ -123,7 +112,7 @@ public class MenuManager
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
if (client.getSpellSelected())
if (client.getSpellSelected() || event.getType() != MenuAction.CC_OP.getId())
{
return;
}
@@ -200,45 +189,12 @@ public class MenuManager
addPlayerMenuItem(newIdx, menuText);
}
@Subscribe
public void onNpcActionChanged(NpcActionChanged event)
{
NPCComposition composition = event.getNpcComposition();
for (String npcOption : npcMenuOptions)
{
addNpcOption(composition, npcOption);
}
}
private void addNpcOption(NPCComposition composition, String npcOption)
{
String[] actions = composition.getActions();
int unused = -1;
for (int i = 0; i < actions.length; ++i)
{
if (actions[i] == null && unused == -1)
{
unused = i;
}
else if (actions[i] != null && actions[i].equals(npcOption))
{
return;
}
}
if (unused == -1)
{
return;
}
actions[unused] = npcOption;
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuAction() != MenuAction.RUNELITE
&& event.getMenuAction() != MenuAction.RUNELITE_PLAYER)
if (event.getMenuAction() != MenuAction.RUNELITE)
{
return; // not a managed widget option or custom player option
return;
}
int widgetId = event.getWidgetId();
@@ -254,23 +210,9 @@ public class MenuManager
customMenu.setMenuTarget(event.getMenuTarget());
customMenu.setWidget(curMenuOption.getWidget());
eventBus.post(customMenu);
return; // don't continue because it's not a player option
return;
}
}
// removes bounty hunter emblem tag and tier from player name, e.g:
// "username<img=20>5<col=40ff00> (level-42)" -> "username<col=40ff00> (level-42)"
String target = BOUNTY_EMBLEM_TAG_AND_TIER_REGEXP.matcher(event.getMenuTarget()).replaceAll("");
// removes tags and level from player names for example:
// <col=ffffff>username<col=40ff00> (level-42) or <col=ffffff><img=2>username</col>
String username = Text.removeTags(target).split("[(]")[0].trim();
PlayerMenuOptionClicked playerMenuOptionClicked = new PlayerMenuOptionClicked();
playerMenuOptionClicked.setMenuOption(event.getMenuOption());
playerMenuOptionClicked.setMenuTarget(username);
eventBus.post(playerMenuOptionClicked);
}
private void addPlayerMenuItem(int playerOptionIndex, String menuText)
@@ -33,11 +33,11 @@ import net.runelite.client.util.ColorUtil;
public final class WidgetMenuOption
{
/**
* The left hand text to be displayed on the menu option. Ex. the menuOption of "Drop Bones" is "Drop"
* The left hand text to be displayed on the menu option. (ex. the menuOption of "Drop Bones" is "Drop")
*/
private String menuOption;
/**
* The right hand text to be displayed on the menu option Ex. the menuTarget of "Drop Bones" is "Bones"
* The right hand text to be displayed on the menu option. (ex. the menuTarget of "Drop Bones" is "Bones")
*/
private String menuTarget;
/**
@@ -470,7 +470,7 @@ enum DiscordGameEventType
private int priority;
/**
* Marks this event as root event, e.g event that should be used for total time tracking
* Marks this event as root event. (eg. event that should be used for total time tracking)
*/
private boolean root;
@@ -51,6 +51,7 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.plugins.Plugin;
@@ -98,7 +99,13 @@ public class GroundMarkerPlugin extends Plugin
@Inject
private ChatboxPanelManager chatboxPanelManager;
private void savePoints(int regionId, Collection<GroundMarkerPoint> points)
@Inject
private EventBus eventBus;
@Inject
private GroundMarkerSharingManager sharingManager;
void savePoints(int regionId, Collection<GroundMarkerPoint> points)
{
if (points == null || points.isEmpty())
{
@@ -110,7 +117,7 @@ public class GroundMarkerPlugin extends Plugin
configManager.setConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId, json);
}
private Collection<GroundMarkerPoint> getPoints(int regionId)
Collection<GroundMarkerPoint> getPoints(int regionId)
{
String json = configManager.getConfiguration(CONFIG_GROUP, REGION_PREFIX + regionId);
if (Strings.isNullOrEmpty(json))
@@ -129,7 +136,7 @@ public class GroundMarkerPlugin extends Plugin
return configManager.getConfig(GroundMarkerConfig.class);
}
private void loadPoints()
void loadPoints()
{
points.clear();
@@ -181,14 +188,18 @@ public class GroundMarkerPlugin extends Plugin
{
overlayManager.add(overlay);
overlayManager.add(minimapOverlay);
sharingManager.addMenuOptions();
loadPoints();
eventBus.register(sharingManager);
}
@Override
public void shutDown()
{
eventBus.unregister(sharingManager);
overlayManager.remove(overlay);
overlayManager.remove(minimapOverlay);
sharingManager.removeMenuOptions();
points.clear();
}
@@ -0,0 +1,243 @@
/*
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.groundmarkers;
import com.google.common.base.Strings;
import com.google.common.util.concurrent.Runnables;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
import com.google.gson.reflect.TypeToken;
import java.awt.Toolkit;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.StringSelection;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.events.WidgetMenuOptionClicked;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_OPTION;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.http.api.RuneLiteAPI;
@Slf4j
class GroundMarkerSharingManager
{
private static final WidgetMenuOption EXPORT_MARKERS_OPTION = new WidgetMenuOption("Export", "Ground Markers", WORLD_MAP_OPTION);
private static final WidgetMenuOption IMPORT_MARKERS_OPTION = new WidgetMenuOption("Import", "Ground Markers", WORLD_MAP_OPTION);
private static final Gson GSON = RuneLiteAPI.GSON;
private final GroundMarkerPlugin plugin;
private final Client client;
private final MenuManager menuManager;
private final ChatMessageManager chatMessageManager;
private final ChatboxPanelManager chatboxPanelManager;
@Inject
private GroundMarkerSharingManager(GroundMarkerPlugin plugin, Client client, MenuManager menuManager, ChatMessageManager chatMessageManager, ChatboxPanelManager chatboxPanelManager)
{
this.plugin = plugin;
this.client = client;
this.menuManager = menuManager;
this.chatMessageManager = chatMessageManager;
this.chatboxPanelManager = chatboxPanelManager;
}
void addMenuOptions()
{
menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION);
menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION);
}
void removeMenuOptions()
{
menuManager.removeManagedCustomMenu(EXPORT_MARKERS_OPTION);
menuManager.removeManagedCustomMenu(IMPORT_MARKERS_OPTION);
}
private boolean widgetMenuClickedEquals(final WidgetMenuOptionClicked event, final WidgetMenuOption target)
{
return event.getMenuTarget().equals(target.getMenuTarget()) &&
event.getMenuOption().equals(target.getMenuOption());
}
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
// ensure that the option clicked is the export markers option
if (event.getWidget() != WORLD_MAP_OPTION)
{
return;
}
if (widgetMenuClickedEquals(event, EXPORT_MARKERS_OPTION))
{
exportGroundMarkers();
}
else if (widgetMenuClickedEquals(event, IMPORT_MARKERS_OPTION))
{
promptForImport();
}
}
private void exportGroundMarkers()
{
int[] regions = client.getMapRegions();
if (regions == null)
{
return;
}
List<GroundMarkerPoint> activePoints = Arrays.stream(regions)
.mapToObj(regionId -> plugin.getPoints(regionId).stream())
.flatMap(Function.identity())
.collect(Collectors.toList());
if (activePoints.isEmpty())
{
sendChatMessage("You have no ground markers to export.");
return;
}
final String exportDump = GSON.toJson(activePoints);
log.debug("Exported ground markers: {}", exportDump);
Toolkit.getDefaultToolkit()
.getSystemClipboard()
.setContents(new StringSelection(exportDump), null);
sendChatMessage(activePoints.size() + " ground markers were copied to your clipboard.");
}
private void promptForImport()
{
final String clipboardText;
try
{
clipboardText = Toolkit.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor)
.toString();
}
catch (IOException | UnsupportedFlavorException ex)
{
sendChatMessage("Unable to read system clipboard.");
log.warn("error reading clipboard", ex);
return;
}
log.debug("Clipboard contents: {}", clipboardText);
if (Strings.isNullOrEmpty(clipboardText))
{
sendChatMessage("You do not have any ground markers copied in your clipboard.");
return;
}
List<GroundMarkerPoint> importPoints;
try
{
// CHECKSTYLE:OFF
importPoints = GSON.fromJson(clipboardText, new TypeToken<List<GroundMarkerPoint>>(){}.getType());
// CHECKSTYLE:ON
}
catch (JsonSyntaxException e)
{
log.debug("Malformed JSON for clipboard import", e);
sendChatMessage("You do not have any ground markers copied in your clipboard.");
return;
}
if (importPoints.isEmpty())
{
sendChatMessage("You do not have any ground markers copied in your clipboard.");
return;
}
chatboxPanelManager.openTextMenuInput("Are you sure you want to import " + importPoints.size() + " ground markers?")
.option("Yes", () -> importGroundMarkers(importPoints))
.option("No", Runnables::doNothing)
.build();
}
private void importGroundMarkers(Collection<GroundMarkerPoint> importPoints)
{
// regions being imported may not be loaded on client,
// so need to import each bunch directly into the config
// first, collate the list of unique region ids in the import
Map<Integer, List<GroundMarkerPoint>> regionGroupedPoints = importPoints.stream()
.collect(Collectors.groupingBy(GroundMarkerPoint::getRegionId));
// now import each region into the config
regionGroupedPoints.forEach((regionId, groupedPoints) ->
{
// combine imported points with existing region points
log.debug("Importing {} points to region {}", groupedPoints.size(), regionId);
Collection<GroundMarkerPoint> regionPoints = plugin.getPoints(regionId);
List<GroundMarkerPoint> mergedList = new ArrayList<>(regionPoints.size() + groupedPoints.size());
// add existing points
mergedList.addAll(regionPoints);
// add new points
for (GroundMarkerPoint point : groupedPoints)
{
// filter out duplicates
if (!mergedList.contains(point))
{
mergedList.add(point);
}
}
plugin.savePoints(regionId, mergedList);
});
// reload points from config
log.debug("Reloading points after import");
plugin.loadPoints();
sendChatMessage(importPoints.size() + " ground markers were imported from the clipboard.");
}
private void sendChatMessage(final String message)
{
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(message)
.build());
}
}
@@ -38,9 +38,10 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.Player;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -174,11 +175,30 @@ public class HiscorePlugin extends Plugin
}
@Subscribe
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuOption().equals(LOOKUP))
if ((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
&& event.getMenuOption().equals(LOOKUP))
{
lookupPlayer(Text.removeTags(event.getMenuTarget()));
final String target;
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
{
// The player id is included in the event, so we can use that to get the player name,
// which avoids having to parse out the combat level and any icons preceding the name.
Player player = client.getCachedPlayers()[event.getId()];
if (player == null)
{
return;
}
target = player.getName();
}
else
{
target = Text.removeTags(event.getMenuTarget());
}
lookupPlayer(target);
}
}
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.idlenotifier;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
import net.runelite.client.config.Units;
@ConfigGroup("idlenotifier")
@@ -110,10 +111,36 @@ public interface IdleNotifierConfig extends Config
return 0;
}
@ConfigItem(
keyName = "lowEnergy",
name = "Low Energy Threshold",
description = "The amount of energy points remaining to send a notification at. A value of 100 will disable notification.",
position = 8
)
@Units(Units.PERCENT)
@Range(max = 100)
default int getLowEnergyThreshold()
{
return 100;
}
@ConfigItem(
keyName = "highEnergy",
name = "High Energy Threshold",
description = "The amount of energy points reached to send a notification. A value of 0 will disable notification.",
position = 9
)
@Units(Units.PERCENT)
@Range(max = 100)
default int getHighEnergyThreshold()
{
return 0;
}
@ConfigItem(
keyName = "oxygen",
name = "Oxygen Threshold",
position = 8,
position = 10,
description = "The amount of remaining oxygen to send a notification at. A value of 0 will disable notification."
)
@Units(Units.PERCENT)
@@ -125,7 +152,7 @@ public interface IdleNotifierConfig extends Config
@ConfigItem(
keyName = "spec",
name = "Spec Threshold",
position = 9,
position = 11,
description = "The amount of special attack energy reached to send a notification at. A value of 0 will disable notification."
)
@Units(Units.PERCENT)
@@ -93,6 +93,8 @@ public class IdleNotifierPlugin extends Plugin
private boolean notifyPosition = false;
private boolean notifyHitpoints = true;
private boolean notifyPrayer = true;
private boolean shouldNotifyLowEnergy = false;
private boolean shouldNotifyHighEnergy = false;
private boolean notifyOxygen = true;
private boolean notifyIdleLogout = true;
private boolean notify6HourLogout = true;
@@ -471,6 +473,16 @@ public class IdleNotifierPlugin extends Plugin
notifier.notify("[" + local.getName() + "] has low prayer!");
}
if (checkLowEnergy())
{
notifier.notify("[" + local.getName() + "] has low run energy!");
}
if (checkHighEnergy())
{
notifier.notify("[" + local.getName() + "] has restored run energy!");
}
if (checkLowOxygen())
{
notifier.notify("[" + local.getName() + "] has low oxygen!");
@@ -572,6 +584,52 @@ public class IdleNotifierPlugin extends Plugin
return false;
}
private boolean checkLowEnergy()
{
if (config.getLowEnergyThreshold() >= 100)
{
return false;
}
if (client.getEnergy() <= config.getLowEnergyThreshold())
{
if (shouldNotifyLowEnergy)
{
shouldNotifyLowEnergy = false;
return true;
}
}
else
{
shouldNotifyLowEnergy = true;
}
return false;
}
private boolean checkHighEnergy()
{
if (config.getHighEnergyThreshold() == 0)
{
return false;
}
if (client.getEnergy() >= config.getHighEnergyThreshold())
{
if (shouldNotifyHighEnergy)
{
shouldNotifyHighEnergy = false;
return true;
}
}
else
{
shouldNotifyHighEnergy = true;
}
return false;
}
private boolean checkInteractionIdle(Duration waitDuration, Player local)
{
if (lastInteract == null)
@@ -215,7 +215,7 @@ public class ItemStatChanges
add(new GauntletPotion(), EGNIOL_POTION_1, EGNIOL_POTION_2, EGNIOL_POTION_3, EGNIOL_POTION_4);
// Soul Wars
add(combo(2, heal(HITPOINTS, perc(.20, 2)), heal(RUN_ENERGY, 100)), BANDAGES_25202);
add(combo(2, heal(HITPOINTS, perc(.15, 1)), heal(RUN_ENERGY, 100)), BANDAGES_25202);
add(combo(6, boost(ATTACK, perc(.15, 5)), boost(STRENGTH, perc(.15, 5)), boost(DEFENCE, perc(.15, 5)), boost(RANGED, perc(.15, 5)), boost(MAGIC, perc(.15, 5)), heal(PRAYER, perc(.25, 8))), POTION_OF_POWER1, POTION_OF_POWER2, POTION_OF_POWER3, POTION_OF_POWER4);
log.debug("{} items; {} behaviours loaded", effects.size(), new HashSet<>(effects.values()).size());
@@ -52,7 +52,7 @@ public abstract class Stat
public abstract int getValue(Client client);
/**
* Get the base stat maximum, ie. the bottom half of the stat fraction.
* Get the base stat maximum. (ie. the bottom half of the stat fraction)
*/
public abstract int getMaximum(Client client);
}
@@ -36,6 +36,7 @@ import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayUtil;
import net.runelite.client.util.Text;
public class NpcMinimapOverlay extends Overlay
{
@@ -56,7 +57,7 @@ public class NpcMinimapOverlay extends Overlay
{
for (NPC npc : plugin.getHighlightedNpcs())
{
renderNpcOverlay(graphics, npc, npc.getName(), config.getHighlightColor());
renderNpcOverlay(graphics, npc, Text.removeTags(npc.getName()), config.getHighlightColor());
}
return null;
@@ -99,7 +99,7 @@ public class SlayerPlugin extends Plugin
//Chat messages
private static final Pattern CHAT_GEM_PROGRESS_MESSAGE = Pattern.compile("^(?:You're assigned to kill|You have received a new Slayer assignment from .*:) (?:[Tt]he )?(?<name>.+?)(?: (?:in|on|south of) (?:the )?(?<location>[^;]+))?(?:; only | \\()(?<amount>\\d+)(?: more to go\\.|\\))$");
private static final String CHAT_GEM_COMPLETE_MESSAGE = "You need something new to hunt.";
private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("(?:\\d+,)*\\d+");
private static final Pattern CHAT_COMPLETE_MESSAGE = Pattern.compile("You've completed (?:at least )?(?<tasks>[\\d,]+) (?:Wilderness )?tasks?(?: and received \\d+ points, giving you a total of (?<points>[\\d,]+)| and reached the maximum amount of Slayer points \\((?<points2>[\\d,]+)\\))?");
private static final String CHAT_CANCEL_MESSAGE = "Your task has been cancelled.";
private static final String CHAT_CANCEL_MESSAGE_JAD = "You no longer have a slayer task as you left the fight cave.";
private static final String CHAT_CANCEL_MESSAGE_ZUK = "You no longer have a slayer task as you left the Inferno.";
@@ -450,6 +450,7 @@ public class SlayerPlugin extends Plugin
expeditiousChargeCount = Integer.parseInt(mExpeditious.group(1));
config.expeditious(expeditiousChargeCount);
}
if (chatMsg.startsWith(CHAT_BRACELET_SLAUGHTER_CHARGE))
{
Matcher mSlaughter = CHAT_BRACELET_SLAUGHTER_CHARGE_REGEX.matcher(chatMsg);
@@ -466,35 +467,25 @@ public class SlayerPlugin extends Plugin
{
Matcher mComplete = CHAT_COMPLETE_MESSAGE.matcher(chatMsg);
List<String> matches = new ArrayList<>();
while (mComplete.find())
if (mComplete.find())
{
matches.add(mComplete.group(0).replaceAll(",", ""));
}
String mTasks = mComplete.group("tasks");
String mPoints = mComplete.group("points");
if (mPoints == null)
{
mPoints = mComplete.group("points2");
}
int streak = -1, points = -1;
switch (matches.size())
{
case 0:
streak = 1;
break;
case 1:
streak = Integer.parseInt(matches.get(0));
break;
case 3:
streak = Integer.parseInt(matches.get(0));
points = Integer.parseInt(matches.get(2));
break;
default:
log.warn("Unreachable default case for message ending in '; return to Slayer master'");
}
if (streak != -1)
{
config.streak(streak);
}
if (points != -1)
{
config.points(points);
if (mTasks != null)
{
int streak = Integer.parseInt(mTasks.replace(",", ""));
config.streak(streak);
}
if (mPoints != null)
{
int points = Integer.parseInt(mPoints.replace(",", ""));
config.points(points);
}
}
setTask("", 0, 0);
@@ -40,6 +40,7 @@ public interface TimeTrackingConfig extends Config
String BOTANIST = "botanist";
String TIMERS = "timers";
String STOPWATCHES = "stopwatches";
String PREFER_SOONEST = "preferSoonest";
@ConfigItem(
keyName = "timeFormatMode",
@@ -120,6 +121,17 @@ public interface TimeTrackingConfig extends Config
return 10;
}
@ConfigItem(
keyName = PREFER_SOONEST,
name = "Prefer soonest completion",
description = "When displaying completion times on the overview, prefer showing the soonest any patch will complete.",
position = 7
)
default boolean preferSoonest()
{
return false;
}
@ConfigItem(
keyName = "activeTab",
name = "Active Tab",
@@ -51,6 +51,7 @@ import net.runelite.client.events.RuneScapeProfileChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.CONFIG_GROUP;
import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.PREFER_SOONEST;
import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.STOPWATCHES;
import static net.runelite.client.plugins.timetracking.TimeTrackingConfig.TIMERS;
import net.runelite.client.plugins.timetracking.clocks.ClockManager;
@@ -173,6 +174,10 @@ public class TimeTrackingPlugin extends Plugin
{
clockManager.loadStopwatches();
}
else if (e.getKey().equals(PREFER_SOONEST))
{
farmingTracker.loadCompletionTimes();
}
}
@Subscribe
@@ -407,7 +407,7 @@ public class FarmingTracker
{
for (Map.Entry<Tab, Set<FarmingPatch>> tab : farmingWorld.getTabs().entrySet())
{
long maxCompletionTime = 0;
long extremumCompletionTime = config.preferSoonest() ? Long.MAX_VALUE : 0;
boolean allUnknown = true;
boolean allEmpty = true;
@@ -426,7 +426,15 @@ public class FarmingTracker
allEmpty = false;
// update max duration if this patch takes longer to grow
maxCompletionTime = Math.max(maxCompletionTime, prediction.getDoneEstimate());
if (config.preferSoonest())
{
extremumCompletionTime = Math.min(extremumCompletionTime, prediction.getDoneEstimate());
}
else
{
extremumCompletionTime = Math.max(extremumCompletionTime, prediction.getDoneEstimate());
}
}
}
@@ -443,7 +451,7 @@ public class FarmingTracker
state = SummaryState.EMPTY;
completionTime = -1L;
}
else if (maxCompletionTime <= Instant.now().getEpochSecond())
else if (extremumCompletionTime <= Instant.now().getEpochSecond())
{
state = SummaryState.COMPLETED;
completionTime = 0;
@@ -451,7 +459,7 @@ public class FarmingTracker
else
{
state = SummaryState.IN_PROGRESS;
completionTime = maxCompletionTime;
completionTime = extremumCompletionTime;
}
summaries.put(tab.getKey(), state);
completionTimes.put(tab.getKey(), completionTime);
@@ -47,10 +47,10 @@ import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ChatPlayer;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.Client;
import net.runelite.api.Friend;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.GameState;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
@@ -60,10 +60,11 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WorldListLoad;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager;
@@ -111,6 +112,9 @@ public class WorldHopperPlugin extends Plugin
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private ConfigManager configManager;
@@ -162,7 +166,7 @@ public class WorldHopperPlugin extends Plugin
@Override
public void hotkeyPressed()
{
hop(true);
clientThread.invoke(() -> hop(true));
}
};
private final HotkeyListener nextKeyListener = new HotkeyListener(() -> config.nextKey())
@@ -170,7 +174,7 @@ public class WorldHopperPlugin extends Plugin
@Override
public void hotkeyPressed()
{
hop(false);
clientThread.invoke(() -> hop(false));
}
};
@@ -304,7 +308,7 @@ public class WorldHopperPlugin extends Plugin
void hopTo(World world)
{
hop(world.getId());
clientThread.invoke(() -> hop(world.getId()));
}
void addToFavorites(World world)
@@ -408,9 +412,9 @@ public class WorldHopperPlugin extends Plugin
}
@Subscribe
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (!event.getMenuOption().equals(HOP_TO))
if (event.getMenuAction() != MenuAction.RUNELITE || !event.getMenuOption().equals(HOP_TO))
{
return;
}
@@ -613,6 +617,8 @@ public class WorldHopperPlugin extends Plugin
private void hop(int worldId)
{
assert client.isClientThread();
WorldResult worldResult = worldService.getWorlds();
// Don't try to hop if the world doesn't exist
World world = worldResult.findWorld(worldId);
@@ -370,10 +370,7 @@ class WorldSwitcherPanel extends PluginPanel
private WorldTableRow buildRow(World world, boolean stripe, boolean current, boolean favorite)
{
WorldTableRow row = new WorldTableRow(world, current, favorite, plugin.getStoredPing(world),
world1 ->
{
plugin.hopTo(world1);
},
plugin::hopTo,
(world12, add) ->
{
if (add)
@@ -159,8 +159,8 @@ class XpState
}
/**
* Update number of actions performed for skill (e.g amount of kills in this case) if last interacted
* NPC died
* Update number of actions performed for skill if last interacted NPC died.
* (eg. amount of kills in this case)
* @param skill skill to update actions for
* @param npc npc that just died
* @param npcHealth max health of npc that just died
@@ -182,7 +182,7 @@ public class QuantityFormatter
}
/**
* Calculates, given a string with a value denominator (ex. 20K)
* Calculates, given a string with a value denominator (for example, 20K)
* the multiplier that the denominator represents (in this case 1000).
*
* @param string The string to check.
@@ -2727,6 +2727,10 @@
2464,
8936
],
"black dhide vambraces": [
2491,
25494
],
"blue dhide chaps": [
2493,
7382,
@@ -2743,7 +2747,8 @@
2497,
12383,
12387,
20424
20424,
25493
],
"blue dhide body": [
2499,
@@ -2761,7 +2766,8 @@
2503,
12381,
12385,
20423
20423,
25492
],
"dragon chainbody": [
2513,
@@ -7760,7 +7766,15 @@
],
"toxic blowpipe": [
12924,
12926
12926,
25484,
25485,
25486,
25487,
25488,
25489,
25490,
25491
],
"serpentine helm": [
12929,
@@ -9240,21 +9254,24 @@
23887,
23888,
23971,
23973
23973,
25495
],
"crystal body": [
23889,
23890,
23891,
23975,
23977
23977,
25496
],
"crystal legs": [
23892,
23893,
23894,
23979,
23981
23981,
25497
],
"crystal staff": [
23898,
@@ -9623,10 +9640,6 @@
25319,
25338
],
"gnome child": [
25320,
25321
],
"soul cape": [
25344,
25346
@@ -9635,5 +9648,25 @@
25380,
25383,
25386
],
"bronze coffin": [
25459,
25469
],
"steel coffin": [
25461,
25470
],
"black coffin": [
25463,
25471
],
"silver coffin": [
25465,
25472
],
"gold coffin": [
25467,
25473
]
}
@@ -0,0 +1,997 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.slayer;
import com.google.inject.Guice;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import net.runelite.api.ChatMessageType;
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Hitsplat;
import net.runelite.api.MessageNode;
import net.runelite.api.NPC;
import net.runelite.api.NPCComposition;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.ActorDeath;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.HitsplatApplied;
import net.runelite.api.events.StatChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.Notifier;
import net.runelite.client.chat.ChatCommandManager;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.http.api.chat.ChatClient;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import org.mockito.Mock;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@RunWith(MockitoJUnitRunner.class)
public class SlayerPluginTest
{
private static final String TASK_NEW = "Your new task is to kill 231 Suqahs.";
private static final String TASK_NEW_KONAR = "You are to bring balance to 147 Wyrms in the Karuulm Slayer Dungeon.";
private static final String TASK_NEW_KONAR_2 = "You are to bring balance to 142 Hellhounds in Witchhaven Dungeon.";
private static final String TASK_NEW_KONAR_3 = "You are to bring balance to 135 Trolls south of Mount Quidamortem.";
private static final String TASK_NEW_FIRST = "We'll start you off hunting goblins, you'll need to kill 17 of them.";
private static final String TASK_NEW_FIRST_KONAR = "We'll start you off bringing balance to cows, you'll need to kill 44 of them.";
private static final String TASK_NEW_NPC_CONTACT = "Excellent, you're doing great. Your new task is to kill<br>211 Suqahs.";
private static final String TASK_NEW_FROM_PARTNER = "You have received a new Slayer assignment from breaklulz: Dust Devils (377)";
private static final String TASK_CHECKSLAYERGEM = "You're assigned to kill Suqahs; only 211 more to go.";
private static final String TASK_CHECKSLAYERGEM_WILDERNESS = "You're assigned to kill Suqahs in the Wilderness; only 211 more to go.";
private static final String TASK_CHECKSLAYERGEM_KONAR = "You're assigned to kill Blue dragons in the Ogre Enclave; only 122 more to go.";
private static final String TASK_UPDATE_COMBAT_BRACELET = "You still need to kill 30 monsters to complete your current Slayer assignment";
private static final String TASK_BOSS_NEW = "Excellent. You're now assigned to kill Vet'ion 3 times.<br>Your reward point tally is 914.";
private static final String TASK_BOSS_NEW_THE = "Excellent. You're now assigned to kill the Chaos <br>Elemental 3 times. Your reward point tally is 914.";
private static final String TASK_KONAR_BOSS = "You're now assigned to bring balance to the Alchemical<br>Hydra 35 times. Your reward point tally is 724.";
private static final String TASK_EXISTING = "You're still hunting suqahs; you have 222 to go. Come<br>back when you've finished your task.";
private static final String TASK_EXISTING_KONAR = "You're still bringing balance to adamant dragons in the Lithkren Vault, with 3 to go. Come back when you're finished.";
private static final String TASK_EXISTING_WILDERNESS = "You're still meant to be slaying bandits in the Wilderness; you have 99 to go. Come back when you've finished your task.";
private static final String TASK_ACTIVATESLAYERGEM = "You're currently assigned to kill fossil island wyverns; only 23 more to go. Your reward point tally is 46.";
private static final String TASK_ACTIVATESLAYERGEM_KONAR = "You're currently assigned to bring balance to adamant dragons in the Lithkren Vault; you have 3 more to go. Your reward point tally is 16.";
private static final String TASK_ACTIVATESLAYERGEM_WILDERNESS = "You're currently assigned to kill bandits in the Wilderness; only 99 more to go. Your reward point tally is 34.";
private static final String REWARD_POINTS = "Reward points: 17,566";
private static final String TASK_ONE = "<col=ef1020>You've completed </col>1 task<col=ef1020> and will need</col> 4 more <col=ef1020>before you start receiving Slayer points; return to a Slayer master.</col>";
private static final String TASK_COMPLETE_NO_POINTS = "<col=ef1020>You've completed </col>3 tasks<col=ef1020> and will need </col>2 more<col=ef1020> before you start receiving Slayer points; return to a Slayer master.";
private static final String TASK_POINTS = "<col=ef1020>You've completed </col>9 tasks <col=ef1020>and received </col>10 points<col=ef1020>, giving you a total of </col>18,000<col=ef1020>; return to a Slayer master.";
private static final String TASK_LARGE_STREAK = "<col=ef1020>You've completed </col>2,465 tasks <col=ef1020>and received </col>15 points<col=ef1020>, giving you a total of </col>131,071<col=ef1020>; return to a Slayer master.";
private static final String TASK_COMPETE_TURAEL = "<col=ef1020>You've completed </col>104 tasks <col=ef1020>. You'll be eligible to earn reward points if you complete tasks from a more advanced Slayer Master.";
private static final String TASK_MAX_STREAK = "<col=ef1020>You've completed at least </col>16,000 tasks <col=ef1020>and received </col>15 points<col=ef1020>, giving you a total of </col>131,071<col=ef1020>; return to a Slayer master.";
private static final String TASK_MAX_POINTS = "<col=ef1020>You've completed </col>9 tasks <col=ef1020>and reached the maximum amount of Slayer points </col>(131,071)<col=ef1020>; return to a Slayer master.";
private static final String TASK_WILDERNESS = "<col=ef1020>You've completed </col>9 Wilderness tasks <col=ef1020>and received </col>10 points<col=ef1020>, giving you a total of </col>18,000<col=ef1020>; return to a Slayer master.";
private static final String TASK_COMPLETE = "You need something new to hunt.";
private static final String TASK_CANCELED = "Your task has been cancelled.";
private static final String SUPERIOR_MESSAGE = "A superior foe has appeared...";
private static final String BRACLET_SLAUGHTER = "Your bracelet of slaughter prevents your slayer count from decreasing. It has 9 charges left.";
private static final String BRACLET_EXPEDITIOUS = "Your expeditious bracelet helps you progress your slayer task faster. It has 9 charges left.";
private static final String BRACLET_SLAUGHTER_V2 = "Your bracelet of slaughter prevents your slayer count from decreasing. It has 1 charge left.";
private static final String BRACLET_EXPEDITIOUS_V2 = "Your expeditious bracelet helps you progress your slayer faster. It has 1 charge left.";
private static final String BRACLET_SLAUGHTER_V3 = "Your bracelet of slaughter prevents your slayer count from decreasing. It then crumbles to dust.";
private static final String BRACLET_EXPEDITIOUS_V3 = "Your expeditious bracelet helps you progress your slayer faster. It then crumbles to dust.";
private static final String CHAT_BRACELET_SLAUGHTER_CHARGE = "Your bracelet of slaughter has 12 charges left.";
private static final String CHAT_BRACELET_EXPEDITIOUS_CHARGE = "Your expeditious bracelet has 12 charges left.";
private static final String CHAT_BRACELET_SLAUGHTER_CHARGE_ONE = "Your bracelet of slaughter has 1 charge left.";
private static final String CHAT_BRACELET_EXPEDITIOUS_CHARGE_ONE = "Your expeditious bracelet has 1 charge left.";
private static final String BREAK_SLAUGHTER = "The bracelet shatters. Your next bracelet of slaughter<br>will start afresh from 30 charges.";
private static final String BREAK_EXPEDITIOUS = "The bracelet shatters. Your next expeditious bracelet<br>will start afresh from 30 charges.";
@Mock
@Bind
Client client;
@Mock
@Bind
SlayerConfig slayerConfig;
@Mock
@Bind
OverlayManager overlayManager;
@Mock
@Bind
SlayerOverlay overlay;
@Mock
@Bind
InfoBoxManager infoBoxManager;
@Mock
@Bind
ItemManager itemManager;
@Mock
@Bind
Notifier notifier;
@Mock
@Bind
ChatMessageManager chatMessageManager;
@Mock
@Bind
ChatCommandManager chatCommandManager;
@Mock
@Bind
ScheduledExecutorService executor;
@Mock
@Bind
ChatClient chatClient;
@Inject
SlayerPlugin slayerPlugin;
@Before
public void before()
{
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
}
@Test
public void testNewTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Suqahs", slayerPlugin.getTaskName());
assertEquals(231, slayerPlugin.getAmount());
}
@Test
public void testNewKonarTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Wyrms", slayerPlugin.getTaskName());
assertEquals(147, slayerPlugin.getAmount());
assertEquals("Karuulm Slayer Dungeon", slayerPlugin.getTaskLocation());
}
@Test
public void testNewKonarTask2()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_2);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Hellhounds", slayerPlugin.getTaskName());
assertEquals(142, slayerPlugin.getAmount());
assertEquals("Witchhaven Dungeon", slayerPlugin.getTaskLocation());
}
@Test
public void testNewKonarTask3()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_KONAR_3);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Trolls", slayerPlugin.getTaskName());
assertEquals(135, slayerPlugin.getAmount());
assertEquals("Mount Quidamortem", slayerPlugin.getTaskLocation());
}
@Test
public void testFirstTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("goblins", slayerPlugin.getTaskName());
assertEquals(17, slayerPlugin.getAmount());
}
@Test
public void testFirstTaskKonar()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_FIRST_KONAR);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("cows", slayerPlugin.getTaskName());
assertEquals(44, slayerPlugin.getAmount());
}
@Test
public void testNewNpcContactTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW_NPC_CONTACT);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Suqahs", slayerPlugin.getTaskName());
assertEquals(211, slayerPlugin.getAmount());
}
@Test
public void testBossTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Vet'ion", slayerPlugin.getTaskName());
assertEquals(3, slayerPlugin.getAmount());
verify(slayerConfig).points(914);
}
@Test
public void testBossTaskThe()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_BOSS_NEW_THE);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Chaos Elemental", slayerPlugin.getTaskName());
assertEquals(3, slayerPlugin.getAmount());
verify(slayerConfig).points(914);
}
@Test
public void testKonarBossTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_KONAR_BOSS);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("Alchemical Hydra", slayerPlugin.getTaskName());
assertEquals(35, slayerPlugin.getAmount());
verify(slayerConfig).points(724);
}
@Test
public void testPartnerTask()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_NEW_FROM_PARTNER, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("Dust Devils", slayerPlugin.getTaskName());
assertEquals(377, slayerPlugin.getAmount());
}
@Test
public void testCheckSlayerGem()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("Suqahs", slayerPlugin.getTaskName());
assertEquals(211, slayerPlugin.getAmount());
}
@Test
public void testCheckSlayerGemWildernessTask()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM_WILDERNESS, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("Suqahs", slayerPlugin.getTaskName());
assertEquals(211, slayerPlugin.getAmount());
assertEquals("Wilderness", slayerPlugin.getTaskLocation());
}
@Test
public void testCheckSlayerGemKonarTask()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_CHECKSLAYERGEM_KONAR, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("Blue dragons", slayerPlugin.getTaskName());
assertEquals(122, slayerPlugin.getAmount());
assertEquals("Ogre Enclave", slayerPlugin.getTaskLocation());
}
@Test
public void testExistingTask()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_EXISTING);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("suqahs", slayerPlugin.getTaskName());
assertEquals(222, slayerPlugin.getAmount());
}
@Test
public void testExistingTaskKonar()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_EXISTING_KONAR);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("adamant dragons", slayerPlugin.getTaskName());
assertEquals(3, slayerPlugin.getAmount());
assertEquals("Lithkren Vault", slayerPlugin.getTaskLocation());
}
@Test
public void testExistingTaskWilderness()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_EXISTING_WILDERNESS);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("bandits", slayerPlugin.getTaskName());
assertEquals(99, slayerPlugin.getAmount());
assertEquals("Wilderness", slayerPlugin.getTaskLocation());
}
@Test
public void testSlayergemActivate()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_ACTIVATESLAYERGEM);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("fossil island wyverns", slayerPlugin.getTaskName());
assertEquals(23, slayerPlugin.getAmount());
}
@Test
public void testSlayergemActivateKonar()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_ACTIVATESLAYERGEM_KONAR);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("adamant dragons", slayerPlugin.getTaskName());
assertEquals(3, slayerPlugin.getAmount());
assertEquals("Lithkren Vault", slayerPlugin.getTaskLocation());
}
@Test
public void testSlayergemActivateWilderness()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_ACTIVATESLAYERGEM_WILDERNESS);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals("bandits", slayerPlugin.getTaskName());
assertEquals(99, slayerPlugin.getAmount());
assertEquals("Wilderness", slayerPlugin.getTaskLocation());
}
@Test
public void testRewardPointsWidget()
{
Widget rewardBar = mock(Widget.class);
Widget rewardBarText = mock(Widget.class);
Widget[] rewardBarChildren = new Widget[]{rewardBarText};
when(rewardBar.getDynamicChildren()).thenReturn(rewardBarChildren);
when(rewardBarText.getText()).thenReturn(REWARD_POINTS);
when(client.getWidget(WidgetInfo.SLAYER_REWARDS_TOPBAR)).thenReturn(rewardBar);
slayerPlugin.onGameTick(new GameTick());
verify(slayerConfig).points(17566);
}
@Test
public void testOneTask()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_ONE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(1);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testNoPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_COMPLETE_NO_POINTS, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(3);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_POINTS, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(9);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
verify(slayerConfig).points(18_000);
}
@Test
public void testLargeStreak()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_LARGE_STREAK, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(2465);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
verify(slayerConfig).points(131_071);
}
@Test
public void testTaskCompleteTurael()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_COMPETE_TURAEL, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(104);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testTaskMaxStreak()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_MAX_STREAK, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(16_000);
verify(slayerConfig).points(131_071);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testTaskMaxPoints()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_MAX_POINTS, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(9);
verify(slayerConfig).points(131_071);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testTaskWilderness()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", TASK_WILDERNESS, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(slayerConfig).streak(9);
verify(slayerConfig).points(18_000);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testComplete()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_COMPLETE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testCancelled()
{
slayerPlugin.setTaskName("cows");
slayerPlugin.setAmount(42);
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Perterter", TASK_CANCELED, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals("", slayerPlugin.getTaskName());
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testSuperiorNotification()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "Superior", SUPERIOR_MESSAGE, null, 0);
when(slayerConfig.showSuperiorNotification()).thenReturn(true);
slayerPlugin.onChatMessage(chatMessageEvent);
verify(notifier).notify(SUPERIOR_MESSAGE);
when(slayerConfig.showSuperiorNotification()).thenReturn(false);
slayerPlugin.onChatMessage(chatMessageEvent);
verifyNoMoreInteractions(notifier);
}
@Test
public void testCorrectlyCapturedTaskKill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
100,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
slayerPlugin.setTaskName("Dagannoth");
slayerPlugin.setAmount(143);
statChanged = new StatChanged(
Skill.SLAYER,
110,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(142, slayerPlugin.getAmount());
}
@Test
public void testIncorrectlyCapturedTaskKill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
100,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
slayerPlugin.setTaskName("Monster");
slayerPlugin.setAmount(98);
assert Task.getTask("Monster") == null;
statChanged = new StatChanged(
Skill.SLAYER,
110,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(97, slayerPlugin.getAmount());
}
@Test
public void testJadTaskKill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
100,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
slayerPlugin.setTaskName("TzTok-Jad");
slayerPlugin.setAmount(1);
// One bat kill
statChanged = new StatChanged(
Skill.SLAYER,
110,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(1, slayerPlugin.getAmount());
// One Jad kill
statChanged = new StatChanged(
Skill.SLAYER,
25360,
-1,
-1
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testZukTaskKill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
110,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
slayerPlugin.setTaskName("TzKal-Zuk");
slayerPlugin.setAmount(1);
// One bat kill
statChanged = new StatChanged(
Skill.SLAYER,
125,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(1, slayerPlugin.getAmount());
// One Zuk kill
statChanged = new StatChanged(
Skill.SLAYER,
102_015,
-1,
-1
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(0, slayerPlugin.getAmount());
}
@Test
public void testBraceletSlaughter()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_SLAUGHTER, null, 0);
slayerPlugin.setAmount(42);
slayerPlugin.setSlaughterChargeCount(10);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(9, slayerPlugin.getSlaughterChargeCount());
assertEquals(43, slayerPlugin.getAmount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", CHAT_BRACELET_SLAUGHTER_CHARGE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(12, slayerPlugin.getSlaughterChargeCount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", CHAT_BRACELET_SLAUGHTER_CHARGE_ONE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getSlaughterChargeCount());
slayerPlugin.setSlaughterChargeCount(1);
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_SLAUGHTER_V3, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(30, slayerPlugin.getSlaughterChargeCount());
Widget braceletBreakWidget = mock(Widget.class);
when(braceletBreakWidget.getText()).thenReturn(BREAK_SLAUGHTER);
when(client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT)).thenReturn(braceletBreakWidget);
slayerPlugin.setSlaughterChargeCount(-1);
slayerPlugin.onGameTick(new GameTick());
assertEquals(30, slayerPlugin.getSlaughterChargeCount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_SLAUGHTER_V2, null, 0);
slayerPlugin.setAmount(42);
slayerPlugin.setSlaughterChargeCount(2);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getSlaughterChargeCount());
assertEquals(43, slayerPlugin.getAmount());
}
@Test
public void testBraceletExpeditious()
{
ChatMessage chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_EXPEDITIOUS, null, 0);
slayerPlugin.setAmount(42);
slayerPlugin.setExpeditiousChargeCount(10);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(41, slayerPlugin.getAmount());
assertEquals(9, slayerPlugin.getExpeditiousChargeCount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(12, slayerPlugin.getExpeditiousChargeCount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", CHAT_BRACELET_EXPEDITIOUS_CHARGE_ONE, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(1, slayerPlugin.getExpeditiousChargeCount());
slayerPlugin.setExpeditiousChargeCount(1);
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_EXPEDITIOUS_V3, null, 0);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(30, slayerPlugin.getExpeditiousChargeCount());
Widget braceletBreakWidget = mock(Widget.class);
when(braceletBreakWidget.getText()).thenReturn(BREAK_EXPEDITIOUS);
when(client.getWidget(WidgetInfo.DIALOG_SPRITE_TEXT)).thenReturn(braceletBreakWidget);
slayerPlugin.setExpeditiousChargeCount(-1);
slayerPlugin.onGameTick(new GameTick());
assertEquals(30, slayerPlugin.getExpeditiousChargeCount());
chatMessageEvent = new ChatMessage(null, GAMEMESSAGE, "", BRACLET_EXPEDITIOUS_V2, null, 0);
slayerPlugin.setAmount(42);
slayerPlugin.setExpeditiousChargeCount(2);
slayerPlugin.onChatMessage(chatMessageEvent);
assertEquals(41, slayerPlugin.getAmount());
assertEquals(1, slayerPlugin.getExpeditiousChargeCount());
}
@Test
public void testCombatBraceletUpdate()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
slayerPlugin.setTaskName("Suqahs");
slayerPlugin.setAmount(231);
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", TASK_UPDATE_COMBAT_BRACELET, null, 0);
slayerPlugin.onChatMessage(chatMessage);
assertEquals("Suqahs", slayerPlugin.getTaskName());
slayerPlugin.killed(1);
assertEquals(30, slayerPlugin.getAmount());
}
@Test
public void updateInitialAmount()
{
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_EXISTING);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
assertEquals(222, slayerPlugin.getInitialAmount());
}
@Test
public void testTaskLookup() throws IOException
{
net.runelite.http.api.chat.Task task = new net.runelite.http.api.chat.Task();
task.setTask("Abyssal demons");
task.setLocation("Abyss");
task.setAmount(42);
task.setInitialAmount(42);
when(slayerConfig.taskCommand()).thenReturn(true);
when(chatClient.getTask(anyString())).thenReturn(task);
ChatMessage setMessage = new ChatMessage();
setMessage.setType(ChatMessageType.PUBLICCHAT);
setMessage.setName("Adam");
setMessage.setMessageNode(mock(MessageNode.class));
slayerPlugin.taskLookup(setMessage, "!task");
verify(chatMessageManager).update(any(MessageNode.class));
}
@Test
public void testTaskLookupInvalid() throws IOException
{
net.runelite.http.api.chat.Task task = new net.runelite.http.api.chat.Task();
task.setTask("task<");
task.setLocation("loc");
task.setAmount(42);
task.setInitialAmount(42);
when(slayerConfig.taskCommand()).thenReturn(true);
when(chatClient.getTask(anyString())).thenReturn(task);
ChatMessage chatMessage = new ChatMessage();
chatMessage.setType(ChatMessageType.PUBLICCHAT);
chatMessage.setName("Adam");
chatMessage.setMessageNode(mock(MessageNode.class));
slayerPlugin.taskLookup(chatMessage, "!task");
verify(chatMessageManager, never()).update(any(MessageNode.class));
}
@Test
public void testNewAccountSlayerKill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
slayerPlugin.setTaskName("Bears");
slayerPlugin.setAmount(35);
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
0,
1,
1
);
slayerPlugin.onStatChanged(statChanged);
statChanged = new StatChanged(
Skill.SLAYER,
27,
1,
1
);
slayerPlugin.onStatChanged(statChanged);
assertEquals(34, slayerPlugin.getAmount());
}
@Test
public void infoboxNotAddedOnLogin()
{
when(slayerConfig.taskName()).thenReturn(Task.BLOODVELD.getName());
GameStateChanged loggingIn = new GameStateChanged();
loggingIn.setGameState(GameState.LOGGING_IN);
slayerPlugin.onGameStateChanged(loggingIn);
GameStateChanged loggedIn = new GameStateChanged();
loggedIn.setGameState(GameState.LOGGED_IN);
slayerPlugin.onGameStateChanged(loggedIn);
verify(infoBoxManager, never()).addInfoBox(any());
}
@Test
public void testMultikill()
{
final Player player = mock(Player.class);
when(player.getLocalLocation()).thenReturn(new LocalPoint(0, 0));
when(client.getLocalPlayer()).thenReturn(player);
// Setup xp cache
StatChanged statChanged = new StatChanged(
Skill.SLAYER,
0,
1,
1
);
slayerPlugin.onStatChanged(statChanged);
NPCComposition npcComposition = mock(NPCComposition.class);
when(npcComposition.getActions()).thenReturn(new String[]{"Attack"});
NPC npc1 = mock(NPC.class);
when(npc1.getName()).thenReturn("Suqah");
when(npc1.getTransformedComposition()).thenReturn(npcComposition);
NPC npc2 = mock(NPC.class);
when(npc2.getName()).thenReturn("Suqah");
when(npc2.getTransformedComposition()).thenReturn(npcComposition);
when(client.getNpcs()).thenReturn(Arrays.asList(npc1, npc2));
// Set task
Widget npcDialog = mock(Widget.class);
when(npcDialog.getText()).thenReturn(TASK_NEW);
when(client.getWidget(WidgetInfo.DIALOG_NPC_TEXT)).thenReturn(npcDialog);
slayerPlugin.onGameTick(new GameTick());
// Damage both npcs
Hitsplat hitsplat = new Hitsplat(Hitsplat.HitsplatType.DAMAGE_ME, 1, 1);
HitsplatApplied hitsplatApplied = new HitsplatApplied();
hitsplatApplied.setHitsplat(hitsplat);
hitsplatApplied.setActor(npc1);
slayerPlugin.onHitsplatApplied(hitsplatApplied);
hitsplatApplied.setActor(npc2);
slayerPlugin.onHitsplatApplied(hitsplatApplied);
// Kill both npcs
slayerPlugin.onActorDeath(new ActorDeath(npc1));
slayerPlugin.onActorDeath(new ActorDeath(npc2));
slayerPlugin.onGameTick(new GameTick());
statChanged = new StatChanged(
Skill.SLAYER,
105,
2,
2
);
slayerPlugin.onStatChanged(statChanged);
assertEquals("Suqahs", slayerPlugin.getTaskName());
assertEquals(229, slayerPlugin.getAmount()); // 2 kills
}
}
@@ -35,10 +35,10 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameShell;
import net.runelite.rs.api.RSGameEngine;
@Mixin(RSGameShell.class)
public abstract class RSGameShellMixin implements RSGameShell
@Mixin(RSGameEngine.class)
public abstract class RSGameEngineMixin implements RSGameEngine
{
@Shadow("client")
private static RSClient client;
@@ -6,10 +6,10 @@ import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameShell;
import net.runelite.rs.api.RSGameEngine;
@Mixin(RSGameShell.class)
public abstract class StretchedModeMaxSizeMixin implements RSGameShell
@Mixin(RSGameEngine.class)
public abstract class StretchedModeMaxSizeMixin implements RSGameEngine
{
@Shadow("client")
private static RSClient client;
@@ -33,7 +33,7 @@ import net.runelite.api.widgets.Widget;
import net.runelite.mapping.Construct;
import net.runelite.mapping.Import;
public interface RSClient extends RSGameShell, Client
public interface RSClient extends RSGameEngine, Client
{
@Import("cameraX")
@Override
@@ -24,11 +24,11 @@
*/
package net.runelite.rs.api;
import net.runelite.api.GameShell;
import net.runelite.api.GameEngine;
import java.awt.Canvas;
import net.runelite.mapping.Import;
public interface RSGameShell extends GameShell
public interface RSGameEngine extends GameEngine
{
@Import("canvas")
Canvas getCanvas();
@@ -526,7 +526,7 @@ public class ArchiveLoader {
class22.field107 = "Can't login? Click here."; // L: 1256
}
GameShell.field481 = new Bounds(Login.loginBoxCenter, var31, var1.stringWidth(class22.field107), 11); // L: 1259
GameEngine.field481 = new Bounds(Login.loginBoxCenter, var31, var1.stringWidth(class22.field107), 11); // L: 1259
GrandExchangeOfferOwnWorldComparator.field643 = new Bounds(Login.loginBoxCenter, var31, var1.stringWidth("Still having trouble logging in?"), 11); // L: 1260
var1.drawCentered(class22.field107, Login.loginBoxCenter, var31, 16777215, 0); // L: 1261
} else if (Login.loginIndex == 3) { // L: 1263
+6 -6
View File
@@ -78,7 +78,7 @@ public final class Canvas extends java.awt.Canvas {
DynamicObject.archive2 = WorldMapCacheName.newArchive(2, true, false, true); // L: 1744
class330.archive3 = WorldMapCacheName.newArchive(3, false, true, true); // L: 1745
class227.archive4 = WorldMapCacheName.newArchive(4, false, true, true); // L: 1746
GameShell.archive5 = WorldMapCacheName.newArchive(5, true, true, true); // L: 1747
GameEngine.archive5 = WorldMapCacheName.newArchive(5, true, true, true); // L: 1747
class217.archive6 = WorldMapCacheName.newArchive(6, true, true, true); // L: 1748
BuddyRankComparator.archive7 = WorldMapCacheName.newArchive(7, false, true, true); // L: 1749
Messages.archive8 = WorldMapCacheName.newArchive(8, false, true, true); // L: 1750
@@ -103,7 +103,7 @@ public final class Canvas extends java.awt.Canvas {
var12 += DynamicObject.archive2.percentage() * 2 / 100; // L: 1771
var12 += class330.archive3.percentage() * 2 / 100; // L: 1772
var12 += class227.archive4.percentage() * 6 / 100; // L: 1773
var12 += GameShell.archive5.percentage() * 4 / 100; // L: 1774
var12 += GameEngine.archive5.percentage() * 4 / 100; // L: 1774
var12 += class217.archive6.percentage() * 2 / 100; // L: 1775
var12 += BuddyRankComparator.archive7.percentage() * 56 / 100; // L: 1776
var12 += Messages.archive8.percentage() * 2 / 100; // L: 1777
@@ -128,7 +128,7 @@ public final class Canvas extends java.awt.Canvas {
UserComparator4.method3469(SceneTilePaint.archive0, "Animations"); // L: 1794
UserComparator4.method3469(WorldMapSprite.archive1, "Skeletons"); // L: 1795
UserComparator4.method3469(class227.archive4, "Sound FX"); // L: 1796
UserComparator4.method3469(GameShell.archive5, "Maps"); // L: 1797
UserComparator4.method3469(GameEngine.archive5, "Maps"); // L: 1797
UserComparator4.method3469(class217.archive6, "Music Tracks"); // L: 1798
UserComparator4.method3469(BuddyRankComparator.archive7, "Models"); // L: 1799
UserComparator4.method3469(Messages.archive8, "Sprites"); // L: 1800
@@ -152,7 +152,7 @@ public final class Canvas extends java.awt.Canvas {
WorldMapIcon_0.method270(22050, !Client.isLowDetail, 2); // L: 1815
MidiPcmStream var20 = new MidiPcmStream(); // L: 1816
var20.method3759(9, 128); // L: 1817
AbstractWorldMapData.pcmPlayer0 = UserComparator6.method3526(GameShell.taskHandler, 0, 22050); // L: 1818
AbstractWorldMapData.pcmPlayer0 = UserComparator6.method3526(GameEngine.taskHandler, 0, 22050); // L: 1818
AbstractWorldMapData.pcmPlayer0.setStream(var20); // L: 1819
var21 = Client.archive15; // L: 1820
var2 = FontName.archive14; // L: 1821
@@ -161,7 +161,7 @@ public final class Canvas extends java.awt.Canvas {
class206.musicSamplesArchive = var2; // L: 1825
class206.soundEffectsArchive = var16; // L: 1826
class206.midiPcmStream = var20; // L: 1827
FriendLoginUpdate.pcmPlayer1 = UserComparator6.method3526(GameShell.taskHandler, 1, 2048); // L: 1829
FriendLoginUpdate.pcmPlayer1 = UserComparator6.method3526(GameEngine.taskHandler, 1, 2048); // L: 1829
WorldMapManager.pcmStreamMixer = new PcmStreamMixer(); // L: 1830
FriendLoginUpdate.pcmPlayer1.setStream(WorldMapManager.pcmStreamMixer); // L: 1831
ItemLayer.decimator = new Decimator(22050, PcmPlayer.field1443); // L: 1832
@@ -498,7 +498,7 @@ public final class Canvas extends java.awt.Canvas {
}
} else if (Client.titleLoadingStage == 110) { // L: 2132
SoundCache.mouseRecorder = new MouseRecorder(); // L: 2133
GameShell.taskHandler.newThreadTask(SoundCache.mouseRecorder, 10); // L: 2134
GameEngine.taskHandler.newThreadTask(SoundCache.mouseRecorder, 10); // L: 2134
Login.Login_loadingText = "Loaded input handler"; // L: 2135
Login.Login_loadingPercent = 92; // L: 2136
Client.titleLoadingStage = 120; // L: 2137
+15 -15
View File
@@ -15,7 +15,7 @@ import netscape.javascript.JSObject;
@Implements("Client")
@ObfuscatedName("client")
public final class Client extends GameShell implements Usernamed {
public final class Client extends GameEngine implements Usernamed {
@ObfuscatedName("ns")
@ObfuscatedSignature(
descriptor = "Lhe;"
@@ -1691,7 +1691,7 @@ public final class Client extends GameShell implements Usernamed {
int var2;
for (var2 = 0; var2 < WorldMapIcon_0.regionLandArchives.length; ++var2) { // L: 947
if (class41.regionMapArchiveIds[var2] != -1 && WorldMapIcon_0.regionLandArchives[var2] == null) { // L: 948 949
WorldMapIcon_0.regionLandArchives[var2] = GameShell.archive5.takeFile(class41.regionMapArchiveIds[var2], 0); // L: 950
WorldMapIcon_0.regionLandArchives[var2] = GameEngine.archive5.takeFile(class41.regionMapArchiveIds[var2], 0); // L: 950
if (WorldMapIcon_0.regionLandArchives[var2] == null) { // L: 951
var43 = false; // L: 952
++field700; // L: 953
@@ -1699,7 +1699,7 @@ public final class Client extends GameShell implements Usernamed {
}
if (GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var2] != -1 && MouseRecorder.regionMapArchives[var2] == null) { // L: 957 958
MouseRecorder.regionMapArchives[var2] = GameShell.archive5.takeFileEncrypted(GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var2], 0, class227.xteaKeys[var2]); // L: 959
MouseRecorder.regionMapArchives[var2] = GameEngine.archive5.takeFileEncrypted(GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var2], 0, class227.xteaKeys[var2]); // L: 959
if (MouseRecorder.regionMapArchives[var2] == null) { // L: 960
var43 = false; // L: 961
++field700; // L: 962
@@ -2050,8 +2050,8 @@ public final class Client extends GameShell implements Usernamed {
for (var46 = var4 - 1; var46 <= var5 + 1; ++var46) { // L: 1223
for (var9 = var6 - 1; var9 <= var7 + 1; ++var9) { // L: 1224
if (var46 < var4 || var46 > var5 || var9 < var6 || var9 > var7) { // L: 1225
GameShell.archive5.loadRegionFromName("m" + var46 + "_" + var9); // L: 1226
GameShell.archive5.loadRegionFromName("l" + var46 + "_" + var9); // L: 1227
GameEngine.archive5.loadRegionFromName("m" + var46 + "_" + var9); // L: 1226
GameEngine.archive5.loadRegionFromName("l" + var46 + "_" + var9); // L: 1227
}
}
}
@@ -2076,11 +2076,11 @@ public final class Client extends GameShell implements Usernamed {
class225.clock.mark(); // L: 1250
for (var5 = 0; var5 < 32; ++var5) { // L: 1251
GameShell.graphicsTickTimes[var5] = 0L;
GameEngine.graphicsTickTimes[var5] = 0L;
}
for (var5 = 0; var5 < 32; ++var5) { // L: 1252
GameShell.clientTickTimes[var5] = 0L;
GameEngine.clientTickTimes[var5] = 0L;
}
class8.gameCyclesToDo = 0; // L: 1253
@@ -2687,7 +2687,7 @@ public final class Client extends GameShell implements Usernamed {
if (--field864 + 1 <= 0) { // L: 1561
try {
if (js5ConnectState == 0) { // L: 1563
WorldMapManager.js5SocketTask = GameShell.taskHandler.newSocketTask(WorldMapSprite.worldHost, ArchiveDiskAction.port3); // L: 1564
WorldMapManager.js5SocketTask = GameEngine.taskHandler.newSocketTask(WorldMapSprite.worldHost, ArchiveDiskAction.port3); // L: 1564
++js5ConnectState; // L: 1565
}
@@ -2706,7 +2706,7 @@ public final class Client extends GameShell implements Usernamed {
if (useBufferedSocket) { // L: 1575
TaskHandler.js5Socket = class219.method4011((Socket)WorldMapManager.js5SocketTask.result, 40000, 5000); // L: 1576
} else {
TaskHandler.js5Socket = new NetSocket((Socket)WorldMapManager.js5SocketTask.result, GameShell.taskHandler, 5000); // L: 1579
TaskHandler.js5Socket = new NetSocket((Socket)WorldMapManager.js5SocketTask.result, GameEngine.taskHandler, 5000); // L: 1579
}
Buffer var1 = new Buffer(5); // L: 1581
@@ -2875,7 +2875,7 @@ public final class Client extends GameShell implements Usernamed {
if (loginState == 1) { // L: 2221
if (WorldMapID.socketTask == null) { // L: 2222
WorldMapID.socketTask = GameShell.taskHandler.newSocketTask(WorldMapSprite.worldHost, ArchiveDiskAction.port3); // L: 2223
WorldMapID.socketTask = GameEngine.taskHandler.newSocketTask(WorldMapSprite.worldHost, ArchiveDiskAction.port3); // L: 2223
}
if (WorldMapID.socketTask.status == 2) { // L: 2225
@@ -2886,7 +2886,7 @@ public final class Client extends GameShell implements Usernamed {
if (useBufferedSocket) { // L: 2227
var1 = class219.method4011((Socket)WorldMapID.socketTask.result, 40000, 5000); // L: 2228
} else {
var1 = new NetSocket((Socket)WorldMapID.socketTask.result, GameShell.taskHandler, 5000); // L: 2231
var1 = new NetSocket((Socket)WorldMapID.socketTask.result, GameEngine.taskHandler, 5000); // L: 2231
}
packetWriter.setSocket((AbstractSocket)var1); // L: 2233
@@ -3042,7 +3042,7 @@ public final class Client extends GameShell implements Usernamed {
var5.packetBuffer.writeBytes(var29.array, 0, var29.array.length); // L: 2364
var5.packetBuffer.writeByte(clientType); // L: 2365
var5.packetBuffer.writeInt(0); // L: 2366
var5.packetBuffer.method5718(GameShell.archive5.hash); // L: 2367
var5.packetBuffer.method5718(GameEngine.archive5.hash); // L: 2367
var5.packetBuffer.method5718(GrandExchangeOfferUnitPriceComparator.archive13.hash); // L: 2368
var5.packetBuffer.method5718(PacketBufferNode.archive12.hash); // L: 2369
var5.packetBuffer.method5587(ItemContainer.archive11.hash); // L: 2370
@@ -3164,7 +3164,7 @@ public final class Client extends GameShell implements Usernamed {
if (loginState == 13) { // L: 2493
field892 = 0; // L: 2494
GameShell.setLoginResponseString("You have only just left another world.", "Your profile will be transferred in:", field682 / 60 + " seconds."); // L: 2495
GameEngine.setLoginResponseString("You have only just left another world.", "Your profile will be transferred in:", field682 / 60 + " seconds."); // L: 2495
if (--field682 <= 0) { // L: 2496
loginState = 0;
}
@@ -3270,7 +3270,7 @@ public final class Client extends GameShell implements Usernamed {
String var25 = var2.readStringCp1252NullTerminated(); // L: 2591
String var33 = var2.readStringCp1252NullTerminated(); // L: 2592
String var27 = var2.readStringCp1252NullTerminated(); // L: 2593
GameShell.setLoginResponseString(var25, var33, var27); // L: 2594
GameEngine.setLoginResponseString(var25, var33, var27); // L: 2594
WorldMapCacheName.updateGameState(10); // L: 2595
}
@@ -5333,7 +5333,7 @@ public final class Client extends GameShell implements Usernamed {
var57.packetBuffer.method5569(var18); // L: 6401
var57.packetBuffer.method5718(var16); // L: 6402
var57.packetBuffer.method5587(var5); // L: 6403
var57.packetBuffer.method5568(GameShell.fps); // L: 6404
var57.packetBuffer.method5568(GameEngine.fps); // L: 6404
packetWriter.addNode(var57); // L: 6405
var1.serverPacket = null; // L: 6406
return true; // L: 6407
+1 -1
View File
@@ -237,7 +237,7 @@ public class FontName {
if (var10.contentType == 1336) { // L: 9016
if (Client.displayFps) { // L: 9017
var13 += 15; // L: 9018
WorldMapLabelSize.fontPlain12.drawRightAligned("Fps:" + GameShell.fps, var12 + var10.width, var13, 16776960, -1); // L: 9019
WorldMapLabelSize.fontPlain12.drawRightAligned("Fps:" + GameEngine.fps, var12 + var10.width, var13, 16776960, -1); // L: 9019
var13 += 15; // L: 9020
Runtime var42 = Runtime.getRuntime(); // L: 9021
var20 = (int)((var42.totalMemory() - var42.freeMemory()) / 1024L); // L: 9022
@@ -26,7 +26,7 @@ import net.runelite.mapping.ObfuscatedSignature;
@ObfuscatedName("bd")
@Implements("GameShell")
public abstract class GameShell extends Applet implements Runnable, FocusListener, WindowListener {
public abstract class GameEngine extends Applet implements Runnable, FocusListener, WindowListener {
@ObfuscatedName("h")
@ObfuscatedSignature(
descriptor = "Lfa;"
@@ -38,7 +38,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
descriptor = "Lbd;"
)
@Export("gameShell")
static GameShell gameShell;
static GameEngine gameEngine;
@ObfuscatedName("t")
@ObfuscatedGetter(
intValue = 548418733
@@ -192,7 +192,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
final EventQueue eventQueue;
static {
gameShell = null; // L: 41
gameEngine = null; // L: 41
GameShell_redundantStartThreadCount = 0; // L: 43
stopTimeMs = 0L; // L: 44
isKilled = false; // L: 45
@@ -207,7 +207,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
garbageCollectorLastCheckTimeMs = -1L; // L: 86
}
protected GameShell() {
protected GameEngine() {
this.hasErrored = false; // L: 46
this.canvasX = 0; // L: 59
this.canvasY = 0; // L: 60
@@ -451,7 +451,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
@Export("startThread")
protected final void startThread(int var1, int var2, int var3) {
try {
if (gameShell != null) { // L: 220
if (gameEngine != null) { // L: 220
++GameShell_redundantStartThreadCount; // L: 221
if (GameShell_redundantStartThreadCount >= 3) { // L: 222
this.error("alreadyloaded"); // L: 223
@@ -462,7 +462,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
return; // L: 227
}
gameShell = this; // L: 229
gameEngine = this; // L: 229
IgnoreList.canvasWidth = var1; // L: 230
ModelData0.canvasHeight = var2; // L: 231
RunException.RunException_revision = var3; // L: 232
@@ -851,7 +851,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
protected abstract void vmethod1777();
public final synchronized void paint(Graphics var1) {
if (this == gameShell && !isKilled) { // L: 449
if (this == gameEngine && !isKilled) { // L: 449
this.fullRedraw = true; // L: 450
if (class298.currentTimeMillis() - this.field472 > 1000L) { // L: 451
Rectangle var2 = var1.getClipBounds(); // L: 452
@@ -864,7 +864,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
} // L: 455
public final void destroy() {
if (this == gameShell && !isKilled) { // L: 438
if (this == gameEngine && !isKilled) { // L: 438
stopTimeMs = class298.currentTimeMillis(); // L: 439
class236.sleepExact(5000L); // L: 440
this.kill(); // L: 441
@@ -899,13 +899,13 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
public abstract void init();
public final void stop() {
if (this == gameShell && !isKilled) { // L: 433
if (this == gameEngine && !isKilled) { // L: 433
stopTimeMs = class298.currentTimeMillis() + 4000L; // L: 434
}
} // L: 435
public final void start() {
if (this == gameShell && !isKilled) { // L: 428
if (this == gameEngine && !isKilled) { // L: 428
stopTimeMs = 0L; // L: 429
}
} // L: 430
@@ -132,11 +132,11 @@ public class GrandExchangeEvent {
int var0;
for (var0 = 0; var0 < 32; ++var0) { // L: 422
GameShell.graphicsTickTimes[var0] = 0L;
GameEngine.graphicsTickTimes[var0] = 0L;
}
for (var0 = 0; var0 < 32; ++var0) { // L: 423
GameShell.clientTickTimes[var0] = 0L;
GameEngine.clientTickTimes[var0] = 0L;
}
class8.gameCyclesToDo = 0; // L: 424
@@ -108,8 +108,8 @@ final class GrandExchangeOfferNameComparator implements Comparator {
GarbageCollectorMXBean var2 = (GarbageCollectorMXBean)var1.next(); // L: 570
if (var2.isValid()) { // L: 572
class25.garbageCollector = var2; // L: 573
GameShell.garbageCollectorLastCheckTimeMs = -1L; // L: 574
GameShell.garbageCollectorLastCollectionTime = -1L; // L: 575
GameEngine.garbageCollectorLastCheckTimeMs = -1L; // L: 574
GameEngine.garbageCollectorLastCollectionTime = -1L; // L: 575
}
}
} catch (Throwable var11) { // L: 580
@@ -119,16 +119,16 @@ final class GrandExchangeOfferNameComparator implements Comparator {
if (class25.garbageCollector != null) { // L: 582
long var9 = class298.currentTimeMillis(); // L: 583
long var3 = class25.garbageCollector.getCollectionTime(); // L: 584
if (-1L != GameShell.garbageCollectorLastCollectionTime) { // L: 585
long var5 = var3 - GameShell.garbageCollectorLastCollectionTime; // L: 586
long var7 = var9 - GameShell.garbageCollectorLastCheckTimeMs; // L: 587
if (-1L != GameEngine.garbageCollectorLastCollectionTime) { // L: 585
long var5 = var3 - GameEngine.garbageCollectorLastCollectionTime; // L: 586
long var7 = var9 - GameEngine.garbageCollectorLastCheckTimeMs; // L: 587
if (var7 != 0L) { // L: 588
var0 = (int)(100L * var5 / var7);
}
}
GameShell.garbageCollectorLastCollectionTime = var3; // L: 590
GameShell.garbageCollectorLastCheckTimeMs = var9; // L: 591
GameEngine.garbageCollectorLastCollectionTime = var3; // L: 590
GameEngine.garbageCollectorLastCheckTimeMs = var9; // L: 591
}
return var0; // L: 593
@@ -170,8 +170,8 @@ public class ItemContainer extends Node {
var8 = var7 + (var6 << 8); // L: 5317
if (!var16 || var7 != 49 && var7 != 149 && var7 != 147 && var6 != 50 && (var6 != 49 || var7 != 47)) { // L: 5318
FileSystem.regions[var4] = var8; // L: 5319
class41.regionMapArchiveIds[var4] = GameShell.archive5.getGroupId("m" + var6 + "_" + var7); // L: 5320
GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var4] = GameShell.archive5.getGroupId("l" + var6 + "_" + var7); // L: 5321
class41.regionMapArchiveIds[var4] = GameEngine.archive5.getGroupId("m" + var6 + "_" + var7); // L: 5320
GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var4] = GameEngine.archive5.getGroupId("l" + var6 + "_" + var7); // L: 5321
++var4; // L: 5322
}
}
@@ -236,8 +236,8 @@ public class ItemContainer extends Node {
FileSystem.regions[var5] = var12; // L: 5368
var13 = var12 >> 8 & 255; // L: 5369
int var14 = var12 & 255; // L: 5370
class41.regionMapArchiveIds[var5] = GameShell.archive5.getGroupId("m" + var13 + "_" + var14); // L: 5371
GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var5] = GameShell.archive5.getGroupId("l" + var13 + "_" + var14); // L: 5372
class41.regionMapArchiveIds[var5] = GameEngine.archive5.getGroupId("m" + var13 + "_" + var14); // L: 5371
GrandExchangeOfferTotalQuantityComparator.regionLandArchiveIds[var5] = GameEngine.archive5.getGroupId("l" + var13 + "_" + var14); // L: 5372
++var5; // L: 5373
}
}
+1 -1
View File
@@ -94,6 +94,6 @@ public class Messages {
)
static void method2285() {
Login.loginIndex = 24; // L: 1517
GameShell.setLoginResponseString("The game servers are currently being updated.", "Please wait a few minutes and try again.", ""); // L: 1518
GameEngine.setLoginResponseString("The game servers are currently being updated.", "Please wait a few minutes and try again.", ""); // L: 1518
} // L: 1519
}
@@ -381,7 +381,7 @@ public class SequenceDefinition extends DualNode {
garbageValue = "1"
)
@Export("doCycleTitle")
static void doCycleTitle(GameShell var0) {
static void doCycleTitle(GameEngine var0) {
int var2;
int var3;
int var4;
@@ -662,12 +662,12 @@ public class SequenceDefinition extends DualNode {
var35 += 15; // L: 496
var36 = 361; // L: 497
if (GameShell.field481 != null) { // L: 498
var38 = GameShell.field481.highX / 2; // L: 499
if (var4 == 1 && var44 >= GameShell.field481.lowX - var38 && var44 <= var38 + GameShell.field481.lowX && var34 >= var36 - 15 && var34 < var36) { // L: 500
if (GameEngine.field481 != null) { // L: 498
var38 = GameEngine.field481.highX / 2; // L: 499
if (var4 == 1 && var44 >= GameEngine.field481.lowX - var38 && var44 <= var38 + GameEngine.field481.lowX && var34 >= var36 - 15 && var34 < var36) { // L: 500
switch(Login.field1190) { // L: 501
case 1:
GameShell.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 504
GameEngine.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 504
Login.loginIndex = 5; // L: 505
return; // L: 506
case 2:
@@ -681,16 +681,16 @@ public class SequenceDefinition extends DualNode {
if (var4 == 1 && var44 >= var38 - 75 && var44 <= var38 + 75 && var34 >= var37 - 20 && var34 <= var37 + 20) { // L: 518
Login.Login_username = Login.Login_username.trim(); // L: 519
if (Login.Login_username.length() == 0) { // L: 520
GameShell.setLoginResponseString("", "Please enter your username/email address.", ""); // L: 521
GameEngine.setLoginResponseString("", "Please enter your username/email address.", ""); // L: 521
return; // L: 522
}
if (Login.Login_password.length() == 0) { // L: 524
GameShell.setLoginResponseString("", "Please enter your password.", ""); // L: 525
GameEngine.setLoginResponseString("", "Please enter your password.", ""); // L: 525
return; // L: 526
}
GameShell.setLoginResponseString("", "Connecting to server...", ""); // L: 528
GameEngine.setLoginResponseString("", "Connecting to server...", ""); // L: 528
WorldMapDecoration.method380(false); // L: 529
WorldMapCacheName.updateGameState(20); // L: 530
return; // L: 531
@@ -782,16 +782,16 @@ public class SequenceDefinition extends DualNode {
if (StudioGame.field3135 == 84) { // L: 591
Login.Login_username = Login.Login_username.trim(); // L: 592
if (Login.Login_username.length() == 0) { // L: 593
GameShell.setLoginResponseString("", "Please enter your username/email address.", ""); // L: 594
GameEngine.setLoginResponseString("", "Please enter your username/email address.", ""); // L: 594
return; // L: 595
}
if (Login.Login_password.length() == 0) { // L: 597
GameShell.setLoginResponseString("", "Please enter your password.", ""); // L: 598
GameEngine.setLoginResponseString("", "Please enter your password.", ""); // L: 598
return; // L: 599
}
GameShell.setLoginResponseString("", "Connecting to server...", ""); // L: 601
GameEngine.setLoginResponseString("", "Connecting to server...", ""); // L: 601
WorldMapDecoration.method380(false); // L: 602
WorldMapCacheName.updateGameState(20); // L: 603
return; // L: 604
@@ -880,7 +880,7 @@ public class SequenceDefinition extends DualNode {
var35 = Login.loginBoxX + 180; // L: 688
var8 = 326; // L: 689
if (var4 == 1 && var44 >= var35 - 75 && var44 <= var35 + 75 && var34 >= var8 - 20 && var34 <= var8 + 20) { // L: 690
GameShell.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 691
GameEngine.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 691
Login.loginIndex = 5; // L: 692
return; // L: 693
}
@@ -892,14 +892,14 @@ public class SequenceDefinition extends DualNode {
if (var4 == 1 && var44 >= var35 - 75 && var44 <= var35 + 75 && var34 >= var8 - 20 && var34 <= var8 + 20) { // L: 699
SecureRandomCallable.otp.trim(); // L: 700
if (SecureRandomCallable.otp.length() != 6) { // L: 701
GameShell.setLoginResponseString("", "Please enter a 6-digit PIN.", ""); // L: 702
GameEngine.setLoginResponseString("", "Please enter a 6-digit PIN.", ""); // L: 702
return; // L: 703
}
WorldMapSection1.field313 = Integer.parseInt(SecureRandomCallable.otp); // L: 705
SecureRandomCallable.otp = ""; // L: 706
WorldMapDecoration.method380(true); // L: 707
GameShell.setLoginResponseString("", "Connecting to server...", ""); // L: 708
GameEngine.setLoginResponseString("", "Connecting to server...", ""); // L: 708
WorldMapCacheName.updateGameState(20); // L: 709
return; // L: 710
}
@@ -945,14 +945,14 @@ public class SequenceDefinition extends DualNode {
if (StudioGame.field3135 == 84) { // L: 743
SecureRandomCallable.otp.trim(); // L: 744
if (SecureRandomCallable.otp.length() != 6) { // L: 745
GameShell.setLoginResponseString("", "Please enter a 6-digit PIN.", ""); // L: 746
GameEngine.setLoginResponseString("", "Please enter a 6-digit PIN.", ""); // L: 746
return; // L: 747
}
WorldMapSection1.field313 = Integer.parseInt(SecureRandomCallable.otp); // L: 749
SecureRandomCallable.otp = ""; // L: 750
WorldMapDecoration.method380(true); // L: 751
GameShell.setLoginResponseString("", "Connecting to server...", ""); // L: 752
GameEngine.setLoginResponseString("", "Connecting to server...", ""); // L: 752
WorldMapCacheName.updateGameState(20); // L: 753
return; // L: 754
}
@@ -1016,7 +1016,7 @@ public class SequenceDefinition extends DualNode {
var8 = 321; // L: 812
if (var4 == 1 && var44 >= var35 - 75 && var44 <= var35 + 75 && var34 >= var8 - 20 && var34 <= var8 + 20) { // L: 813
AttackOption.openURL(AbstractWorldMapIcon.method632("secure", true) + "m=dob/set_dob.ws", true, false); // L: 814
GameShell.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 815
GameEngine.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 815
Login.loginIndex = 6; // L: 816
return; // L: 817
}
@@ -1030,7 +1030,7 @@ public class SequenceDefinition extends DualNode {
var8 = 321; // L: 826
if (var4 == 1 && var44 >= var35 - 75 && var44 <= var35 + 75 && var34 >= var8 - 20 && var34 <= var8 + 20) { // L: 827
AttackOption.openURL("https://www.jagex.com/terms/privacy", true, false); // L: 828
GameShell.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 829
GameEngine.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 829
Login.loginIndex = 6; // L: 830
return; // L: 831
}
@@ -1056,7 +1056,7 @@ public class SequenceDefinition extends DualNode {
var37 = 276; // L: 852
if (var4 == 1 && var44 >= var38 - 75 && var44 <= var38 + 75 && var34 >= var37 - 20 && var34 <= var37 + 20) { // L: 853
AttackOption.openURL(var30, true, false); // L: 854
GameShell.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 855
GameEngine.setLoginResponseString("", "Page has opened in a new window.", "(Please check your popup blocker.)"); // L: 855
Login.loginIndex = 6; // L: 856
return; // L: 857
}
@@ -44,11 +44,11 @@ public class UserComparator8 extends AbstractUserComparator {
@Export("getLoginError")
static void getLoginError(int var0) {
if (var0 == -3) { // L: 2791
GameShell.setLoginResponseString("Connection timed out.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("Connection timed out.", "Please try using a different world.", "");
} else if (var0 == -2) { // L: 2792
GameShell.setLoginResponseString("Error connecting to server.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("Error connecting to server.", "Please try using a different world.", "");
} else if (var0 == -1) { // L: 2793
GameShell.setLoginResponseString("No response from server.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("No response from server.", "Please try using a different world.", "");
} else if (var0 == 3) { // L: 2794
Login.loginIndex = 3; // L: 2795
Login.field1190 = 1; // L: 2796
@@ -57,66 +57,66 @@ public class UserComparator8 extends AbstractUserComparator {
Login.field1199 = 0; // L: 2801
} else if (var0 == 5) { // L: 2804
Login.field1190 = 2; // L: 2805
GameShell.setLoginResponseString("Your account has not logged out from its last", "session or the server is too busy right now.", "Please try again in a few minutes."); // L: 2806
GameEngine.setLoginResponseString("Your account has not logged out from its last", "session or the server is too busy right now.", "Please try again in a few minutes."); // L: 2806
} else if (var0 != 68 && (Client.onMobile || var0 != 6)) { // L: 2808
if (var0 == 7) { // L: 2811
GameShell.setLoginResponseString("This world is full.", "Please use a different world.", "");
GameEngine.setLoginResponseString("This world is full.", "Please use a different world.", "");
} else if (var0 == 8) { // L: 2812
GameShell.setLoginResponseString("Unable to connect.", "Login server offline.", "");
GameEngine.setLoginResponseString("Unable to connect.", "Login server offline.", "");
} else if (var0 == 9) { // L: 2813
GameShell.setLoginResponseString("Login limit exceeded.", "Too many connections from your address.", "");
GameEngine.setLoginResponseString("Login limit exceeded.", "Too many connections from your address.", "");
} else if (var0 == 10) { // L: 2814
GameShell.setLoginResponseString("Unable to connect.", "Bad session id.", "");
GameEngine.setLoginResponseString("Unable to connect.", "Bad session id.", "");
} else if (var0 == 11) { // L: 2815
GameShell.setLoginResponseString("We suspect someone knows your password.", "Press 'change your password' on front page.", "");
GameEngine.setLoginResponseString("We suspect someone knows your password.", "Press 'change your password' on front page.", "");
} else if (var0 == 12) { // L: 2816
GameShell.setLoginResponseString("You need a members account to login to this world.", "Please subscribe, or use a different world.", "");
GameEngine.setLoginResponseString("You need a members account to login to this world.", "Please subscribe, or use a different world.", "");
} else if (var0 == 13) { // L: 2817
GameShell.setLoginResponseString("Could not complete login.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("Could not complete login.", "Please try using a different world.", "");
} else if (var0 == 14) { // L: 2818
GameShell.setLoginResponseString("The server is being updated.", "Please wait 1 minute and try again.", "");
GameEngine.setLoginResponseString("The server is being updated.", "Please wait 1 minute and try again.", "");
} else if (var0 == 16) { // L: 2819
GameShell.setLoginResponseString("Too many login attempts.", "Please wait a few minutes before trying again.", "");
GameEngine.setLoginResponseString("Too many login attempts.", "Please wait a few minutes before trying again.", "");
} else if (var0 == 17) { // L: 2820
GameShell.setLoginResponseString("You are standing in a members-only area.", "To play on this world move to a free area first", "");
GameEngine.setLoginResponseString("You are standing in a members-only area.", "To play on this world move to a free area first", "");
} else if (var0 == 18) { // L: 2821
Login.loginIndex = 12; // L: 2823
Login.field1199 = 1; // L: 2824
} else if (var0 == 19) { // L: 2827
GameShell.setLoginResponseString("This world is running a closed Beta.", "Sorry invited players only.", "Please use a different world.");
GameEngine.setLoginResponseString("This world is running a closed Beta.", "Sorry invited players only.", "Please use a different world.");
} else if (var0 == 20) { // L: 2828
GameShell.setLoginResponseString("Invalid loginserver requested.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("Invalid loginserver requested.", "Please try using a different world.", "");
} else if (var0 == 22) { // L: 2829
GameShell.setLoginResponseString("Malformed login packet.", "Please try again.", "");
GameEngine.setLoginResponseString("Malformed login packet.", "Please try again.", "");
} else if (var0 == 23) { // L: 2830
GameShell.setLoginResponseString("No reply from loginserver.", "Please wait 1 minute and try again.", "");
GameEngine.setLoginResponseString("No reply from loginserver.", "Please wait 1 minute and try again.", "");
} else if (var0 == 24) { // L: 2831
GameShell.setLoginResponseString("Error loading your profile.", "Please contact customer support.", "");
GameEngine.setLoginResponseString("Error loading your profile.", "Please contact customer support.", "");
} else if (var0 == 25) { // L: 2832
GameShell.setLoginResponseString("Unexpected loginserver response.", "Please try using a different world.", "");
GameEngine.setLoginResponseString("Unexpected loginserver response.", "Please try using a different world.", "");
} else if (var0 == 26) { // L: 2833
GameShell.setLoginResponseString("This computers address has been blocked", "as it was used to break our rules.", "");
GameEngine.setLoginResponseString("This computers address has been blocked", "as it was used to break our rules.", "");
} else if (var0 == 27) { // L: 2834
GameShell.setLoginResponseString("", "Service unavailable.", "");
GameEngine.setLoginResponseString("", "Service unavailable.", "");
} else if (var0 == 31) { // L: 2835
GameShell.setLoginResponseString("Your account must have a displayname set", "in order to play the game. Please set it", "via the website, or the main game.");
GameEngine.setLoginResponseString("Your account must have a displayname set", "in order to play the game. Please set it", "via the website, or the main game.");
} else if (var0 == 32) {
GameShell.setLoginResponseString("Your attempt to log into your account was", "unsuccessful. Don't worry, you can sort", "this out by visiting the billing system."); // L: 2836
GameEngine.setLoginResponseString("Your attempt to log into your account was", "unsuccessful. Don't worry, you can sort", "this out by visiting the billing system."); // L: 2836
} else if (var0 == 37) { // L: 2837
GameShell.setLoginResponseString("Your account is currently inaccessible.", "Please try again in a few minutes.", "");
GameEngine.setLoginResponseString("Your account is currently inaccessible.", "Please try again in a few minutes.", "");
} else if (var0 == 38) { // L: 2838
GameShell.setLoginResponseString("You need to vote to play!", "Visit runescape.com and vote,", "and then come back here!");
GameEngine.setLoginResponseString("You need to vote to play!", "Visit runescape.com and vote,", "and then come back here!");
} else if (var0 == 55) { // L: 2839
Login.loginIndex = 8; // L: 2840
} else {
if (var0 == 56) { // L: 2842
GameShell.setLoginResponseString("Enter the 6-digit code generated by your", "authenticator app.", ""); // L: 2843
GameEngine.setLoginResponseString("Enter the 6-digit code generated by your", "authenticator app.", ""); // L: 2843
WorldMapCacheName.updateGameState(11); // L: 2844
return; // L: 2845
}
if (var0 == 57) { // L: 2847
GameShell.setLoginResponseString("The code you entered was incorrect.", "Please try again.", ""); // L: 2848
GameEngine.setLoginResponseString("The code you entered was incorrect.", "Please try again.", ""); // L: 2848
WorldMapCacheName.updateGameState(11); // L: 2849
return; // L: 2850
}
@@ -124,11 +124,11 @@ public class UserComparator8 extends AbstractUserComparator {
if (var0 == 61) { // L: 2852
Login.loginIndex = 7; // L: 2853
} else {
GameShell.setLoginResponseString("Unexpected server response", "Please try using a different world.", ""); // L: 2855
GameEngine.setLoginResponseString("Unexpected server response", "Please try using a different world.", ""); // L: 2855
}
}
} else {
GameShell.setLoginResponseString("RuneScape has been updated!", "Please reload this page.", ""); // L: 2809
GameEngine.setLoginResponseString("RuneScape has been updated!", "Please reload this page.", ""); // L: 2809
}
WorldMapCacheName.updateGameState(10); // L: 2856
@@ -140,7 +140,7 @@ public final class WorldMapRectangle {
WorldMapSprite.archive1.clearFiles(); // L: 2905
class330.archive3.clearFiles(); // L: 2906
class227.archive4.clearFiles(); // L: 2907
GameShell.archive5.clearFiles(); // L: 2908
GameEngine.archive5.clearFiles(); // L: 2908
class217.archive6.clearFiles(); // L: 2909
BuddyRankComparator.archive7.clearFiles(); // L: 2910
Messages.archive8.clearFiles(); // L: 2911
@@ -182,7 +182,7 @@ public class WorldMapSection1 implements WorldMapSection {
switch(var0) { // L: 2941
case 1:
Login.loginIndex = 24; // L: 2950
GameShell.setLoginResponseString("", "You were disconnected from the server.", ""); // L: 2951
GameEngine.setLoginResponseString("", "You were disconnected from the server.", ""); // L: 2951
break;
case 2:
Messages.method2285(); // L: 2944
+7 -7
View File
@@ -444,7 +444,7 @@ public enum class7 implements Enumerated {
static void method83() {
Login.Login_username = Login.Login_username.trim(); // L: 896
if (Login.Login_username.length() == 0) { // L: 897
GameShell.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 898
GameEngine.setLoginResponseString("Please enter your username.", "If you created your account after November", "2010, this will be the creation email address."); // L: 898
} else {
long var1;
try {
@@ -488,23 +488,23 @@ public enum class7 implements Enumerated {
switch(var0) { // L: 936
case 2:
GameShell.setLoginResponseString(Strings.field3053, Strings.field3054, Strings.field3055); // L: 941
GameEngine.setLoginResponseString(Strings.field3053, Strings.field3054, Strings.field3055); // L: 941
Login.loginIndex = 6; // L: 942
break; // L: 943
case 3:
GameShell.setLoginResponseString("", "Error connecting to server.", ""); // L: 954
GameEngine.setLoginResponseString("", "Error connecting to server.", ""); // L: 954
break;
case 4:
GameShell.setLoginResponseString("The part of the website you are trying", "to connect to is offline at the moment.", "Please try again later."); // L: 951
GameEngine.setLoginResponseString("The part of the website you are trying", "to connect to is offline at the moment.", "Please try again later."); // L: 951
break; // L: 952
case 5:
GameShell.setLoginResponseString("Sorry, there was an error trying to", "log you in to this part of the website.", "Please try again later."); // L: 938
GameEngine.setLoginResponseString("Sorry, there was an error trying to", "log you in to this part of the website.", "Please try again later."); // L: 938
break; // L: 939
case 6:
GameShell.setLoginResponseString("", "Error connecting to server.", ""); // L: 948
GameEngine.setLoginResponseString("", "Error connecting to server.", ""); // L: 948
break; // L: 949
case 7:
GameShell.setLoginResponseString("You must enter a valid login to proceed. For accounts", "created after 24th November 2010, please use your", "email address. Otherwise please use your username."); // L: 945
GameEngine.setLoginResponseString("You must enter a valid login to proceed. For accounts", "created after 24th November 2010, please use your", "email address. Otherwise please use your username."); // L: 945
}
}