From 023a80cf69c087ca9b7be808af893747f4b2b093 Mon Sep 17 00:00:00 2001 From: zeruth Date: Thu, 4 Feb 2021 02:30:24 -0500 Subject: [PATCH 1/8] externals: move injector assurance to Plugin class --- .../net/runelite/client/plugins/Plugin.java | 13 +++++++ .../client/plugins/PluginManager.java | 35 ++----------------- 2 files changed, 15 insertions(+), 33 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/Plugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/Plugin.java index a36a1f40e6..eca34f0488 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/Plugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/Plugin.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins; import com.google.inject.Binder; import com.google.inject.Injector; import com.google.inject.Module; +import net.runelite.client.RuneLite; public abstract class Plugin implements Module { @@ -49,8 +50,20 @@ public abstract class Plugin implements Module { } + // This should never be null when we are using it public final Injector getInjector() { + if (injector == null) + { + Module pluginModule = (Binder binder) -> + { + binder.bind((Class) this.getClass()).toInstance(this); + binder.install(this); + }; + Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule); + pluginInjector.injectMembers(this); + injector = pluginInjector; + } return injector; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java index 01c2d9ba7d..155b524c80 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/PluginManager.java @@ -165,20 +165,7 @@ public class PluginManager try { Injector injector = plugin.getInjector(); - if (injector == null) - { - // Create injector for the module - Module pluginModule = (Binder binder) -> - { - // Since the plugin itself is a module, it won't bind itself, so we'll bind it here - binder.bind((Class) plugin.getClass()).toInstance(plugin); - binder.install(plugin); - }; - Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule); - pluginInjector.injectMembers(plugin); - plugin.injector = pluginInjector; - injector = pluginInjector; - } + for (Key key : injector.getBindings().keySet()) { Class type = key.getTypeLiteral().getRawType(); @@ -208,25 +195,7 @@ public class PluginManager plugins = getPlugins(); } plugins.forEach(pl -> - { - //TODO: Not sure why this is necessary but it is. The Injector isn't null when its handed off from our ExternalPluginManager. - // Hopefully we can figure out the root cause of the underlying issue. - if (pl.injector == null) - { - // Create injector for the module - Module pluginModule = (Binder binder) -> - { - // Since the plugin itself is a module, it won't bind itself, so we'll bind it here - binder.bind((Class) pl.getClass()).toInstance(pl); - binder.install(pl); - }; - Injector pluginInjector = RuneLite.getInjector().createChildInjector(pluginModule); - pluginInjector.injectMembers(pl); - pl.injector = pluginInjector; - } - - injectors.add(pl.getInjector()); - }); + injectors.add(pl.getInjector())); List list = new ArrayList<>(); for (Injector injector : injectors) From 233a44061015641f6d0e7cf7ba7802eaa26264f7 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 15:17:27 -0500 Subject: [PATCH 2/8] api: squash oprs varbits/animID, add ClipBoard --- .../java/com/openosrs/api/AnimationID.java | 239 -------------- .../main/java/com/openosrs/api/Varbits.java | 312 ------------------ .../java/net/runelite/api/AnimationID.java | 235 ++++++++++++- .../main/java/net/runelite/api/Varbits.java | 233 ++++++------- .../com/openosrs/client/util/Clipboard.java | 62 ++++ 5 files changed, 415 insertions(+), 666 deletions(-) delete mode 100644 runelite-api/src/main/java/com/openosrs/api/AnimationID.java delete mode 100644 runelite-api/src/main/java/com/openosrs/api/Varbits.java create mode 100644 runelite-client/src/main/java/com/openosrs/client/util/Clipboard.java diff --git a/runelite-api/src/main/java/com/openosrs/api/AnimationID.java b/runelite-api/src/main/java/com/openosrs/api/AnimationID.java deleted file mode 100644 index 8a3de35994..0000000000 --- a/runelite-api/src/main/java/com/openosrs/api/AnimationID.java +++ /dev/null @@ -1,239 +0,0 @@ -package com.openosrs.api; - -//This is where Animation IDs should go that aren't found in RuneLite -public class AnimationID extends net.runelite.api.AnimationID -{ - - // NPC animations - public static final int TZTOK_JAD_MAGIC_ATTACK = 2656; - public static final int TZTOK_JAD_RANGE_ATTACK = 2652; - public static final int HELLHOUND_DEFENCE = 6566; - - public static final int FISHING_TRAILBLAZER_HARPOON_2 = 8785; - - public static final int CRYSTALLINE_RAT_DEATH = 8334; - public static final int CRYSTALLINE_BAT_DEATH = 4917; - public static final int CRYSTALLINE_WOLF_DEATH = 8335; - public static final int CRYSTALLINE_SPIDER_DEATH = 8338; - public static final int CRYSTALLINE_UNICORN_DEATH = 6377; - public static final int CRYSTALLINE_DRAGON_DEATH = 92; - public static final int CRYSTALLINE_BEAR_DEATH = 4929; - public static final int CRYSTALLINE_DARK_BEAST_DEATH = 2733; - public static final int CORRUPTED_SCORPION_DEATH = 6256; - - public static final int TABLET_TELEPORT = 4069; - - public static final int THIEVING_STALL = 832; - public static final int PICKPOCKET_SUCCESS = 881; - public static final int PULL_LEVER = 2140; - public static final int STANDARD_PURPLE_TELEPORT = 714; - public static final int ECTOPHIAL_TELEPORT = 878; - public static final int FAIRY_RING_TELEPORT = 3265; - public static final int SCROLL_TELEPORT = 3864; - public static final int XERICS_TALISMAN_TELEPORT = 3865; - public static final int WILDERNESS_OBELISK_TELEPORT = 3945; - public static final int SEED_POD_TELEPORT = 4544; - - //block animations for players and perhaps npcs as well? - public static final int BLOCK_DEFENDER = 4177; - public static final int BLOCK_NO_SHIELD = 420; - public static final int BLOCK_SHIELD = 1156; - public static final int BLOCK_SWORD = 388; - public static final int BLOCK_UNARMED = 424; // Same Animation as failed pickpocked - - public static final int NIGHTMARE_DEATH = 8612; - public static final int LOW_LEVEL_MAGIC_ATTACK = 1162; - public static final int HIGH_LEVEL_MAGIC_ATTACK = 1167; - public static final int BLOWPIPE_ATTACK = 5061; - - // NPC animations - public static final int BLACKJACK_KO = 838; - - // Fight Caves - public static final int TZTOK_JAD_MELEE_ATTACK = 2655; - public static final int TOK_XIL_RANGE_ATTACK = 2633; - public static final int TOK_XIL_MELEE_ATTACK = 2628; - public static final int KET_ZEK_MELEE_ATTACK = 2644; - public static final int KET_ZEK_MAGE_ATTACK = 2647; - public static final int MEJ_KOT_MELEE_ATTACK = 2637; - public static final int MEJ_KOT_HEAL_ATTACK = 2639; - - // Vorkath - public static final int VORKATH_WAKE_UP = 7950; - public static final int VORKATH_DEATH = 7949; - public static final int VORKATH_SLASH_ATTACK = 7951; - public static final int VORKATH_ATTACK = 7952; - public static final int VORKATH_FIRE_BOMB_OR_SPAWN_ATTACK = 7960; - public static final int VORKATH_ACID_ATTACK = 7957; - - // Tekton - public static final int TEKTON_ANVIL = 7475; - public static final int TEKTON_AUTO1 = 7482; - public static final int TEKTON_AUTO2 = 7483; - public static final int TEKTON_AUTO3 = 7484; - public static final int TEKTON_FAST_AUTO1 = 7478; - public static final int TEKTON_FAST_AUTO2 = 7488; - public static final int TEKTON_ENRAGE_AUTO1 = 7492; - public static final int TEKTON_ENRAGE_AUTO2 = 7493; - public static final int TEKTON_ENRAGE_AUTO3 = 7494; - - // Hydra - public static final int HYDRA_WALKING = 8232; - public static final int HYDRA_IDLE = 8233; - public static final int HYDRA_POISON_1 = 8234; - public static final int HYDRA_RANGED_1 = 8235; - public static final int HYDRA_MAGIC_1 = 8236; - public static final int HYDRA_1_1 = 8237; - public static final int HYDRA_1_2 = 8238; - public static final int HYDRA_LIGHTNING = 8241; - public static final int HYDRA_RANGED_2 = 8242; - public static final int HYDRA_MAGIC_2 = 8243; - public static final int HYDRA_2_1 = 8244; - public static final int HYDRA_2_2 = 8245; - public static final int HYDRA_FIRE = 8248; - public static final int HYDRA_RANGED_3 = 8249; - public static final int HYDRA_MAGIC_3 = 8250; - public static final int HYDRA_3_1 = 8251; - public static final int HYDRA_3_2 = 8252; - public static final int HYDRA_MAGIC_4 = 8254; - public static final int HYDRA_POISON_4 = 8254; - public static final int HYDRA_RANGED_4 = 8255; - public static final int HYDRA_RANGED_OR_POISON_ATTACK = 8256; - public static final int HYDRA_4_1 = 8257; - public static final int HYDRA_4_2 = 8258; - - // Inferno animations - public static final int JAL_NIB = 7574; - public static final int JAL_MEJRAH = 7578; - public static final int JAL_MEJRAH_STAND = 7577; - public static final int JAL_AK_RANGE_ATTACK = 7581; - public static final int JAL_AK_MELEE_ATTACK = 7582; - public static final int JAL_AK_MAGIC_ATTACK = 7583; - public static final int JAL_IMKOT = 7597; - public static final int JAL_XIL_MELEE_ATTACK = 7604; - public static final int JAL_XIL_RANGE_ATTACK = 7605; - public static final int JAL_ZEK_MAGE_ATTACK = 7610; - public static final int JAL_ZEK_MELEE_ATTACK = 7612; - public static final int JALTOK_JAD_MELEE_ATTACK = 7590; - public static final int JALTOK_JAD_MAGE_ATTACK = 7592; - public static final int JALTOK_JAD_RANGE_ATTACK = 7593; - public static final int TZKAL_ZUK = 7566; - public static final int JAL_MEJJAK = 2858; - - // General Graardor - public static final int MINION_AUTO1 = 6154; - public static final int MINION_AUTO2 = 6156; - public static final int MINION_AUTO3 = 7071; - public static final int MINION_AUTO4 = 7073; - public static final int GENERAL_AUTO1 = 7018; - public static final int GENERAL_AUTO2 = 7020; - public static final int GENERAL_AUTO3 = 7021; - - // Kr'il Tsutsaroth - public static final int ZAMMY_GENERIC_AUTO = 64; - public static final int KRIL_AUTO = 6948; - public static final int KRIL_SPEC = 6950; - public static final int ZAKL_AUTO = 7077; - public static final int BALFRUG_AUTO = 4630; - - // Commander Zilyana - public static final int ZILYANA_MELEE_AUTO = 6964; - public static final int ZILYANA_AUTO = 6967; - public static final int ZILYANA_SPEC = 6970; - public static final int STARLIGHT_AUTO = 6376; - public static final int BREE_AUTO = 7026; - public static final int GROWLER_AUTO = 7037; - - // Kree'arra - public static final int KREE_RANGED = 6978; - public static final int SKREE_AUTO = 6955; - public static final int GEERIN_AUTO = 6956; - public static final int GEERIN_FLINCH = 6958; - public static final int KILISA_AUTO = 6957; - - // Vetion - public static final int VETION_EARTHQUAKE = 5507; - - // Zulrah - public static final int ZULRAH_DEATH = 5804; - public static final int ZULRAH_PHASE = 5072; - - //Dagannoth Kings - public static final int DAG_REX = 2853; - public static final int DAG_PRIME = 2854; - public static final int DAG_SUPREME = 2855; - - // Lizardman shaman - public static final int LIZARDMAN_SHAMAN_SPAWN = 7157; - public static final int LIZARDMAN_SHAMAN_SPAWN_EXPLOSION = 7159; - - // Cerberus - public static final int CERBERUS_MAGIC_ATTACK = 4489; - public static final int CERBERUS_RANGED_ATTACK = 4490; - public static final int CERBERUS_MELEE_ATTACK = 4491; - public static final int CERBERUS_LAVA_ATTACK = 4493; - public static final int CERBERUS_SUMMON_GHOSTS = 4494; - - // Gauntlet Hunleff - public static final int HUNLEFF_TRAMPLE = 8420; - public static final int HUNLEFF_ATTACK = 8419; - public static final int HUNLEFF_TORNADO = 8418; - public static final int HUNLLEF_SWITCH_TO_MAGIC = 8754; - public static final int HUNLLEF_SWITCH_TO_RANGED = 8755; - - //Zalcano - public static final int ZALCANO_KNOCKED_DOWN = 8437; - public static final int ZALCANO_WAKEUP = 8439; - public static final int ZALCANO_ROCK_GLOWING = 8448; - - // Theatre of Blood - Sugadinti Maiden - public static final int SUGADINTI_MAIDEN_BLOOD_SPLAT_ATTACK = 8091; - public static final int SUGADINTI_MAIDEN_MAGIC_ATTACK = 8092; - public static final int SUGADINTI_MAIDEN_DEATH = 8094; - - // Theatre of Blood - Pestilent Bloat - public static final int BLOAT_SLEEP = 8082; - - // Theatre of Blood - Sotetseg - public static final int SOTETSEG_MELEE_ATTACK = 8138; - public static final int SOTETSEG_REGULAR_PROJECTILE_ATTACK = 8139; - - // Theatre of Blood - Verzik Vitur - public static final int VERZIK_PHASE_1_MAGIC_ATTACK = 8109; - public static final int VERZIK_PHASE_1_MAGIC_ATTACK_CHANNEL = 8110; - public static final int VERZIK_CHANGE_TO_PHASE_2 = 8111; - public static final int VERZIK_PHASE_2_MAGIC_ATTACK = 8114; - public static final int VERZIK_PHASE_2_BELLY_FLOP_ATTACK_1 = 8116; - public static final int VERZIK_PHASE_2_HEALING_CHANNEL = 8117; - public static final int VERZIK_PHASE_2_BELLY_FLOP_ATTACK_2 = 8118; - public static final int VERZIK_CHANGE_TO_PHASE_3 = 8119; - public static final int VERZIK_PHASE_3_MELEE_ATTACK = 8123; - public static final int VERZIK_PHASE_3_MAGIC_ATTACK = 8124; - public static final int VERZIK_PHASE_3_RANGED_ATTACK = 8125; - public static final int VERZIK_PHASE_3_GREEN_POOL_ATTACK = 8126; - public static final int VERZIK_PHASE_3_WEB_ATTACK = 8127; - public static final int VERZIK_DEATH_1 = 8128; - public static final int VERZIK_DEATH_2 = 8129; - - // The Nightmare of Ashihama - public static final int NIGHTMARE_SPAWN_SLEEPWALKERS = 8572; - public static final int NIGHTMARE_FLOATY = 8592; - public static final int NIGHTMARE_WALKING = 8592; - public static final int NIGHTMARE_IDLE = 8593; - public static final int NIGHTMARE_MELEE_ATTACK = 8594; - public static final int NIGHTMARE_MAGIC_ATTACK = 8595; - public static final int NIGHTMARE_RANGED_ATTACK = 8596; - public static final int NIGHTMARE_SURGE_ATTACK = 8597; - public static final int NIGHTMARE_GHOST_AOE_ATTACK = 8598; - public static final int NIGHTMARE_CURSE_PRAYERS_ATTACK = 8599; - public static final int NIGHTMARE_SPAWN_INFECTIOUS_SPORES = 8600; - public static final int NIGHTMARE_SPAWN_ROOM_SECTION_FLOWERS = 8601; - public static final int NIGHTMARE_CHANNEL_DEVASTATING_ATTACK = 8604; - public static final int NIGHTMARE_SWITCH_TO_DEVIL_PHASE = 8605; - public static final int NIGHTMARE_PARASITE_ATTACK = 8606; - public static final int NIGHTMARE_JUMP_DOWN = 8607; - public static final int NIGHTMARE_SINK_DOWN = 8608; - public static final int NIGHTMARE_JUMP_UP = 8609; - public static final int NIGHTMARE_JUMP_UP_2 = 8610; - public static final int NIGHTMARE_WAKE_UP = 8611; -} diff --git a/runelite-api/src/main/java/com/openosrs/api/Varbits.java b/runelite-api/src/main/java/com/openosrs/api/Varbits.java deleted file mode 100644 index bc98952741..0000000000 --- a/runelite-api/src/main/java/com/openosrs/api/Varbits.java +++ /dev/null @@ -1,312 +0,0 @@ -package com.openosrs.api; - -import lombok.AllArgsConstructor; -import lombok.Getter; - -@AllArgsConstructor -@Getter -public enum Varbits -{ - /* - * Kharedst's Memoirs Teleport Item - */ - KHAREDSTS_MEMOIRS_CHARGES(6035), - - /** - * Grand Exchange - */ - GRAND_EXCHANGE_PRICE_PER_ITEM(4398), - - - /** - * Locked Prayers - * 0-7 = Locked - * 8 = Unlocked - */ - CHIVPIETY_UNLOCKED(3909), - - /** - * Locked Prayers - * 0 = Locked - * 1 = Unlocked - */ - - RIGOUR_UNLOCKED(5451), - AUGURY_UNLOCKED(5452), - PRESERVE_UNLOCKED(5453), - - /** - * Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating - */ - THEATRE_OF_BLOOD(6440), - BLOAT_DOOR(6447), - - /** - * Theatre of Blood orb varbits each number stands for the player's health on a scale of 1-27 (I think), 0 hides the orb - */ - THEATRE_OF_BLOOD_ORB_1(6442), - THEATRE_OF_BLOOD_ORB_2(6443), - THEATRE_OF_BLOOD_ORB_3(6444), - THEATRE_OF_BLOOD_ORB_4(6445), - THEATRE_OF_BLOOD_ORB_5(6446), - - /** - * Nightmare Zone - */ - NMZ_ABSORPTION(3956), - NMZ_POINTS(3949), - NMZ_OVERLOAD(3955), - - /** - * Pyramid plunder - */ - PYRAMID_PLUNDER_SARCO_OPEN(2362), - PYRAMID_PLUNDER_CHEST_OPEN(2363), - PYRAMID_PLUNDER_ROOM_LOCATION(2365), - PYRAMID_PLUNDER_TIMER(2375), - PYRAMID_PLUNDER_THIEVING_LEVEL(2376), - PYRAMID_PLUNDER_ROOM(2377), - - /** - * In the Wilderness - */ - IN_THE_WILDERNESS(5963), - - /** - * Kingdom Management - */ - KINGDOM_FAVOR(72), - KINGDOM_COFFER(74), - KINGDOM_WORKERS_WOOD(81), - KINGDOM_WORKERS_HERBS(82), - KINGDOM_WORKERS_FISHING(83), - KINGDOM_WORKERS_MINING(84), - KINGDOM_WORKERS_FISH_COOKED_BUTTON(135), // 0 - Raw, 1 - Cooked - KINGDOM_WORKERS_HARDWOOD(2131), - KINGDOM_WORKERS_FARM(2132), - KINGDOM_WORKERS_HARDWOOD_BUTTON(2133), // 0 - Mahogany, 1 - Teak, 2 - Both - KINGDOM_WORKERS_HERBS_BUTTON(2134), // 0 - Herbs, 1 - Flax - - /** - * Varbit used for Slayer reward points - */ - SLAYER_REWARD_POINTS(4068), - - /** - * 0 = standard - * 1 = ancients - * 2 = lunars - * 3 = arrceus - **/ - SPELLBOOK(4070), - - /** - * Bank settings/flags - **/ - BANK_NOTE_FLAG(3958), - - - /** - * Spells being auto-casted - */ - AUTO_CAST_SPELL(276), - - /** - * Temple Trekking - */ - TREK_POINTS(1955), - TREK_STARTED(1956), - TREK_EVENT(1958), - TREK_STATUS(6719), - BLOAT_ENTERED_ROOM(6447), - - /** - * f2p Quest varbits, these don't hold the completion value. - */ - QUEST_DEMON_SLAYER(2561), - QUEST_GOBLIN_DIPLOMACY(2378), - QUEST_MISTHALIN_MYSTERY(3468), - QUEST_THE_CORSAIR_CURSE(6071), - QUEST_X_MARKS_THE_SPOT(8063), - QUEST_ERNEST_LEVER_A(1788), - QUEST_ERNEST_LEVER_B(1789), - QUEST_ERNEST_LEVER_C(1790), - QUEST_ERNEST_LEVER_D(1791), - QUEST_ERNEST_LEVER_E(1792), - QUEST_ERNEST_LEVER_F(1793), - - /** - * member Quest varbits, these don't hold the completion value. - */ - QUEST_ANIMAL_MAGNETISM(3185), - QUEST_BETWEEN_A_ROCK(299), - QUEST_CONTACT(3274), - QUEST_ZOGRE_FLESH_EATERS(487), - QUEST_DARKNESS_OF_HALLOWVALE(2573), - QUEST_DEATH_TO_THE_DORGESHUUN(2258), - QUEST_DESERT_TREASURE(358), - QUEST_DEVIOUS_MINDS(1465), - QUEST_EAGLES_PEAK(2780), - QUEST_ELEMENTAL_WORKSHOP_II(2639), - QUEST_ENAKHRAS_LAMENT(1560), - QUEST_ENLIGHTENED_JOURNEY(2866), - QUEST_THE_EYES_OF_GLOUPHRIE(2497), - QUEST_FAIRYTALE_I_GROWING_PAINS(1803), - QUEST_FAIRYTALE_II_CURE_A_QUEEN(2326), - QUEST_THE_FEUD(334), // 14 = able to pickpocket - QUEST_FORGETTABLE_TALE(822), - QUEST_GARDEN_OF_TRANQUILLITY(961), - QUEST_GHOSTS_AHOY(217), - QUEST_THE_GIANT_DWARF(571), - QUEST_THE_GOLEM(346), - QUEST_HORROR_FROM_THE_DEEP(34), - QUEST_ICTHLARINS_LITTLE_HELPER(418), - QUEST_IN_AID_OF_THE_MYREQUE(1990), - QUEST_THE_LOST_TRIBE(532), - QUEST_LUNAR_DIPLOMACY(2448), - QUEST_MAKING_HISTORY(1383), - QUEST_MOUNTAIN_DAUGHTER(260), - QUEST_MOURNINGS_END_PART_II(1103), - QUEST_MY_ARMS_BIG_ADVENTURE(2790), - QUEST_RATCATCHERS(1404), - QUEST_RECIPE_FOR_DISASTER(1850), - QUEST_RECRUITMENT_DRIVE(657), - QUEST_ROYAL_TROUBLE(2140), - QUEST_THE_SLUG_MENACE(2610), - QUEST_SHADOW_OF_THE_STORM(1372), - QUEST_A_SOULS_BANE(2011), - QUEST_SPIRITS_OF_THE_ELID(1444), - QUEST_SWAN_SONG(2098), - QUEST_A_TAIL_OF_TWO_CATS(1028), - QUEST_TEARS_OF_GUTHIX(451), - QUEST_WANTED(1051), - QUEST_COLD_WAR(3293), - QUEST_THE_FREMENNIK_ISLES(3311), - QUEST_TOWER_OF_LIFE(3337), - QUEST_WHAT_LIES_BELOW(3523), - QUEST_OLAFS_QUEST(3534), - QUEST_ANOTHER_SLICE_OF_HAM(3550), - QUEST_DREAM_MENTOR(3618), - QUEST_GRIM_TALES(2783), - QUEST_KINGS_RANSOM(3888), - QUEST_MONKEY_MADNESS_II(5027), - QUEST_CLIENT_OF_KOUREND(5619), - QUEST_BONE_VOYAGE(5795), - QUEST_THE_QUEEN_OF_THIEVES(6037), - QUEST_THE_DEPTHS_OF_DESPAIR(6027), - QUEST_DRAGON_SLAYER_II(6104), - QUEST_TALE_OF_THE_RIGHTEOUS(6358), - QUEST_A_TASTE_OF_HOPE(6396), - QUEST_MAKING_FRIENDS_WITH_MY_ARM(6528), - QUEST_THE_ASCENT_OF_ARCEUUS(7856), - QUEST_THE_FORSAKEN_TOWER(7796), - //TODO - QUEST_SONG_OF_THE_ELVES(7796), - - /** - * mini-quest varbits, these don't hold the completion value. - */ - QUEST_ARCHITECTURAL_ALLIANCE(4982), - QUEST_BEAR_YOUR_SOUL(5078), - QUEST_CURSE_OF_THE_EMPTY_LORD(821), - QUEST_ENCHANTED_KEY(1391), - QUEST_THE_GENERALS_SHADOW(3330), - QUEST_SKIPPY_AND_THE_MOGRES(1344), - QUEST_LAIR_OF_TARN_RAZORLOR(3290), - QUEST_FAMILY_PEST(5347), - QUEST_THE_MAGE_ARENA_II(6067), - //TODO - QUEST_IN_SEARCH_OF_KNOWLEDGE(6067), - - /** - * Spellbook filtering (1 = unfiltered, 0 = filtered) - */ - FILTER_SPELLBOOK(6718), - - /** - * POH Building mode (1 = yes, 0 = no) - */ - BUILDING_MODE(2176), - - /** - * 1 if in game, 0 if not - */ - LMS_IN_GAME(5314), - - /** - * Amount of pvp kills in current game - */ - LMS_KILLS(5315), - - /** - * The x coordinate of the final safespace (world coord) - */ - LMS_SAFE_X(5316), - - LMS_POISON_PROGRESS(5317), - - /** - * The y coordinate of the final safespace (world coord) - */ - LMS_SAFE_Y(5320), - - /** - * 1 is true, 0 is false. - */ - GAUNTLET_FINAL_ROOM_ENTERED(9177), - - /** - * 1 is true, 0 is false. - */ - GAUNTLET_ENTERED(9178), - - WITHDRAW_X_AMOUNT(3960), - - IN_PVP_AREA(8121), - - /** - * Value of hotkey varbits can be 0-13 - * 0 corresponds to no hotkey set - * 1-12 correspond to F1-F12 respectively - * 13 corresponds to escape - */ - COMBAT_TAB_HOTKEY(4675), - STATS_TAB_HOTKEY(4676), - QUESTS_TAB_HOTKEY(4677), - INVENTORY_TAB_HOTKEY(4678), - EQUIPMENT_TAB_HOTKEY(4679), - PRAYER_TAB_HOTKEY(4680), - SPELLBOOK_TAB_HOTKEY(4682), - FRIENDS_TAB_HOTKEY(4684), - ACCOUNT_MANAGEMENT_TAB_HOTKEY(6517), - LOGOUT_TAB_HOTKEY(4689), - OPTIONS_TAB_HOTKEY(4686), - EMOTES_TAB_HOTKEY(4687), - CLAN_TAB_HOTKEY(4683), - MUSIC_TAB_HOTKEY(4688), - - /** - * Chat Notifications settings - *
- * LOOT_DROP_NOTIFICATIONS: 1 is true, 0 is false - * LOOT_DROP_NOTIFICATIONS_VALUE: gp value - * UNTRADEABLE_LOOT_NOTIFICATIONS: 1 is true, 0 is false - * BOSS_KILL_COUNT_UPDATES: 1 is filtered, 0 is unfiltered - * DROP_ITEM_WARNINGS: 1 is true, 0 is false - * DROP_ITEM_WARNINGS_VALUE: gp value - */ - LOOT_DROP_NOTIFICATIONS(5399), - LOOT_DROP_NOTIFICATIONS_VALUE(5400), - UNTRADEABLE_LOOT_NOTIFICATIONS(5402), - BOSS_KILL_COUNT_UPDATES(4930), - DROP_ITEM_WARNINGS(5411), - DROP_ITEM_WARNINGS_VALUE(5412), - - PARASITE(10151), - ; - - /** - * The raw varbit ID. - */ - private final int id; -} diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 45b2369f23..2b657032d6 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -30,7 +30,7 @@ package net.runelite.api; * Note: This class is not complete and may not contain a specific animation * required. */ -public class AnimationID +public final class AnimationID { public static final int IDLE = -1; public static final int HERBLORE_PESTLE_AND_MORTAR = 364; @@ -251,4 +251,235 @@ public class AnimationID // POH Animations public static final int INCENSE_BURNER = 3687; -} + + //OPENOSRS + + // NPC animations + public static final int FISHING_TRAILBLAZER_HARPOON_2 = 8785; + + public static final int CRYSTALLINE_RAT_DEATH = 8334; + public static final int CRYSTALLINE_BAT_DEATH = 4917; + public static final int CRYSTALLINE_WOLF_DEATH = 8335; + public static final int CRYSTALLINE_SPIDER_DEATH = 8338; + public static final int CRYSTALLINE_UNICORN_DEATH = 6377; + public static final int CRYSTALLINE_DRAGON_DEATH = 92; + public static final int CRYSTALLINE_BEAR_DEATH = 4929; + public static final int CRYSTALLINE_DARK_BEAST_DEATH = 2733; + public static final int CORRUPTED_SCORPION_DEATH = 6256; + + public static final int TABLET_TELEPORT = 4069; + + public static final int THIEVING_STALL = 832; + public static final int PICKPOCKET_SUCCESS = 881; + public static final int PULL_LEVER = 2140; + public static final int STANDARD_PURPLE_TELEPORT = 714; + public static final int ECTOPHIAL_TELEPORT = 878; + public static final int FAIRY_RING_TELEPORT = 3265; + public static final int SCROLL_TELEPORT = 3864; + public static final int XERICS_TALISMAN_TELEPORT = 3865; + public static final int WILDERNESS_OBELISK_TELEPORT = 3945; + public static final int SEED_POD_TELEPORT = 4544; + + //block animations for players and perhaps npcs as well? + public static final int BLOCK_DEFENDER = 4177; + public static final int BLOCK_NO_SHIELD = 420; + public static final int BLOCK_SHIELD = 1156; + public static final int BLOCK_SWORD = 388; + public static final int BLOCK_UNARMED = 424; // Same Animation as failed pickpocked + + public static final int NIGHTMARE_DEATH = 8612; + public static final int LOW_LEVEL_MAGIC_ATTACK = 1162; + public static final int HIGH_LEVEL_MAGIC_ATTACK = 1167; + public static final int BLOWPIPE_ATTACK = 5061; + + // NPC animations + public static final int BLACKJACK_KO = 838; + + // Fight Caves + public static final int TZTOK_JAD_MELEE_ATTACK = 2655; + public static final int TOK_XIL_RANGE_ATTACK = 2633; + public static final int TOK_XIL_MELEE_ATTACK = 2628; + public static final int KET_ZEK_MELEE_ATTACK = 2644; + public static final int KET_ZEK_MAGE_ATTACK = 2647; + public static final int MEJ_KOT_MELEE_ATTACK = 2637; + public static final int MEJ_KOT_HEAL_ATTACK = 2639; + + // Vorkath + public static final int VORKATH_WAKE_UP = 7950; + public static final int VORKATH_DEATH = 7949; + public static final int VORKATH_SLASH_ATTACK = 7951; + public static final int VORKATH_ATTACK = 7952; + public static final int VORKATH_FIRE_BOMB_OR_SPAWN_ATTACK = 7960; + public static final int VORKATH_ACID_ATTACK = 7957; + + // Tekton + public static final int TEKTON_ANVIL = 7475; + public static final int TEKTON_AUTO1 = 7482; + public static final int TEKTON_AUTO2 = 7483; + public static final int TEKTON_AUTO3 = 7484; + public static final int TEKTON_FAST_AUTO1 = 7478; + public static final int TEKTON_FAST_AUTO2 = 7488; + public static final int TEKTON_ENRAGE_AUTO1 = 7492; + public static final int TEKTON_ENRAGE_AUTO2 = 7493; + public static final int TEKTON_ENRAGE_AUTO3 = 7494; + + // Hydra + public static final int HYDRA_WALKING = 8232; + public static final int HYDRA_IDLE = 8233; + public static final int HYDRA_POISON_1 = 8234; + public static final int HYDRA_RANGED_1 = 8235; + public static final int HYDRA_MAGIC_1 = 8236; + public static final int HYDRA_1_1 = 8237; + public static final int HYDRA_1_2 = 8238; + public static final int HYDRA_LIGHTNING = 8241; + public static final int HYDRA_RANGED_2 = 8242; + public static final int HYDRA_MAGIC_2 = 8243; + public static final int HYDRA_2_1 = 8244; + public static final int HYDRA_2_2 = 8245; + public static final int HYDRA_FIRE = 8248; + public static final int HYDRA_RANGED_3 = 8249; + public static final int HYDRA_MAGIC_3 = 8250; + public static final int HYDRA_3_1 = 8251; + public static final int HYDRA_3_2 = 8252; + public static final int HYDRA_MAGIC_4 = 8254; + public static final int HYDRA_POISON_4 = 8254; + public static final int HYDRA_RANGED_4 = 8255; + public static final int HYDRA_RANGED_OR_POISON_ATTACK = 8256; + public static final int HYDRA_4_1 = 8257; + public static final int HYDRA_4_2 = 8258; + + // Inferno animations + public static final int JAL_NIB = 7574; + public static final int JAL_MEJRAH = 7578; + public static final int JAL_MEJRAH_STAND = 7577; + public static final int JAL_AK_RANGE_ATTACK = 7581; + public static final int JAL_AK_MELEE_ATTACK = 7582; + public static final int JAL_AK_MAGIC_ATTACK = 7583; + public static final int JAL_IMKOT = 7597; + public static final int JAL_XIL_MELEE_ATTACK = 7604; + public static final int JAL_XIL_RANGE_ATTACK = 7605; + public static final int JAL_ZEK_MAGE_ATTACK = 7610; + public static final int JAL_ZEK_MELEE_ATTACK = 7612; + public static final int JALTOK_JAD_MELEE_ATTACK = 7590; + public static final int JALTOK_JAD_MAGE_ATTACK = 7592; + public static final int JALTOK_JAD_RANGE_ATTACK = 7593; + public static final int TZKAL_ZUK = 7566; + public static final int JAL_MEJJAK = 2858; + + // General Graardor + public static final int MINION_AUTO1 = 6154; + public static final int MINION_AUTO2 = 6156; + public static final int MINION_AUTO3 = 7071; + public static final int MINION_AUTO4 = 7073; + public static final int GENERAL_AUTO1 = 7018; + public static final int GENERAL_AUTO2 = 7020; + public static final int GENERAL_AUTO3 = 7021; + + // Kr'il Tsutsaroth + public static final int ZAMMY_GENERIC_AUTO = 64; + public static final int KRIL_AUTO = 6948; + public static final int KRIL_SPEC = 6950; + public static final int ZAKL_AUTO = 7077; + public static final int BALFRUG_AUTO = 4630; + + // Commander Zilyana + public static final int ZILYANA_MELEE_AUTO = 6964; + public static final int ZILYANA_AUTO = 6967; + public static final int ZILYANA_SPEC = 6970; + public static final int STARLIGHT_AUTO = 6376; + public static final int BREE_AUTO = 7026; + public static final int GROWLER_AUTO = 7037; + + // Kree'arra + public static final int KREE_RANGED = 6978; + public static final int SKREE_AUTO = 6955; + public static final int GEERIN_AUTO = 6956; + public static final int GEERIN_FLINCH = 6958; + public static final int KILISA_AUTO = 6957; + + // Vetion + public static final int VETION_EARTHQUAKE = 5507; + + // Zulrah + public static final int ZULRAH_DEATH = 5804; + public static final int ZULRAH_PHASE = 5072; + + //Dagannoth Kings + public static final int DAG_REX = 2853; + public static final int DAG_PRIME = 2854; + public static final int DAG_SUPREME = 2855; + + // Lizardman shaman + public static final int LIZARDMAN_SHAMAN_SPAWN = 7157; + public static final int LIZARDMAN_SHAMAN_SPAWN_EXPLOSION = 7159; + + // Cerberus + public static final int CERBERUS_MAGIC_ATTACK = 4489; + public static final int CERBERUS_RANGED_ATTACK = 4490; + public static final int CERBERUS_MELEE_ATTACK = 4491; + public static final int CERBERUS_LAVA_ATTACK = 4493; + public static final int CERBERUS_SUMMON_GHOSTS = 4494; + + // Gauntlet Hunleff + public static final int HUNLEFF_TRAMPLE = 8420; + public static final int HUNLEFF_ATTACK = 8419; + public static final int HUNLEFF_TORNADO = 8418; + public static final int HUNLLEF_SWITCH_TO_MAGIC = 8754; + public static final int HUNLLEF_SWITCH_TO_RANGED = 8755; + + //Zalcano + public static final int ZALCANO_KNOCKED_DOWN = 8437; + public static final int ZALCANO_WAKEUP = 8439; + public static final int ZALCANO_ROCK_GLOWING = 8448; + + // Theatre of Blood - Sugadinti Maiden + public static final int SUGADINTI_MAIDEN_BLOOD_SPLAT_ATTACK = 8091; + public static final int SUGADINTI_MAIDEN_MAGIC_ATTACK = 8092; + public static final int SUGADINTI_MAIDEN_DEATH = 8094; + + // Theatre of Blood - Pestilent Bloat + public static final int BLOAT_SLEEP = 8082; + + // Theatre of Blood - Sotetseg + public static final int SOTETSEG_MELEE_ATTACK = 8138; + public static final int SOTETSEG_REGULAR_PROJECTILE_ATTACK = 8139; + + // Theatre of Blood - Verzik Vitur + public static final int VERZIK_PHASE_1_MAGIC_ATTACK = 8109; + public static final int VERZIK_PHASE_1_MAGIC_ATTACK_CHANNEL = 8110; + public static final int VERZIK_CHANGE_TO_PHASE_2 = 8111; + public static final int VERZIK_PHASE_2_MAGIC_ATTACK = 8114; + public static final int VERZIK_PHASE_2_BELLY_FLOP_ATTACK_1 = 8116; + public static final int VERZIK_PHASE_2_HEALING_CHANNEL = 8117; + public static final int VERZIK_PHASE_2_BELLY_FLOP_ATTACK_2 = 8118; + public static final int VERZIK_CHANGE_TO_PHASE_3 = 8119; + public static final int VERZIK_PHASE_3_MELEE_ATTACK = 8123; + public static final int VERZIK_PHASE_3_MAGIC_ATTACK = 8124; + public static final int VERZIK_PHASE_3_RANGED_ATTACK = 8125; + public static final int VERZIK_PHASE_3_GREEN_POOL_ATTACK = 8126; + public static final int VERZIK_PHASE_3_WEB_ATTACK = 8127; + public static final int VERZIK_DEATH_1 = 8128; + public static final int VERZIK_DEATH_2 = 8129; + + // The Nightmare of Ashihama + public static final int NIGHTMARE_SPAWN_SLEEPWALKERS = 8572; + public static final int NIGHTMARE_FLOATY = 8592; + public static final int NIGHTMARE_WALKING = 8592; + public static final int NIGHTMARE_IDLE = 8593; + public static final int NIGHTMARE_MELEE_ATTACK = 8594; + public static final int NIGHTMARE_MAGIC_ATTACK = 8595; + public static final int NIGHTMARE_RANGED_ATTACK = 8596; + public static final int NIGHTMARE_SURGE_ATTACK = 8597; + public static final int NIGHTMARE_GHOST_AOE_ATTACK = 8598; + public static final int NIGHTMARE_CURSE_PRAYERS_ATTACK = 8599; + public static final int NIGHTMARE_SPAWN_INFECTIOUS_SPORES = 8600; + public static final int NIGHTMARE_SPAWN_ROOM_SECTION_FLOWERS = 8601; + public static final int NIGHTMARE_CHANNEL_DEVASTATING_ATTACK = 8604; + public static final int NIGHTMARE_SWITCH_TO_DEVIL_PHASE = 8605; + public static final int NIGHTMARE_PARASITE_ATTACK = 8606; + public static final int NIGHTMARE_JUMP_DOWN = 8607; + public static final int NIGHTMARE_SINK_DOWN = 8608; + public static final int NIGHTMARE_JUMP_UP = 8609; + public static final int NIGHTMARE_JUMP_UP_2 = 8610; + public static final int NIGHTMARE_WAKE_UP = 8611; +} \ No newline at end of file diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index 32b000971e..a50b41db7f 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -560,7 +560,7 @@ public enum Varbits EXPLORER_RING_ALCHS(4554), EXPLORER_RING_RUNENERGY(4553), - + WINTERTODT_TIMER(7980), /** * League relics @@ -599,76 +599,102 @@ public enum Varbits PVP_SPEC_ORB(8121), //OPENOSRS + /* + * Kharedst's Memoirs Teleport Item + */ + KHAREDSTS_MEMOIRS_CHARGES(6035), /** * Grand Exchange */ GRAND_EXCHANGE_PRICE_PER_ITEM(4398), - /* - * Kharedst's Memoirs Teleport Item - */ - KHAREDSTS_MEMOIRS_CHARGES(6035), - - LMS_POISON_PROGRESS(5317), /** - * The y coordinate of the final safespace (world coord) + * Locked Prayers + * 0-7 = Locked + * 8 = Unlocked */ - LMS_SAFE_Y(5320), + CHIVPIETY_UNLOCKED(3909), /** - * 1 is true, 0 is false. + * Locked Prayers + * 0 = Locked + * 1 = Unlocked */ - GAUNTLET_FINAL_ROOM_ENTERED(9177), + + RIGOUR_UNLOCKED(5451), + AUGURY_UNLOCKED(5452), + PRESERVE_UNLOCKED(5453), /** - * 1 is true, 0 is false. + * Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating */ - GAUNTLET_ENTERED(9178), - - WITHDRAW_X_AMOUNT(3960), - - IN_PVP_AREA(8121), + BLOAT_DOOR(6447), /** - * Value of hotkey varbits can be 0-13 - * 0 corresponds to no hotkey set - * 1-12 correspond to F1-F12 respectively - * 13 corresponds to escape + * Theatre of Blood orb varbits each number stands for the player's health on a scale of 1-27 (I think), 0 hides the orb */ - COMBAT_TAB_HOTKEY(4675), - STATS_TAB_HOTKEY(4676), - QUESTS_TAB_HOTKEY(4677), - INVENTORY_TAB_HOTKEY(4678), - EQUIPMENT_TAB_HOTKEY(4679), - PRAYER_TAB_HOTKEY(4680), - SPELLBOOK_TAB_HOTKEY(4682), - FRIENDS_TAB_HOTKEY(4684), - ACCOUNT_MANAGEMENT_TAB_HOTKEY(6517), - LOGOUT_TAB_HOTKEY(4689), - OPTIONS_TAB_HOTKEY(4686), - EMOTES_TAB_HOTKEY(4687), - CLAN_TAB_HOTKEY(4683), - MUSIC_TAB_HOTKEY(4688), + THEATRE_OF_BLOOD_ORB_1(6442), + THEATRE_OF_BLOOD_ORB_2(6443), + THEATRE_OF_BLOOD_ORB_3(6444), + THEATRE_OF_BLOOD_ORB_4(6445), + THEATRE_OF_BLOOD_ORB_5(6446), /** - * Chat Notifications settings - *
- * LOOT_DROP_NOTIFICATIONS: 1 is true, 0 is false - * LOOT_DROP_NOTIFICATIONS_VALUE: gp value - * UNTRADEABLE_LOOT_NOTIFICATIONS: 1 is true, 0 is false - * BOSS_KILL_COUNT_UPDATES: 1 is filtered, 0 is unfiltered - * DROP_ITEM_WARNINGS: 1 is true, 0 is false - * DROP_ITEM_WARNINGS_VALUE: gp value + * Nightmare Zone */ - LOOT_DROP_NOTIFICATIONS(5399), - LOOT_DROP_NOTIFICATIONS_VALUE(5400), - UNTRADEABLE_LOOT_NOTIFICATIONS(5402), - BOSS_KILL_COUNT_UPDATES(4930), - DROP_ITEM_WARNINGS(5411), - DROP_ITEM_WARNINGS_VALUE(5412), - /** + NMZ_OVERLOAD(3955), + + /** + * Pyramid plunder + */ + PYRAMID_PLUNDER_SARCO_OPEN(2362), + PYRAMID_PLUNDER_CHEST_OPEN(2363), + + /** + * In the Wilderness + */ + IN_THE_WILDERNESS(5963), + + /** + * Kingdom Management + */ + KINGDOM_WORKERS_WOOD(81), + KINGDOM_WORKERS_HERBS(82), + KINGDOM_WORKERS_FISHING(83), + KINGDOM_WORKERS_MINING(84), + KINGDOM_WORKERS_FISH_COOKED_BUTTON(135), // 0 - Raw, 1 - Cooked + KINGDOM_WORKERS_HARDWOOD(2131), + KINGDOM_WORKERS_FARM(2132), + KINGDOM_WORKERS_HARDWOOD_BUTTON(2133), // 0 - Mahogany, 1 - Teak, 2 - Both + KINGDOM_WORKERS_HERBS_BUTTON(2134), // 0 - Herbs, 1 - Flax + + /** + * Varbit used for Slayer reward points + */ + SLAYER_REWARD_POINTS(4068), + + /** + * 0 = standard + * 1 = ancients + * 2 = lunars + * 3 = arrceus + **/ + SPELLBOOK(4070), + + /** + * Bank settings/flags + **/ + BANK_NOTE_FLAG(3958), + + + /** + * Spells being auto-casted + */ + AUTO_CAST_SPELL(276), + + /** * Temple Trekking */ TREK_POINTS(1955), @@ -785,8 +811,6 @@ public enum Varbits */ BUILDING_MODE(2176), - WINTERTODT_TIMER(7980), - /** * 1 if in game, 0 if not */ @@ -802,81 +826,64 @@ public enum Varbits */ LMS_SAFE_X(5316), + LMS_POISON_PROGRESS(5317), + /** - * Locked Prayers - * 0-7 = Locked - * 8 = Unlocked + * The y coordinate of the final safespace (world coord) */ - CHIVPIETY_UNLOCKED(3909), + LMS_SAFE_Y(5320), /** - * Locked Prayers - * 0 = Locked - * 1 = Unlocked + * 1 is true, 0 is false. */ + GAUNTLET_FINAL_ROOM_ENTERED(9177), - RIGOUR_UNLOCKED(5451), - AUGURY_UNLOCKED(5452), - PRESERVE_UNLOCKED(5453), - /** - * Spells being auto-casted + * 1 is true, 0 is false. */ - AUTO_CAST_SPELL(276), + GAUNTLET_ENTERED(9178), + + WITHDRAW_X_AMOUNT(3960), + + IN_PVP_AREA(8121), /** - * Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating + * Value of hotkey varbits can be 0-13 + * 0 corresponds to no hotkey set + * 1-12 correspond to F1-F12 respectively + * 13 corresponds to escape */ - BLOAT_DOOR(6447), + COMBAT_TAB_HOTKEY(4675), + STATS_TAB_HOTKEY(4676), + QUESTS_TAB_HOTKEY(4677), + INVENTORY_TAB_HOTKEY(4678), + EQUIPMENT_TAB_HOTKEY(4679), + PRAYER_TAB_HOTKEY(4680), + SPELLBOOK_TAB_HOTKEY(4682), + FRIENDS_TAB_HOTKEY(4684), + ACCOUNT_MANAGEMENT_TAB_HOTKEY(6517), + LOGOUT_TAB_HOTKEY(4689), + OPTIONS_TAB_HOTKEY(4686), + EMOTES_TAB_HOTKEY(4687), + CLAN_TAB_HOTKEY(4683), + MUSIC_TAB_HOTKEY(4688), /** - * Theatre of Blood orb varbits each number stands for the player's health on a scale of 1-27 (I think), 0 hides the orb + * Chat Notifications settings + *
+ * LOOT_DROP_NOTIFICATIONS: 1 is true, 0 is false + * LOOT_DROP_NOTIFICATIONS_VALUE: gp value + * UNTRADEABLE_LOOT_NOTIFICATIONS: 1 is true, 0 is false + * BOSS_KILL_COUNT_UPDATES: 1 is filtered, 0 is unfiltered + * DROP_ITEM_WARNINGS: 1 is true, 0 is false + * DROP_ITEM_WARNINGS_VALUE: gp value */ - THEATRE_OF_BLOOD_ORB_1(6442), - THEATRE_OF_BLOOD_ORB_2(6443), - THEATRE_OF_BLOOD_ORB_3(6444), - THEATRE_OF_BLOOD_ORB_4(6445), - THEATRE_OF_BLOOD_ORB_5(6446), - - //NMZ - NMZ_OVERLOAD(3955), - - //Pyramid Plunder - PYRAMID_PLUNDER_SARCO_OPEN(2362), - PYRAMID_PLUNDER_CHEST_OPEN(2363), - - /** - * Varbit used for Slayer reward points - */ - SLAYER_REWARD_POINTS(4068), - - /** - * 0 = standard - * 1 = ancients - * 2 = lunars - * 3 = arrceus - **/ - SPELLBOOK(4070), - - /** - * Bank settings/flags - **/ - BANK_NOTE_FLAG(3958), - - KINGDOM_WORKERS_WOOD(81), - KINGDOM_WORKERS_HERBS(82), - KINGDOM_WORKERS_FISHING(83), - KINGDOM_WORKERS_MINING(84), - KINGDOM_WORKERS_FISH_COOKED_BUTTON(135), // 0 - Raw, 1 - Cooked - KINGDOM_WORKERS_HARDWOOD(2131), - KINGDOM_WORKERS_FARM(2132), - KINGDOM_WORKERS_HARDWOOD_BUTTON(2133), // 0 - Mahogany, 1 - Teak, 2 - Both - KINGDOM_WORKERS_HERBS_BUTTON(2134), // 0 - Herbs, 1 - Flax - - /** - * In the Wilderness - */ - IN_THE_WILDERNESS(5963), + LOOT_DROP_NOTIFICATIONS(5399), + LOOT_DROP_NOTIFICATIONS_VALUE(5400), + UNTRADEABLE_LOOT_NOTIFICATIONS(5402), + BOSS_KILL_COUNT_UPDATES(4930), + DROP_ITEM_WARNINGS(5411), + DROP_ITEM_WARNINGS_VALUE(5412), ; /** diff --git a/runelite-client/src/main/java/com/openosrs/client/util/Clipboard.java b/runelite-client/src/main/java/com/openosrs/client/util/Clipboard.java new file mode 100644 index 0000000000..5f9f236c16 --- /dev/null +++ b/runelite-client/src/main/java/com/openosrs/client/util/Clipboard.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2018, Connor + * 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 com.openosrs.client.util; + +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; + +public class Clipboard +{ + public static String retrieve() + { + Transferable contents = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null); + + if (contents == null || !contents.isDataFlavorSupported(DataFlavor.stringFlavor)) + { + return null; + } + + try + { + return (String) contents.getTransferData(DataFlavor.stringFlavor); + } + catch (UnsupportedFlavorException | IOException ex) + { + return null; + } + } + + public static void store(String contents) + { + final StringSelection selection = new StringSelection(contents); + + Toolkit.getDefaultToolkit().getSystemClipboard().setContents(selection, null); + } +} \ No newline at end of file From 19c912c67cbb8e7cb6a87ba897b78d89435af50d Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 15:17:53 -0500 Subject: [PATCH 3/8] mes: allow swaps from outside plugin --- .../plugins/menuentryswapper/MenuEntrySwapperPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index b72c138391..6c9b6cd800 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -152,7 +152,7 @@ public class MenuEntrySwapperPlugin extends Plugin @Getter private boolean configuringShiftClick = false; - private final Multimap swaps = LinkedHashMultimap.create(); + private static final Multimap swaps = LinkedHashMultimap.create(); private final ArrayListMultimap optionIndexes = ArrayListMultimap.create(); @Provides @@ -361,7 +361,7 @@ public class MenuEntrySwapperPlugin extends Plugin swap("eat", "guzzle", config::swapRockCake); } - private void swap(String option, String swappedOption, Supplier enabled) + public static void swap(String option, String swappedOption, Supplier enabled) { swap(option, alwaysTrue(), swappedOption, enabled); } @@ -371,7 +371,7 @@ public class MenuEntrySwapperPlugin extends Plugin swap(option, equalTo(target), swappedOption, enabled); } - private void swap(String option, Predicate targetPredicate, String swappedOption, Supplier enabled) + private static void swap(String option, Predicate targetPredicate, String swappedOption, Supplier enabled) { swaps.put(option, new Swap(alwaysTrue(), targetPredicate, swappedOption, enabled, true)); } From cf1f5cf7ceb82117afda3bb8fc8d0843ac31b1d5 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 16:09:19 -0500 Subject: [PATCH 4/8] api: re-implement WidgetHiddenChanged event --- .../api/events/WidgetHiddenChanged.java | 44 +++++++++++++++++++ .../net/runelite/mixins/RSWidgetMixin.java | 43 ++++++++++++++++++ .../java/net/runelite/rs/api/RSWidget.java | 2 + 3 files changed, 89 insertions(+) create mode 100644 runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java diff --git a/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java new file mode 100644 index 0000000000..b66c05267f --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/events/WidgetHiddenChanged.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2018, Adam + * 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.api.events; + +import net.runelite.api.widgets.Widget; +import lombok.Data; + +/** + * An event where the hidden state of a {@link Widget} has been modified. + */ +@Data +public class WidgetHiddenChanged implements Event +{ + /** + * The affected widget. + */ + private Widget widget; + /** + * The new hidden state of the widget. + */ + private boolean hidden; +} \ No newline at end of file diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java index c940376ba4..3bc5fb52ef 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSWidgetMixin.java @@ -28,6 +28,7 @@ import net.runelite.api.HashTable; import net.runelite.api.Node; import net.runelite.api.Point; import net.runelite.api.WidgetNode; +import net.runelite.api.events.WidgetHiddenChanged; import net.runelite.api.events.WidgetPositioned; import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.FieldHook; @@ -74,6 +75,48 @@ public abstract class RSWidgetMixin implements RSWidget rl$y = -1; } + @Inject + @Override + public void broadcastHidden(boolean hidden) + { + WidgetHiddenChanged event = new WidgetHiddenChanged(); + event.setWidget(this); + event.setHidden(hidden); + + client.getCallbacks().post(event); + + RSWidget[] children = getChildren(); + + if (children != null) + { + // recursive through children + for (RSWidget child : children) + { + // if the widget is hidden it will not magically unhide from its parent changing + if (child == null || child.isSelfHidden()) + { + continue; + } + + child.broadcastHidden(hidden); + } + } + + // make sure we iterate nested children as well + // cannot be null + Widget[] nestedChildren = getNestedChildren(); + + for (Widget nestedChild : nestedChildren) + { + if (nestedChild == null || nestedChild.isSelfHidden()) + { + continue; + } + + ((RSWidget) nestedChild).broadcastHidden(hidden); + } + } + @Inject @Override public void setRenderParentId(int parentId) diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java index ace10f8461..57546ccfe4 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSWidget.java @@ -588,4 +588,6 @@ public interface RSWidget extends Widget @Import("onVarTransmit") @Override void setOnVarTransmitListener(Object[] o); + + void broadcastHidden(boolean hidden); } \ No newline at end of file From a579bdb121286638c2a3d71294d25d243781af39 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 22:04:27 -0500 Subject: [PATCH 5/8] api: add client/ui/overlay/components/table --- .../components/table/TableAlignment.java | 32 ++ .../components/table/TableComponent.java | 465 ++++++++++++++++++ .../components/table/TableElement.java | 38 ++ .../ui/overlay/components/table/TableRow.java | 41 ++ 4 files changed, 576 insertions(+) create mode 100644 runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableAlignment.java create mode 100644 runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableComponent.java create mode 100644 runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableElement.java create mode 100644 runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableRow.java diff --git a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableAlignment.java b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableAlignment.java new file mode 100644 index 0000000000..6061e639f8 --- /dev/null +++ b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableAlignment.java @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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 com.openosrs.client.ui.overlay.components.table; + +public enum TableAlignment +{ + LEFT, + CENTER, + RIGHT +} diff --git a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableComponent.java b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableComponent.java new file mode 100644 index 0000000000..6f96434e6d --- /dev/null +++ b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableComponent.java @@ -0,0 +1,465 @@ +/* + * Copyright (c) 2018, Jordan Atwood + * Copyright (c) 2019, TheStonedTurtle + * 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 com.openosrs.client.ui.overlay.components.table; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import net.runelite.api.util.Text; +import net.runelite.client.ui.overlay.components.ComponentConstants; +import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity; +import net.runelite.client.ui.overlay.components.TextComponent; + +@Setter +public class TableComponent implements LayoutableRenderableEntity +{ + private static final TableElement EMPTY_ELEMENT = TableElement.builder().build(); + + @Getter + private final List columns = new ArrayList<>(); + @Getter + private final List rows = new ArrayList<>(); + + @Getter + private final Rectangle bounds = new Rectangle(); + + private TableAlignment defaultAlignment = TableAlignment.LEFT; + private Color defaultColor = Color.WHITE; + private Dimension gutter = new Dimension(3, 0); + private Point preferredLocation = new Point(); + private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0); + + @Override + public Dimension render(final Graphics2D graphics) + { + final FontMetrics metrics = graphics.getFontMetrics(); + final TableRow colRow = TableRow.builder().elements(this.columns).build(); + final int[] columnWidths = getColumnWidths(metrics, colRow); + + graphics.translate(preferredLocation.x, preferredLocation.y); + + // Display the columns first + int height = displayRow(graphics, colRow, 0, columnWidths, metrics); + + for (TableRow row : this.rows) + { + height = displayRow(graphics, row, height, columnWidths, metrics); + } + + graphics.translate(-preferredLocation.x, -preferredLocation.y); + + final Dimension dimension = new Dimension(preferredSize.width, height); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + + return dimension; + } + + private int displayRow(Graphics2D graphics, TableRow row, int height, int[] columnWidths, FontMetrics metrics) + { + int x = 0; + int startingRowHeight = height; + + final List elements = row.getElements(); + for (int i = 0; i < elements.size(); i++) + { + int y = startingRowHeight; + final TableElement cell = elements.get(i); + + final String content = cell.getContent(); + if (content == null) + { + continue; + } + + final String[] lines = lineBreakText(content, columnWidths[i], metrics); + final TableAlignment alignment = getCellAlignment(row, i); + final Color color = getCellColor(row, i); + + for (String line : lines) + { + final int alignmentOffset = getAlignedPosition(line, alignment, columnWidths[i], metrics); + final TextComponent leftLineComponent = new TextComponent(); + y += metrics.getHeight(); + + leftLineComponent.setPosition(new Point(x + alignmentOffset, y)); + leftLineComponent.setText(line); + leftLineComponent.setColor(color); + leftLineComponent.render(graphics); + } + height = Math.max(height, y); + x += columnWidths[i] + gutter.width; + } + + return height + gutter.height; + } + + /** + * Returns the width that each column should take up + * Based on https://stackoverflow.com/questions/22206825/algorithm-for-calculating-variable-column-widths-for-set-table-width + * + * @param metrics + * @return int[] of column width + */ + private int[] getColumnWidths(final FontMetrics metrics, final TableRow columnRow) + { + int numCols = columns.size(); + for (final TableRow r : rows) + { + numCols = Math.max(r.getElements().size(), numCols); + } + + int[] maxtextw = new int[numCols]; // max text width over all rows + int[] maxwordw = new int[numCols]; // max width of longest word + boolean[] flex = new boolean[numCols]; // is column flexible? + boolean[] wrap = new boolean[numCols]; // can column be wrapped? + int[] finalcolw = new int[numCols]; // final width of columns + + final List rows = new ArrayList<>(this.rows); + rows.add(columnRow); + + for (final TableRow r : rows) + { + final List elements = r.getElements(); + for (int col = 0; col < elements.size(); col++) + { + final TableElement ele = elements.get(col); + final String cell = ele.getContent(); + if (cell == null) + { + continue; + } + + final int cellWidth = getTextWidth(metrics, cell); + + maxtextw[col] = Math.max(maxtextw[col], cellWidth); + for (String word : cell.split(" ")) + { + maxwordw[col] = Math.max(maxwordw[col], getTextWidth(metrics, word)); + } + + if (maxtextw[col] == cellWidth) + { + wrap[col] = cell.contains(" "); + } + } + } + + int left = preferredSize.width - (numCols - 1) * gutter.width; + final double avg = left / numCols; + int nflex = 0; + + // Determine whether columns should be flexible and assign width of non-flexible cells + for (int col = 0; col < numCols; col++) + { + // This limit can be adjusted as needed + final double maxNonFlexLimit = 1.5 * avg; + + flex[col] = maxtextw[col] > maxNonFlexLimit; + if (flex[col]) + { + nflex++; + } + else + { + finalcolw[col] = maxtextw[col]; + left -= finalcolw[col]; + } + } + + // If there is not enough space, make columns that could be word-wrapped flexible too + if (left < nflex * avg) + { + for (int col = 0; col < numCols; col++) + { + if (!flex[col] && wrap[col]) + { + left += finalcolw[col]; + finalcolw[col] = 0; + flex[col] = true; + nflex++; + } + } + } + + // Calculate weights for flexible columns. The max width is capped at the table width to + // treat columns that have to be wrapped more or less equal + int tot = 0; + for (int col = 0; col < numCols; col++) + { + if (flex[col]) + { + maxtextw[col] = Math.min(maxtextw[col], preferredSize.width); + tot += maxtextw[col]; + } + } + + // Now assign the actual width for flexible columns. Make sure that it is at least as long + // as the longest word length + for (int col = 0; col < numCols; col++) + { + if (flex[col]) + { + finalcolw[col] = left * maxtextw[col] / tot; + finalcolw[col] = Math.max(finalcolw[col], maxwordw[col]); + left -= finalcolw[col]; + } + } + + // When the sum of column widths is less than the total space available, distribute the + // extra space equally across all columns + final int extraPerCol = left / numCols; + for (int col = 0; col < numCols; col++) + { + finalcolw[col] += extraPerCol; + left -= extraPerCol; + } + // Add any remainder to the right-most column + finalcolw[finalcolw.length - 1] += left; + + return finalcolw; + } + + private static int getTextWidth(final FontMetrics metrics, final String cell) + { + return metrics.stringWidth(Text.removeTags(cell)); + } + + private static String[] lineBreakText(final String text, final int maxWidth, final FontMetrics metrics) + { + final String[] words = text.split(" "); + + if (words.length == 0) + { + return new String[0]; + } + + final StringBuilder wrapped = new StringBuilder(words[0]); + int spaceLeft = maxWidth - getTextWidth(metrics, wrapped.toString()); + + for (int i = 1; i < words.length; i++) + { + final String word = words[i]; + final int wordLen = getTextWidth(metrics, word); + final int spaceWidth = metrics.stringWidth(" "); + + if (wordLen + spaceWidth > spaceLeft) + { + wrapped.append("\n").append(word); + spaceLeft = maxWidth - wordLen; + } + else + { + wrapped.append(" ").append(word); + spaceLeft -= spaceWidth + wordLen; + } + } + + return wrapped.toString().split("\n"); + } + + public boolean isEmpty() + { + return columns.size() == 0 || rows.size() == 0; + } + + private void ensureColumnSize(final int size) + { + while (size > columns.size()) + { + columns.add(TableElement.builder().build()); + } + } + + private static int getAlignedPosition(final String str, final TableAlignment alignment, final int columnWidth, final FontMetrics metrics) + { + final int stringWidth = getTextWidth(metrics, str); + int offset = 0; + + switch (alignment) + { + case LEFT: + break; + case CENTER: + offset = (columnWidth / 2) - (stringWidth / 2); + break; + case RIGHT: + offset = columnWidth - stringWidth; + break; + } + return offset; + } + + /** + * Returns the color for the specified table element. + * Priority order: cell->row->column->default + * + * @param row TableRow element + * @param colIndex column index + */ + private Color getCellColor(final TableRow row, final int colIndex) + { + final List rowElements = row.getElements(); + final TableElement cell = colIndex < rowElements.size() ? rowElements.get(colIndex) : EMPTY_ELEMENT; + final TableElement column = colIndex < columns.size() ? columns.get(colIndex) : EMPTY_ELEMENT; + + return firstNonNull( + cell.getColor(), + row.getRowColor(), + column.getColor(), + defaultColor); + } + + private void setColumnAlignment(final int col, final TableAlignment alignment) + { + assert columns.size() > col; + columns.get(col).setAlignment(alignment); + } + + public void setColumnAlignments(@Nonnull final TableAlignment... alignments) + { + ensureColumnSize(alignments.length); + for (int i = 0; i < alignments.length; i++) + { + setColumnAlignment(i, alignments[i]); + } + } + + /** + * Returns the alignment for the specified table element. + * Priority order: cell->row->column->default + * + * @param row TableRow element + * @param colIndex column index + */ + private TableAlignment getCellAlignment(final TableRow row, final int colIndex) + { + final List rowElements = row.getElements(); + final TableElement cell = colIndex < rowElements.size() ? rowElements.get(colIndex) : EMPTY_ELEMENT; + final TableElement column = colIndex < columns.size() ? columns.get(colIndex) : EMPTY_ELEMENT; + + return firstNonNull( + cell.getAlignment(), + row.getRowAlignment(), + column.getAlignment(), + defaultAlignment); + } + + @SafeVarargs + private static T firstNonNull(@Nullable T... elements) + { + if (elements == null || elements.length == 0) + { + return null; + } + + int i = 0; + T cur = elements[0]; + while (cur == null && i < elements.length) + { + cur = elements[i]; + i++; + } + + return cur; + } + + // Helper functions for cleaner overlay code + public void addRow(@Nonnull final String... cells) + { + final List elements = new ArrayList<>(); + for (final String cell : cells) + { + elements.add(TableElement.builder().content(cell).build()); + } + + final TableRow row = TableRow.builder().build(); + row.setElements(elements); + + this.rows.add(row); + } + + private void addRows(@Nonnull final String[]... rows) + { + for (String[] row : rows) + { + addRow(row); + } + } + + public void addRows(@NonNull final TableRow... rows) + { + this.rows.addAll(Arrays.asList(rows)); + } + + public void setRows(@Nonnull final String[]... elements) + { + this.rows.clear(); + addRows(elements); + } + + public void setRows(@Nonnull final TableRow... elements) + { + this.rows.clear(); + this.rows.addAll(Arrays.asList(elements)); + } + + private void addColumn(@Nonnull final String col) + { + this.columns.add(TableElement.builder().content(col).build()); + } + + public void addColumns(@NonNull final TableElement... columns) + { + this.columns.addAll(Arrays.asList(columns)); + } + + public void setColumns(@Nonnull final TableElement... elements) + { + this.columns.clear(); + this.columns.addAll(Arrays.asList(elements)); + } + + public void setColumns(@Nonnull final String... columns) + { + this.columns.clear(); + for (String col : columns) + { + addColumn(col); + } + } +} diff --git a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableElement.java b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableElement.java new file mode 100644 index 0000000000..daf7eb5790 --- /dev/null +++ b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableElement.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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 com.openosrs.client.ui.overlay.components.table; + +import java.awt.Color; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class TableElement +{ + TableAlignment alignment; + Color color; + String content; +} diff --git a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableRow.java b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableRow.java new file mode 100644 index 0000000000..9451bba547 --- /dev/null +++ b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/components/table/TableRow.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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 com.openosrs.client.ui.overlay.components.table; + +import java.awt.Color; +import java.util.Collections; +import java.util.List; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class TableRow +{ + Color rowColor; + TableAlignment rowAlignment; + @Builder.Default + List elements = Collections.emptyList(); +} From e08e16fa48cfaa6e9024ed758448a8aaa996afc1 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 22:18:06 -0500 Subject: [PATCH 6/8] npcstats: add static getter for attack speed --- .../src/main/java/com/openosrs/client/game/NPCStats.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/runelite-client/src/main/java/com/openosrs/client/game/NPCStats.java b/runelite-client/src/main/java/com/openosrs/client/game/NPCStats.java index 93071976a7..ccf623ba78 100644 --- a/runelite-client/src/main/java/com/openosrs/client/game/NPCStats.java +++ b/runelite-client/src/main/java/com/openosrs/client/game/NPCStats.java @@ -207,6 +207,14 @@ public class NPCStats } }; + public static int getAttackSpeed(int npcId) + { + if (statsMap != null) + if (statsMap.get(npcId) != null) + return statsMap.get(npcId).getAttackSpeed(); + return -1; + } + public static void loadStats() throws IOException { try (JsonReader reader = new JsonReader(new InputStreamReader(NPCStats.class.getResourceAsStream("npc_stats.json"), StandardCharsets.UTF_8))) From 681216c25dd0ca33bb6e8adfffda3d74701b9940 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 5 Feb 2021 22:28:50 -0500 Subject: [PATCH 7/8] bootstrapper: use pretty formatting --- buildSrc/src/main/kotlin/BootstrapTask.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/BootstrapTask.kt b/buildSrc/src/main/kotlin/BootstrapTask.kt index 3eaf7dcebb..0e141ee23d 100644 --- a/buildSrc/src/main/kotlin/BootstrapTask.kt +++ b/buildSrc/src/main/kotlin/BootstrapTask.kt @@ -1,3 +1,4 @@ +import groovy.json.JsonOutput import org.gradle.api.DefaultTask import org.gradle.api.file.RegularFileProperty import org.gradle.api.tasks.* @@ -117,11 +118,13 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT "artifacts" to getArtifacts() ).toString() + val prettyJson = JsonOutput.prettyPrint(json) + val bootstrapDir = File("${project.buildDir}/bootstrap") bootstrapDir.mkdirs() File(bootstrapDir, "bootstrap-${type}.json").printWriter().use { out -> - out.println(json) + out.println(prettyJson) } } } From ad6e26715197092b93f63e679c834a58f4d15e0c Mon Sep 17 00:00:00 2001 From: zeruth Date: Sat, 6 Feb 2021 01:17:47 -0500 Subject: [PATCH 8/8] api: expand animID / overlayUtil --- .../java/net/runelite/api/AnimationID.java | 22 +++++++++++++ .../client/ui/overlay/OverlayUtil.java | 33 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index 2b657032d6..d86d33e89c 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -482,4 +482,26 @@ public final class AnimationID public static final int NIGHTMARE_JUMP_UP = 8609; public static final int NIGHTMARE_JUMP_UP_2 = 8610; public static final int NIGHTMARE_WAKE_UP = 8611; + + //Supplies Tracker + public static final int ONEHAND_SLASH_SWORD_ANIMATION = 390; + public static final int ONEHAND_STAB_SWORD_ANIMATION = 386; + public static final int SCYTHE_OF_VITUR_ANIMATION = 8056; + public static final int LOW_LEVEL_STANDARD_SPELLS = 711; + public static final int WAVE_SPELL_ANIMATION = 727; + public static final int SURGE_SPELL_ANIMATION = 7855; + public static final int HIGH_ALCH_ANIMATION = 713; + public static final int LUNAR_HUMIDIFY = 6294; + public static final int PRAY_AT_ALTAR = 645; + public static final int ENSOULED_HEADS_ANIMATION = 7198; + + // Weapon attack animations + public static final int ONEHAND_SLASH_AXE_ANIMATION = 395; + public static final int ONEHAND_CRUSH_PICKAXE_ANIMATION = 400; + public static final int ONEHAND_CRUSH_AXE_ANIMATION = 401; + public static final int UNARMED_PUNCH_ANIMATION = 422; + public static final int UNARMED_KICK_ANIMATION = 423; + public static final int BOW_ATTACK_ANIMATION = 426; + public static final int ONEHAND_STAB_HALBERD_ANIMATION = 428; + public static final int ONEHAND_SLASH_HALBERD_ANIMATION = 440; } \ No newline at end of file diff --git a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/OverlayUtil.java b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/OverlayUtil.java index 0c4f611be5..47a6d2e716 100644 --- a/runelite-client/src/main/java/com/openosrs/client/ui/overlay/OverlayUtil.java +++ b/runelite-client/src/main/java/com/openosrs/client/ui/overlay/OverlayUtil.java @@ -138,4 +138,37 @@ public class OverlayUtil extends net.runelite.client.ui.overlay.OverlayUtil graphics.fill(poly); graphics.setStroke(originalStroke); } + + public static void renderAreaTilePolygon(Graphics2D graphics, Shape poly, Color color) + { + graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 10)); + graphics.fill(poly); + } + + public static void renderFullLine(Graphics2D graphics, int[][] line, Color color) + { + graphics.setColor(color); + final Stroke originalStroke = graphics.getStroke(); + graphics.setStroke(new BasicStroke(2)); + graphics.drawLine(line[0][0], line[0][1], line[1][0], line[1][1]); + graphics.setStroke(originalStroke); + } + + public static void renderDashedLine(Graphics2D graphics, int[][] line, Color color) + { + graphics.setColor(color); + final Stroke originalStroke = graphics.getStroke(); + graphics.setStroke(new BasicStroke(2, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{9}, 0)); + graphics.drawLine(line[0][0], line[0][1], line[1][0], line[1][1]); + graphics.setStroke(originalStroke); + } + + public static void renderOutlinePolygon(Graphics2D graphics, Shape poly, Color color) + { + graphics.setColor(color); + final Stroke originalStroke = graphics.getStroke(); + graphics.setStroke(new BasicStroke(2)); + graphics.draw(poly); + graphics.setStroke(originalStroke); + } }