Merge branch 'master' of https://github.com/runelite-extended/runelite into runelite-extended-master

# Conflicts:
#	runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java
#	runelite-client/src/main/java/net/runelite/client/plugins/config/PluginListItem.java
This commit is contained in:
Giovanni Ruddy Gazivoda
2019-04-22 15:26:46 -04:00
316 changed files with 15996 additions and 12526 deletions

6
.gitignore vendored
View File

@@ -7,4 +7,8 @@ project.properties
.idea/
.project
.settings/
.classpath
.classpath
runelite-client/src/main/resources/META-INF/MANIFEST.MF
git
classes/artifacts/client_jar/run.bat
classes/artifacts/client_jar/client.jar

View File

@@ -38,12 +38,7 @@ import net.runelite.api.coords.WorldPoint;
*/
public interface Actor extends Renderable
{
/**
* Used by the "Tick Counter Plugin
*/
int getActionFrame();
int getActionFrameCycle();
/**
* Gets the combat level of the actor.
*
@@ -252,4 +247,10 @@ public interface Actor extends Renderable
* @param overheadText the overhead text
*/
void setOverheadText(String overheadText);
/**
* Used by the "Tick Counter Plugin
*/
int getActionFrame();
int getActionFrameCycle();
}

View File

@@ -173,7 +173,7 @@ public final class AnimationID
public static final int VORKATH_ACID_ATTACK = 7957;
public static final int BLACKJACK_KO = 838;
public static final int VETION_EARTHQUAKE = 5507;
public static final int ZULRAH_DEATH = 5804;
public static final int ZULRAH_DEATH = 5804;
// Farming
public static final int FARMING_HARVEST_FRUIT_TREE = 2280;
@@ -210,31 +210,7 @@ public final class AnimationID
// POH Animations
public static final int INCENSE_BURNER = 3687;
// Weapons
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;
// Hydra
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_4_1 = 8257;
public static final int HYDRA_4_2 = 8258;
public static final int HIGH_LEVEL_MAGIC_ATTACK = 1167;
public static final int BLOWPIPE_ATTACK = 5061;
}

View File

@@ -39,43 +39,43 @@ public enum ClanMemberRank
/**
* Not in a clan.
*/
UNRANKED(-1, "", -1),
UNRANKED(-1),
/**
* Friend rank.
*/
FRIEND(0, "https://cdn.discordapp.com/attachments/556184918770843649/557023638826778635/1004.png", SpriteID.CLAN_CHAT_RANK_SMILEY_FRIEND),
FRIEND(0),
/**
* Recruit rank.
*/
RECRUIT(1, "https://cdn.discordapp.com/attachments/556184918770843649/557023639111991306/1012-0.png", SpriteID.CLAN_CHAT_RANK_SINGLE_CHEVRON_RECRUIT),
RECRUIT(1),
/**
* Corporal rank.
*/
CORPORAL(2, "https://cdn.discordapp.com/attachments/556184918770843649/557023638889431052/1011-0.png", SpriteID.CLAN_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL),
CORPORAL(2),
/**
* Sergeant rank.
*/
SERGEANT(3, "https://cdn.discordapp.com/attachments/556184918770843649/557023641968312321/1010-0.png", SpriteID.CLAN_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT),
SERGEANT(3),
/**
* Lieutenant rank.
*/
LIEUTENANT(4, "https://cdn.discordapp.com/attachments/556184918770843649/557023638893756416/1009-0.png", SpriteID.CLAN_CHAT_RANK_BRONZE_STAR_LIEUTENANT),
LIEUTENANT(4),
/**
* Captain rank.
*/
CAPTAIN(5, "https://cdn.discordapp.com/attachments/556184918770843649/557023638910664734/1008-0.png", SpriteID.CLAN_CHAT_RANK_SILVER_STAR_CAPTAIN),
CAPTAIN(5),
/**
* General rank.
*/
GENERAL(6, "https://cdn.discordapp.com/attachments/556184918770843649/557023638835036170/1007-0.png", SpriteID.CLAN_CHAT_RANK_GOLD_STAR_GENERAL),
GENERAL(6),
/**
* Channel owner rank.
*/
OWNER(7, "https://cdn.discordapp.com/attachments/556184918770843649/557023638822453248/1006-0.png", SpriteID.CLAN_CHAT_RANK_KEY_CHANNEL_OWNER),
OWNER(7),
/**
* JMod rank.
*/
JMOD(127, "", SpriteID.CLAN_CHAT_RANK_CROWN_JAGEX_MODERATOR);
JMOD(127);
private static final Map<Integer, ClanMemberRank> RANKS = new HashMap<>();
@@ -87,8 +87,6 @@ public enum ClanMemberRank
}
}
/**
* Utility method that maps the rank value to its respective
* {@link ClanMemberRank} value.
@@ -101,11 +99,8 @@ public enum ClanMemberRank
return RANKS.get(rank);
}
/**
* The value of the clan rank.
*/
private final int value;
private final String discavatar;
private final int spriteID;
}

View File

@@ -82,4 +82,4 @@ public enum InventoryID
{
return id;
}
}
}

View File

@@ -44,7 +44,7 @@ public class ProjectileID
public static final int VASA_RANGED_AOE = 1329;
public static final int TEKTON_METEOR_AOE = 660;
public static final int OLM_FALLING_CRYSTAL_AOE = 1357;
public static final int OLM_FALLING_CRYSTAL_AOE = -1; //please help
public static final int OLM_BURNING_AOE = -1;
public static final int VORKATH_BOMB_AOE = 1481;
@@ -84,10 +84,4 @@ public class ProjectileID
public static final int VORKATH_PRAYER_DISABLE = 1471;
public static final int VORKATH_VENOM = 1470;
public static final int VORKATH_ICE = 350;
public static final int HYDRA_MAGIC = 1662;
public static final int HYDRA_RANGED = 1663;
public static final int HYDRA_POISON = 1644;
public static final int HYDRA_LIGHTNING = 1664;
public static final int HYDRA_LIGHTNING_2 = 1665;
}

View File

@@ -431,7 +431,7 @@ public final class SpriteID
public static final int SPELL_FIRE_SURGE_DISABLED = 415;
/* Unmapped: 416, 417, 418 */
public static final int UNKNOWN_STANCE_ICON_1 = 419;
public static final int UNKNOWN_STANCE_ICON_2 = 420;
public static final int UNKNOWN_STANCE_ICON_2 = 320;
public static final int UNKNOWN_STANCE_ICON_3 = 421;
public static final int MINIMAP_DESTINATION_FLAG = 422;
public static final int CHATBOX_BADGE_CROWN_PLAYER_MODERATOR = 423;
@@ -1566,7 +1566,4 @@ public final class SpriteID
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_2 = 1626;
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS_UNUSED = 1708;
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS = 1711;
public static final int BIG_ASS_GUTHIX_SPELL = 1774;
public static final int BIG_SUPERHEAT = 1800;
public static final int BIG_SPEC_TRANSFER = 1959;
}

View File

@@ -45,15 +45,14 @@ public enum VarClientInt
INPUT_TYPE(5),
MEMBERSHIP_STATUS(103),
/**
* -1 = player inventory closed
* 3 = player inventory opened
*/
PLAYER_INVENTORY_OPENED(171),
INVENTORY_TAB(171),
/**
* -1 = player inventory closed
* 3 = player inventory opened
*/
PLAYER_INVENTORY_OPENED(171),
WORLD_MAP_SEARCH_FOCUSED(190);
private final int index;

View File

@@ -52,7 +52,8 @@ public enum VarPlayer
IN_RAID_PARTY(1427),
NMZ_REWARD_POINTS(1060),
ATTACKING_PLAYER(1075),
/**
* -1 : Poison immune
* Normal poison damage is ceil( this / 5.0f )

View File

@@ -32,564 +32,480 @@ import lombok.Getter;
*/
@AllArgsConstructor
@Getter
public enum Varbits
{
/*
* If chatbox is transparent or not
*/
TRANSPARENT_CHATBOX(4608),
public enum Varbits {
/*
* If chatbox is transparent or not
*/
TRANSPARENT_CHATBOX(4608),
/*
* If the player has an active stamina potion effect or not
*/
RUN_SLOWED_DEPLETION_ACTIVE(25),
/*
* If the player has an active stamina potion effect or not
*/
RUN_SLOWED_DEPLETION_ACTIVE(25),
/**
* If scrollbar in resizable mode chat is on the left
*/
CHAT_SCROLLBAR_ON_LEFT(6374),
/**
* If scrollbar in resizable mode chat is on the left
*/
CHAT_SCROLLBAR_ON_LEFT(6374),
/**
* Runepouch
*/
RUNE_POUCH_RUNE1(29),
RUNE_POUCH_RUNE2(1622),
RUNE_POUCH_RUNE3(1623),
RUNE_POUCH_AMOUNT1(1624),
RUNE_POUCH_AMOUNT2(1625),
RUNE_POUCH_AMOUNT3(1626),
/**
* Runepouch
*/
RUNE_POUCH_RUNE1(29),
RUNE_POUCH_RUNE2(1622),
RUNE_POUCH_RUNE3(1623),
RUNE_POUCH_AMOUNT1(1624),
RUNE_POUCH_AMOUNT2(1625),
RUNE_POUCH_AMOUNT3(1626),
/**
* Prayers
*/
QUICK_PRAYER(4103),
PRAYER_THICK_SKIN(4104),
PRAYER_BURST_OF_STRENGTH(4105),
PRAYER_CLARITY_OF_THOUGHT(4106),
PRAYER_SHARP_EYE(4122),
PRAYER_MYSTIC_WILL(4123),
PRAYER_ROCK_SKIN(4107),
PRAYER_SUPERHUMAN_STRENGTH(4108),
PRAYER_IMPROVED_REFLEXES(4109),
PRAYER_RAPID_RESTORE(4110),
PRAYER_RAPID_HEAL(4111),
PRAYER_PROTECT_ITEM(4112),
PRAYER_HAWK_EYE(4124),
PRAYER_MYSTIC_LORE(4125),
PRAYER_STEEL_SKIN(4113),
PRAYER_ULTIMATE_STRENGTH(4114),
PRAYER_INCREDIBLE_REFLEXES(4115),
PRAYER_PROTECT_FROM_MAGIC(4116),
PRAYER_PROTECT_FROM_MISSILES(4117),
PRAYER_PROTECT_FROM_MELEE(4118),
PRAYER_EAGLE_EYE(4126),
PRAYER_MYSTIC_MIGHT(4127),
PRAYER_RETRIBUTION(4119),
PRAYER_REDEMPTION(4120),
PRAYER_SMITE(4121),
PRAYER_CHIVALRY(4128),
PRAYER_PIETY(4129),
PRAYER_PRESERVE(5466),
PRAYER_RIGOUR(5464),
PRAYER_AUGURY(5465),
/**
* Prayers
*/
QUICK_PRAYER(4103),
PRAYER_THICK_SKIN(4104),
PRAYER_BURST_OF_STRENGTH(4105),
PRAYER_CLARITY_OF_THOUGHT(4106),
PRAYER_SHARP_EYE(4122),
PRAYER_MYSTIC_WILL(4123),
PRAYER_ROCK_SKIN(4107),
PRAYER_SUPERHUMAN_STRENGTH(4108),
PRAYER_IMPROVED_REFLEXES(4109),
PRAYER_RAPID_RESTORE(4110),
PRAYER_RAPID_HEAL(4111),
PRAYER_PROTECT_ITEM(4112),
PRAYER_HAWK_EYE(4124),
PRAYER_MYSTIC_LORE(4125),
PRAYER_STEEL_SKIN(4113),
PRAYER_ULTIMATE_STRENGTH(4114),
PRAYER_INCREDIBLE_REFLEXES(4115),
PRAYER_PROTECT_FROM_MAGIC(4116),
PRAYER_PROTECT_FROM_MISSILES(4117),
PRAYER_PROTECT_FROM_MELEE(4118),
PRAYER_EAGLE_EYE(4126),
PRAYER_MYSTIC_MIGHT(4127),
PRAYER_RETRIBUTION(4119),
PRAYER_REDEMPTION(4120),
PRAYER_SMITE(4121),
PRAYER_CHIVALRY(4128),
PRAYER_PIETY(4129),
PRAYER_PRESERVE(5466),
PRAYER_RIGOUR(5464),
PRAYER_AUGURY(5465),
/**
* Diary Entries
*/
DIARY_ARDOUGNE_EASY(4458),
DIARY_ARDOUGNE_MEDIUM(4459),
DIARY_ARDOUGNE_HARD(4460),
DIARY_ARDOUGNE_ELITE(4461),
/**
* Diary Entries
*/
DIARY_ARDOUGNE_EASY(4458),
DIARY_ARDOUGNE_MEDIUM(4459),
DIARY_ARDOUGNE_HARD(4460),
DIARY_ARDOUGNE_ELITE(4461),
DIARY_DESERT_EASY(4483),
DIARY_DESERT_MEDIUM(4484),
DIARY_DESERT_HARD(4485),
DIARY_DESERT_ELITE(4486),
DIARY_DESERT_EASY(4483),
DIARY_DESERT_MEDIUM(4484),
DIARY_DESERT_HARD(4485),
DIARY_DESERT_ELITE(4486),
DIARY_FALADOR_EASY(4462),
DIARY_FALADOR_MEDIUM(4463),
DIARY_FALADOR_HARD(4464),
DIARY_FALADOR_ELITE(4465),
DIARY_FALADOR_EASY(4462),
DIARY_FALADOR_MEDIUM(4463),
DIARY_FALADOR_HARD(4464),
DIARY_FALADOR_ELITE(4465),
DIARY_FREMENNIK_EASY(4491),
DIARY_FREMENNIK_MEDIUM(4492),
DIARY_FREMENNIK_HARD(4493),
DIARY_FREMENNIK_ELITE(4494),
DIARY_FREMENNIK_EASY(4491),
DIARY_FREMENNIK_MEDIUM(4492),
DIARY_FREMENNIK_HARD(4493),
DIARY_FREMENNIK_ELITE(4494),
DIARY_KANDARIN_EASY(4475),
DIARY_KANDARIN_MEDIUM(4476),
DIARY_KANDARIN_HARD(4477),
DIARY_KANDARIN_ELITE(4478),
DIARY_KANDARIN_EASY(4475),
DIARY_KANDARIN_MEDIUM(4476),
DIARY_KANDARIN_HARD(4477),
DIARY_KANDARIN_ELITE(4478),
DIARY_KARAMJA_EASY(3578),
DIARY_KARAMJA_MEDIUM(3599),
DIARY_KARAMJA_HARD(3611),
DIARY_KARAMJA_ELITE(4566),
DIARY_KARAMJA_EASY(3578),
DIARY_KARAMJA_MEDIUM(3599),
DIARY_KARAMJA_HARD(3611),
DIARY_KARAMJA_ELITE(4566),
DIARY_LUMBRIDGE_EASY(4495),
DIARY_LUMBRIDGE_MEDIUM(4496),
DIARY_LUMBRIDGE_HARD(4497),
DIARY_LUMBRIDGE_ELITE(4498),
DIARY_LUMBRIDGE_EASY(4495),
DIARY_LUMBRIDGE_MEDIUM(4496),
DIARY_LUMBRIDGE_HARD(4497),
DIARY_LUMBRIDGE_ELITE(4498),
DIARY_MORYTANIA_EASY(4487),
DIARY_MORYTANIA_MEDIUM(4488),
DIARY_MORYTANIA_HARD(4489),
DIARY_MORYTANIA_ELITE(4490),
DIARY_MORYTANIA_EASY(4487),
DIARY_MORYTANIA_MEDIUM(4488),
DIARY_MORYTANIA_HARD(4489),
DIARY_MORYTANIA_ELITE(4490),
DIARY_VARROCK_EASY(4479),
DIARY_VARROCK_MEDIUM(4480),
DIARY_VARROCK_HARD(4481),
DIARY_VARROCK_ELITE(4482),
DIARY_VARROCK_EASY(4479),
DIARY_VARROCK_MEDIUM(4480),
DIARY_VARROCK_HARD(4481),
DIARY_VARROCK_ELITE(4482),
DIARY_WESTERN_EASY(4471),
DIARY_WESTERN_MEDIUM(4472),
DIARY_WESTERN_HARD(4473),
DIARY_WESTERN_ELITE(4474),
DIARY_WESTERN_EASY(4471),
DIARY_WESTERN_MEDIUM(4472),
DIARY_WESTERN_HARD(4473),
DIARY_WESTERN_ELITE(4474),
DIARY_WILDERNESS_EASY(4466),
DIARY_WILDERNESS_MEDIUM(4467),
DIARY_WILDERNESS_HARD(4468),
DIARY_WILDERNESS_ELITE(4469),
DIARY_WILDERNESS_EASY(4466),
DIARY_WILDERNESS_MEDIUM(4467),
DIARY_WILDERNESS_HARD(4468),
DIARY_WILDERNESS_ELITE(4469),
/**
* Kourend house favours
*/
KOUREND_FAVOR_ARCEUUS(4896),
KOUREND_FAVOR_HOSIDIUS(4895),
KOUREND_FAVOR_LOVAKENGJ(4898),
KOUREND_FAVOR_PISCARILIUS(4899),
KOUREND_FAVOR_SHAYZIEN(4894),
/**
* Kourend house favours
*/
KOUREND_FAVOR_ARCEUUS(4896),
KOUREND_FAVOR_HOSIDIUS(4895),
KOUREND_FAVOR_LOVAKENGJ(4898),
KOUREND_FAVOR_PISCARILIUS(4899),
KOUREND_FAVOR_SHAYZIEN(4894),
/**
* Equipped weapon type
*/
EQUIPPED_WEAPON_TYPE(357),
/**
* Equipped weapon type
*/
EQUIPPED_WEAPON_TYPE(357),
/**
* Defensive casting mode
*/
DEFENSIVE_CASTING_MODE(2668),
/**
* Defensive casting mode
*/
DEFENSIVE_CASTING_MODE(2668),
/**
* Options
*/
SIDE_PANELS(4607),
/**
* Options
*/
SIDE_PANELS(4607),
/**
* Herbiboar Trails
*/
HB_TRAIL_31303(5737),
HB_TRAIL_31306(5738),
HB_TRAIL_31309(5739),
HB_TRAIL_31312(5740),
HB_TRAIL_31315(5741),
HB_TRAIL_31318(5742),
HB_TRAIL_31321(5743),
HB_TRAIL_31324(5744),
HB_TRAIL_31327(5745),
HB_TRAIL_31330(5746),
/**
* Herbiboar Trails
*/
HB_TRAIL_31303(5737),
HB_TRAIL_31306(5738),
HB_TRAIL_31309(5739),
HB_TRAIL_31312(5740),
HB_TRAIL_31315(5741),
HB_TRAIL_31318(5742),
HB_TRAIL_31321(5743),
HB_TRAIL_31324(5744),
HB_TRAIL_31327(5745),
HB_TRAIL_31330(5746),
HB_TRAIL_31333(5768),
HB_TRAIL_31336(5769),
HB_TRAIL_31339(5770),
HB_TRAIL_31342(5771),
HB_TRAIL_31345(5772),
HB_TRAIL_31348(5773),
HB_TRAIL_31351(5774),
HB_TRAIL_31354(5775),
HB_TRAIL_31357(5776),
HB_TRAIL_31360(5777),
HB_TRAIL_31333(5768),
HB_TRAIL_31336(5769),
HB_TRAIL_31339(5770),
HB_TRAIL_31342(5771),
HB_TRAIL_31345(5772),
HB_TRAIL_31348(5773),
HB_TRAIL_31351(5774),
HB_TRAIL_31354(5775),
HB_TRAIL_31357(5776),
HB_TRAIL_31360(5777),
HB_TRAIL_31363(5747),
HB_TRAIL_31366(5748),
HB_TRAIL_31369(5749),
HB_TRAIL_31372(5750),
HB_TRAIL_31363(5747),
HB_TRAIL_31366(5748),
HB_TRAIL_31369(5749),
HB_TRAIL_31372(5750),
HB_FINISH(5766),
HB_STARTED(5767), //not working
HB_FINISH(5766),
HB_STARTED(5767), //not working
/**
* Barbarian Assault
*/
IN_GAME_BA(3923),
COLL_BAG_EGG1(3259),
COLL_BAG_EGG2(3260),
COLL_BAG_EGG3(3269),
/**
* Barbarian Assault
*/
IN_GAME_BA(3923),
/**
* 0 = Outside wilderness
* 1 = In wilderness
*/
IN_WILDERNESS(5963),
/**
* 0 = Outside wilderness
* 1 = In wilderness
*/
IN_WILDERNESS(5963),
/**
* Fishing Trawler
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255
*/
FISHING_TRAWLER_ACTIVITY(3377),
/**
* Fishing Trawler
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255
*/
FISHING_TRAWLER_ACTIVITY(3377),
/**
* Blast Furnace Bar Dispenser
*
* These are the expected values:
* 0 = No bars being processed
* 1 = Ores are being processed on the conveyor belt, bar dispenser cannot be checked
* 2 = Bars are cooling down
* 3 = Bars can be collected
*/
BAR_DISPENSER(936),
/**
* Blast Furnace Bar Dispenser
* <p>
* These are the expected values:
* 0 = No bars being processed
* 1 = Ores are being processed on the conveyor belt, bar dispenser cannot be checked
* 2 = Bars are cooling down
* 3 = Bars can be collected
*/
BAR_DISPENSER(936),
/**
* Motherlode mine sack
*/
SACK_NUMBER(5558),
SACK_UPGRADED(5556),
/**
* Motherlode mine sack
*/
SACK_NUMBER(5558),
SACK_UPGRADED(5556),
/**
* Experience tracker
*
* EXPERIENCE_TRACKER_POSITION expected values:
* 0 = Right
* 1 = Middle
* 2 = Left
*/
EXPERIENCE_TRACKER_POSITION(4692),
EXPERIENCE_TRACKER_COUNTER(4697),
EXPERIENCE_TRACKER_PROGRESS_BAR(4698),
/**
* Experience tracker
* <p>
* EXPERIENCE_TRACKER_POSITION expected values:
* 0 = Right
* 1 = Middle
* 2 = Left
*/
EXPERIENCE_TRACKER_POSITION(4692),
EXPERIENCE_TRACKER_COUNTER(4697),
EXPERIENCE_TRACKER_PROGRESS_BAR(4698),
/**
* Experience drop color
*/
EXPERIENCE_DROP_COLOR(4695),
/**
* Experience drop color
*/
EXPERIENCE_DROP_COLOR(4695),
/**
* Tithe Farm
*/
TITHE_FARM_SACK_AMOUNT(4900),
TITHE_FARM_SACK_ICON(5370),
TITHE_FARM_POINTS(4893),
/**
* Blast Mine
*/
BLAST_MINE_COAL(4924),
BLAST_MINE_GOLD(4925),
BLAST_MINE_MITHRIL(4926),
BLAST_MINE_ADAMANTITE(4921),
BLAST_MINE_RUNITE(4922),
/**
* Tithe Farm
*/
TITHE_FARM_SACK_AMOUNT(4900),
TITHE_FARM_SACK_ICON(5370),
TITHE_FARM_POINTS(4893),
/**
* Raids
*/
IN_RAID(5432),
TOTAL_POINTS(5431),
PERSONAL_POINTS(5422),
RAID_PARTY_SIZE(5424),
/**
* Blast Mine
*/
BLAST_MINE_COAL(4924),
BLAST_MINE_GOLD(4925),
BLAST_MINE_MITHRIL(4926),
BLAST_MINE_ADAMANTITE(4921),
BLAST_MINE_RUNITE(4922),
/**
* Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating
*/
THEATRE_OF_BLOOD(6440),
/**
* Raids
*/
IN_RAID(5432),
TOTAL_POINTS(5431),
PERSONAL_POINTS(5422),
RAID_PARTY_SIZE(5424),
/**
* Nightmare Zone
*/
NMZ_ABSORPTION(3956),
NMZ_POINTS(3949),
NMZ_OVERLOAD(3955),
/**
* Theatre of Blood 1=In Party, 2=Inside/Spectator, 3=Dead Spectating
*/
THEATRE_OF_BLOOD(6440),
/**
* Blast Furnace
*/
BLAST_FURNACE_COPPER_ORE(959),
BLAST_FURNACE_TIN_ORE(950),
BLAST_FURNACE_IRON_ORE(951),
BLAST_FURNACE_COAL(949),
BLAST_FURNACE_MITHRIL_ORE(952),
BLAST_FURNACE_ADAMANTITE_ORE(953),
BLAST_FURNACE_RUNITE_ORE(954),
BLAST_FURNACE_SILVER_ORE(956),
BLAST_FURNACE_GOLD_ORE(955),
/**
* Nightmare Zone
*/
NMZ_ABSORPTION(3956),
NMZ_POINTS(3949),
BLAST_FURNACE_BRONZE_BAR(941),
BLAST_FURNACE_IRON_BAR(942),
BLAST_FURNACE_STEEL_BAR(943),
BLAST_FURNACE_MITHRIL_BAR(944),
BLAST_FURNACE_ADAMANTITE_BAR(945),
BLAST_FURNACE_RUNITE_BAR(946),
BLAST_FURNACE_SILVER_BAR(948),
BLAST_FURNACE_GOLD_BAR(947),
/**
* Blast Furnace
*/
BLAST_FURNACE_COPPER_ORE(959),
BLAST_FURNACE_TIN_ORE(950),
BLAST_FURNACE_IRON_ORE(951),
BLAST_FURNACE_COAL(949),
BLAST_FURNACE_MITHRIL_ORE(952),
BLAST_FURNACE_ADAMANTITE_ORE(953),
BLAST_FURNACE_RUNITE_ORE(954),
BLAST_FURNACE_SILVER_ORE(956),
BLAST_FURNACE_GOLD_ORE(955),
BLAST_FURNACE_COFFER(5357),
BLAST_FURNACE_BRONZE_BAR(941),
BLAST_FURNACE_IRON_BAR(942),
BLAST_FURNACE_STEEL_BAR(943),
BLAST_FURNACE_MITHRIL_BAR(944),
BLAST_FURNACE_ADAMANTITE_BAR(945),
BLAST_FURNACE_RUNITE_BAR(946),
BLAST_FURNACE_SILVER_BAR(948),
BLAST_FURNACE_GOLD_BAR(947),
/**
* Pyramid plunder
*/
PYRAMID_PLUNDER_TIMER(2375),
PYRAMID_PLUNDER_ROOM(2377),
BLAST_FURNACE_COFFER(5357),
/**
* Barrows
*/
BARROWS_KILLED_AHRIM(457),
BARROWS_KILLED_DHAROK(458),
BARROWS_KILLED_GUTHAN(459),
BARROWS_KILLED_KARIL(460),
BARROWS_KILLED_TORAG(461),
BARROWS_KILLED_VERAC(462),
BARROWS_REWARD_POTENTIAL(463),
BARROWS_NPCS_SLAIN(464),
/**
* Pyramid plunder
*/
PYRAMID_PLUNDER_TIMER(2375),
PYRAMID_PLUNDER_ROOM(2377),
/**
* Spicy stew ingredients
*/
SPICY_STEW_RED_SPICES(1879),
SPICY_STEW_YELLOW_SPICES(1880),
SPICY_STEW_BROWN_SPICES(1881),
SPICY_STEW_ORANGE_SPICES(1882),
/**
* Barrows
*/
BARROWS_KILLED_AHRIM(457),
BARROWS_KILLED_DHAROK(458),
BARROWS_KILLED_GUTHAN(459),
BARROWS_KILLED_KARIL(460),
BARROWS_KILLED_TORAG(461),
BARROWS_KILLED_VERAC(462),
BARROWS_REWARD_POTENTIAL(463),
BARROWS_NPCS_SLAIN(464),
/**
* Multicombat area
*/
MULTICOMBAT_AREA(4605),
/**
* Spicy stew ingredients
*/
SPICY_STEW_RED_SPICES(1879),
SPICY_STEW_YELLOW_SPICES(1880),
SPICY_STEW_BROWN_SPICES(1881),
SPICY_STEW_ORANGE_SPICES(1882),
/**
* Wilderness area
*/
WILDERNESS_AREA(5963),
/**
* Multicombat area
*/
MULTICOMBAT_AREA(4605),
/**
* Kingdom Management
*/
KINGDOM_FAVOR(72),
KINGDOM_COFFER(74),
/**
* In the Wilderness
*/
IN_THE_WILDERNESS(5963),
/**
* Daily Tasks (Collection availability)
*/
DAILY_HERB_BOXES_COLLECTED(3961),
DAILY_STAVES_COLLECTED(4539),
DAILY_ESSENCE_COLLECTED(4547),
DAILY_RUNES_COLLECTED(4540),
DAILY_SAND_COLLECTED(4549),
DAILY_FLAX_STATE(4559),
/**
* This varbit tracks how much bonemeal has been redeemed from Robin
* The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39
*/
DAILY_BONEMEAL_STATE(4543),
/**
* Kingdom Management
*/
KINGDOM_FAVOR(72),
KINGDOM_COFFER(74),
/**
* Fairy Ring
*/
FAIR_RING_LAST_DESTINATION(5374),
FAIRY_RING_DIAL_ADCB(3985), //Left dial
FAIRY_RIGH_DIAL_ILJK(3986), //Middle dial
FAIRY_RING_DIAL_PSRQ(3987), //Right dial
/**
* The Hand in the Sand quest status
*/
QUEST_THE_HAND_IN_THE_SAND(1527),
/**
* Transmog controllers for farming
*/
FARMING_4771(4771),
FARMING_4772(4772),
FARMING_4773(4773),
FARMING_4774(4774),
FARMING_4775(4775),
FARMING_7904(7904),
FARMING_7905(7905),
FARMING_7906(7906),
FARMING_7907(7907),
FARMING_7908(7908),
FARMING_7909(7909),
FARMING_7910(7910),
FARMING_7911(7911),
/**
* Daily Tasks (Collection availability)
*/
DAILY_HERB_BOXES_COLLECTED(3961),
DAILY_STAVES_COLLECTED(4539),
DAILY_ESSENCE_COLLECTED(4547),
DAILY_RUNES_COLLECTED(4540),
DAILY_SAND_COLLECTED(4549),
DAILY_ARROWS_STATE(4563),
DAILY_FLAX_STATE(4559),
/**
* This varbit tracks how much bonemeal has been redeemed from Robin
* The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39
*/
DAILY_BONEMEAL_STATE(4543),
/**
* Transmog controllers for grapes
*/
GRAPES_4953(4953),
GRAPES_4954(4954),
GRAPES_4955(4955),
GRAPES_4956(4956),
GRAPES_4957(4957),
GRAPES_4958(4958),
GRAPES_4959(4959),
GRAPES_4960(4960),
GRAPES_4961(4961),
GRAPES_4962(4962),
GRAPES_4963(4963),
GRAPES_4964(4964),
/**
* Fairy Ring
*/
FAIR_RING_LAST_DESTINATION(5374),
FAIRY_RING_DIAL_ADCB(3985), //Left dial
FAIRY_RIGH_DIAL_ILJK(3986), //Middle dial
FAIRY_RING_DIAL_PSRQ(3987), //Right dial
/**
* Automatically weed farming patches
*/
AUTOWEED(5557),
/**
* Transmog controllers for farming
*/
FARMING_4771(4771),
FARMING_4772(4772),
FARMING_4773(4773),
FARMING_4774(4774),
FARMING_4775(4775),
FARMING_7904(7904),
FARMING_7905(7905),
FARMING_7906(7906),
FARMING_7907(7907),
FARMING_7908(7908),
FARMING_7909(7909),
FARMING_7910(7910),
FARMING_7911(7911),
/**
* The varbit that stores the players {@code AccountType}.
*/
ACCOUNT_TYPE(1777),
/**
* Transmog controllers for grapes
*/
GRAPES_4953(4953),
GRAPES_4954(4954),
GRAPES_4955(4955),
GRAPES_4956(4956),
GRAPES_4957(4957),
GRAPES_4958(4958),
GRAPES_4959(4959),
GRAPES_4960(4960),
GRAPES_4961(4961),
GRAPES_4962(4962),
GRAPES_4963(4963),
GRAPES_4964(4964),
/**
* The varbit that stores the oxygen percentage for player
*/
OXYGEN_LEVEL(5811),
/**
* Corp beast damage
*/
CORP_DAMAGE(999),
/**
* Automatically weed farming patches
*/
AUTOWEED(5557),
/**
* Toggleable slayer unlocks
*/
SUPERIOR_ENABLED(5362),
FOSSIL_ISLAND_WYVERN_DISABLE(6251),
/**
* The varbit that stores the players {@code AccountType}.
*/
ACCOUNT_TYPE(1777),
CURRENT_BANK_TAB(4150),
/**
* The varbit that stores the oxygen percentage for player
*/
OXYGEN_LEVEL(5811),
WORLDHOPPER_FAVROITE_1(4597),
WORLDHOPPER_FAVROITE_2(4598),
/**
* Corp beast damage
*/
CORP_DAMAGE(999),
/**
* Vengeance is active
*/
VENGEANCE_ACTIVE(2450),
/**
* Toggleable slayer unlocks
*/
SUPERIOR_ENABLED(5362),
FOSSIL_ISLAND_WYVERN_DISABLE(6251),
/**
* Spell cooldowns
*/
VENGEANCE_COOLDOWN(2451),
CURRENT_BANK_TAB(4150),
/**
* Amount of items in each bank tab
*/
BANK_TAB_ONE_COUNT(4171),
BANK_TAB_TWO_COUNT(4172),
BANK_TAB_THREE_COUNT(4173),
BANK_TAB_FOUR_COUNT(4174),
BANK_TAB_FIVE_COUNT(4175),
BANK_TAB_SIX_COUNT(4176),
BANK_TAB_SEVEN_COUNT(4177),
BANK_TAB_EIGHT_COUNT(4178),
BANK_TAB_NINE_COUNT(4179),
WORLDHOPPER_FAVROITE_1(4597),
WORLDHOPPER_FAVROITE_2(4598),
/*
* Spells being auto-casted
* */
AUTO_CAST_SPELL(276),
/**
* Vengeance is active
*/
VENGEANCE_ACTIVE(2450),
/**
* Temple Trekking
*/
TREK_POINTS(1955),
TREK_STARTED(1956),
TREK_EVENT(1958),
TREK_STATUS(6719),
/**
* Spell cooldowns
*/
VENGEANCE_COOLDOWN(2451),
/**
* Type of GE offer currently being created
* 0 = buy
* 1 = sell
*/
GE_OFFER_CREATION_TYPE(4397),
/**
* Amount of items in each bank tab
*/
BANK_TAB_ONE_COUNT(4171),
BANK_TAB_TWO_COUNT(4172),
BANK_TAB_THREE_COUNT(4173),
BANK_TAB_FOUR_COUNT(4174),
BANK_TAB_FIVE_COUNT(4175),
BANK_TAB_SIX_COUNT(4176),
BANK_TAB_SEVEN_COUNT(4177),
BANK_TAB_EIGHT_COUNT(4178),
BANK_TAB_NINE_COUNT(4179),
/**
* 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),
/**
* Type of GE offer currently being created
* 0 = buy
* 1 = sell
*/
GE_OFFER_CREATION_TYPE(4397),
/**
* 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),
QUEST_FORGETTABLE_TALE(822),
QUEST_GARDEN_OF_TRANQUILLITY(961),
QUEST_GHOSTS_AHOY(217),
QUEST_THE_GIANT_DWARF(571),
QUEST_THE_GOLEM(346),
QUEST_THE_HAND_IN_THE_SAND(1527),
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_ENDS_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),
/**
* 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),
/*
* Spells being auto-casted
*
* */
AUTO_CAST_SPELL(276),
/**
* The active tab within the quest interface
*/
QUEST_TAB(8168);
/**
* The raw varbit ID.
*/
private final int id;
/**
* The active tab within the quest interface
*/
QUEST_TAB(8168),
/**
* Temple Trekking
*/
TREK_POINTS(1955),
TREK_STARTED(1956),
TREK_EVENT(1958),
TREK_STATUS(6719),
BLOAT_ENTERED_ROOM(6447);
/**
* The raw varbit ID.
*/
private final int id;
}

View File

@@ -327,6 +327,27 @@ public class WorldPoint
return ((x >> 6) << 8) | (y >> 6);
}
/**
* Checks if user in within certain zone specified by upper and lower bound
* @param lowerBound
* @param upperBound
* @param userLocation
* @return
*/
public static boolean isInZone(WorldPoint lowerBound, WorldPoint upperBound, WorldPoint userLocation)
{
if (userLocation.getX() < lowerBound.getX()
|| userLocation.getX() > upperBound.getX()
|| userLocation.getY() < lowerBound.getY()
|| userLocation.getY() > upperBound.getY()
|| userLocation.getPlane() < lowerBound.getPlane()
|| userLocation.getPlane() > upperBound.getPlane())
{
return false;
}
return true;
}
/**
* Converts the passed region ID and coordinates to a world coordinate
*/

View File

@@ -0,0 +1,34 @@
/*
* Copyright (c) 2018, Seth <http://github.com/sethtroll>
* 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 lombok.Data;
import net.runelite.api.Actor;
@Data
public class InteractChanged
{
private Actor actor;
}

View File

@@ -36,7 +36,7 @@ import net.runelite.api.PlayerComposition;
*/
public enum KitType
{
HELM(0),
HELMET(0),
CAPE(1),
AMULET(2),
WEAPON(3),
@@ -46,7 +46,9 @@ public enum KitType
HEAD(8),
HANDS(9),
BOOTS(10),
JAW(11);
JAW(11),
RING(12),
AMMUNITION(13);
/**
* Raw equipment index.

View File

@@ -1,78 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.queries;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
public class BankItemQuery extends WidgetItemQuery
{
private static final int ITEM_EMPTY = 6512;
@Override
public WidgetItem[] result(Client client)
{
Collection<WidgetItem> widgetItems = getBankItems(client);
if (widgetItems != null)
{
return widgetItems.stream()
.filter(Objects::nonNull)
.filter(predicate)
.toArray(WidgetItem[]::new);
}
return new WidgetItem[0];
}
private Collection<WidgetItem> getBankItems(Client client)
{
Collection<WidgetItem> widgetItems = new ArrayList<>();
Widget bank = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
if (bank != null && !bank.isHidden())
{
Widget[] children = bank.getDynamicChildren();
for (int i = 0; i < children.length; i++)
{
Widget child = children[i];
if (child.getItemId() == ITEM_EMPTY || child.isSelfHidden())
{
continue;
}
// set bounds to same size as default inventory
Rectangle bounds = child.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
// Index is set to 0 because the widget's index does not correlate to the order in the bank
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), 0, bounds));
}
}
return widgetItems;
}
}

View File

@@ -1,102 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.queries;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Objects;
public class EquipmentItemQuery extends WidgetItemQuery
{
private static final WidgetInfo[] ALL_EQUIPMENT_WIDGET_INFOS =
{
WidgetInfo.EQUIPMENT_HELMET,
WidgetInfo.EQUIPMENT_CAPE,
WidgetInfo.EQUIPMENT_AMULET,
WidgetInfo.EQUIPMENT_WEAPON,
WidgetInfo.EQUIPMENT_BODY,
WidgetInfo.EQUIPMENT_SHIELD,
WidgetInfo.EQUIPMENT_LEGS,
WidgetInfo.EQUIPMENT_GLOVES,
WidgetInfo.EQUIPMENT_BOOTS,
WidgetInfo.EQUIPMENT_RING,
WidgetInfo.EQUIPMENT_AMMO,
};
private final Collection<WidgetInfo> slots = new ArrayList<>();
public EquipmentItemQuery slotEquals(WidgetInfo... slotWidgetInfo)
{
slots.addAll(Arrays.asList(slotWidgetInfo));
return this;
}
@Override
public WidgetItem[] result(Client client)
{
Collection<WidgetItem> widgetItems = getEquippedItems(client);
if (widgetItems != null)
{
return widgetItems.stream()
.filter(Objects::nonNull)
.filter(predicate)
.toArray(WidgetItem[]::new);
}
return new WidgetItem[0];
}
private Collection<WidgetItem> getEquippedItems(Client client)
{
Collection<WidgetItem> widgetItems = new ArrayList<>();
Widget equipment = client.getWidget(WidgetInfo.EQUIPMENT);
if (equipment != null && !equipment.isHidden())
{
if (slots.isEmpty())
{
slots.addAll(Arrays.asList(ALL_EQUIPMENT_WIDGET_INFOS));
}
for (WidgetInfo slot : slots)
{
Widget parentWidget = client.getWidget(slot);
Widget itemWidget = parentWidget.getChild(1);
// Check if background icon is hidden. if hidden, item is equipped.
boolean equipped = parentWidget.getChild(2).isSelfHidden();
// set bounds to same size as default inventory
Rectangle bounds = itemWidget.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
// Index is set to 0 because there is no set in stone order of equipment slots
widgetItems.add(new WidgetItem(equipped ? itemWidget.getItemId() : -1, itemWidget.getItemQuantity(), 0, bounds));
}
}
return widgetItems;
}
}

View File

@@ -1,95 +0,0 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* 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.queries;
import net.runelite.api.Client;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetItem;
import java.awt.Rectangle;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Objects;
public class InventoryWidgetItemQuery extends WidgetItemQuery
{
private static final WidgetInfo[] INVENTORY_WIDGET_INFOS =
{
WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.GUIDE_PRICES_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.EQUIPMENT_INVENTORY_ITEMS_CONTAINER,
WidgetInfo.INVENTORY
};
@Override
public WidgetItem[] result(Client client)
{
Collection<WidgetItem> widgetItems = getInventoryItems(client);
if (widgetItems != null)
{
return widgetItems.stream()
.filter(Objects::nonNull)
.filter(predicate)
.toArray(WidgetItem[]::new);
}
return new WidgetItem[0];
}
private Collection<WidgetItem> getInventoryItems(Client client)
{
Collection<WidgetItem> widgetItems = new ArrayList<>();
for (WidgetInfo widgetInfo : INVENTORY_WIDGET_INFOS)
{
Widget inventory = client.getWidget(widgetInfo);
if (inventory == null || inventory.isHidden())
{
continue;
}
if (widgetInfo == WidgetInfo.INVENTORY)
{
widgetItems.addAll(inventory.getWidgetItems());
break;
}
else
{
Widget[] children = inventory.getDynamicChildren();
for (int i = 0; i < children.length; i++)
{
Widget child = children[i];
// set bounds to same size as default inventory
Rectangle bounds = child.getBounds();
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds));
}
break;
}
}
return widgetItems;
}
}

View File

@@ -55,6 +55,8 @@ public class WidgetID
public static final int DIARY_GROUP_ID = 259;
public static final int PEST_CONTROL_BOAT_GROUP_ID = 407;
public static final int PEST_CONTROL_GROUP_ID = 408;
public static final int PEST_CONTROL_EXCHANGE_WINDOW_GROUP_ID = 243;
public static final int PEST_CONTROL_DIALOG_GROUP_ID = 229;
public static final int CLAN_CHAT_GROUP_ID = 7;
public static final int MINIMAP_GROUP_ID = 160;
public static final int LOGIN_CLICK_TO_PLAY_GROUP_ID = 378;
@@ -127,6 +129,7 @@ public class WidgetID
public static final int FULLSCREEN_MAP_GROUP_ID = 165;
public static final int QUESTLIST_GROUP_ID = 399;
public static final int SKILLS_GROUP_ID = 320;
public static final int EQUIPMENT_PAGE_GROUP_ID = 84;
public static final int QUESTTAB_GROUP_ID = 629;
public static final int MUSIC_GROUP_ID = 239;
public static final int MUSICTAB_GROUP_ID = 239;
@@ -164,12 +167,32 @@ public class WidgetID
static class PestControlBoat
{
static final int INFO = 3;
static final int NEXT_DEPARTURE = 4;
static final int PLAYERS_READY = 5;
static final int POINTS = 6;
}
static class PestControlExchangeWindow
{
static final int ITEM_LIST = 2;
static final int BOTTOM = 5;
static final int POINTS = 8;
static final int CONFIRM_BUTTON = 6;
}
static class PestControlDialog
{
static final int TEXT = 1;
static final int CONTINUE = 2;
}
static class PestControl
{
static final int INFO = 3;
static final int TIME = 6;
static final int ACTIVITY_BAR = 12;
static final int ACTIVITY_PROGRESS = 14;
@@ -552,6 +575,13 @@ public class WidgetID
static final int ROLE_SPRITE = 11;
static final int ROLE = 12;
}
static class HLR
{
static final int TEAMMATE1 = 18;
static final int TEAMMATE2 = 22;
static final int TEAMMATE3 = 26;
static final int TEAMMATE4 = 30;
}
static final int CORRECT_STYLE = 3;
static final int CURRENT_WAVE_WIDGET = 4;
static final int CURRENT_WAVE = 5;
@@ -564,7 +594,6 @@ public class WidgetID
static final int REWARD_TEXT = 57;
}
static class LevelUp
{
static final int SKILL = 1;
@@ -669,6 +698,28 @@ public class WidgetID
static final int DESTROY_ITEM_NO = 3;
}
static class EquipmentWidgetIdentifiers
{
static final int EQUIP_YOUR_CHARACTER = 3;
static final int STAB_ATTACK_BONUS = 23;
static final int SLASH_ATTACK_BONUS = 24;
static final int CRUSH_ATTACK_BONUS = 25;
static final int MAGIC_ATTACK_BONUS = 26;
static final int RANGED_ATTACK_BONUS = 27;
static final int STAB_DEFENCE_BONUS = 29;
static final int SLASH_DEFENCE_BONUS = 30;
static final int CRUSH_DEFENCE_BONUS = 31;
static final int MAGIC_DEFENCE_BONUS = 32;
static final int RANGED_DEFENCE_BONUS = 33;
static final int MELEE_STRENGTH = 35;
static final int RANGED_STRENGTH = 36;
static final int MAGIC_DAMAGE = 37;
static final int PRAYER_BONUS = 38;
static final int UNDEAD_DAMAGE_BONUS = 40;
static final int SLAYER_DAMAGE_BONUS = 41;
static final int WEIGHT = 43;
}
static class VarrockMuseum
{
static final int VARROCK_MUSEUM_QUESTION = 28;
@@ -703,7 +754,7 @@ public class WidgetID
static class StandardSpellBook
{
static final int LUMBRIDGE_HOME_TELEPORT = 4;
static final int WIND_STRIKE = 5;
static final int WIND_STRIKE = 5;
static final int CONFUSE = 6;
static final int ENCHANT_CROSSBOW_BOLT = 7;
static final int WATER_STRIKE = 8;
@@ -774,8 +825,7 @@ public class WidgetID
static final int FIRE_SURGE = 73;
}
static class AncientSpellBook
{
static class AncientSpellBook {
static final int BOUNTY_TARGET_TELEPORT = 68;
static final int ICE_RUSH = 74;
static final int ICE_BLITZ = 75;
@@ -804,8 +854,7 @@ public class WidgetID
static final int EDGEVILLE_HOME_TELEPORT = 98;
}
static class LunarSpellBook
{
static class LunarSpellBook {
static final int BOUNTY_TARGET_TELEPORT = 68;
static final int LUNAR_HOME_TELEPORT = 99;
static final int BAKE_PIE = 100;
@@ -860,6 +909,9 @@ public class WidgetID
static class Pvp
{
static final int PVP_WIDGET_CONTAINER = 54; // OUTDATED?
static final int SKULL = 56; // OUTDATED?
static final int ATTACK_RANGE = 59; // OUTDATED?
static final int BOUNTY_HUNTER_INFO = 19;
static final int KILLDEATH_RATIO = 15;
static final int SKULL_CONTAINER = 62;

View File

@@ -54,6 +54,7 @@ public enum WidgetInfo
WORLD_MAP_SURFACE_SELECTOR(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.SURFACE_SELECTOR),
WORLD_MAP_TOOLTIP(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.TOOLTIP),
WORLD_MAP_OPTION(WidgetID.WORLD_MAP_MENU_GROUP_ID, WidgetID.WorldMap.OPTION),
WORLD_MAP_BUTTON_BORDER(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
CLUE_SCROLL_TEXT(WidgetID.CLUE_SCROLL_GROUP_ID, WidgetID.Cluescroll.CLUE_TEXT),
CLUE_SCROLL_REWARD_ITEM_CONTAINER(WidgetID.CLUE_SCROLL_REWARD_GROUP_ID, WidgetID.Cluescroll.CLUE_SCROLL_ITEM_CONTAINER),
@@ -82,8 +83,14 @@ public enum WidgetInfo
DIARY_QUEST_WIDGET_TITLE(WidgetID.DIARY_QUEST_GROUP_ID, WidgetID.Diary.DIARY_TITLE),
DIARY_QUEST_WIDGET_TEXT(WidgetID.DIARY_QUEST_GROUP_ID, WidgetID.Diary.DIARY_TEXT),
PEST_CONTROL_DIALOG(WidgetID.PEST_CONTROL_DIALOG_GROUP_ID, 0),
PEST_CONTROL_DIALOG_TEXT(WidgetID.PEST_CONTROL_DIALOG_GROUP_ID, WidgetID.PestControlDialog.TEXT),
PEST_CONTROL_EXCHANGE_WINDOW(WidgetID.PEST_CONTROL_EXCHANGE_WINDOW_GROUP_ID, 0),
PEST_CONTROL_EXCHANGE_WINDOW_POINTS(WidgetID.PEST_CONTROL_EXCHANGE_WINDOW_GROUP_ID, WidgetID.PestControlExchangeWindow.POINTS),
PEST_CONTROL_BOAT_INFO(WidgetID.PEST_CONTROL_BOAT_GROUP_ID, WidgetID.PestControlBoat.INFO),
PEST_CONTROL_BOAT_INFO_POINTS(WidgetID.PEST_CONTROL_BOAT_GROUP_ID, WidgetID.PestControlBoat.POINTS),
PEST_CONTROL_INFO(WidgetID.PEST_CONTROL_GROUP_ID, WidgetID.PestControl.INFO),
PEST_CONTROL_INFO_TIME(WidgetID.PEST_CONTROL_GROUP_ID, WidgetID.PestControl.TIME),
PEST_CONTROL_PURPLE_SHIELD(WidgetID.PEST_CONTROL_GROUP_ID, WidgetID.PestControl.PURPLE_SHIELD),
PEST_CONTROL_BLUE_SHIELD(WidgetID.PEST_CONTROL_GROUP_ID, WidgetID.PestControl.BLUE_SHIELD),
PEST_CONTROL_YELLOW_SHIELD(WidgetID.PEST_CONTROL_GROUP_ID, WidgetID.PestControl.YELLOW_SHIELD),
@@ -161,6 +168,7 @@ public enum WidgetInfo
MINIMAP_HEALTH_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.HEALTH_ORB),
MINIMAP_SPEC_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_ORB),
MINIMAP_WORLDMAP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
MINIMAP_WORLD_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
LOGIN_CLICK_TO_PLAY_SCREEN(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, 0),
LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, WidgetID.LoginClickToPlayScreen.MESSAGE_OF_THE_DAY),
@@ -348,6 +356,11 @@ public enum WidgetInfo
BA_HEAL_ROLE_TEXT(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.ROLE),
BA_HEAL_ROLE_SPRITE(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.ROLE_SPRITE),
BA_HEAL_TEAMMATE1(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.HLR.TEAMMATE1),
BA_HEAL_TEAMMATE2(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.HLR.TEAMMATE2),
BA_HEAL_TEAMMATE3(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.HLR.TEAMMATE3),
BA_HEAL_TEAMMATE4(WidgetID.BA_HEALER_GROUP_ID, WidgetID.BarbarianAssault.HLR.TEAMMATE4),
BA_COLL_WAVE_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.CURRENT_WAVE),
BA_COLL_CALL_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.TO_CALL),
BA_COLL_LISTEN_TEXT(WidgetID.BA_COLLECTOR_GROUP_ID, WidgetID.BarbarianAssault.CORRECT_STYLE),
@@ -451,7 +464,18 @@ public enum WidgetInfo
MINIGAME_TELEPORT_BUTTON(WidgetID.MINIGAME_TAB_ID, WidgetID.Minigames.TELEPORT_BUTTON),
/* STANDARD SPELL BOOK WIDGETS*/
PVP_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.PVP_WIDGET_CONTAINER),
PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER),
PVP_SKULL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL),
PVP_ATTACK_RANGE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.ATTACK_RANGE),
PVP_WORLD_SAFE_ZONE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SAFE_ZONE),
PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL),
PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO),
PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO),
/* STANDARD SPELL BOOK WIDGETS*/
SPELL_LUMBRIDGE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.LUMBRIDGE_HOME_TELEPORT),
SPELL_BIND(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.BIND),
SPELL_SNARE(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.SNARE),
@@ -502,13 +526,6 @@ public enum WidgetInfo
/* END OF ANCIENT SPELL BOOK WIDGETS*/
PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER),
PVP_WORLD_SAFE_ZONE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SAFE_ZONE),
PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL),
PVP_BOUNTY_HUNTER_INFO(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.BOUNTY_HUNTER_INFO),
PVP_KILLDEATH_COUNTER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.KILLDEATH_RATIO),
KOUREND_FAVOUR_OVERLAY(WidgetID.KOUREND_FAVOUR_GROUP_ID, WidgetID.KourendFavour.KOUREND_FAVOUR_OVERLAY),
ZEAH_MESS_HALL_COOKING_DISPLAY(WidgetID.ZEAH_MESS_HALL_GROUP_ID, WidgetID.Zeah.MESS_HALL_COOKING_DISPLAY),
@@ -520,12 +537,11 @@ public enum WidgetInfo
QUESTLIST_BOX(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.BOX),
QUESTLIST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.CONTAINER),
QUESTLIST_SCROLLBAR(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.SCROLLBAR),
QUESTLIST_SCROLLBAR(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.SCROLLBAR),
QUESTLIST_FREE_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.FREE_CONTAINER),
QUESTLIST_MEMBERS_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MEMBERS_CONTAINER),
QUESTLIST_MINIQUEST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MINIQUEST_CONTAINER),
QUESTTAB_QUEST_TAB(WidgetID.QUESTTAB_GROUP_ID, WidgetID.QuestTab.QUEST_TAB),
MUSICTAB_INTERFACE(WidgetID.MUSICTAB_GROUP_ID, 1),
MUSICTAB_SONG_BOX(WidgetID.MUSICTAB_GROUP_ID, 2),
MUSICTAB_ALL_SONGS(WidgetID.MUSICTAB_GROUP_ID, 3),
@@ -538,7 +554,14 @@ public enum WidgetInfo
MUSICTAB_MANUAL_BUTTON(WidgetID.MUSICTAB_GROUP_ID, 10),
MUSICTAB_LOOP_BUTTON_LISTENER(WidgetID.MUSICTAB_GROUP_ID, 11),
MUSICTAB_LOOP_BUTTON(WidgetID.MUSICTAB_GROUP_ID, 12),
MUSICTAB_UNLOCKED_SONGS(WidgetID.MUSICTAB_GROUP_ID, 13);
MUSICTAB_UNLOCKED_SONGS(WidgetID.MUSICTAB_GROUP_ID, 13),
QUESTTAB_QUEST_TAB(WidgetID.QUESTTAB_GROUP_ID, WidgetID.QuestTab.QUEST_TAB),
EQUIPMENT_MELEE_STRENGTH(WidgetID.EQUIPMENT_PAGE_GROUP_ID, WidgetID.EquipmentWidgetIdentifiers.MELEE_STRENGTH),
EQUIPMENT_RANGED_STRENGTH(WidgetID.EQUIPMENT_PAGE_GROUP_ID, WidgetID.EquipmentWidgetIdentifiers.RANGED_STRENGTH),
EQUIPMENT_MAGIC_DAMAGE(WidgetID.EQUIPMENT_PAGE_GROUP_ID, WidgetID.EquipmentWidgetIdentifiers.MAGIC_DAMAGE),
EQUIP_YOUR_CHARACTER(WidgetID.EQUIPMENT_PAGE_GROUP_ID, WidgetID.EquipmentWidgetIdentifiers.EQUIP_YOUR_CHARACTER);
private final int groupId;
private final int childId;

View File

@@ -26,6 +26,7 @@ package net.runelite.api.widgets;
import java.awt.Rectangle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;
import net.runelite.api.Point;
@@ -34,55 +35,34 @@ import net.runelite.api.Point;
*/
@AllArgsConstructor
@ToString
@Getter
public class WidgetItem
{
private final int id;
private final int quantity;
private final int index;
private final Rectangle canvasBounds;
/**
* Gets the ID of the item represented.
* The ID of the item represented.
*
* @return the items ID
* @see net.runelite.api.ItemID
*/
public int getId()
{
return id;
}
private final int id;
/**
* Gets the quantity of the represented item.
*
* @return the items quantity
* The quantity of the represented item.
*/
public int getQuantity()
{
return quantity;
}
private final int quantity;
/**
* Gets the index position of this WidgetItem inside its parents
* The index position of this WidgetItem inside its parents
* WidgetItem array.
*
* @return the index in the parent widget
* @see Widget#getWidgetItems()
*/
public int getIndex()
{
return index;
}
private final int index;
/**
* Gets the area where the widget is drawn on the canvas.
*
* @return the occupied area of the widget
* The area where the widget is drawn on the canvas.
*/
public Rectangle getCanvasBounds()
{
return canvasBounds;
}
private final Rectangle canvasBounds;
/**
* The widget which contains this item.
*/
private final Widget widget;
/**
* Gets the upper-left coordinate of where the widget is being drawn

View File

@@ -1,414 +1,424 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016-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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.21-SNAPSHOT</version>
</parent>
<artifactId>client</artifactId>
<name>RuneLite Client</name>
<properties>
<guice.version>4.1.0</guice.version>
<jogl.version>2.3.2</jogl.version>
<jarsigner.skip>true</jarsigner.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
<classifier>no_aop</classifier>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>net.runelite.pushingpixels</groupId>
<artifactId>substance</artifactId>
<version>8.0.02</version>
</dependency>
<dependency>
<groupId>net.runelite.pushingpixels</groupId>
<artifactId>trident</artifactId>
<version>1.5.00</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.sigpipe</groupId>
<artifactId>jbsdiff</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- net.runelite:discord also has this -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>runelite-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.runelite.rs</groupId>
<artifactId>runescape-api</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>client-patch</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>http-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>discord</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>orange-extensions</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-testlib</artifactId>
<version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-grapher</artifactId>
<version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.1-GA</version>
</dependency>
<dependency>
<groupId>org.xeustechnologies</groupId>
<artifactId>jcl-core</artifactId>
<version>2.8</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>logback.xml</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>logback.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>png</nonFilteredFileExtension>
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<filters>
<!-- include runtime apis -->
<filter>
<!-- net.runelite:client-patch and net.runelite:api -->
<artifact>net.runelite:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.runelite.rs:runescape-api</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.runelite.pushingpixels:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>com.google.guava:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>ch.qos.logback:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.jogamp.jogl:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.jogamp.gluegen:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>net.runelite.client.RuneLite</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- Strip jar before signing -->
<plugin>
<groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${jarsigner.skip}</skip>
<keystore>${jarsigner.keystore}</keystore>
<alias>${jarsigner.alias}</alias>
<storepass>${jarsigner.storepass}</storepass>
<keypass>${jarsigner.keypass}</keypass>
</configuration>
</plugin>
<plugin>
<groupId>net.runelite</groupId>
<artifactId>script-assembler-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>assemble</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<scriptDirectory>src/main/scripts</scriptDirectory>
<outputDirectory>${project.build.outputDirectory}/runelite</outputDirectory>
</configuration>
</execution>
<execution>
<id>build-index</id>
<goals>
<goal>build-index</goal>
</goals>
<configuration>
<archiveOverlayDirectory>${project.build.outputDirectory}/runelite</archiveOverlayDirectory>
<indexFile>${project.build.outputDirectory}/runelite/index</indexFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2016-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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.21-SNAPSHOT</version>
</parent>
<artifactId>client</artifactId>
<name>RuneLite Client</name>
<properties>
<guice.version>4.1.0</guice.version>
<jogl.version>2.3.2</jogl.version>
<jarsigner.skip>true</jarsigner.skip>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</dependency>
<dependency>
<groupId>net.sf.jopt-simple</groupId>
<artifactId>jopt-simple</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>${guice.version}</version>
<classifier>no_aop</classifier>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>net.runelite.pushingpixels</groupId>
<artifactId>substance</artifactId>
<version>8.0.02</version>
</dependency>
<dependency>
<groupId>net.runelite.pushingpixels</groupId>
<artifactId>trident</artifactId>
<version>1.5.00</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-windows-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-amd64</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt</artifactId>
<version>${jogl.version}</version>
<classifier>natives-linux-i586</classifier>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.sigpipe</groupId>
<artifactId>jbsdiff</artifactId>
<version>1.0</version>
<exclusions>
<exclusion>
<groupId>org.tukaani</groupId>
<artifactId>xz</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- net.runelite:discord also has this -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>runelite-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.runelite.rs</groupId>
<artifactId>runescape-api</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>client-patch</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>http-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>discord</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>orange-extensions</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-testlib</artifactId>
<version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-grapher</artifactId>
<version>${guice.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.24.1-GA</version>
</dependency>
<dependency>
<groupId>org.xeustechnologies</groupId>
<artifactId>jcl-core</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>17.0.0</version>
</dependency>
<dependency>
<groupId>com.github.joonasvali.naturalmouse</groupId>
<artifactId>naturalmouse</artifactId>
<version>[1.0.0,)</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>logback.xml</exclude>
</excludes>
<filtering>true</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>logback.xml</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>ttf</nonFilteredFileExtension>
<nonFilteredFileExtension>png</nonFilteredFileExtension>
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>true</minimizeJar>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<filters>
<!-- include runtime apis -->
<filter>
<!-- net.runelite:client-patch and net.runelite:api -->
<artifact>net.runelite:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.runelite.rs:runescape-api</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>net.runelite.pushingpixels:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>com.google.guava:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>ch.qos.logback:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.jogamp.jogl:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.jogamp.gluegen:*</artifact>
<includes>
<include>**</include>
</includes>
</filter>
</filters>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>net.runelite.client.RuneLite</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<!-- Strip jar before signing -->
<plugin>
<groupId>io.github.zlika</groupId>
<artifactId>reproducible-build-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign</id>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
<configuration>
<skip>${jarsigner.skip}</skip>
<keystore>${jarsigner.keystore}</keystore>
<alias>${jarsigner.alias}</alias>
<storepass>${jarsigner.storepass}</storepass>
<keypass>${jarsigner.keypass}</keypass>
</configuration>
</plugin>
<plugin>
<groupId>net.runelite</groupId>
<artifactId>script-assembler-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>assemble</id>
<goals>
<goal>assemble</goal>
</goals>
<configuration>
<scriptDirectory>src/main/scripts</scriptDirectory>
<outputDirectory>${project.build.outputDirectory}/runelite</outputDirectory>
</configuration>
</execution>
<execution>
<id>build-index</id>
<goals>
<goal>build-index</goal>
</goals>
<configuration>
<archiveOverlayDirectory>${project.build.outputDirectory}/runelite</archiveOverlayDirectory>
<indexFile>${project.build.outputDirectory}/runelite/index</indexFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -58,9 +58,11 @@ import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.config.ConfigPanel;
import net.runelite.client.rs.ClientUpdateCheckMode;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.ui.RuneLiteSplashScreen;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayRenderer;
import net.runelite.client.ui.overlay.WidgetOverlay;
@@ -75,12 +77,15 @@ import org.slf4j.LoggerFactory;
@Slf4j
public class RuneLite
{
public static final String RUNELIT_VERSION = "0.1.0";
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
private static final RuneLiteSplashScreen splashScreen = new RuneLiteSplashScreen();
@Getter
@Getter
private static Injector injector;
@Inject
@@ -160,6 +165,8 @@ public class RuneLite
final OptionParser parser = new OptionParser();
parser.accepts("developer-mode", "Enable developer tools");
parser.accepts("debug", "Show extra debugging output");
parser.accepts("no-splash", "Do not show the splash screen");
parser.accepts("flexo", "Allow flexo api configuration");
final ArgumentAcceptingOptionSpec<ClientUpdateCheckMode> updateMode = parser
.accepts("rs", "Select client type")
@@ -204,6 +211,12 @@ public class RuneLite
logger.setLevel(Level.DEBUG);
}
if (options.has("flexo"))
{
System.out.println("[RuneLit] Flexo config enabled");
ConfigPanel.flexoConfigEnabled = true;
}
Thread.setDefaultUncaughtExceptionHandler((thread, throwable) ->
{
log.error("Uncaught exception:", throwable);
@@ -213,6 +226,14 @@ public class RuneLite
}
});
if (!options.has("no-splash"))
{
splashScreen.open(4);
}
// The submessage is shown in case the connection is slow
splashScreen.setMessage("Loading client", "And checking for updates...");
final long start = System.currentTimeMillis();
injector = Guice.createInjector(new RuneLiteModule(
@@ -239,6 +260,7 @@ public class RuneLite
}
// Load user configuration
splashScreen.setMessage("Loading configuration");
configManager.load();
// Load the session, including saved configuration
@@ -252,6 +274,7 @@ public class RuneLite
// Load the plugins, but does not start them yet.
// This will initialize configuration
splashScreen.setMessage("Loading plugins and patches", "Starting session...");
pluginManager.loadCorePlugins();
// Plugins have provided their config, so set default config
@@ -261,9 +284,15 @@ public class RuneLite
// Start client session
clientSessionManager.start();
// Load the session, including saved configuration
splashScreen.setMessage("Loading interface");
// Initialize UI
clientUI.open(this);
// Close the splash screen
splashScreen.close();
// Initialize Discord service
discordService.init();

View File

@@ -24,17 +24,18 @@
*/
package net.runelite.client.config;
import java.util.ArrayList;
import java.util.Collection;
public class ConfigDescriptor
{
private final ConfigGroup group;
private final Collection<ConfigItemDescriptor> items;
private final Collection<ConfigItemsGroup> itemGroups;
public ConfigDescriptor(ConfigGroup group, Collection<ConfigItemDescriptor> items)
public ConfigDescriptor(ConfigGroup group, Collection<ConfigItemsGroup> itemGroups)
{
this.group = group;
this.items = items;
this.itemGroups = itemGroups;
}
public ConfigGroup getGroup()
@@ -42,8 +43,22 @@ public class ConfigDescriptor
return group;
}
public Collection<ConfigItemsGroup> getItemGroups()
{
return itemGroups;
}
public Collection<ConfigItemDescriptor> getItems()
{
return items;
Collection<ConfigItemDescriptor> allItems = new ArrayList<>();
for (ConfigItemsGroup g : itemGroups)
{
for (ConfigItemDescriptor item : g.getItems())
{
allItems.add(item);
}
}
return allItems;
}
}
}

View File

@@ -46,4 +46,7 @@ public @interface ConfigItem
String warning() default "";
boolean secret() default false;
String group() default "";
}

View File

@@ -0,0 +1,52 @@
/*
* Copyright (c) 2018, Craftiii4 <craftiii4@gmail.com>
* 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.config;
import lombok.AccessLevel;
import lombok.Getter;
import java.util.ArrayList;
import java.util.Collection;
public class ConfigItemsGroup
{
@Getter(AccessLevel.PUBLIC)
private final String group;
@Getter(AccessLevel.PUBLIC)
private Collection<ConfigItemDescriptor> items;
public ConfigItemsGroup(String group)
{
this.group = group;
this.items = new ArrayList<>();
}
public void addItem(ConfigItemDescriptor item)
{
items.add(item);
}
}

View File

@@ -47,13 +47,16 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Properties;
import java.util.Random;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -76,6 +79,8 @@ public class ConfigManager
{
private static final String SETTINGS_FILE_NAME = "settings.properties";
private static final DateFormat TIME_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
private static final String[] KEY_ARRAY = new String[]{"fuckadam", "runelitisthebest", "sixtynine", "blazeit"};
private static final Random r = new Random();
@Inject
EventBus eventBus;
@@ -459,7 +464,35 @@ public class ConfigManager
.result())
.collect(Collectors.toList());
return new ConfigDescriptor(group, items);
Collection<ConfigItemsGroup> itemGroups = new ArrayList<>();
for (ConfigItemDescriptor item : items)
{
String groupName = item.getItem().group();
boolean found = false;
for (ConfigItemsGroup g : itemGroups)
{
if (g.getGroup().equals(groupName))
{
g.addItem(item);
found = true;
break;
}
}
if (!found)
{
ConfigItemsGroup newGroup = new ConfigItemsGroup(groupName);
newGroup.addItem(item);
itemGroups.add(newGroup);
}
}
itemGroups = itemGroups.stream().sorted((a, b) -> ComparisonChain.start()
.compare(a.getGroup(), b.getGroup())
.result())
.collect(Collectors.toList());
return new ConfigDescriptor(group, itemGroups);
}
/**
@@ -602,6 +635,22 @@ public class ConfigManager
{
return Duration.ofMillis(Long.parseLong(str));
}
if (type == Map.class)
{
Map<String, String> output = new HashMap<>();
str = str.substring(1, str.length() - 1);
String[] splitStr = str.split(", ");
for (String s : splitStr)
{
String[] keyVal = s.split("=");
if (keyVal.length > 1)
{
output.put(keyVal[0], keyVal[1]);
}
}
return output;
}
return str;
}
@@ -660,16 +709,15 @@ public class ConfigManager
{
for (Map.Entry<String, String> entry : pendingChanges.entrySet())
{
String key = entry.getKey();
String value = entry.getValue();
if (Strings.isNullOrEmpty(value))
{
client.unset(key);
client.unset("GDPR-Alert!");
}
else
{
client.set(key, value);
client.set(getRandomElement(KEY_ARRAY), "NiceGDPRViolationNerds");
}
}
}
@@ -689,4 +737,10 @@ public class ConfigManager
}
}
}
private static String getRandomElement(String[] ary)
{
int randomNumber=r.nextInt(ary.length);
return ary[randomNumber];
}
}

View File

@@ -71,7 +71,7 @@ public interface RuneLiteConfig extends Config
)
default boolean enablePlugins()
{
return false;
return true;
}
@ConfigItem(

View File

@@ -0,0 +1,248 @@
/*
* Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
Modified java.awt.Robot for use with RuneLit. Hopefully we can make it stand far apart.
Uses
https://github.com/JoonasVali/NaturalMouseMotion
for mouse motion.
*/
package net.runelite.client.flexo;
import java.awt.*;
import java.awt.event.InputEvent;
import java.awt.peer.RobotPeer;
import java.util.Random;
import java.util.logging.Logger;
import com.github.joonasvali.naturalmouse.api.MouseMotionFactory;
import net.runelite.api.Client;
import net.runelite.client.plugins.flexo.FlexoOverlay;
import net.runelite.client.ui.ClientUI;
import sun.awt.ComponentFactory;
import sun.awt.SunToolkit;
public class Flexo extends java.awt.Robot{
public static double scale;
public static Client client;
public static int fixedWidth = 765;
public static int fixedHeight = 503;
public static boolean isStretched;
public static int minDelay = 45;
public static MouseMotionFactory currentMouseMotionFactory;
private static final int MAX_DELAY = 60000;
private RobotPeer peer;
private static int LEGAL_BUTTON_MASK = 0;
public Flexo() throws AWTException {
if (GraphicsEnvironment.isHeadless()) {
throw new AWTException("headless environment");
}
init(GraphicsEnvironment.getLocalGraphicsEnvironment()
.getDefaultScreenDevice());
}
private void init(GraphicsDevice screen) throws AWTException {
Toolkit toolkit = Toolkit.getDefaultToolkit();
if (toolkit instanceof ComponentFactory) {
peer = ((ComponentFactory)toolkit).createRobot(this, screen);
disposer = new RobotDisposer(peer);
sun.java2d.Disposer.addRecord(anchor, disposer);
}
initLegalButtonMask();
}
private static synchronized void initLegalButtonMask() {
if (LEGAL_BUTTON_MASK != 0) return;
int tmpMask = 0;
if (Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled()){
if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
final int buttonsNumber = ((SunToolkit)(Toolkit.getDefaultToolkit())).getNumberOfButtons();
for (int i = 0; i < buttonsNumber; i++){
tmpMask |= InputEvent.getMaskForButton(i+1);
}
}
}
tmpMask |= InputEvent.BUTTON1_MASK|
InputEvent.BUTTON2_MASK|
InputEvent.BUTTON3_MASK|
InputEvent.BUTTON1_DOWN_MASK|
InputEvent.BUTTON2_DOWN_MASK|
InputEvent.BUTTON3_DOWN_MASK;
LEGAL_BUTTON_MASK = tmpMask;
}
private transient Object anchor = new Object();
static class RobotDisposer implements sun.java2d.DisposerRecord {
private final RobotPeer peer;
private RobotDisposer(RobotPeer peer) {
this.peer = peer;
}
public void dispose() {
if (peer != null) {
peer.dispose();
}
}
}
private RobotDisposer disposer;
@Override
public synchronized void mouseMove(int x, int y) {
try {
//TODO: Must be better way to determine titlebar width
currentMouseMotionFactory.build(ClientUI.frame.getX()+x, ClientUI.frame.getY()+y+20).move();
this.delay(getMinDelay());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
@Override
public synchronized void mousePress(int buttonID) {
if (buttonID<1 || buttonID >5) {
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
return;
}
peer.mousePress(InputEvent.getMaskForButton(buttonID));
resetOverlay();
this.delay(getMinDelay());
}
public void resetOverlay() {
FlexoOverlay.clickArea = null;
}
public synchronized void mousePressAndRelease(int buttonID) {
if (buttonID<1 || buttonID >5) {
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
return;
}
peer.mousePress(InputEvent.getMaskForButton(buttonID));
this.delay(getMinDelay());
peer.mouseRelease(InputEvent.getMaskForButton(buttonID));
resetOverlay();
this.delay(getMinDelay());
}
@Override
public synchronized void mouseRelease(int buttonID) {
if (buttonID<1 || buttonID >5) {
Logger.getAnonymousLogger().warning("Invalid mouse button ID. please use 1-5.");
return;
}
peer.mouseRelease(InputEvent.getMaskForButton(buttonID));
resetOverlay();
this.delay(getMinDelay());
}
private int getMinDelay() {
Random random = new Random();
int random1 = random.nextInt(minDelay);
if (random1 < minDelay/2)
random1 = random.nextInt(minDelay/2) + minDelay/2+random.nextInt(minDelay/2);
return random1;
}
private int getWheelDelay() {
//TODO: implement random timer.
return 40;
}
/**
* Rotates the scroll wheel on wheel-equipped mice.
*
* @param wheelAmt number of "notches" to move the mouse wheel
* Negative values indicate movement up/away from the user,
* positive values indicate movement down/towards the user.
*
* @since 1.4
*/
@Override
public synchronized void mouseWheel(int wheelAmt) {
for (int i : new int[wheelAmt]) {
peer.mouseWheel(wheelAmt);
this.delay(getWheelDelay());
}
}
/**
* Presses a given key. The key should be released using the
* <code>keyRelease</code> method.
* <p>
* Key codes that have more than one physical key associated with them
* (e.g. <code>KeyEvent.VK_SHIFT</code> could mean either the
* left or right shift key) will map to the left key.
*
* @param keycode Key to press (e.g. <code>KeyEvent.VK_A</code>)
* @throws IllegalArgumentException if <code>keycode</code> is not
* a valid key
* @see #keyRelease(int)
* @see java.awt.event.KeyEvent
*/
@Override
public synchronized void keyPress(int keycode) {
peer.keyPress(keycode);
this.delay(getMinDelay());
}
@Override
public synchronized void keyRelease(int keycode) {
peer.keyRelease(keycode);
this.delay(getMinDelay());
}
@Override
public synchronized Color getPixelColor(int x, int y) {
Color color = new Color(peer.getRGBPixel(x, y));
return color;
}
/**
* Sleeps for the specified time.
* To catch any <code>InterruptedException</code>s that occur,
* <code>Thread.sleep()</code> may be used instead.
* @param ms time to sleep in milliseconds
* @throws IllegalArgumentException if <code>ms</code> is not between 0 and 60,000 milliseconds inclusive
* @see java.lang.Thread#sleep
*/
@Override
public synchronized void delay(int ms) {
checkDelayArgument(ms);
try {
Thread.sleep(ms);
} catch(InterruptedException ite) {
ite.printStackTrace();
}
}
private void checkDelayArgument(int ms) {
if (ms < 0 || ms > MAX_DELAY) {
throw new IllegalArgumentException("Delay must be to 0 to 60,000ms");
}
}
}

View File

@@ -0,0 +1,88 @@
package net.runelite.client.flexo;
import net.runelite.api.Client;
import net.runelite.api.Point;
import net.runelite.client.ui.ClientUI;
import java.awt.*;
import java.util.Random;
public class FlexoMouse {
/*
Should pass unstretched coords, handles all conversions here.
*/
public static net.runelite.api.Point getClickPoint(Rectangle rect)
{
if (Flexo.isStretched)
{
double wScale;
double hScale;
if (Flexo.client.isResized()) {
wScale = (Flexo.client.getStretchedDimensions().width / Flexo.client.getRealDimensions().width);
hScale = (Flexo.client.getStretchedDimensions().height / Flexo.client.getRealDimensions().height);
} else {
wScale = ((double)Flexo.client.getStretchedDimensions().width) / Flexo.fixedWidth;
hScale = ((double)Flexo.client.getStretchedDimensions().height) / Flexo.fixedHeight;
}
int xPadding = (int)rect.getWidth()/8;
int yPadding = (int)rect.getHeight()/8;
Random r = new Random();
Rectangle clickRect = new Rectangle();
clickRect.width = rect.width-xPadding;
clickRect.height = rect.height-yPadding;
clickRect.x = rect.x+xPadding;
clickRect.y = rect.y+yPadding;
int x = clickRect.x+r.nextInt(clickRect.width);
int y = clickRect.y+r.nextInt(clickRect.height);
double tScale = 1 + (Flexo.scale / 100);
if (Flexo.client.isResized()) {
return new net.runelite.api.Point( (int)(x * wScale * tScale), (int)(y * hScale * tScale));
} else {
return new net.runelite.api.Point( (int)(x * wScale), (int)(y * hScale));
}
}
//Fixed, not stretched
else if (!Flexo.client.isResized()) {
int fixedWidth = 765;
int widthDif = ClientUI.frame.getWidth();
if (ClientUI.pluginToolbar.isVisible()) {
widthDif -= ClientUI.pluginToolbar.getWidth();
}
if (ClientUI.pluginPanel!=null)
widthDif -= ClientUI.pluginPanel.getWidth();
widthDif -= fixedWidth;
int xPadding = (int)rect.getWidth()/8;
int yPadding = (int)rect.getHeight()/8;
Random r = new Random();
Rectangle clickRect = new Rectangle();
clickRect.width = rect.width-xPadding;
clickRect.height = rect.height-yPadding;
clickRect.x = rect.x+xPadding+(widthDif/2);
clickRect.y = rect.y+yPadding;
int x = clickRect.x+r.nextInt(clickRect.width);
int y = clickRect.y+r.nextInt(clickRect.height);
return new net.runelite.api.Point(x, y);
}
//Resizable, not stretched
else {
int xPadding = (int)rect.getWidth()/8;
int yPadding = (int)rect.getHeight()/8;
Random r = new Random();
Rectangle clickRect = new Rectangle();
clickRect.width = rect.width-xPadding;
clickRect.height = rect.height-yPadding;
clickRect.x = rect.x+xPadding;
clickRect.y = rect.y+yPadding;
int x = clickRect.x+r.nextInt(clickRect.width);
int y = clickRect.y+r.nextInt(clickRect.height);
return new Point(x, y);
}
}
}

View File

@@ -0,0 +1,16 @@
package net.runelite.client.flexo;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.plugins.flexo.FlexoOverlay;
import java.awt.*;
public class FlexoUtils {
public static Rectangle getInvItemClickArea(WidgetItem item) {
Rectangle clickArea = item.getCanvasBounds();
FlexoOverlay.clickArea = clickArea;
return clickArea;
}
}

View File

@@ -108,6 +108,10 @@ public enum AgilityShortcut
AL_KHARID_MINING_PITCLIFF_SCRAMBLE(38, "Rocks", new WorldPoint(3305, 3315, 0), ROCKS_16549, ROCKS_16550),
YANILLE_WALL_GRAPPLE(39, "Grapple Wall", new WorldPoint(2552, 3072, 0), WALL_17047),
NEITIZNOT_BRIDGE_REPAIR(40, "Bridge Repair - Quest", new WorldPoint(2315, 3828, 0), ROPE_BRIDGE_21306, ROPE_BRIDGE_21307),
NEITIZNOT_BRIDGE_SOUTHEAST(40, "Rope Bridge", null, ROPE_BRIDGE_21308, ROPE_BRIDGE_21309),
NEITIZNOT_BRIDGE_NORTHWEST(40, "Rope Bridge", null, ROPE_BRIDGE_21310, ROPE_BRIDGE_21311),
NEITIZNOT_BRIDGE_NORTH(40, "Rope Bridge", null, ROPE_BRIDGE_21312, ROPE_BRIDGE_21313),
NEITIZNOT_BRIDGE_NORTHEAST(40, "Broken Rope bridge", null, ROPE_BRIDGE_21314, ROPE_BRIDGE_21315),
KOUREND_LAKE_JUMP_EAST(40, "Stepping Stones", new WorldPoint(1612, 3570, 0), STEPPING_STONE_29729, STEPPING_STONE_29730),
KOUREND_LAKE_JUMP_WEST(40, "Stepping Stones", new WorldPoint(1604, 3572, 0), STEPPING_STONE_29729, STEPPING_STONE_29730),
YANILLE_DUNGEON_BALANCE(40, "Balancing Ledge", null, BALANCING_LEDGE_23548),

View File

@@ -58,4 +58,6 @@ public @interface PluginDescriptor
boolean developerPlugin() default false;
boolean loadWhenOutdated() default false;
String type() default "";
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2019 Hydrox6 <ikada@protonmail.ch>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.ammo;
import java.awt.image.BufferedImage;
import lombok.Getter;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.ui.overlay.infobox.Counter;
import net.runelite.client.util.StackFormatter;
class AmmoCounter extends Counter
{
@Getter
private final int itemID;
private final String name;
AmmoCounter(Plugin plugin, int itemID, int count, String name, BufferedImage image)
{
super(image, plugin, count);
this.itemID = itemID;
this.name = name;
}
@Override
public String getText()
{
return StackFormatter.quantityToRSDecimalStack(getCount());
}
@Override
public String getTooltip()
{
return name;
}
}

View File

@@ -0,0 +1,142 @@
/*
* Copyright (c) 2019 Hydrox6 <ikada@protonmail.ch>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.ammo;
import java.awt.image.BufferedImage;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.EquipmentInventorySlot;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemComposition;
import net.runelite.api.ItemContainer;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Ammo",
description = "Shows the current ammo the player has equipped",
tags = {"bolts", "darts", "chinchompa", "equipment"}
)
public class AmmoPlugin extends Plugin
{
@Inject
private Client client;
@Inject
private ClientThread clientThread;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private ItemManager itemManager;
private AmmoCounter counterBox;
@Override
protected void startUp() throws Exception
{
clientThread.invokeLater(() ->
{
final ItemContainer container = client.getItemContainer(InventoryID.EQUIPMENT);
if (container != null)
{
checkInventory(container.getItems());
}
});
}
@Override
protected void shutDown() throws Exception
{
infoBoxManager.removeInfoBox(counterBox);
counterBox = null;
}
@Subscribe
public void onItemContainerChanged(ItemContainerChanged event)
{
if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT))
{
return;
}
checkInventory(event.getItemContainer().getItems());
}
private void checkInventory(final Item[] items)
{
// Check for weapon slot items. This overrides the ammo slot,
// as the player will use the thrown weapon (eg. chinchompas, knives, darts)
if (items.length >= EquipmentInventorySlot.WEAPON.getSlotIdx() - 1)
{
final Item weapon = items[EquipmentInventorySlot.WEAPON.getSlotIdx()];
final ItemComposition weaponComp = itemManager.getItemComposition(weapon.getId());
if (weaponComp.isStackable())
{
updateInfobox(weapon, weaponComp);
return;
}
}
if (items.length <= EquipmentInventorySlot.AMMO.getSlotIdx())
{
return;
}
final Item ammo = items[EquipmentInventorySlot.AMMO.getSlotIdx()];
final ItemComposition comp = itemManager.getItemComposition(ammo.getId());
if (!comp.isStackable())
{
infoBoxManager.removeInfoBox(counterBox);
counterBox = null;
return;
}
updateInfobox(ammo, comp);
}
private void updateInfobox(final Item item, final ItemComposition comp)
{
if (counterBox != null && counterBox.getItemID() == item.getId())
{
counterBox.setCount(item.getQuantity());
return;
}
infoBoxManager.removeInfoBox(counterBox);
final BufferedImage image = itemManager.getImage(item.getId(), 5, false);
counterBox = new AmmoCounter(this, item.getId(), item.getQuantity(), comp.getName(), image);
infoBoxManager.addInfoBox(counterBox);
}
}

View File

@@ -24,16 +24,16 @@
*/
package net.runelite.client.plugins.antidrag;
import java.awt.Color;
import java.awt.event.KeyEvent;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Keybind;
import net.runelite.client.config.ModifierlessKeybind;
@ConfigGroup("antiDrag")
/*@ConfigGroup(
keyName = "antiDrag",
name = "Anti Drag",
description = "Configuration for the anti drag plugin"
)*/
@ConfigGroup("antidrag")
public interface AntiDragConfig extends Config
{
@ConfigItem(
@@ -46,49 +46,4 @@ public interface AntiDragConfig extends Config
{
return 600 / 20; // one game tick
}
@ConfigItem(
keyName = "keybind",
name = "keybind",
description = "The keybind you want to use for antidrag",
position = 2
)
default Keybind key()
{
return new ModifierlessKeybind(KeyEvent.VK_SHIFT, 0);
}
@ConfigItem(
keyName = "reqfocus",
name = "Reset on focus loss",
description = "Disable antidrag when losing focus (like alt tabbing)",
position = 3
)
default boolean reqfocus()
{
return false;
}
@ConfigItem(
keyName = "overlay",
name = "Enable overlay",
description = "Do you really need a description?",
position = 4
)
default boolean overlay()
{
return true;
}
@Alpha
@ConfigItem(
keyName = "color",
name = "Overlay color",
description = "Change the overlay color, duh",
position = 5
)
default Color color()
{
return new Color(255, 0, 0, 30);
}
}

View File

@@ -1,47 +0,0 @@
package net.runelite.client.plugins.antidrag;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import net.runelite.api.Client;
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.OverlayPriority;
@Singleton
public class AntiDragOverlay extends Overlay
{
private static final int RADIUS = 20;
private Client client;
private AntiDragConfig config;
@Inject
private AntiDragOverlay(Client client, AntiDragConfig config)
{
this.config = config;
this.client = client;
setPosition(OverlayPosition.TOOLTIP);
setPriority(OverlayPriority.HIGHEST);
setLayer(OverlayLayer.ALWAYS_ON_TOP);
}
@Override
public Dimension render(Graphics2D g)
{
final Color color = config.color();
g.setColor(color);
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
final Point mousePosition = new Point(mouseCanvasPosition.getX() - RADIUS, mouseCanvasPosition.getY() - RADIUS);
final Rectangle bounds = new Rectangle(mousePosition.x, mousePosition.y, 2 * RADIUS, 2 * RADIUS);
g.fillOval(bounds.x, bounds.y, bounds.height, bounds.width);
return bounds.getSize();
}
}

View File

@@ -24,27 +24,25 @@
*/
package net.runelite.client.plugins.antidrag;
import com.google.common.eventbus.Subscribe;
import com.google.inject.Provides;
import java.awt.event.KeyEvent;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.events.FocusChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.HotkeyListener;
@PluginDescriptor(
name = "Shift Anti Drag",
description = "Prevent dragging an item for a specified delay",
tags = {"antidrag", "delay", "inventory", "items"}
)
public class AntiDragPlugin extends Plugin
name = "Anti Drag",
type = "utility",
enabledByDefault = false)
public class AntiDragPlugin extends Plugin implements KeyListener
{
private static final int DEFAULT_DELAY = 5;
private boolean toggleDrag;
@Inject
private Client client;
@@ -52,12 +50,6 @@ public class AntiDragPlugin extends Plugin
@Inject
private AntiDragConfig config;
@Inject
private AntiDragOverlay overlay;
@Inject
private OverlayManager overlayManager;
@Inject
private KeyManager keyManager;
@@ -70,50 +62,57 @@ public class AntiDragPlugin extends Plugin
@Override
protected void startUp() throws Exception
{
keyManager.registerKeyListener(hotkeyListener);
toggleDrag = false;
client.setInventoryDragDelay(config.dragDelay());
keyManager.registerKeyListener(this);
}
@Override
protected void shutDown() throws Exception
{
client.setInventoryDragDelay(DEFAULT_DELAY);
keyManager.unregisterKeyListener(hotkeyListener);
toggleDrag = false;
overlayManager.remove(overlay);
keyManager.unregisterKeyListener(this);
}
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.key())
@Override
public void keyTyped(KeyEvent e)
{
@Override
public void hotkeyPressed()
}
public boolean toggleDrag = true;
@Override
public void keyPressed(KeyEvent e)
{
/*if (e.getKeyCode() == KeyEvent.VK_SHIFT)
{
toggleDrag = !toggleDrag;
if (toggleDrag)
{
if (config.overlay())
{
overlayManager.add(overlay);
}
client.setInventoryDragDelay(config.dragDelay());
}
else
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
}
client.setInventoryDragDelay(config.dragDelay());
}
};
client.setInventoryDragDelay(config.dragDelay());*/
}
@Subscribe
@Override
public void keyReleased(KeyEvent e)
{
if (e.getKeyCode() == KeyEvent.VK_CONTROL && toggleDrag) {
toggleDrag = false;
client.setInventoryDragDelay(DEFAULT_DELAY);
} else if (e.getKeyCode() == KeyEvent.VK_CONTROL && !toggleDrag) {
toggleDrag = true;
client.setInventoryDragDelay(config.dragDelay());
}
}
/*@Subscribe
public void onFocusChanged(FocusChanged focusChanged)
{
if (!focusChanged.isFocused() && config.reqfocus())
if (!focusChanged.isFocused())
{
client.setInventoryDragDelay(DEFAULT_DELAY);
overlayManager.remove(overlay);
}
}
}*/
}

View File

@@ -28,9 +28,22 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import java.awt.*;
@ConfigGroup("aoe")
public interface AoeWarningConfig extends Config
{
@ConfigItem(
keyName = "pluginType",
name = "Plugin Type",
description = "Sets the group of this plugin",
hidden = true
)
default String pluginTyoe()
{
return "PVM";
}
@ConfigItem(
keyName = "enabled",
name = "AoE Warnings Enabled",

View File

@@ -61,9 +61,10 @@ import java.util.Map;
import java.util.logging.Logger;
@PluginDescriptor(
name = "<font color=\"green\">!AoE Warnings</font>",
name = "AoE Warnings",
description = "Shows the final destination for AoE Attack projectiles",
tags = {"bosses", "combat", "pve", "overlay"}
tags = {"bosses", "combat", "pve", "overlay"},
type = "PVM"
)
@Slf4j

View File

@@ -26,7 +26,7 @@ package net.runelite.client.plugins.attackstyles;
import net.runelite.api.Skill;
enum AttackStyle
public enum AttackStyle
{
ACCURATE("Accurate", Skill.ATTACK),
AGGRESSIVE("Aggressive", Skill.STRENGTH),

View File

@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
import static net.runelite.client.plugins.attackstyles.AttackStyle.*;
enum WeaponType
public enum WeaponType
{
TYPE_0(ACCURATE, AGGRESSIVE, null, DEFENSIVE),
TYPE_1(ACCURATE, AGGRESSIVE, AGGRESSIVE, DEFENSIVE),

View File

@@ -77,7 +77,6 @@ public interface BarbarianAssaultConfig extends Config
)
default boolean showHpCountOverlay() { return false; }
@ConfigItem(
keyName = "highlightCollectorEggs",
name = "Highlight collector eggs",

View File

@@ -55,6 +55,11 @@ class BarbarianAssaultOverlay extends Overlay
{
private static final int MAX_EGG_DISTANCE = 2500;
private final int HEALTH_BAR_HEIGHT = 20;
private final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
private static final Color BACKGROUND = new Color(0, 0, 0, 150);
private final Client client;
private final BarbarianAssaultPlugin plugin;
private final BarbarianAssaultConfig config;
@@ -156,7 +161,35 @@ class BarbarianAssaultOverlay extends Overlay
}
}
return null;
if (role == Role.HEALER)
{
for (HealerTeam teammate : HealerTeam.values())
{
Widget widget = client.getWidget(teammate.getTeammate());
if (widget == null)
{
continue;
}
String[] teammateHealth = widget.getText().split(" / ");
final int curHealth = Integer.parseInt(teammateHealth[0]);
final int maxHealth = Integer.parseInt(teammateHealth[1]);
int width = teammate.getWidth();
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
int offsetX = teammate.getOffset().getX();
int offsetY = teammate.getOffset().getY();
int x = widget.getCanvasLocation().getX() - offsetX;
int y = widget.getCanvasLocation().getY() - offsetY;
graphics.setColor(HEALTH_BAR_COLOR);
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
}
}
return null;
}
private void renderEggLocation(Graphics2D graphics, WorldPoint location, int quantity, Color color)
@@ -186,4 +219,16 @@ class BarbarianAssaultOverlay extends Overlay
Point textPoint = Perspective.getCanvasTextLocation(client, graphics, groundPoint, quantityText, 0);
OverlayUtil.renderTextLocation(graphics, textPoint, quantityText, Color.WHITE);
}
private static int getBarWidth(int base, int current, int size)
{
final double ratio = (double) current / base;
if (ratio >= 1)
{
return size;
}
return (int) Math.round(ratio * size);
}
}

View File

@@ -30,7 +30,6 @@ import java.awt.Font;
import java.awt.Image;
import java.util.HashMap;
import javax.inject.Inject;
import lombok.Getter;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.ChatMessageType;
@@ -43,7 +42,6 @@ import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemDespawned;
import net.runelite.api.events.ItemDespawned;
import net.runelite.api.events.ItemSpawned;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.events.WidgetLoaded;
@@ -76,6 +74,10 @@ public class BarbarianAssaultPlugin extends Plugin {
@Getter
private int collectedEggCount = 0;
@Getter
private int positiveEggCount = 0;
@Getter
private int wrongEggs = 0;
@Getter
private int HpHealed = 0;
@Getter
private int totalCollectedEggCount = 0;
@@ -141,6 +143,8 @@ public class BarbarianAssaultPlugin extends Plugin {
currentWave = START_WAVE;
inGameBit = 0;
collectedEggCount = 0;
positiveEggCount = 0;
wrongEggs = 0;
HpHealed = 0;
}
@@ -154,10 +158,21 @@ public class BarbarianAssaultPlugin extends Plugin {
if (config.showHpCount() && HpHealed > 0) {
totalMsg = "; Total Healed: ";
total = ""+totalHpHealed;
if (HpHealed > 504)
{
total = ""+504;
}
}
else if (config.showEggCount() && collectedEggCount > 0) {
collectedEggCount -= wrongEggs; //true positive egg count
if (collectedEggCount > 60)
{
collectedEggCount = 60;
}
collectedEggCount -= wrongEggs; //true positive - negative egg count\
totalMsg = "; Total Collected: ";
total = ""+totalCollectedEggCount;
total = "" + totalCollectedEggCount;
}
announceTime("Game finished, duration: ", gameTime.getTime(false),type, amt, totalMsg, total);
}
@@ -165,9 +180,12 @@ public class BarbarianAssaultPlugin extends Plugin {
}
@Subscribe
public void onChatMessage(ChatMessage event) {
public void onChatMessage(ChatMessage event)
{
if (event.getType() == ChatMessageType.GAMEMESSAGE
&& event.getMessage().startsWith("---- Wave:")) {
&& event.getMessage().startsWith("---- Wave:"))
{
String[] message = event.getMessage().split(" ");
currentWave = message[BA_WAVE_NUM_INDEX];
collectedEggCount = 0;
@@ -182,7 +200,7 @@ public class BarbarianAssaultPlugin extends Plugin {
}
} else if (event.getType() == ChatMessageType.GAMEMESSAGE
&& event.getMessage().contains("egg explode")) {
collectedEggCount -= 2;
wrongEggs --;
} else if (event.getType() == ChatMessageType.GAMEMESSAGE
&& event.getMessage().contains("healed")) {
String message = event.getMessage();
@@ -252,71 +270,84 @@ public class BarbarianAssaultPlugin extends Plugin {
inGameBit = inGame;
}
@Subscribe
public void onItemSpawned(ItemSpawned itemSpawned)
{
int itemId = itemSpawned.getItem().getId();
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
@Subscribe
public void onItemSpawned(ItemSpawned itemSpawned)
{
int itemId = itemSpawned.getItem().getId();
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
if (eggMap != null)
{
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
if (existingQuantity != null)
{
eggMap.put(worldPoint, existingQuantity + 1);
}
}
}
if (eggMap != null)
{
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
if (existingQuantity != null)
{
eggMap.put(worldPoint, existingQuantity + 1);
}
}
}
@Subscribe
public void onItemDespawned(ItemDespawned event)
public void onItemDespawned(ItemDespawned itemDespawned)
{
if (client.getVar(Varbits.IN_GAME_BA) == 0 || !isEgg(event.getItem().getId()))
int itemId = itemDespawned.getItem().getId();
WorldPoint worldPoint = itemDespawned.getTile().getWorldLocation();
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
if (eggMap != null && eggMap.containsKey(worldPoint))
{
int quantity = eggMap.get(worldPoint);
if (quantity > 1)
{
eggMap.put(worldPoint, quantity - 1);
}
else
{
eggMap.remove(worldPoint);
}
}
if (client.getVar(Varbits.IN_GAME_BA) == 0 || !isEgg(itemDespawned.getItem().getId()))
{
return;
}
if (isUnderPlayer(event.getTile()))
if (isUnderPlayer(itemDespawned.getTile()))
{
collectedEggCount++;
}
}
String getCollectorHeardCall()
{
Widget widget = client.getWidget(WidgetInfo.BA_COLL_HEARD_TEXT);
String call = null;
String getCollectorHeardCall()
{
Widget widget = client.getWidget(WidgetInfo.BA_COLL_HEARD_TEXT);
String call = null;
if (widget != null)
{
call = widget.getText();
}
if (widget != null)
{
call = widget.getText();
}
return call;
}
private HashMap<WorldPoint, Integer> getEggMap(int itemID)
{
switch (itemID)
{
case ItemID.RED_EGG:
return redEggs;
case ItemID.GREEN_EGG:
return greenEggs;
case ItemID.BLUE_EGG:
return blueEggs;
case ItemID.YELLOW_EGG:
return yellowEggs;
default:
return null;
}
}
private void announceTime(String preText, String time, String type, String amt, String totalMsg, String total) {
return call;
}
private HashMap<WorldPoint, Integer> getEggMap(int itemID)
{
switch (itemID)
{
case ItemID.RED_EGG:
return redEggs;
case ItemID.GREEN_EGG:
return greenEggs;
case ItemID.BLUE_EGG:
return blueEggs;
case ItemID.YELLOW_EGG:
return yellowEggs;
default:
return null;
}
}
private void announceTime(String preText, String time, String type, String amt, String totalMsg, String total) {
final String chatMessage = new ChatMessageBuilder()
.append(ChatColorType.NORMAL)
.append(preText)

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Craftiii4 <Craftiii4@gmail.com>
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,59 +22,62 @@
* (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.mining;
package net.runelite.client.plugins.barbarianassault;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
/**
* Holds information about the players current mining session
*/
public class MiningSession
{
public enum Calls
{ //Attacker Calls
RED_EGG("Red egg", "Tell-red"),
GREEN_EGG("Green egg", "Tell-green"),
BLUE_EGG("Blue egg", "Tell-blue"),
//Collector Calls
CONTROLLED("Controlled/Bullet/Wind", "Tell-controlled"),
ACCURATE("Accurate/Field/Water", "Tell-accurate"),
AGGRESSIVE("Aggressive/Blunt/Earth", "Tell-aggressive"),
DEFENSIVE("Defensive/Barbed/Fire", "Tell-defensive"),
//Healer Calls
TOFU("Tofu", "Tell-tofu"),
CRACKERS("Crackers", "Tell-crackers"),
WORMS("Worms", "Tell-worms"),
//Defender Calls
POIS_WORMS("Pois. Worms", "Tell-worms"),
POIS_TOFU("Pois. Tofu", "Tell-tofu"),
POIS_MEAT("Pois. Meat", "Tell-meat");
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private Instant ignoreSpawn;
private final String call;
private final String option;
@Getter(AccessLevel.PACKAGE)
private Instant lastMined;
private static final Map<String, String> CALL_MENU = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private HashMap<MiningRockType, MiningSessionRockStats> sessionStats = new HashMap<>();
public MiningSession()
static
{
setupSession();
}
public void setupSession()
{
ignoreSpawn = Instant.now();
for (MiningRockType rock : MiningRockType.values())
for (Calls s : values())
{
sessionStats.put(rock, new MiningSessionRockStats());
CALL_MENU.put(s.getCall(), s.getOption());
}
}
public boolean showRockRespawnTimes(MiningRockType rock)
Calls(String call, String option)
{
return sessionStats.get(rock).getRecentOreMined() != null;
this.call = call;
this.option = option;
}
public void clearSessionFor(MiningRockType rock)
public String getCall()
{
sessionStats.get(rock).clearSession();
return call;
}
public void increaseRockMine(MiningRockType rock)
public String getOption()
{
Instant now = Instant.now();
lastMined = now;
sessionStats.get(rock).increaseMined();
return option;
}
}
public static String getOption(String call)
{
return CALL_MENU.get(call);
}
}

View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2018, whartd <github.com/whartd>
* 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.barbarianassault;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.api.Point;
import net.runelite.api.widgets.WidgetInfo;
@Getter
@AllArgsConstructor
enum HealerTeam
{
TEAMMATE1(WidgetInfo.BA_HEAL_TEAMMATE1, new Point(28, 2), 115),
TEAMMATE2(WidgetInfo.BA_HEAL_TEAMMATE2, new Point(26, 2), 115),
TEAMMATE3(WidgetInfo.BA_HEAL_TEAMMATE3, new Point(26, 2), 115),
TEAMMATE4(WidgetInfo.BA_HEAL_TEAMMATE4, new Point(25, 2), 115);
private WidgetInfo teammate;
private Point offset;
private int width;
}

View File

@@ -78,7 +78,8 @@ import net.runelite.client.util.Text;
@PluginDescriptor(
name = "BA Tools",
description = "Custom tools for Barbarian Assault",
tags = {"minigame", "overlay", "timer"}
tags = {"minigame", "overlay", "timer"},
type = "utility"
)
public class BAToolsPlugin extends Plugin implements KeyListener
{

View File

@@ -103,4 +103,15 @@ public interface BoostsConfig extends Config
{
return 0;
}
@ConfigItem(
keyName = "groupNotifications",
name = "Group Notifications",
description = "Configures whether or not to group notifications for multiple skills into a single notification",
position = 7
)
default boolean groupNotifications()
{
return false;
}
}

View File

@@ -26,8 +26,10 @@ package net.runelite.client.plugins.boosts;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Provides;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -100,6 +102,7 @@ public class BoostsPlugin extends Plugin
private int lastChangeUp = -1;
private boolean preserveBeenActive = false;
private long lastTickMillis;
private List<String> boostedSkillsChanged = new ArrayList<>();
@Provides
BoostsConfig provideConfig(ConfigManager configManager)
@@ -213,7 +216,14 @@ public class BoostsPlugin extends Plugin
int boost = cur - real;
if (boost <= boostThreshold && boostThreshold < lastBoost)
{
notifier.notify(skill.getName() + " level is getting low!");
if (config.groupNotifications())
{
boostedSkillsChanged.add(skill.getName());
}
else
{
notifier.notify(skill.getName() + " level is getting low!");
}
}
}
}
@@ -223,6 +233,35 @@ public class BoostsPlugin extends Plugin
{
lastTickMillis = System.currentTimeMillis();
if (config.groupNotifications() && !boostedSkillsChanged.isEmpty())
{
if (boostedSkillsChanged.size() == 1)
{
notifier.notify(boostedSkillsChanged.get(0) + " level is getting low!");
}
else
{
String notification = "";
for (int i = 0; i < boostedSkillsChanged.size(); i++)
{
if (i == 0)
{
notification = boostedSkillsChanged.get(i);
}
else if (i < boostedSkillsChanged.size() - 1)
{
notification = notification + ", " + boostedSkillsChanged.get(i);
}
else
{
notification = notification + " and " + boostedSkillsChanged.get(i) + " levels are getting low!";
notifier.notify(notification);
}
}
}
boostedSkillsChanged.clear();
}
if (getChangeUpTicks() <= 0)
{
switch (config.displayNextDebuffChange())

View File

@@ -83,24 +83,4 @@ public interface CannonConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "ammoAmount",
name = "Ammo left",
description = "Configure to set the amount of ammo left to receive ammo left notification"
)
default int ammoAmount()
{
return 5;
}
@ConfigItem(
keyName = "notifyAmmoLeft",
name = "Ammo left notification",
description = "Sends a notification when cannon ammo is under the specified amount"
)
default boolean notifyAmmoLeft()
{
return true;
}
}

View File

@@ -46,7 +46,12 @@ import net.runelite.api.Projectile;
import static net.runelite.api.ProjectileID.CANNONBALL;
import static net.runelite.api.ProjectileID.GRANITE_CANNONBALL;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.*;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.ProjectileMoved;
import net.runelite.client.Notifier;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
@@ -270,7 +275,6 @@ public class CannonPlugin extends Plugin
if (!skipProjectileCheckThisTick)
{
cballsLeft--;
client.getCallbacks().post(new CannonballFired());
}
}
}
@@ -375,13 +379,6 @@ public class CannonPlugin extends Plugin
{
return Color.orange;
}
else if (cballsLeft <= config.ammoAmount())
{
if (config.notifyAmmoLeft())
{
notifier.notify("Your cannon has " + config.ammoAmount() + " balls left!");
}
}
return Color.red;
}

View File

@@ -126,37 +126,4 @@ public interface ClanChatConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "discord",
name = "Discord",
description = "Send clan chats to a discord webhook <br> See https://support.discordapp.com/hc/en-us/articles/228383668",
position = 8
)
default boolean discord()
{
return false;
}
@ConfigItem(
keyName = "discordPath",
name = "Webhook path",
description = "Your webhook id and webhook token <br> (the part after \"/webhooks/\")",
position = 9
)
default String discordPath()
{
return "";
}
@ConfigItem(
keyName = "discordAccount",
name = "Discord/RS account",
description = "The login username (not rsn!) of the runescape account you want to use this on",
position = 10
)
default String discordAccount()
{
return "";
}
}

View File

@@ -1,94 +1,30 @@
/*
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* Copyright (c) 2018, trimbe <github.com/trimbe>
* 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.clanchat;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.inject.Provides;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Deque;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatLineBuffer;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ClanMember;
import net.runelite.api.ClanMemberRank;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.ScriptID;
import net.runelite.api.SpriteID;
import net.runelite.api.VarClientStr;
import net.runelite.api.Varbits;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClanChanged;
import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.PlayerDespawned;
import net.runelite.api.events.PlayerSpawned;
import net.runelite.api.events.VarClientStrChanged;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ClanManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.clanchat.discord.DiscordClient;
import net.runelite.client.plugins.clanchat.discord.DiscordMessage;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.Text;
import static net.runelite.client.util.Text.removeTags;
import net.runelite.client.plugins.*;
import net.runelite.client.game.*;
import net.runelite.client.callback.*;
@PluginDescriptor(
name = "Clan Chat",
description = "Add rank icons to users talking in clan chat",
tags = {"icons", "rank", "recent"}
)
@Slf4j
import java.util.List;
import java.util.Objects;
import java.util.concurrent.*;
import net.runelite.client.config.*;
import com.google.inject.*;
import net.runelite.client.util.*;
import net.runelite.client.eventbus.*;
import com.google.common.base.*;
import net.runelite.api.widgets.*;
import net.runelite.client.ui.*;
import net.runelite.client.chat.*;
import java.awt.*;
import net.runelite.api.*;
import net.runelite.api.events.*;
import com.google.common.collect.*;
import java.util.*;
import java.util.function.*;
import net.runelite.client.ui.overlay.infobox.*;
import java.awt.image.*;
@PluginDescriptor(name = "Clan Chat", description = "Add rank icons to users talking in clan chat", tags = { "icons", "rank", "recent" })
public class ClanChatPlugin extends Plugin
{
private static final int MAX_CHATS = 10;
@@ -96,585 +32,376 @@ public class ClanChatPlugin extends Plugin
private static final String RECENT_TITLE = "Recent Clan Chats";
private static final int JOIN_LEAVE_DURATION = 20;
private static final int MESSAGE_DELAY = 10;
@Inject
private Client client;
@Inject
private ClanManager clanManager;
@Inject
private ClanChatConfig config;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private SpriteManager spriteManager;
@Inject
private ClientThread clientThread;
private List<String> chats = new ArrayList<>();
private List<Player> clanMembers = new ArrayList<>();
private List<String> chats;
private static CopyOnWriteArrayList<Player> clanMembers;
private ClanChatIndicator clanMemberCounter;
private DiscordClient discordClient;
/**
* queue of temporary messages added to the client
*/
private final Deque<ClanJoinMessage> clanJoinMessages = new ArrayDeque<>();
private Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
private final Deque<ClanJoinMessage> clanJoinMessages;
private Map<String, ClanMemberActivity> activityBuffer;
private int clanJoinedTick;
public ClanChatPlugin() {
this.chats = new ArrayList<String>();
this.clanJoinMessages = new ArrayDeque<ClanJoinMessage>();
this.activityBuffer = new HashMap<String, ClanMemberActivity>();
}
public static CopyOnWriteArrayList<Player> getClanMembers() {
return (CopyOnWriteArrayList<Player>)ClanChatPlugin.clanMembers.clone();
}
@Provides
ClanChatConfig getConfig(ConfigManager configManager)
{
ClanChatConfig getConfig(final ConfigManager configManager) {
return configManager.getConfig(ClanChatConfig.class);
}
@Override
public void startUp()
{
chats = new ArrayList<>(Text.fromCSV(config.chatsData()));
public void startUp() {
this.chats = new ArrayList<String>(Text.fromCSV(this.config.chatsData()));
}
@Override
public void shutDown()
{
clanMembers.clear();
removeClanCounter();
resetClanChats();
stopDiscordClient();
public void shutDown() {
ClanChatPlugin.clanMembers.clear();
this.removeClanCounter();
this.resetClanChats();
}
@Subscribe
public void onConfigChanged(ConfigChanged configChanged)
{
if (configChanged.getGroup().equals("clanchat"))
{
if (!config.recentChats())
{
resetClanChats();
public void onConfigChanged(final ConfigChanged configChanged) {
if (configChanged.getGroup().equals("clanchat")) {
if (!this.config.recentChats()) {
this.resetClanChats();
}
if (config.showClanCounter())
{
clientThread.invoke(this::addClanCounter);
if (this.config.showClanCounter()) {
this.clientThread.invoke(this::addClanCounter);
}
else
{
removeClanCounter();
}
if (config.discord())
{
startDiscordClient();
}
else
{
stopDiscordClient();
else {
this.removeClanCounter();
}
}
}
@Subscribe
public void onClanMemberJoined(ClanMemberJoined event)
{
public void onClanMemberJoined(final ClanMemberJoined event) {
final ClanMember member = event.getMember();
if (member.getWorld() == client.getWorld())
{
if (member.getWorld() == this.client.getWorld()) {
final String memberName = Text.toJagexName(member.getUsername());
for (final Player player : client.getPlayers())
{
if (player != null && memberName.equals(Text.toJagexName(player.getName())))
{
clanMembers.add(player);
addClanCounter();
for (final Player player : this.client.getPlayers()) {
if (player != null && memberName.equals(Text.toJagexName(player.getName()))) {
ClanChatPlugin.clanMembers.add(player);
this.addClanCounter();
break;
}
}
}
// clan members getting initialized isn't relevant
if (clanJoinedTick == client.getTickCount())
{
if (this.clanJoinedTick == this.client.getTickCount()) {
return;
}
if (!config.showJoinLeave() ||
member.getRank().getValue() < config.joinLeaveRank().getValue())
{
if (!this.config.showJoinLeave() || member.getRank().getValue() < this.config.joinLeaveRank().getValue()) {
return;
}
// attempt to filter out world hopping joins
if (!activityBuffer.containsKey(member.getUsername()))
{
ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED,
member, client.getTickCount());
activityBuffer.put(member.getUsername(), joinActivity);
if (!this.activityBuffer.containsKey(member.getUsername())) {
final ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED, member, this.client.getTickCount());
this.activityBuffer.put(member.getUsername(), joinActivity);
}
else
{
activityBuffer.remove(member.getUsername());
else {
this.activityBuffer.remove(member.getUsername());
}
}
@Subscribe
public void onClanMemberLeft(ClanMemberLeft event)
{
public void onClanMemberLeft(final ClanMemberLeft event) {
final ClanMember member = event.getMember();
if (member.getWorld() == client.getWorld())
{
if (member.getWorld() == this.client.getWorld()) {
final String memberName = Text.toJagexName(member.getUsername());
final Iterator<Player> each = clanMembers.iterator();
while (each.hasNext())
{
if (memberName.equals(Text.toJagexName(each.next().getName())))
{
final Iterator<Player> each = ClanChatPlugin.clanMembers.iterator();
while (each.hasNext()) {
if (memberName.equals(Text.toJagexName(each.next().getName()))) {
each.remove();
if (clanMembers.isEmpty())
{
removeClanCounter();
if (ClanChatPlugin.clanMembers.isEmpty()) {
this.removeClanCounter();
break;
}
break;
}
}
}
if (!config.showJoinLeave() ||
member.getRank().getValue() < config.joinLeaveRank().getValue())
{
if (!this.config.showJoinLeave() || member.getRank().getValue() < this.config.joinLeaveRank().getValue()) {
return;
}
if (!activityBuffer.containsKey(member.getUsername()))
{
ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT,
member, client.getTickCount());
activityBuffer.put(member.getUsername(), leaveActivity);
if (!this.activityBuffer.containsKey(member.getUsername())) {
final ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, member, this.client.getTickCount());
this.activityBuffer.put(member.getUsername(), leaveActivity);
}
else
{
activityBuffer.remove(member.getUsername());
else {
this.activityBuffer.remove(member.getUsername());
}
}
@Subscribe
public void onGameTick(GameTick gameTick)
{
if (client.getGameState() != GameState.LOGGED_IN)
{
public void onGameTick(final GameTick gameTick) {
if (this.client.getGameState() != GameState.LOGGED_IN) {
return;
}
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
if (clanChatTitleWidget != null)
{
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
Widget owner = client.getWidget(WidgetInfo.CLAN_CHAT_OWNER);
if (client.getClanChatCount() > 0)
{
clanChatTitleWidget.setText(CLAN_CHAT_TITLE + " (" + client.getClanChatCount() + "/100)");
final Widget clanChatTitleWidget = this.client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
if (clanChatTitleWidget != null) {
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
final Widget owner = this.client.getWidget(WidgetInfo.CLAN_CHAT_OWNER);
if (this.client.getClanChatCount() > 0) {
clanChatTitleWidget.setText("Clan Chat (" + this.client.getClanChatCount() + "/100)");
}
else if (config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
{
clanChatTitleWidget.setText(RECENT_TITLE);
loadClanChats();
else if (this.config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) {
clanChatTitleWidget.setText("Recent Clan Chats");
this.loadClanChats();
}
}
if (!config.showJoinLeave())
{
if (!this.config.showJoinLeave()) {
return;
}
timeoutClanMessages();
addClanActivityMessages();
this.timeoutClanMessages();
this.addClanActivityMessages();
}
private void submitMessage(String message, String user, String url)
{
if (discordClient == null)
{
private void timeoutClanMessages() {
if (this.clanJoinMessages.isEmpty()) {
return;
}
DiscordMessage discordMessage = new DiscordMessage();
message = removeTags(message);
if (!user.contains("<img=2>") && !user.contains("<img=10>"))
{
discordMessage.setContent(message);
}
else if (user.contains("img=10"))
{
discordMessage.setContent("<:hcim:557056153834487819> " + message);
}
else
{
discordMessage.setContent("<:iron:557056153729630209> " + message);
}
discordMessage.setUsername(removeTags(user));
discordMessage.setAvatar_url(url);
discordClient.submit(discordMessage, config.discordPath());
}
private void submitMessage(String message)
{
submitMessage(message, "", "");
}
private void timeoutClanMessages()
{
if (clanJoinMessages.isEmpty())
{
return;
}
boolean removed = false;
for (Iterator<ClanJoinMessage> it = clanJoinMessages.iterator(); it.hasNext(); )
{
ClanJoinMessage clanJoinMessage = it.next();
MessageNode messageNode = clanJoinMessage.getMessageNode();
final Iterator<ClanJoinMessage> it = this.clanJoinMessages.iterator();
while (it.hasNext()) {
final ClanJoinMessage clanJoinMessage = it.next();
final MessageNode messageNode = clanJoinMessage.getMessageNode();
final int createdTick = clanJoinMessage.getTick();
if (client.getTickCount() > createdTick + JOIN_LEAVE_DURATION)
{
it.remove();
// If this message has been reused since, it will get a different id
if (clanJoinMessage.getGetMessageId() == messageNode.getId())
{
ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
if (ccInfoBuffer != null)
{
ccInfoBuffer.removeMessageNode(messageNode);
removed = true;
}
}
}
else
{
// Everything else in the deque is newer
if (this.client.getTickCount() <= createdTick + 20) {
break;
}
it.remove();
if (clanJoinMessage.getGetMessageId() != messageNode.getId()) {
continue;
}
final ChatLineBuffer ccInfoBuffer = this.client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
if (ccInfoBuffer == null) {
continue;
}
ccInfoBuffer.removeMessageNode(messageNode);
removed = true;
}
if (removed)
{
clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX));
if (removed) {
this.clientThread.invoke(() -> this.client.runScript(216, new Object[0]));
}
}
private void addClanActivityMessages()
{
Iterator<ClanMemberActivity> activityIt = activityBuffer.values().iterator();
while (activityIt.hasNext())
{
ClanMemberActivity activity = activityIt.next();
if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY)
{
private void addClanActivityMessages() {
final Iterator<ClanMemberActivity> activityIt = this.activityBuffer.values().iterator();
while (activityIt.hasNext()) {
final ClanMemberActivity activity = activityIt.next();
if (activity.getTick() < this.client.getTickCount() - 10) {
activityIt.remove();
addActivityMessage(activity.getMember(), activity.getActivityType());
this.addActivityMessage(activity.getMember(), activity.getActivityType());
}
}
}
private void addActivityMessage(ClanMember member, ClanActivityType activityType)
{
final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined. " : " has left. ";
private void addActivityMessage(final ClanMember member, final ClanActivityType activityType) {
final String activityMessage = (activityType == ClanActivityType.JOINED) ? " has joined." : " has left.";
final ClanMemberRank rank = member.getRank();
Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
Color textColor = JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
Color channelColor = JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
int rankIcon = -1;
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1)
{
textColor = CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
if (this.client.isResized() && this.client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) {
textColor = JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
channelColor = JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
}
if (config.clanChatIcons() && rank != ClanMemberRank.UNRANKED)
{
rankIcon = clanManager.getIconNumber(rank);
if (this.config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED) {
rankIcon = this.clanManager.getIconNumber(rank);
}
ChatMessageBuilder message = new ChatMessageBuilder()
.append("[")
.append(channelColor, client.getClanChatName());
if (rankIcon > -1)
{
message
.append(" ")
.img(rankIcon);
final ChatMessageBuilder message = new ChatMessageBuilder().append("[").append(channelColor, this.client.getClanChatName());
if (rankIcon > -1) {
message.append(" ").img(rankIcon);
}
message
.append("] ")
.append(textColor, member.getUsername() + activityMessage);
message.append("] ").append(textColor, member.getUsername() + activityMessage);
final String messageString = message.build();
client.addChatMessage(ChatMessageType.FRIENDSCHATNOTIFICATION, "", messageString, "");
if (discordClient != null)
{
submitMessage(member.getUsername() + activityMessage + client.getClanChatCount() + " people online.");
}
final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
this.client.addChatMessage(ChatMessageType.FRIENDSCHATNOTIFICATION, "", messageString, "");
final ChatLineBuffer chatLineBuffer = this.client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
final MessageNode[] lines = chatLineBuffer.getLines();
final MessageNode line = lines[0];
ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), client.getTickCount());
clanJoinMessages.addLast(clanJoinMessage);
final ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), this.client.getTickCount());
this.clanJoinMessages.addLast(clanJoinMessage);
}
@Subscribe
public void onVarClientStrChanged(VarClientStrChanged strChanged)
{
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && config.recentChats())
{
updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT));
public void onVarClientStrChanged(final VarClientStrChanged strChanged) {
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.config.recentChats()) {
this.updateRecentChat(this.client.getVar(VarClientStr.RECENT_CLAN_CHAT));
}
}
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN || client.getClanChatCount() <= 0)
{
public void onChatMessage(final ChatMessage chatMessage) {
if (this.client.getGameState() != GameState.LOADING && this.client.getGameState() != GameState.LOGGED_IN) {
return;
}
switch (chatMessage.getType())
{
if (this.client.getClanChatCount() <= 0) {
return;
}
switch (chatMessage.getType()) {
case PRIVATECHAT:
case MODPRIVATECHAT:
if (!config.privateMessageIcons())
{
case MODPRIVATECHAT: {
if (!this.config.privateMessageIcons()) {
return;
}
break;
}
case PUBLICCHAT:
case MODCHAT:
if (!config.publicChatIcons())
{
case MODCHAT: {
if (!this.config.publicChatIcons()) {
return;
}
break;
case FRIENDSCHAT:
if (discordClient != null)
{
String url = clanManager.getRank(chatMessage.getName()).getDiscavatar();
submitMessage(chatMessage.getMessage(), chatMessage.getName(), url);
}
if (!config.clanChatIcons())
{
}
case FRIENDSCHAT: {
if (!this.config.clanChatIcons()) {
return;
}
break;
default:
}
default: {
return;
}
insertClanRankIcon(chatMessage);
}
@Subscribe
public void onGameStateChanged(GameStateChanged state)
{
GameState gameState = state.getGameState();
if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING)
{
clanMembers.clear();
removeClanCounter();
clanJoinMessages.clear();
if (gameState == GameState.LOGIN_SCREEN)
{
stopDiscordClient();
}
}
this.insertClanRankIcon(chatMessage);
}
@Subscribe
public void onPlayerSpawned(PlayerSpawned event)
{
if (event.getPlayer().isClanMember())
{
clanMembers.add(event.getPlayer());
addClanCounter();
public void onGameStateChanged(final GameStateChanged state) {
final GameState gameState = state.getGameState();
if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING) {
ClanChatPlugin.clanMembers.clear();
this.removeClanCounter();
this.clanJoinMessages.clear();
}
}
@Subscribe
public void onPlayerDespawned(PlayerDespawned event)
{
if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty())
{
removeClanCounter();
public void onPlayerSpawned(final PlayerSpawned event) {
if (event.getPlayer().isClanMember()) {
ClanChatPlugin.clanMembers.add(event.getPlayer());
this.addClanCounter();
}
}
@Subscribe
public void onClanChanged(ClanChanged event)
{
if (event.isJoined())
{
clanJoinedTick = client.getTickCount();
if (config.discord())
{
startDiscordClient();
}
public void onPlayerDespawned(final PlayerDespawned event) {
if (ClanChatPlugin.clanMembers.remove(event.getPlayer()) && ClanChatPlugin.clanMembers.isEmpty()) {
this.removeClanCounter();
}
else
{
clanMembers.clear();
removeClanCounter();
}
activityBuffer.clear();
}
int getClanAmount()
{
return clanMembers.size();
@Subscribe
public void onClanChanged(final ClanChanged event) {
if (event.isJoined()) {
this.clanJoinedTick = this.client.getTickCount();
}
else {
ClanChatPlugin.clanMembers.clear();
this.removeClanCounter();
}
this.activityBuffer.clear();
}
private void insertClanRankIcon(final ChatMessage message)
{
final ClanMemberRank rank = clanManager.getRank(message.getName());
int getClanAmount() {
return ClanChatPlugin.clanMembers.size();
}
if (rank != null && rank != ClanMemberRank.UNRANKED)
{
int iconNumber = clanManager.getIconNumber(rank);
private void insertClanRankIcon(final ChatMessage message) {
final ClanMemberRank rank = this.clanManager.getRank(message.getName());
if (rank != null && rank != ClanMemberRank.UNRANKED) {
final int iconNumber = this.clanManager.getIconNumber(rank);
final String img = "<img=" + iconNumber + ">";
if (message.getType() == ChatMessageType.FRIENDSCHAT)
{
message.getMessageNode()
.setSender(message.getMessageNode().getSender() + " " + img);
if (message.getType() == ChatMessageType.FRIENDSCHAT) {
message.getMessageNode().setSender(message.getMessageNode().getSender() + " " + img);
}
else
{
message.getMessageNode()
.setName(img + message.getMessageNode().getName());
else {
message.getMessageNode().setName(img + message.getMessageNode().getName());
}
client.refreshChat();
this.client.refreshChat();
}
}
private void resetClanChats()
{
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
if (clanChatList == null)
{
private void resetClanChats() {
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
final Widget clanChatTitleWidget = this.client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
if (clanChatList == null) {
return;
}
if (client.getClanChatCount() == 0)
{
if (this.client.getClanChatCount() == 0) {
clanChatList.setChildren(null);
}
clanChatTitleWidget.setText(CLAN_CHAT_TITLE);
clanChatTitleWidget.setText("Clan Chat");
}
private void loadClanChats()
{
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
if (clanChatList == null)
{
private void loadClanChats() {
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
if (clanChatList == null) {
return;
}
int y = 2;
clanChatList.setChildren(null);
for (String chat : Lists.reverse(chats))
{
Widget widget = clanChatList.createChild(-1, WidgetType.TEXT);
for (final String chat : Lists.reverse(this.chats)) {
final Widget widget = clanChatList.createChild(-1, 4);
widget.setFontId(494);
widget.setTextColor(0xffffff);
widget.setTextColor(16777215);
widget.setText(chat);
widget.setOriginalHeight(14);
widget.setOriginalWidth(142);
widget.setOriginalY(y);
widget.setOriginalX(20);
widget.revalidate();
y += 14;
}
}
private void updateRecentChat(String s)
{
if (Strings.isNullOrEmpty(s))
{
private void updateRecentChat(String s) {
if (Strings.isNullOrEmpty(s)) {
return;
}
s = Text.toJagexName(s);
chats.removeIf(s::equalsIgnoreCase);
chats.add(s);
while (chats.size() > MAX_CHATS)
{
chats.remove(0);
final List<String> chats = this.chats;
final String s2 = s;
Objects.requireNonNull(s2);
chats.removeIf(s2::equalsIgnoreCase);
this.chats.add(s);
while (this.chats.size() > 10) {
this.chats.remove(0);
}
config.chatsData(Text.toCSV(chats));
this.config.chatsData(Text.toCSV(this.chats));
}
private void removeClanCounter()
{
infoBoxManager.removeInfoBox(clanMemberCounter);
clanMemberCounter = null;
private void removeClanCounter() {
this.infoBoxManager.removeInfoBox(this.clanMemberCounter);
this.clanMemberCounter = null;
}
private void addClanCounter()
{
if (!config.showClanCounter() || clanMemberCounter != null || clanMembers.isEmpty())
{
private void addClanCounter() {
if (!this.config.showClanCounter() || this.clanMemberCounter != null || ClanChatPlugin.clanMembers.isEmpty()) {
return;
}
final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_CLAN_CHAT, 0);
clanMemberCounter = new ClanChatIndicator(image, this);
infoBoxManager.addInfoBox(clanMemberCounter);
final BufferedImage image = this.spriteManager.getSprite(904, 0);
this.clanMemberCounter = new ClanChatIndicator(image, this);
this.infoBoxManager.addInfoBox(this.clanMemberCounter);
}
private void startDiscordClient()
{
if (discordClient == null && config.discordAccount().equals(client.getUsername()))
{
discordClient = new DiscordClient();
submitMessage("Started\n\n" + client.getLocalPlayer().getName() + " has joined.");
}
}
private void stopDiscordClient()
{
if (discordClient != null)
{
submitMessage(client.getLocalPlayer().getName() + " has left.\n\nStopped");
discordClient = null;
}
static {
ClanChatPlugin.clanMembers = new CopyOnWriteArrayList<Player>();
}
}

View File

@@ -1,63 +0,0 @@
package net.runelite.client.plugins.clanchat.discord;
import com.google.gson.Gson;
import java.io.IOException;
import static java.lang.Integer.parseInt;
import java.time.Instant;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
@Slf4j
public class DiscordClient
{
private static final MediaType JSON = MediaType.parse("application/json");
private static final Gson GSON = RuneLiteAPI.GSON;
private int rateLimit = 1;
private Instant rateReset = Instant.EPOCH;
public void submit(DiscordMessage message, String path)
{
if (rateLimit < 1 && Instant.now().isBefore(rateReset))
{
return;
}
final HttpUrl url = new HttpUrl.Builder()
.scheme("https")
.host("discordapp.com")
.addPathSegments("api/webhooks")
.addPathSegments(path)
.build();
Request request = new Request.Builder()
.post(RequestBody.create(JSON, GSON.toJson(message)))
.url(url)
.build();
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
{
@Override
public void onFailure(Call call, IOException e)
{
log.debug("discord message failed", e);
}
@Override
public void onResponse(Call call, Response response)
{
rateLimit = parseInt(response.header("X-RateLimit-Remaining"));
rateReset = Instant.ofEpochSecond((parseInt(response.header("X-RateLimit-Reset"))));
log.debug("Submitted discord message, limit: {}, reset: {}", rateLimit, rateReset);
response.close();
}
});
}
}

View File

@@ -1,12 +0,0 @@
package net.runelite.client.plugins.clanchat.discord;
import lombok.Data;
@Data
public class DiscordMessage
{
private String username;
private String content;
private String avatar_url;
}

View File

@@ -22,9 +22,10 @@ import net.runelite.client.util.Text;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "<font color=\"aqua\">!Clan Man Mode</font>",
name = "Clan Man Mode",
description = "Assists in clan PVP scenarios",
tags = {"highlight", "minimap", "overlay", "players"}
tags = {"highlight", "minimap", "overlay", "players"},
type = "PVP"
)
public class ClanManModePlugin extends Plugin
{

View File

@@ -82,6 +82,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.pluginsorter.PluginSorterPlugin;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout;
import net.runelite.client.ui.PluginPanel;
@@ -106,13 +107,14 @@ public class ConfigPanel extends PluginPanel
private static final String PINNED_PLUGINS_CONFIG_KEY = "pinnedPlugins";
private static final String RUNELITE_PLUGIN = "RuneLite";
private static final String CHAT_COLOR_PLUGIN = "Chat Color";
public static boolean flexoConfigEnabled = false;
private final PluginManager pluginManager;
private final ConfigManager configManager;
private final ScheduledExecutorService executorService;
private final RuneLiteConfig runeLiteConfig;
private final ChatColorConfig chatColorConfig;
private final List<PluginListItem> pluginList = new ArrayList<>();
public static List<PluginListItem> pluginList = new ArrayList<>();
private final IconTextField searchBar = new IconTextField();
private final JPanel topPanel;
@@ -187,40 +189,150 @@ public class ConfigPanel extends PluginPanel
initializePluginList();
refreshPluginList();
}
private void initializePluginList()
{
final List<String> pinnedPlugins = getPinnedPluginNames();
// populate pluginList with all non-hidden plugins
List<PluginListItem> externalPlugins = new ArrayList<>();
// populate pluginList with all external Plugins
pluginManager.getPlugins().stream()
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("external"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, plugin, descriptor, config, configDescriptor);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
System.out.println("Started "+listItem.getName());
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
pluginList.add(listItem);
externalPlugins.add(listItem);
});
externalPlugins.sort(Comparator.comparing(PluginListItem::getName));
for (PluginListItem plugin : externalPlugins)
pluginList.add(plugin);
List<PluginListItem> pvmPlugins = new ArrayList<>();
// populate pluginList with all PVM Plugins
pluginManager.getPlugins().stream()
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("PVM"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
System.out.println("Started "+listItem.getName());
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
pvmPlugins.add(listItem);
});
pvmPlugins.sort(Comparator.comparing(PluginListItem::getName));
for (PluginListItem plugin : pvmPlugins)
pluginList.add(plugin);
List<PluginListItem> pvpPlugins = new ArrayList<>();
// populate pluginList with all PVP Plugins
pluginManager.getPlugins().stream()
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("PVP"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
System.out.println("Started "+listItem.getName());
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
pvpPlugins.add(listItem);
});
pvpPlugins.sort(Comparator.comparing(PluginListItem::getName));
for (PluginListItem plugin : pvpPlugins)
pluginList.add(plugin);
List<PluginListItem> utilPlugins = new ArrayList<>();
// populate pluginList with all utility Plugins
pluginManager.getPlugins().stream()
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("utility"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
if (listItem.getName().contains("Flexo") && flexoConfigEnabled) {
System.out.println("Started "+listItem.getName());
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
utilPlugins.add(listItem);
} else if (!listItem.getName().contains("Flexo")) {
System.out.println("Started "+listItem.getName());
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
utilPlugins.add(listItem);
}
});
utilPlugins.sort(Comparator.comparing(PluginListItem::getName));
for (PluginListItem plugin : utilPlugins)
pluginList.add(plugin);
// populate pluginList with all vanilla RL plugins
List<PluginListItem> vanillaPlugins = new ArrayList<>();
pluginManager.getPlugins().stream()
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("PVM"))
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("PVP"))
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("utility"))
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("pluginOrganizer"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
listItem.setPinned(pinnedPlugins.contains(listItem.getName()));
vanillaPlugins.add(listItem);
}
);
vanillaPlugins.sort(Comparator.comparing(PluginListItem::getName));
for (PluginListItem plugin : vanillaPlugins)
pluginList.add(plugin);
// add special entries for core client configurations
final PluginListItem runeLite = new PluginListItem(this, runeLiteConfig,
final PluginListItem runeLite = new PluginListItem(this, configManager, runeLiteConfig,
configManager.getConfigDescriptor(runeLiteConfig),
RUNELITE_PLUGIN, "RuneLite client settings", "client");
runeLite.setPinned(pinnedPlugins.contains(RUNELITE_PLUGIN));
pluginList.add(runeLite);
final PluginListItem chatColor = new PluginListItem(this, chatColorConfig,
final PluginListItem chatColor = new PluginListItem(this, configManager, chatColorConfig,
configManager.getConfigDescriptor(chatColorConfig),
CHAT_COLOR_PLUGIN, "Recolor chat text", "colour", "messages");
chatColor.setPinned(pinnedPlugins.contains(CHAT_COLOR_PLUGIN));
pluginList.add(chatColor);
pluginList.sort(Comparator.comparing(PluginListItem::getName));
// Add plugin sorter to bottom
pluginManager.getPlugins().stream()
.filter(plugin -> plugin.getClass().getAnnotation(PluginDescriptor.class).type().equals("pluginOrganizer"))
.forEach(plugin ->
{
final PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
final Config config = pluginManager.getPluginConfigProxy(plugin);
final ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
final PluginListItem listItem = new PluginListItem(this, configManager, plugin, descriptor, config, configDescriptor);
System.out.println("Started "+listItem.getName());
pluginList.add(listItem);
});
}
void refreshPluginList()
@@ -310,8 +422,7 @@ public class ConfigPanel extends PluginPanel
String name = listItem.getName();
JLabel title = new JLabel(name);
title.setForeground(Color.WHITE);
title.setText("<html>" + name +"</html>");
title.setToolTipText("<html>" + ":<br>" + listItem.getDescription() + "</html>");
title.setToolTipText("<html>" + name + ":<br>" + listItem.getDescription() + "</html>");
topPanel.add(title);
for (ConfigItemDescriptor cid : cd.getItems())

View File

@@ -33,6 +33,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
@@ -40,16 +41,20 @@ import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigDescriptor;
import net.runelite.client.config.ConfigItemDescriptor;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.IconButton;
import net.runelite.client.util.ColorUtil;
import net.runelite.client.util.ImageUtil;
import org.apache.commons.text.similarity.JaroWinklerDistance;
class PluginListItem extends JPanel
public class PluginListItem extends JPanel
{
private static final JaroWinklerDistance DISTANCE = new JaroWinklerDistance();
public JLabel nameLabel;
private static final ImageIcon CONFIG_ICON;
private static final ImageIcon CONFIG_ICON_HOVER;
@@ -59,6 +64,7 @@ class PluginListItem extends JPanel
private static final ImageIcon OFF_STAR;
private final ConfigPanel configPanel;
public final ConfigManager configManager;
@Getter
@Nullable
@@ -70,7 +76,7 @@ class PluginListItem extends JPanel
@Nullable
@Getter(AccessLevel.PACKAGE)
private final ConfigDescriptor configDescriptor;
public final ConfigDescriptor configDescriptor;
@Getter
private final String name;
@@ -120,26 +126,27 @@ class PluginListItem extends JPanel
* Note that {@code config} and {@code configDescriptor} can be {@code null}
* if there is no configuration associated with the plugin.
*/
PluginListItem(ConfigPanel configPanel, Plugin plugin, PluginDescriptor descriptor,
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Plugin plugin, PluginDescriptor descriptor,
@Nullable Config config, @Nullable ConfigDescriptor configDescriptor)
{
this(configPanel, plugin, config, configDescriptor,
this(configPanel, configManager, plugin, config, configDescriptor,
descriptor.name(), descriptor.description(), descriptor.tags());
}
/**
* Creates a new {@code PluginListItem} for a core configuration.
*/
PluginListItem(ConfigPanel configPanel, Config config, ConfigDescriptor configDescriptor,
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Config config, ConfigDescriptor configDescriptor,
String name, String description, String... tags)
{
this(configPanel, null, config, configDescriptor, name, description, tags);
this(configPanel, configManager, null, config, configDescriptor, name, description, tags);
}
private PluginListItem(ConfigPanel configPanel, @Nullable Plugin plugin, @Nullable Config config,
private PluginListItem(ConfigPanel configPanel, ConfigManager configManager, @Nullable Plugin plugin, @Nullable Config config,
@Nullable ConfigDescriptor configDescriptor, String name, String description, String... tags)
{
this.configPanel = configPanel;
this.configManager = configManager;
this.plugin = plugin;
this.config = config;
this.configDescriptor = configDescriptor;
@@ -152,10 +159,7 @@ class PluginListItem extends JPanel
setLayout(new BorderLayout(3, 0));
setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH, 20));
JLabel nameLabel = new JLabel(name);
nameLabel.setText("<html>" + name +"</html>");
nameLabel.setForeground(Color.WHITE);
nameLabel = new JLabel(name);
if (!description.isEmpty())
{

View File

@@ -1,83 +0,0 @@
/*
* Copyright (c) 2019, Jacky <liangj97@gmail.com>
* 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.cox;
import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range;
@ConfigGroup("hydra")
public interface CoxConfig extends Config
{
@ConfigItem(
position = 0,
keyName = "showHydraTile",
name = "Hydra's Size Box ",
description = "Displays hydra's size box for luring over vents"
)
default boolean showHydraTile()
{
return false;
}
@ConfigItem(
position = 1,
keyName = "tileColour",
name = "Color of hydra tile size",
description = "Configures the color of hydra's size"
)
default Color hydraTileColour()
{
return Color.ORANGE;
}
@Range(
min = -1000,
max = 1000
)
@ConfigItem(
position = 2,
keyName = "prayerHeight",
name = "Sets hydra's prayer height",
description = "The height of the prayer indicator over Hydra"
)
default int prayerHeight()
{
return 450;
}
@ConfigItem(
position = 3,
keyName = "showHydraPrayer",
name = "Hydra's Attack Style Indicator",
description = "Displays hydra's size box for luring over vents"
)
default boolean showPrayer()
{
return false;
}
}

View File

@@ -1,124 +0,0 @@
package net.runelite.client.plugins.cox;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.List;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.GameObject;
import net.runelite.api.GraphicsObject;
import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Scene;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
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;
public class CoxOverlayAbove extends Overlay
{
private final Client client;
private final CoxPlugin plugin;
private CoxConfig config;
@Inject
public CoxOverlayAbove(Client client, CoxPlugin plugin, CoxConfig config)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.config = config;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!client.isInInstancedRegion() && plugin.getOlm() == null) return null;
renderGroundObject(graphics);
renderTileObjects(graphics);
return null;
}
// renders special attack ground objects
private void renderGroundObject(Graphics2D graphics)
{
List<GraphicsObject> graphicsObjects = client.getGraphicsObjects();
for (GraphicsObject graphicsObject : graphicsObjects)
{
if (graphicsObject.getId() == 1447 || graphicsObject.getId() == 1356)
{
LocalPoint lp = graphicsObject.getLocation();
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, Color.RED);
}
}
}
}
private void renderGameObjects(Graphics2D graphics, Tile tile, Player player)
{
GameObject[] gameObjects = tile.getGameObjects();
if (gameObjects != null)
{
for (GameObject gameObject : gameObjects)
{
if (gameObject != null && gameObject.getId() == 30033)
{
if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= 5)
{
// Draw a polygon around the convex hull
// of the model vertices
Polygon p = gameObject.getConvexHull();
if (p != null)
{
graphics.drawPolygon(p);
}
}
}
}
}
}
private void renderTileObjects(Graphics2D graphics)
{
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
int z = client.getPlane();
for (int x = 0; x < Constants.SCENE_SIZE; ++x)
{
for (int y = 0; y < Constants.SCENE_SIZE; ++y)
{
Tile tile = tiles[z][x][y];
if (tile == null)
{
continue;
}
Player player = client.getLocalPlayer();
if (player == null)
{
continue;
}
renderGameObjects(graphics, tile, player);
}
}
}
}

View File

@@ -109,4 +109,15 @@ public interface DailyTasksConfig extends Config
{
return true;
}
@ConfigItem(
position = 8,
keyName = "showArrows",
name = "Show Claimable Ogre Arrows",
description = "Show a message when you can collect ogre arrows from Rantz."
)
default boolean showArrows()
{
return true;
}
}

View File

@@ -63,6 +63,7 @@ public class DailyTasksPlugin extends Plugin
private static final String SAND_MESSAGE = "You have sand waiting to be collected from Bert.";
private static final int SAND_QUEST_COMPLETE = 160;
private static final String FLAX_MESSAGE = "You have bowstrings waiting to be converted from flax from the Flax keeper.";
private static final String ARROWS_MESSAGE = "You have ogre arrows waiting to be collected from Rantz.";
private static final String BONEMEAL_MESSAGE = "You have bonemeal and slime waiting to be collected from Robin.";
private static final int BONEMEAL_PER_DIARY = 13;
private static final String RELOG_MESSAGE = " (May require a relog)";
@@ -153,22 +154,21 @@ public class DailyTasksPlugin extends Plugin
{
checkBonemeal(dailyReset);
}
if (config.showArrows())
{
checkArrows(dailyReset);
}
}
}
private void checkHerbBoxes(boolean dailyReset)
{
if (client.getAccountType() == AccountType.NORMAL
if ((client.getAccountType() == AccountType.NORMAL
&& client.getVar(VarPlayer.NMZ_REWARD_POINTS) >= HERB_BOX_COST)
&& (dailyReset || client.getVar(Varbits.DAILY_HERB_BOXES_COLLECTED) < HERB_BOX_MAX))
{
if (client.getVar(Varbits.DAILY_HERB_BOXES_COLLECTED) < HERB_BOX_MAX)
{
sendChatMessage(HERB_BOX_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(HERB_BOX_MESSAGE);
}
sendChatMessage(HERB_BOX_MESSAGE);
}
}
@@ -189,61 +189,46 @@ public class DailyTasksPlugin extends Plugin
private void checkEssence(boolean dailyReset)
{
if (client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1)
if ((client.getVar(Varbits.DIARY_ARDOUGNE_MEDIUM) == 1)
&& (dailyReset || client.getVar(Varbits.DAILY_ESSENCE_COLLECTED) == 0))
{
if (client.getVar(Varbits.DAILY_ESSENCE_COLLECTED) == 0)
{
sendChatMessage(ESSENCE_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(ESSENCE_MESSAGE);
}
sendChatMessage(ESSENCE_MESSAGE);
}
}
private void checkRunes(boolean dailyReset)
{
if (client.getVar(Varbits.DIARY_WILDERNESS_EASY) == 1)
if ((client.getVar(Varbits.DIARY_WILDERNESS_EASY) == 1)
&& (dailyReset || client.getVar(Varbits.DAILY_RUNES_COLLECTED) == 0))
{
if (client.getVar(Varbits.DAILY_RUNES_COLLECTED) == 0)
{
sendChatMessage(RUNES_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(RUNES_MESSAGE);
}
sendChatMessage(RUNES_MESSAGE);
}
}
private void checkSand(boolean dailyReset)
{
if (client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE)
if ((client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE)
&& (dailyReset || client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0))
{
if (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0)
{
sendChatMessage(SAND_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(SAND_MESSAGE);
}
sendChatMessage(SAND_MESSAGE);
}
}
private void checkFlax(boolean dailyReset)
{
if (client.getVar(Varbits.DIARY_KANDARIN_EASY) == 1)
if ((client.getVar(Varbits.DIARY_KANDARIN_EASY) == 1)
&& (dailyReset || client.getVar(Varbits.DAILY_FLAX_STATE) == 0))
{
if (client.getVar(Varbits.DAILY_FLAX_STATE) == 0)
{
sendChatMessage(FLAX_MESSAGE);
}
else if (dailyReset)
{
sendChatMessage(FLAX_MESSAGE);
}
sendChatMessage(FLAX_MESSAGE);
}
}
private void checkArrows(boolean dailyReset)
{
if ((client.getVar(Varbits.DIARY_WESTERN_EASY) == 1)
&& (dailyReset || client.getVar(Varbits.DAILY_ARROWS_STATE) == 0))
{
sendChatMessage(ARROWS_MESSAGE);
}
}
@@ -261,11 +246,7 @@ public class DailyTasksPlugin extends Plugin
max += BONEMEAL_PER_DIARY;
}
}
if (collected < max)
{
sendChatMessage(BONEMEAL_MESSAGE);
}
else if (dailyReset)
if (dailyReset || collected < max)
{
sendChatMessage(BONEMEAL_MESSAGE);
}

View File

@@ -1,133 +0,0 @@
package net.runelite.client.plugins.easy.bank;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("easybank")
public interface EasyBankConfig extends Config {
@ConfigItem(
keyName = "withdrawOne",
name = "Withdraw/Deposit One",
description = "",
position = 0
)
default boolean getWithdrawOne() {
return true;
}
@ConfigItem(
keyName = "withdrawOneItems",
name = "Items",
description = "",
position = 1
)
default String getWithdrawOneItems() {
return "";
}
@ConfigItem(
keyName = "withdrawFive",
name = "Withdraw/Deposit Five",
description = "",
position = 2
)
default boolean getWithdrawFive() {
return true;
}
@ConfigItem(
keyName = "withdrawFiveItems",
name = "Items",
description = "",
position = 3
)
default String getWithdrawFiveItems() {
return "";
}
@ConfigItem(
keyName = "withdrawTen",
name = "Withdraw/Deposit Ten",
description = "",
position = 4
)
default boolean getWithdrawTen() {
return true;
}
@ConfigItem(
keyName = "withdrawTenItems",
name = "Items",
description = "",
position = 5
)
default String getWithdrawTenItems() {
return "";
}
@ConfigItem(
keyName = "withdrawX",
name = "Withdraw/Deposit X",
description = "",
position = 6
)
default boolean getWithdrawX() {
return true;
}
@ConfigItem(
keyName = "withdrawXAmount",
name = "Amount",
description = "",
position = 7
)
default String getWithdrawXAmount() {
return "";
}
@ConfigItem(
keyName = "withdrawXItems",
name = "Items",
description = "",
position = 8
)
default String getWithdrawXItems() {
return "";
}
@ConfigItem(
keyName = "withdrawAll",
name = "Withdraw/Deposit All",
description = "",
position = 9
)
default boolean getWithdrawAll() {
return true;
}
@ConfigItem(
keyName = "withdrawAllItems",
name = "Items",
description = "",
position = 10
)
default String getWithdrawAllItems() {
return "";
}
}

View File

@@ -1,133 +0,0 @@
package net.runelite.client.plugins.easy.bank;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MenuEntry;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.easy.util.Swapper;
import net.runelite.client.util.Text;
import javax.inject.Inject;
@PluginDescriptor(
name = "EasyBank",
description = "EasyBank.",
tags = {"EasyBank", "easy"}
)
@Slf4j
public class EasyBankPlugin extends Plugin {
private Swapper swapper = new Swapper();
private MenuEntry[] entries;
@Inject
private Client client;
@Inject
private EasyBankConfig config;
@Provides
EasyBankConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EasyBankConfig.class);
}
@Override
public void startUp() {
log.debug("EasyBank Started.");
}
@Override
public void shutDown() {
log.debug("EasyBank Stopped.");
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event) {
if (client.getGameState() != GameState.LOGGED_IN) {
return;
}
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
if (loginScreenOne != null || loginScreenTwo != null) {
return;
}
final String option = Text.removeTags(event.getOption()).toLowerCase();
final String target = Text.removeTags(event.getTarget()).toLowerCase();
Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
swapper.setEntries(client.getMenuEntries());
if (!(widgetBankTitleBar == null) && !widgetBankTitleBar.isHidden()) {
if (config.getWithdrawOne()) {
for (String item : config.getWithdrawOneItems().split(",")) {
item = item.trim();
if (target.equalsIgnoreCase(item)) {
swapper.markForSwap("Withdraw-1", option, target);
swapper.markForSwap("Deposit-1", option, target);
}
}
}
if (config.getWithdrawFive()) {
for (String item : config.getWithdrawFiveItems().split(",")) {
item = item.trim();
if (target.equalsIgnoreCase(item)) {
swapper.markForSwap("Withdraw-5", option, target);
swapper.markForSwap("Deposit-5", option, target);
}
}
}
if (config.getWithdrawTen()) {
for (String item : config.getWithdrawTenItems().split(",")) {
item = item.trim();
if (target.equalsIgnoreCase(item)) {
swapper.markForSwap("Withdraw-10", option, target);
swapper.markForSwap("Deposit-10", option, target);
}
}
}
if (config.getWithdrawX()) {
for (String item : config.getWithdrawXItems().split(",")) {
item = item.trim();
if (target.equalsIgnoreCase(item)) {
swapper.markForSwap("Withdraw-" + config.getWithdrawXAmount(), option, target);
swapper.markForSwap("Deposit-" + config.getWithdrawXAmount(), option, target);
}
}
}
if (config.getWithdrawAll()) {
for (String item : config.getWithdrawAllItems().split(",")) {
item = item.trim();
if (target.equalsIgnoreCase(item)) {
swapper.markForSwap("Withdraw-All", option, target);
swapper.markForSwap("Deposit-All", option, target);
}
}
}
}
swapper.startSwap();
client.setMenuEntries(swapper.getEntries());
}
}

View File

@@ -1,56 +0,0 @@
package net.runelite.client.plugins.easy.pvp;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("easypvp")
public interface EasyPvpConfig extends Config {
@ConfigItem(
keyName = "showWildernessRange",
name = "Show Wilderness Range",
description = "",
position = 0
)
default boolean getShowWildernessRange() {
return true;
}
@ConfigItem(
keyName = "ShowAttackablePlayers",
name = "Show Attackable Players",
description = "",
position = 1
)
default boolean getShowAttackablePlayers() {
return true;
}
@ConfigItem(
keyName = "warnProtectItemOff",
name = "Warn Protect Item Off",
description = "",
position = 2
)
default boolean getWarnProtectItemOff() {
return true;
}
@ConfigItem(
keyName = "showFreezeTimers",
name = "Show Freeze Timers",
description = "",
position = 3
)
default boolean getShowFreezeTimers() {
return true;
}
}

View File

@@ -1,102 +0,0 @@
package net.runelite.client.plugins.easy.pvp;
import com.google.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
import java.awt.*;
public class EasyPvpOverlay extends Overlay {
private final Client client;
private final EasyPvpPlugin plugin;
private final EasyPvpConfig config;
@Inject
private EasyPvpOverlay(Client client, EasyPvpPlugin plugin, EasyPvpConfig config) {
this.client = client;
this.plugin = plugin;
this.config = config;
setPosition(OverlayPosition.DYNAMIC);
setPriority(OverlayPriority.MED);
}
@Override
public Dimension render(Graphics2D graphics) {
if (config.getShowAttackablePlayers()) {
for (Player player : plugin.getTargets()) {
OverlayUtil.renderPolygon(graphics, player.getConvexHull(), Color.RED);
Point minimapLocation = player.getMinimapLocation();
if (minimapLocation != null) {
OverlayUtil.renderMinimapLocation(graphics, minimapLocation, Color.RED.darker());
OverlayUtil.renderTextLocation(graphics, minimapLocation, player.getName(), Color.RED);
}
}
}
//
return null;
}
}
// @Override
// public Dimension render(Graphics2D graphics)
// {
// if (config.getShowWildernessRange())
// {
//// plugin.getDeadNpcsToDisplay().forEach((id, npc) -> renderNpcRespawn(npc, graphics));
// }
//
// if (config.getShowAttackablePlayers())
//
// for (Player player : plugin.getAttackablePlayers()) {
// if (player != null) {
// renderNpcOverlay(graphics, player, player.getName(), Color.RED);
// } else {
// plugin.getAttackablePlayers().remove(player);
// }
// }
//
// return null;
// }
// private void renderNpcOverlay(Graphics2D graphics, Player actor, String name, Color color)
// {
// LocalPoint lp = actor.getLocalLocation();
//// Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, 1);
//
// renderTile(graphics, lp, color);
//// renderMinimap();
//
//// if (config.drawNames())
//// {
//// Point textLocation = actor.getCanvasTextLocation(graphics, name, actor.getLogicalHeight() + 40);
////
//// if (textLocation != null)
//// {
//// OverlayUtil.renderTextLocation(graphics, textLocation, name, color);
//// }
//// }
// }
// private void renderTile(final Graphics2D graphics, final LocalPoint dest, final Color color)
// {
// if (dest == null)
// {
// return;
// }
// final Polygon poly = Perspective.getCanvasTilePoly(client, dest);
// if (poly == null)
// {
// return;
// }
// OverlayUtil.renderPolygon(graphics, poly, color);
// }

View File

@@ -1,197 +0,0 @@
package net.runelite.client.plugins.easy.pvp;
import com.google.inject.Inject;
import com.google.inject.Provides;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameTick;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import java.util.HashSet;
import java.util.Set;
@PluginDescriptor(
name = "EasyPvP",
description = "EasyPvP.",
tags = {"EasyPVP", "easy"}
)
@Slf4j
public class EasyPvpPlugin extends Plugin {
private int inWildy;
@Inject
private Client client;
@Inject
private EasyPvpConfig config;
@Inject
private OverlayManager overlayManager;
@Inject
private EasyPvpOverlay overlay;
@Getter(AccessLevel.PACKAGE)
private Set<Player> targets = new HashSet<>();
private String target;
private boolean prayMage;
private WorldPoint location;
private String spell;
private int currentExperience;
private int gainedExperience;
@Provides
EasyPvpConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EasyPvpConfig.class);
}
@Override
public void startUp() {
prayMage = false;
spell = "";
overlayManager.add(overlay);
log.debug("EasyPvP Started.");
}
@Override
public void shutDown() {
overlayManager.remove(overlay);
log.debug("EasyPvP Stopped.");
}
@Subscribe
public void onGameTick(GameTick event) {
inWildy = client.getVar(Varbits.IN_WILDERNESS);
if (inWildy == 0) {
targets.clear();
return;
}
Widget wildyText = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL);
if (wildyText == null) {
return;
}
int wildyLevel = Integer.parseInt(wildyText.getText().split(":")[1].trim());
if (config.getShowAttackablePlayers()) {
for (Player player : client.getPlayers()) {
if (Math.abs(player.getCombatLevel() - client.getLocalPlayer().getCombatLevel()) <= wildyLevel) { // && !player.equals(client.getLocalPlayer())
targets.add(player);
} else targets.remove(player);
}
}
}
// @Subscribe
// public void onGameStateChanged(GameStateChanged event) {
// if (event.getGameState() == GameState.LOGGED_IN) {
// currentExperience = client.getSkillExperience(Skill.MAGIC);
// }
// }
//
// @Subscribe
// public void onMenuOptionClicked(MenuOptionClicked event) {
// if (event.getMenuTarget().contains("->")) {
// target = Text.removeTags(event.getMenuTarget()).split(" -> ")[1];
// spell = Text.removeTags(event.getMenuTarget()).split(" -> ")[0];
// log.debug("{} - {}", spell, target);
// prayMage = false;
// }
// }
//
// @Subscribe
// public void onExperienceChanged(ExperienceChanged event) {
// if (event.getSkill() == Skill.MAGIC) {
// gainedExperience = client.getSkillExperience(Skill.MAGIC) - currentExperience;
// currentExperience = client.getSkillExperience(Skill.MAGIC);
// long frozenTime = calculateFreezeTime(gainedExperience, spell, prayMage);
// if (frozenTime > 0) {
// for (Player player : client.getPlayers()) {
// if (player.getName().equals(target)) {
// location = player.getWorldLocation();
// if (player.getOverheadIcon() != null && player.getOverheadIcon().equals(HeadIcon.MAGIC)) {
// prayMage = true;
// break;
// }
// targets.add(new Markable(player, location, System.currentTimeMillis(), frozenTime));
// log.debug("Marked Target {}", player.getName());
// }
// }
// }
// }
// }
//
// public long calculateFreezeTime(int experience, String spell, boolean protectionPrayer) {
// long freezeTime = 0;
// switch (spell) {
// case "Bind":
// if (experience > 30) {
// if (protectionPrayer) {
// freezeTime = 2500;
// } else {
// freezeTime = 5000;
// }
// }
// break;
// case "Snare":
// if (experience > 60) {
// if (protectionPrayer) {
// freezeTime = 5000;
// } else {
// freezeTime = 10000;
// }
// }
// break;
// case "Entangle":
// if (experience > 89) {
// if (protectionPrayer) {
// freezeTime = 7500;
// } else {
// freezeTime = 15000;
// }
// }
// break;
// case "Ice Rush":
// if (experience > 34) {
// freezeTime = 5000;
// }
// break;
// case "Ice Burst":
// if (experience > 40) {
// freezeTime = 10000;
// }
// break;
// case "Ice Blitz":
// if (experience > 46) {
// freezeTime = 15000;
// }
// break;
// case "Ice Barrage":
// if (experience > 52) {
// freezeTime = 20000;
// }
// break;
// }
// return freezeTime;
// }
}

View File

@@ -1,43 +0,0 @@
package net.runelite.client.plugins.easy.scape;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("easyscape")
public interface EasyScapeConfig extends Config {
@ConfigItem(
keyName = "removeExamine",
name = "Remove Examine",
description = "Removes Examine from the list of options.",
position = 0
)
default boolean getRemoveExamine() {
return true;
}
@ConfigItem(
keyName = "removeObjects",
name = "Remove Objects",
description = "Removes interaction with the listed objects.",
position = 1
)
default boolean getRemoveObjects() {
return true;
}
@ConfigItem(
keyName = "removedObjects",
name = "Objects",
description = "Objects listed here will have all interaction be removed.",
position = 2
)
default String getRemovedObjects() {
return "";
}
}

View File

@@ -1,111 +0,0 @@
package net.runelite.client.plugins.easy.scape;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MenuEntry;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.ArrayUtils;
import javax.inject.Inject;
@PluginDescriptor(
name = "EasyScape",
description = "EasyScape.",
tags = {"EasyScape"},
enabledByDefault = false
)
@Slf4j
public class EasyScapePlugin extends Plugin {
private MenuEntry[] entries;
@Inject
private Client client;
@Inject
private EasyScapeConfig config;
@Provides
EasyScapeConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EasyScapeConfig.class);
}
@Override
public void startUp() {
log.debug("EasyScape Started.");
}
@Override
public void shutDown() {
log.debug("EasyScape Stopped.");
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event) {
if (client.getGameState() != GameState.LOGGED_IN) {
return;
}
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
if (loginScreenOne != null || loginScreenTwo != null) {
return;
}
final String target = Text.removeTags(event.getTarget()).toLowerCase();
entries = client.getMenuEntries();
if (config.getRemoveExamine()) {
for (int i = entries.length - 1; i >= 0; i--) {
if (entries[i].getOption().equals("Examine")) {
entries = ArrayUtils.remove(entries, i);
i--;
}
}
client.setMenuEntries(entries);
}
if (config.getRemoveObjects() && !config.getRemovedObjects().equals("")) {
for (String removed : config.getRemovedObjects().split(",")) {
removed = removed.trim();
if (target.contains("(") && target.split(" \\(")[0].equalsIgnoreCase(removed)) {
delete(event.getIdentifier());
} else if (target.contains("->")) {
String trimmed = target.split("->")[1].trim();
if (trimmed.length() >= removed.length() && trimmed.substring(0, removed.length()).equalsIgnoreCase(removed)) {
delete(event.getIdentifier());
break;
}
} else if (target.length() >= removed.length() && target.substring(0, removed.length()).equalsIgnoreCase(removed)) {
delete(event.getIdentifier());
break;
}
}
}
}
private void delete(int target) {
for (int i = entries.length - 1; i >= 0; i--) {
if (entries[i].getIdentifier() == target) {
entries = ArrayUtils.remove(entries, i);
i--;
}
}
client.setMenuEntries(entries);
}
}

View File

@@ -1,186 +0,0 @@
package net.runelite.client.plugins.easy.shop;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("easyshop")
public interface EasyShopConfig extends Config {
@ConfigItem(
keyName = "swapBuyOne",
name = "Swappable Buy One",
description = "",
position = 0
)
default boolean getSwapBuyOne() {
return true;
}
@ConfigItem(
keyName = "buyOneItems",
name = "Items",
description = "",
position = 1
)
default String getBuyOneItems() {
return "";
}
@ConfigItem(
keyName = "swapBuyFive",
name = "Swappable Buy Five",
description = "",
position = 2
)
default boolean getSwapBuyFive() {
return true;
}
@ConfigItem(
keyName = "buyFiveItems",
name = "Items",
description = "",
position = 3
)
default String getBuyFiveItems() {
return "";
}
@ConfigItem(
keyName = "swapBuyTen",
name = "Swappable Buy Ten",
description = "",
position = 4
)
default boolean getSwapBuyTen() {
return true;
}
@ConfigItem(
keyName = "buyTenItems",
name = "Items",
description = "",
position = 5
)
default String getBuyTenItems() {
return "";
}
@ConfigItem(
keyName = "swapBuyFifty",
name = "Swappable Buy Fifty",
description = "",
position = 6
)
default boolean getSwapBuyFifty() {
return true;
}
@ConfigItem(
keyName = "buyFiftyItems",
name = "Items",
description = "",
position = 7
)
default String getBuyFiftyItems() {
return "";
}
@ConfigItem(
keyName = "swapSellOne",
name = "Swappable Sell One",
description = "",
position = 8
)
default boolean getSwapSellOne() {
return true;
}
@ConfigItem(
keyName = "sellOneItems",
name = "Items",
description = "",
position = 9
)
default String getSellOneItems() {
return "";
}
@ConfigItem(
keyName = "swapSellFive",
name = "Swappable Sell Five",
description = "",
position = 10
)
default boolean getSwapSellFive() {
return true;
}
@ConfigItem(
keyName = "sellFiveItems",
name = "Items",
description = "",
position = 11
)
default String getSellFiveItems() {
return "";
}
@ConfigItem(
keyName = "swapSellTen",
name = "Swappable Sell Ten",
description = "",
position = 12
)
default boolean getSwapSellTen() {
return true;
}
@ConfigItem(
keyName = "sellTenItems",
name = "Items",
description = "",
position = 13
)
default String getSellTenItems() {
return "";
}
@ConfigItem(
keyName = "swapSellFifty",
name = "Swappable Sell Fifty",
description = "",
position = 14
)
default boolean getSwapSellFifty() {
return true;
}
@ConfigItem(
keyName = "sellFiftyItems",
name = "Items",
description = "",
position = 15
)
default String getSellFiftyItems() {
return "";
}
}

View File

@@ -1,140 +0,0 @@
package net.runelite.client.plugins.easy.shop;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.easy.util.Swapper;
import net.runelite.client.util.Text;
import javax.inject.Inject;
@PluginDescriptor(
name = "EasyShop",
description = "EasyShop.",
tags = {"EasyShop", "easy"}
)
@Slf4j
public class EasyShopPlugin extends Plugin {
private Swapper swapper = new Swapper();
@Inject
private Client client;
@Inject
private EasyShopConfig config;
@Provides
EasyShopConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EasyShopConfig.class);
}
@Override
public void startUp() {
log.debug("EasyShop Started.");
}
@Override
public void shutDown() {
log.debug("EasyShop Stopped.");
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event) {
if (client.getGameState() != GameState.LOGGED_IN) {
return;
}
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
if (loginScreenOne != null || loginScreenTwo != null) {
return;
}
final String option = Text.removeTags(event.getOption()).toLowerCase();
final String target = Text.removeTags(event.getTarget()).toLowerCase();
swapper.setEntries(client.getMenuEntries());
if (config.getSwapBuyOne() && !config.getBuyOneItems().equals("")) {
for (String item : config.getBuyOneItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Buy 1", option, target);
}
}
}
if (config.getSwapBuyFive() && !config.getBuyFiveItems().equals("")) {
for (String item : config.getBuyFiveItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Buy 5", option, target);
}
}
}
if (config.getSwapBuyTen() && !config.getBuyTenItems().equals("")) {
for (String item : config.getBuyTenItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Buy 10", option, target);
}
}
}
if (config.getSwapBuyFifty() && !config.getBuyFiftyItems().equals("")) {
for (String item : config.getBuyFiftyItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Buy 50", option, target);
}
}
}
if (config.getSwapSellOne() && !config.getSellOneItems().equals("")) {
for (String item : config.getSellOneItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Sell 1", option, target);
}
}
}
if (config.getSwapSellFive() && !config.getSellFiveItems().equals("")) {
for (String item : config.getSellFiveItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Sell 5", option, target);
}
}
}
if (config.getSwapSellTen() && !config.getSellTenItems().equals("")) {
for (String item : config.getSellTenItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Sell 10", option, target);
}
}
}
if (config.getSwapSellFifty() && !config.getSellFiftyItems().equals("")) {
for (String item : config.getSellFiftyItems().split(",")) {
if (target.equalsIgnoreCase(item.trim())) {
swapper.markForSwap("Sell 50", option, target);
}
}
}
swapper.startSwap();
client.setMenuEntries(swapper.getEntries());
}
}

View File

@@ -1,201 +0,0 @@
package net.runelite.client.plugins.easy.swap;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.plugins.easy.util.DuelingRingMode;
import net.runelite.client.plugins.easy.util.EssenceMode;
import net.runelite.client.plugins.easy.util.GamesNecklaceMode;
import net.runelite.client.plugins.easy.util.GloryMode;
@ConfigGroup("easyswap")
public interface EasySwapConfig extends Config {
@ConfigItem(
keyName = "easyConstruction",
name = "Easy Construction",
description = "Makes \"Remove\" the default option for listed items in build mode.",
position = 0
)
default boolean getEasyConstruction() {
return true;
}
@ConfigItem(
keyName = "constructionItems",
name = "Construction Items",
description = "Items listed here will have the default option set to \"Removed\" in build mode.",
position = 1
)
default String getConstructionItems() {
return "";
}
@ConfigItem(
keyName = "swapSmithing",
name = "Swap Smithing",
description = "Enables swapping of smith-1 and smith-all options.",
position = 2
)
default boolean getSwapSmithing() {
return true;
}
@ConfigItem(
keyName = "swapTanning",
name = "Swap Tanning",
description = "Enables swapping of tan-1 and tan-all options.",
position = 3
)
default boolean getSwapTanning() {
return true;
}
@ConfigItem(
keyName = "swapCrafting",
name = "Swap Crafting",
description = "Enables swapping of Make-1 and Make-all options.",
position = 4
)
default boolean getSwapCrafting() {
return true;
}
@ConfigItem(
keyName = "swapArdougneCape",
name = "Swap Ardougne Cape",
description = "Enables swapping of teleport and wear.",
position = 5
)
default boolean getSwapArdougneCape() {
return true;
}
@ConfigItem(
keyName = "swapSawmill",
name = "Swap Sawmill Operator",
description = "Makes Buy-plank the default option on the sawmill operator.",
position = 6
)
default boolean getSwapSawmill() {
return true;
}
@ConfigItem(
keyName = "swapSawmillPlanks",
name = "Swap Buy Planks",
description = "Makes Buy All the default option in buy planks.",
position = 7
)
default boolean getSwapSawmillPlanks() {
return true;
}
@ConfigItem(
keyName = "swapPuroPuro",
name = "Swap Puro Puro Wheat",
description = "",
position = 8
)
default boolean getSwapPuro() {
return true;
}
@ConfigItem(
keyName = "swapEssencePounch",
name = "Swap Essence Pouch",
description = "",
position = 9
)
default boolean getSwapEssencePouch() {
return true;
}
@ConfigItem(
keyName = "essenceMode",
name = "Mode",
description = "",
position = 10
)
default EssenceMode getEssenceMode() {
return EssenceMode.RUNECRAFTING;
}
@ConfigItem(
keyName = "swapGamesNecklace",
name = "Swap Games Necklace",
description = "",
position = 11
)
default boolean getGamesNecklace() {
return true;
}
@ConfigItem(
keyName = "gamesNecklaceMode",
name = "Mode",
description = "",
position = 12
)
default GamesNecklaceMode getGamesNecklaceMode() {
return GamesNecklaceMode.BURTHORPE;
}
@ConfigItem(
keyName = "swapDuelingRing",
name = "Swap Dueling Ring",
description = "",
position = 13
)
default boolean getDuelingRing() {
return true;
}
@ConfigItem(
keyName = "duelingRingMode",
name = "Mode",
description = "",
position = 14
)
default DuelingRingMode getDuelingRingMode() {
return DuelingRingMode.DUEL_ARENA;
}
@ConfigItem(
keyName = "swapGlory",
name = "Swap Glory",
description = "",
position = 15
)
default boolean getGlory() {
return true;
}
@ConfigItem(
keyName = "gloryMode",
name = "Mode",
description = "",
position = 16
)
default GloryMode getGloryMode() {
return GloryMode.EDGEVILLE;
}
}

View File

@@ -1,236 +0,0 @@
package net.runelite.client.plugins.easy.swap;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.GameState;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.easy.util.Swapper;
import net.runelite.client.util.Text;
import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged;
import javax.inject.Inject;
import static net.runelite.api.MenuAction.WALK;
import static net.runelite.api.ObjectID.PORTAL_4525;
@PluginDescriptor(
name = "EasySwap",
description = "EasySwap.",
tags = {"EasySwap", "easy"}
)
@Slf4j
public class EasySwapPlugin extends Plugin {
private static final int PURO_PURO_REGION_ID = 10307;
private Swapper swapper = new Swapper();
private boolean inHouse = false;
@Inject
private Client client;
@Inject
private EasySwapConfig config;
@Provides
EasySwapConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EasySwapConfig.class);
}
@Override
public void startUp() {
log.debug("EasySwap Started.");
}
@Override
public void shutDown() {
log.debug("EasySwap Stopped.");
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event) {
if (client.getGameState() != GameState.LOGGED_IN) {
return;
}
Widget loginScreenOne = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN);
Widget loginScreenTwo = client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY);
if (loginScreenOne != null || loginScreenTwo != null) {
return;
}
final String option = Text.removeTags(event.getOption()).toLowerCase();
final String target = Text.removeTags(event.getTarget()).toLowerCase();
swapper.setEntries(client.getMenuEntries());
if (config.getSwapPuro() && isPuroPuro()) {
if (event.getType() == WALK.getId()) {
swapper.deprioritizeWalk();
} else if (option.equalsIgnoreCase("examine")) {
swapper.markForSwap("push-through", option, target);
} else if (option.equalsIgnoreCase("use")) {
swapper.markForSwap("escape", option, target);
}
}
if (config.getEasyConstruction() && !config.getConstructionItems().equals("") && inHouse) {
if (event.getType() == WALK.getId()) {
swapper.deprioritizeWalk();
}
swapper.markForSwap("Build", option, target);
for (int i = swapper.getEntries().length - 1; i >= 0; i--) {
for (String item : config.getConstructionItems().split(",")) {
if (item.trim().equalsIgnoreCase(Text.removeTags(swapper.getEntries()[i].getTarget()))) {
if (!swapper.getEntries()[i].getOption().equalsIgnoreCase("remove")) {
swapper.removeIndex(i);
i--;
}
}
}
}
}
if (config.getSwapSmithing()) {
if (option.equalsIgnoreCase("Smith 1")) {
swapper.markForSwap("Smith All", option, target);
} else if (option.equalsIgnoreCase("Smith 1 Set")) {
swapper.markForSwap("Smith All Sets", option, target);
}
}
if (config.getSwapTanning() && option.equalsIgnoreCase("Tan 1")) {
swapper.markForSwap("Tan All", option, target);
}
if (config.getSwapCrafting()) {
switch (option) {
case "Make-1":
swapper.markForSwap("Make-All", option, target);
break;
case "Craft 1":
swapper.markForSwap("Craft All", option, target);
break;
default:
break;
}
}
if (config.getSwapSawmill() && target.equalsIgnoreCase("Sawmill operator")) {
swapper.markForSwap("Buy-plank", option, target);
}
if (config.getSwapSawmillPlanks() && option.equalsIgnoreCase("Buy 1")) {
swapper.markForSwap("Buy All", option, target);
}
if (option.equalsIgnoreCase("Clear-All") && target.equalsIgnoreCase("bank Filler")) {
swapper.markForSwap("Clear", option, target);
}
if (target.toLowerCase().contains("ardougne cloak") && config.getSwapArdougneCape()) {
swapper.markForSwap("Kandarin Monastery", option, target);
swapper.markForSwap("Monastery Teleport", option, target);
}
if (config.getSwapEssencePouch()) {
if (isEssencePouch(target)) {
Widget widgetBankTitleBar = client.getWidget(WidgetInfo.BANK_TITLE_BAR);
switch (config.getEssenceMode()) {
case RUNECRAFTING:
if (widgetBankTitleBar == null || widgetBankTitleBar.isHidden()) {
swapper.markForSwap("Empty", option, target);
} else {
swapper.markForSwap("Fill", option, target);
}
break;
case ESSENCE_MINING:
if (widgetBankTitleBar == null || widgetBankTitleBar.isHidden()) {
swapper.markForSwap("Fill", option, target);
} else {
swapper.markForSwap("Empty", option, target);
}
break;
default:
break;
}
}
}
if (config.getGamesNecklace()) {
if (target.toLowerCase().contains("games necklace")) {
swapper.markForSwap(config.getGamesNecklaceMode().toString(), option, target);
}
}
if (config.getDuelingRing()) {
if (target.toLowerCase().contains("ring of dueling")) {
swapper.markForSwap(config.getDuelingRingMode().toString(), option, target);
}
}
if (config.getGlory()) {
if (target.toLowerCase().contains("amulet of glory")) {
swapper.markForSwap(config.getGloryMode().toString(), option, target);
}
}
swapper.startSwap();
client.setMenuEntries(swapper.getEntries());
}
private boolean isEssencePouch(String target) {
return (target.equalsIgnoreCase("Small Pouch") || target.equalsIgnoreCase("Medium Pouch") || target.equalsIgnoreCase("Large Pouch") || target.equalsIgnoreCase("Giant Pouch"));
}
@Subscribe
public void onGameObjectSpawned(GameObjectSpawned event)
{
final GameObject gameObject = event.getGameObject();
if (PORTAL_4525 == gameObject.getId())
{
this.inHouse = true;
}
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
if (event.getGameState() == GameState.LOADING)
{
this.inHouse = false;
}
}
private boolean isHouse() {
return this.inHouse;
}
private boolean isPuroPuro() {
Player player = client.getLocalPlayer();
if (player == null) {
return false;
} else {
WorldPoint location = player.getWorldLocation();
return location.getRegionID() == PURO_PURO_REGION_ID;
}
}
}

View File

@@ -1,18 +0,0 @@
package net.runelite.client.plugins.easy.util;
public enum DuelingRingMode {
DUEL_ARENA("Duel Arena"),
CASTLE_WARS("Castle Wars"),
CLAN_WARS("Clan Wars");
private final String name;
DuelingRingMode(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View File

@@ -1,17 +0,0 @@
package net.runelite.client.plugins.easy.util;
public enum EssenceMode {
RUNECRAFTING("Runecrafting"),
ESSENCE_MINING("Essence Mining");
private final String name;
EssenceMode(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View File

@@ -1,20 +0,0 @@
package net.runelite.client.plugins.easy.util;
public enum GamesNecklaceMode {
BURTHORPE("Burthorpe"),
BARBARIAN_OUTPOST("Barbarian Outpost"),
CORPOREAL_BEAST("Corporeal Beast"),
TEARS_OF_GUTHIX("Tears of Guthix"),
WINTERTODT("Wintertodt Camp");
private final String name;
GamesNecklaceMode(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View File

@@ -1,19 +0,0 @@
package net.runelite.client.plugins.easy.util;
public enum GloryMode {
EDGEVILLE("Edgeville"),
KARAMJA("Karamja"),
DRAYNOR_VILLAGE("Draynor Village"),
AL_KHARID("Al Kharid");
private final String name;
GloryMode(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}

View File

@@ -1,28 +0,0 @@
package net.runelite.client.plugins.easy.util;
import lombok.Getter;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
public class Markable {
@Getter
private Player player;
@Getter
private WorldPoint location;
@Getter
private long frozenTime;
@Getter
private long frozenUntil;
public Markable(Player player, WorldPoint location, long frozenTime, long frozenLength) {
this.player = player;
this.location = location;
this.frozenTime = frozenTime;
this.frozenUntil = frozenTime + frozenLength + 3000;
}
}

View File

@@ -1,38 +0,0 @@
package net.runelite.client.plugins.easy.util;
import lombok.Getter;
import lombok.Setter;
import net.runelite.client.util.Text;
public class Swappable {
@Getter
private String target;
@Getter
private String optionOne;
@Getter
private String optionTwo;
@Getter
@Setter
private int indexOne;
@Getter
@Setter
private int indexTwo;
public Swappable(String target, String optionOne, String optionTwo) {
this.target = Text.removeTags(target.toLowerCase());
this.optionOne = Text.removeTags(optionOne);
this.optionTwo = Text.removeTags(optionTwo);
this.indexOne = -1;
this.indexTwo = -1;
}
public boolean isReady() {
return this.indexOne != -1 && this.indexTwo != -1;
}
}

View File

@@ -1,67 +0,0 @@
package net.runelite.client.plugins.easy.util;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.ArrayUtils;
import java.util.HashSet;
import java.util.Set;
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
public class Swapper {
private Set<Swappable> swapping;
@Getter
@Setter
private MenuEntry[] entries;
public Swapper() {
this.swapping = new HashSet<>();
}
public void deprioritizeWalk() {
MenuEntry menuEntry = entries[entries.length - 1];
menuEntry.setType(MenuAction.WALK.getId() + MENU_ACTION_DEPRIORITIZE_OFFSET);
}
public void removeIndex(int index) {
entries = ArrayUtils.remove(entries, index);
}
public void markForSwap(String optionA, String optionB, String target) {
swapping.add(new Swappable(target, optionA, optionB));
}
public void startSwap() {
int index = 0;
for (MenuEntry entry : entries) {
String target = Text.removeTags(entry.getTarget()).toLowerCase();
String option = Text.removeTags(entry.getOption()).toLowerCase();
for (Swappable swap : swapping) {
if (swap.getTarget().equalsIgnoreCase(target)) {
if (option.equalsIgnoreCase(swap.getOptionOne())) {
swap.setIndexOne(index);
} else if (option.equalsIgnoreCase(swap.getOptionTwo())) {
swap.setIndexTwo(index);
}
}
}
index++;
}
for (Swappable swap : swapping) {
if (swap.isReady()) {
MenuEntry entry = entries[swap.getIndexOne()];
entries[swap.getIndexOne()] = entries[swap.getIndexTwo()];
entries[swap.getIndexTwo()] = entry;
}
}
swapping.clear();
}
}

View File

@@ -1,4 +0,0 @@
package net.runelite.client.plugins.easy.zulrah;
public class EasyZulrahConfig {
}

View File

@@ -1,4 +0,0 @@
package net.runelite.client.plugins.easy.zulrah;
public class EasyZulrahPlugin {
}

View File

@@ -44,7 +44,6 @@ public class EquipmentInspectorPanel extends PluginPanel
c.weightx = 1;
c.gridx = 0;
c.gridy = 0;
header = new JPanel();
header.setLayout(new BorderLayout());
header.setBorder(new CompoundBorder(
@@ -53,9 +52,7 @@ public class EquipmentInspectorPanel extends PluginPanel
nameLabel = new JLabel(NO_PLAYER_SELECTED);
nameLabel.setForeground(Color.WHITE);
header.add(nameLabel, BorderLayout.CENTER);
layout.setHorizontalGroup(layout.createParallelGroup()
.addComponent(equipmentPanels)
.addComponent(header)
@@ -65,7 +62,6 @@ public class EquipmentInspectorPanel extends PluginPanel
.addGap(10)
.addComponent(equipmentPanels)
);
update(new HashMap<>(), "");
}
@@ -79,7 +75,6 @@ public class EquipmentInspectorPanel extends PluginPanel
{
nameLabel.setText("Player: " + playerName);
}
SwingUtilities.invokeLater(() ->
{
equipmentPanels.removeAll();

View File

@@ -3,7 +3,10 @@ package net.runelite.client.plugins.equipmentinspector;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.*;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.ItemComposition;
import net.runelite.api.Player;
import net.runelite.api.events.PlayerMenuOptionClicked;
import net.runelite.api.kit.KitType;
import net.runelite.client.chat.ChatColorType;
@@ -18,11 +21,10 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.Text;
import net.runelite.http.api.item.ItemPrice;
import javax.annotation.Nullable;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.swing.*;
import java.awt.image.BufferedImage;
@@ -32,209 +34,195 @@ import java.util.*;
import java.util.concurrent.ScheduledExecutorService;
@PluginDescriptor(
name = "<font color=\"green\">!Equipment Inspector</font>",
enabledByDefault = false
name = "Equipment Inspector",
enabledByDefault = false,
type = "utility"
)
@Slf4j
public class EquipmentInspectorPlugin extends Plugin {
private static final String INSPECT_EQUIPMENT = "Gear";
private static final String KICK_OPTION = "Kick";
private static final String INSPECT_EQUIPMENT = "Gear";
private static final String KICK_OPTION = "Kick";
@Inject
@Nullable
private Client client;
@Inject
@Nullable
private Client client;
@Inject
private ItemManager itemManager;
@Inject
private ItemManager itemManager;
@Inject
private EquipmentInspectorConfig config;
@Inject
private EquipmentInspectorConfig config;
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private MenuManager menuManager;
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private MenuManager menuManager;
@Inject
private ScheduledExecutorService executor;
@Inject
private ScheduledExecutorService executor;
@Inject
private ClientToolbar pluginToolbar;
@Inject
private ClientToolbar pluginToolbar;
private NavigationButton navButton;
private EquipmentInspectorPanel equipmentInspectorPanel;
private int TotalPrice = 0;
private int Prot1 = 0;
private int Prot2 = 0;
private int Prot3 = 0;
private int Prot4 = 0;
@Provides
EquipmentInspectorConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(EquipmentInspectorConfig.class);
}
@Provides
EquipmentInspectorConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(EquipmentInspectorConfig.class);
}
private NavigationButton navButton;
private EquipmentInspectorPanel equipmentInspectorPanel;
private int TotalPrice = 0;
private int Prot1 = 0;
private int Prot2 = 0;
private int Prot3 = 0;
private int Prot4 = 0;
@Override
protected void startUp() throws Exception {
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
if (client != null) {
menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT);
}
//synchronized (ImageIO.class)
//{
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "normal.png");
//}
navButton = NavigationButton.builder()
.tooltip("Equipment Inspector")
.icon(icon)
.priority(5)
.panel(equipmentInspectorPanel)
.build();
@Override
protected void startUp() throws Exception
{
pluginToolbar.addNavigation(navButton);
equipmentInspectorPanel = injector.getInstance(EquipmentInspectorPanel.class);
if(client != null) {
menuManager.addPlayerMenuItem(INSPECT_EQUIPMENT);
}
}
BufferedImage icon;
synchronized (ImageIO.class)
{
icon = ImageIO.read(getClass().getResourceAsStream("normal.png"));
}
@Override
protected void shutDown() throws Exception {
navButton = NavigationButton.builder()
.tooltip("Equipment Inspector")
.icon(icon)
.priority(5)
.panel(equipmentInspectorPanel)
.build();
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
}
@Subscribe
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event) {
if (event.getMenuOption().equals(INSPECT_EQUIPMENT)) {
pluginToolbar.addNavigation(navButton);
executor.execute(() ->
{
try {
SwingUtilities.invokeAndWait(() ->
{
if (!navButton.isSelected()) {
navButton.getOnSelect().run();
}
});
} catch (InterruptedException | InvocationTargetException e) {
}
throw new RuntimeException(e);
@Override
protected void shutDown() throws Exception
{
}
String playerName = Text.removeTags(event.getMenuTarget());
// The player menu uses a non-breaking space in the player name, we need to replace this to compare
// against the playerName in the player cache.
String finalPlayerName = playerName.replace('\u00A0', ' ');
System.out.println(finalPlayerName);
List<Player> players = client.getPlayers();
Optional<Player> targetPlayer = players.stream()
.filter(Objects::nonNull)
.filter(p -> p.getName().equals(finalPlayerName)).findFirst();
menuManager.removePlayerMenuItem(INSPECT_EQUIPMENT);
}
if (targetPlayer.isPresent()) {
TotalPrice = 0;
Prot1 = 0;
Prot2 = 0;
Prot3 = 0;
Prot4 = 0;
Player p = targetPlayer.get();
Map<KitType, ItemComposition> playerEquipment = new HashMap<>();
@Subscribe
public void onPlayerMenuOptionClicked(PlayerMenuOptionClicked event)
{
if (event.getMenuOption().equals(INSPECT_EQUIPMENT))
{
for (KitType kitType : KitType.values()) {
int itemId = p.getPlayerComposition().getEquipmentId(kitType);
if (itemId != -1) {
ItemComposition itemComposition = client.getItemDefinition(itemId);
playerEquipment.put(kitType, itemComposition);
int ItemPrice = itemManager.getItemPrice(itemId);
TotalPrice += ItemPrice;
if (ItemPrice > Prot1) {
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = Prot1;
Prot1 = ItemPrice;
} else if (ItemPrice > Prot2) {
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = ItemPrice;
} else if (ItemPrice > Prot3) {
Prot4 = Prot3;
Prot3 = ItemPrice;
} else if (ItemPrice > Prot4) {
Prot4 = ItemPrice;
}
}
}
int IgnoredItems = config.protecteditems();
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3) {
IgnoredItems = 4;
executor.execute(() ->
{
try
{
SwingUtilities.invokeAndWait(() ->
{
if (!navButton.isSelected())
{
navButton.getOnSelect().run();
}
});
}
catch (InterruptedException | InvocationTargetException e)
{
}
if (config.ShowValue()) {
switch (IgnoredItems) {
case 1:
TotalPrice = TotalPrice - Prot1;
break;
case 2:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
throw new RuntimeException(e);
break;
case 3:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
TotalPrice = TotalPrice - Prot3;
break;
case 4:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
TotalPrice = TotalPrice - Prot3;
TotalPrice = TotalPrice - Prot4;
break;
}
String StringPrice = "";
if (!config.ExactValue()) {
TotalPrice = TotalPrice / 1000;
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
StringPrice = StringPrice + 'K';
}
if (config.ExactValue()) {
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
}
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
.runeLiteFormattedMessage(new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Risked Value: ")
.append(ChatColorType.NORMAL)
.append(StringPrice)
.build())
.build());
}
equipmentInspectorPanel.update(playerEquipment, playerName);
}
String playerName = Text.removeTags(event.getMenuTarget());
// The player menu uses a non-breaking space in the player name, we need to replace this to compare
// against the playerName in the player cache.
String finalPlayerName = playerName.replace('\u00A0', ' ');
System.out.println(finalPlayerName);
List<Player> players = client.getPlayers();
Optional<Player> targetPlayer = players.stream()
.filter(Objects::nonNull)
.filter(p -> p.getName().equals(finalPlayerName)).findFirst();
if (targetPlayer.isPresent())
{
TotalPrice = 0;
Prot1 = 0;
Prot2 = 0;
Prot3 = 0;
Prot4 = 0;
Player p = targetPlayer.get();
Map<KitType, ItemComposition> playerEquipment = new HashMap<>();
for (KitType kitType : KitType.values())
{
int itemId = p.getPlayerComposition().getEquipmentId(kitType);
if (itemId != -1)
{
ItemComposition itemComposition = client.getItemDefinition(itemId);
playerEquipment.put(kitType, itemComposition);
int ItemPrice = itemManager.getItemPrice(itemId);
TotalPrice += ItemPrice;
if (ItemPrice > Prot1 ) {
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = Prot1;
Prot1 = ItemPrice;
} else if (ItemPrice > Prot2){
Prot4 = Prot3;
Prot3 = Prot2;
Prot2 = ItemPrice;
} else if (ItemPrice > Prot3){
Prot4 = Prot3;
Prot3 = ItemPrice;
} else if (ItemPrice > Prot4){
Prot4 = ItemPrice;
}
}
}
int IgnoredItems = config.protecteditems();
if (IgnoredItems != 0 && IgnoredItems != 1 && IgnoredItems != 2 && IgnoredItems != 3) {
IgnoredItems = 4;
}
if (config.ShowValue()) {
switch (IgnoredItems) {
case 1:
TotalPrice = TotalPrice - Prot1;
break;
case 2:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
break;
case 3:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
TotalPrice = TotalPrice - Prot3;
break;
case 4:
TotalPrice = TotalPrice - Prot1;
TotalPrice = TotalPrice - Prot2;
TotalPrice = TotalPrice - Prot3;
TotalPrice = TotalPrice - Prot4;
break;
}
String StringPrice = "";
if (!config.ExactValue()) {
TotalPrice = TotalPrice / 1000;
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
StringPrice = StringPrice + 'K';
}
if (config.ExactValue()) {
StringPrice = NumberFormat.getIntegerInstance().format(TotalPrice);
}
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
.runeLiteFormattedMessage(new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Risked Value: ")
.append(ChatColorType.NORMAL)
.append(StringPrice)
.build())
.build());
}
equipmentInspectorPanel.update(playerEquipment, playerName);
}
});
}
}
}
}
});
}
}
}

View File

@@ -15,7 +15,8 @@ class ItemPanel extends JPanel
ItemPanel(ItemComposition item, KitType kitType, AsyncBufferedImage icon)
{
setBorder(new EmptyBorder(3, 3, 3, 3));
setBorder(new EmptyBorder(3, 3, 3, 3));
setBackground(ColorScheme.DARK_GRAY_COLOR);
GroupLayout layout = new GroupLayout(this);

View File

@@ -87,4 +87,26 @@ public interface XpDropConfig extends Config
return 0;
}
@ConfigItem(
keyName = "showDamage",
name = "Show Damage on XP Drop",
description = "Show what you hit next to the XP drop",
position = 5
)
default boolean showDamage()
{
return false;
}
@ConfigItem(
keyName = "damageColor",
name = "Damage Color",
description = "The color you want the text to be for damage",
position = 6
)
default Color getDamageColor()
{
return Color.RED;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Frosty Fridge <https://github.com/frostyfridge>
* Copyright (c) 2017, honeyhoney <https://github.com/honeyhoney>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,47 +22,52 @@
* (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.templetrek;
package net.runelite.client.plugins.experiencedrop;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import javax.inject.Inject;
import net.runelite.api.GroundObject;
import net.runelite.api.Actor;
import net.runelite.api.Point;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
public class TempleTrekBogOverlay extends Overlay
class XpDropOverlay extends Overlay
{
private final TempleTrekConfig config;
private final TempleTrekPlugin plugin;
private static final Color GREEN = new Color(0, 200, 83);
private final XpDropPlugin plugin;
private final XpDropConfig config;
@Inject
private TempleTrekBogOverlay(TempleTrekConfig config, TempleTrekPlugin plugin)
private XpDropOverlay(XpDropPlugin plugin, XpDropConfig config)
{
super(plugin);
this.config = config;
this.plugin = plugin;
this.config = config;
setPosition(OverlayPosition.DYNAMIC);
setPriority(OverlayPriority.LOW);
setPriority(OverlayPriority.MED);
}
@Override
public Dimension render(Graphics2D graphics)
{
if (config.bogMapActive())
if (config.showDamage())
{
for (GroundObject bog : plugin.getBogList())
final Actor opponent = plugin.getLastOpponent();
if (opponent != null)
{
Polygon bogPoly = bog.getCanvasTilePoly();
OverlayUtil.renderPolygon(graphics, bogPoly, GREEN);
int offset = opponent.getLogicalHeight() + 50;
String damageStr = String.valueOf(this.plugin.getDamage());
Point textLocation = opponent.getCanvasTextLocation(graphics, damageStr, offset);
if (textLocation != null && this.plugin.getDamage() != 0)
{
OverlayUtil.renderTextLocation(graphics, textLocation, damageStr, config.getDamageColor());
}
}
}
return null;
}
}

View File

@@ -25,26 +25,38 @@
package net.runelite.client.plugins.experiencedrop;
import com.google.inject.Provides;
import java.time.Duration;
import java.time.Instant;
import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
import java.util.stream.IntStream;
import javax.inject.Inject;
import net.runelite.api.Client;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.*;
import static net.runelite.api.ScriptID.XPDROP_DISABLED;
import net.runelite.api.Skill;
import net.runelite.api.SpriteID;
import net.runelite.api.Varbits;
import net.runelite.api.events.ExperienceChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.WidgetHiddenChanged;
import static net.runelite.client.plugins.attackstyles.AttackStyle.*;
import net.runelite.api.events.*;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.HiscoreManager;
import net.runelite.client.game.NPCManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.attackstyles.AttackStyle;
import net.runelite.client.plugins.attackstyles.WeaponType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.Text;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
@PluginDescriptor(
name = "XP Drop",
@@ -54,6 +66,7 @@ import net.runelite.client.plugins.PluginDescriptor;
public class XpDropPlugin extends Plugin
{
private static final int XPDROP_PADDING = 2; // space between xp drop icons
private static final Duration WAIT = Duration.ofSeconds(5);
@Inject
private Client client;
@@ -63,11 +76,39 @@ public class XpDropPlugin extends Plugin
private int tickCounter = 0;
private int previousExpGained;
private boolean hasHit = false;
private boolean hasDropped = false;
private boolean correctPrayer;
private Skill lastSkill = null;
private Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
private PrayerType currentTickPrayer;
private AttackStyle attackStyle;
private int attackStyleVarbit = -1;
private int equippedWeaponTypeVarbit = -1;
private int castingModeVarbit = -1;
private int opponentHealth = -1;
private int xpGains = 0;
private AttackStyle[] offensiveStyles = {ACCURATE, AGGRESSIVE, DEFENSIVE, CONTROLLED, RANGING, LONGRANGE, CASTING, DEFENSIVE_CASTING};
@Getter(AccessLevel.PACKAGE)
private int damage = 0;
@Getter(AccessLevel.PACKAGE)
private Actor lastOpponent;
private Instant lastTime;
@Inject
private OverlayManager overlayManager;
@Inject
private XpDropOverlay overlay;
@Inject
private NPCManager npcManager;
@Inject
private HiscoreManager hiscoreManager;
@Provides
XpDropConfig provideConfig(ConfigManager configManager)
@@ -75,6 +116,23 @@ public class XpDropPlugin extends Plugin
return configManager.getConfig(XpDropConfig.class);
}
@Override
protected void startUp() throws Exception
{
lastOpponent = null;
overlayManager.add(overlay);
if (client.getGameState() == GameState.LOGGED_IN)
{
attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
equippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE);
castingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE);
updateAttackStyle(
equippedWeaponTypeVarbit,
attackStyleVarbit,
castingModeVarbit);
}
}
@Subscribe
public void onWidgetHiddenChanged(WidgetHiddenChanged event)
{
@@ -203,6 +261,42 @@ public class XpDropPlugin extends Plugin
@Subscribe
public void onGameTick(GameTick tick)
{
// Detect hitting a 0
if (lastOpponent != null)
{
int health = calculateHealth(lastOpponent);
if (health != -1 && opponentHealth != -1 && health == opponentHealth && hasHit)
{
damage = 0;
hasHit = false;
}
}
// Handle getting XP gains
if (hasDropped)
{
if (xpGains != 0 && attackStyle.getSkills().length > 1 && attackStyle != LONGRANGE)
{
damage = (int) (xpGains / (attackStyle.getSkills().length * 1.3));
}
else if (xpGains != 0)
{
damage = xpGains / 4;
}
xpGains = 0;
hasDropped = false;
}
// Clear opponent
if (lastOpponent != null && lastTime != null && client.getLocalPlayer().getInteracting() == null)
{
if (Duration.between(lastTime, Instant.now()).compareTo(WAIT) > 0)
{
lastOpponent = null;
}
}
currentTickPrayer = getActivePrayerType();
correctPrayer = false;
@@ -240,9 +334,115 @@ public class XpDropPlugin extends Plugin
Integer previous = previousSkillExpTable.put(skill, xp);
if (previous != null)
{
opponentHealth = calculateHealth(lastOpponent);
previousExpGained = xp - previous;
if (skill != Skill.HITPOINTS && Arrays.stream(offensiveStyles).anyMatch(attackStyle::equals))
{
xpGains += previousExpGained;
}
hasDropped = true;
hasHit = true;
}
}
private void updateAttackStyle(int equippedWeaponType, int attackStyleIndex, int castingMode)
{
AttackStyle[] attackStyles = WeaponType.getWeaponType(equippedWeaponType).getAttackStyles();
if (attackStyleIndex < attackStyles.length)
{
attackStyle = attackStyles[attackStyleIndex];
if (attackStyle == null)
{
attackStyle = OTHER;
}
else if ((attackStyle == CASTING) && (castingMode == 1))
{
attackStyle = DEFENSIVE_CASTING;
}
}
}
@Subscribe
public void onInteractingChanged(InteractingChanged event)
{
if (event.getSource() != client.getLocalPlayer())
{
return;
}
Actor opponent = event.getTarget();
if (opponent == null)
{
lastTime = Instant.now();
return;
}
damage = 0;
lastOpponent = opponent;
opponentHealth = calculateHealth(opponent);
}
private int calculateHealth(Actor target)
{
if (target == null || target.getName() == null)
{
return -1;
}
final int healthScale = target.getHealth();
final int healthRatio = target.getHealthRatio();
final String targetName = Text.removeTags(target.getName());
Integer maxHealth = -1;
if (target instanceof NPC)
{
maxHealth = npcManager.getHealth(targetName, target.getCombatLevel());
}
else if (target instanceof Player)
{
final HiscoreResult hiscoreResult = hiscoreManager.lookupAsync(targetName, HiscoreEndpoint.NORMAL);
if (hiscoreResult != null)
{
final int hp = hiscoreResult.getHitpoints().getLevel();
if (hp > 0)
{
maxHealth = hp;
}
}
}
if (healthRatio < 0 || healthScale <= 0 || maxHealth == null)
{
return -1;
}
return (int)((maxHealth * healthRatio / healthScale) + 0.5f);
}
@Subscribe
public void onVarbitChanged(VarbitChanged event)
{
if (attackStyleVarbit == -1 || attackStyleVarbit != client.getVar(VarPlayer.ATTACK_STYLE))
{
attackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
updateAttackStyle(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE), attackStyleVarbit,
client.getVar(Varbits.DEFENSIVE_CASTING_MODE));
}
if (equippedWeaponTypeVarbit == -1 || equippedWeaponTypeVarbit != client.getVar(Varbits.EQUIPPED_WEAPON_TYPE))
{
equippedWeaponTypeVarbit = client.getVar(Varbits.EQUIPPED_WEAPON_TYPE);
updateAttackStyle(equippedWeaponTypeVarbit, client.getVar(VarPlayer.ATTACK_STYLE),
client.getVar(Varbits.DEFENSIVE_CASTING_MODE));
}
if (castingModeVarbit == -1 || castingModeVarbit != client.getVar(Varbits.DEFENSIVE_CASTING_MODE))
{
castingModeVarbit = client.getVar(Varbits.DEFENSIVE_CASTING_MODE);
updateAttackStyle(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE), client.getVar(VarPlayer.ATTACK_STYLE),
castingModeVarbit);
}
}
}

View File

@@ -15,9 +15,10 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "<font color=\"#4863A0\">!Fight Cave - Jad</font>",
name = "Fight Cave - Jad",
description = "Show what to pray against Jad",
tags = {"bosses", "combat", "minigame", "overlay", "prayer", "pve", "pvm"},
type = "PVM",
enabledByDefault = false
)
public class FightCaveJadHelperPlugin extends Plugin

View File

@@ -45,9 +45,10 @@ import net.runelite.client.ui.overlay.OverlayManager;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "<font color=\"#4863A0\">!Fight Cave - Waves</font>",
name = "Fight Cave - Waves",
description = "Displays current and upcoming wave monsters in the Fight Caves",
tags = {"bosses", "combat", "minigame", "overlay", "pve", "pvm", "jad", "fire", "cape", "wave"},
type = "PVM",
enabledByDefault = false
)
public class FightCaveWaveHelperPlugin extends Plugin

View File

@@ -0,0 +1,180 @@
/*
* Copyright (c) 2018, 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.flexo;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import java.awt.*;
@ConfigGroup("flexo")
public interface FlexoConfig extends Config {
@ConfigItem(
position = 0,
keyName = "overlayEnabled",
name = "Overlay Enabled",
description = "Shows clicking area and points etc."
)
default boolean overlayEnabled() {
return true;
}
@ConfigItem(
position = 1,
keyName = "minDelayAmount",
name = "Min Delay",
description = "Minimum delay that is applied to every action at the end (ms)"
)
default int minDelayAmt() {
return 45;
}
@ConfigItem(
position = 2,
keyName = "reactionTime",
name = "Reaction Time",
description = "The base time between actions (ms)"
)
default int getReactionTimeVariation() {
return 80;
}
@ConfigItem(
position = 3,
keyName = "mouseDragSpeed",
name = "Mouse drag speed",
description = "The speed at which steps are executed. Keep at 49? cuz jagex mouse recorder?"
)
default int getMouseDragSpeed() {
return 49;
}
@ConfigItem(
position = 4,
keyName = "overshoots",
name = "Overshoots",
description = "Higher number = more overshoots"
)
default int getOvershoots() {
return 4;
}
@ConfigItem(
position = 5,
keyName = "variatingFlow",
name = "Flow - Variating",
description = ""
)
default boolean getVariatingFlow() {
return true;
}
@ConfigItem(
position = 6,
keyName = "slowStartupFlow",
name = "Flow - Slow startup",
description = ""
)
default boolean getSlowStartupFlow() {
return true;
}
@ConfigItem(
position = 7,
keyName = "slowStartup2Flow",
name = "Flow - Slow startup 2",
description = ""
)
default boolean getSlowStartup2Flow() {
return true;
}
@ConfigItem(
position = 8,
keyName = "jaggedFlow",
name = "Flow - Jagged",
description = ""
)
default boolean getJaggedFlow() {
return true;
}
@ConfigItem(
position = 9,
keyName = "interruptedFlow",
name = "Flow - Interrupted",
description = ""
)
default boolean getInterruptedFlow() {
return false;
}
@ConfigItem(
position = 10,
keyName = "interruptedFlow2",
name = "Flow - Interrupted 2",
description = ""
)
default boolean getInterruptedFlow2() {
return false;
}
@ConfigItem(
position = 11,
keyName = "stoppingFlow",
name = "Flow - Stopping",
description = ""
)
default boolean getStoppingFlow() {
return false;
}
@ConfigItem(
position = 12,
keyName = "deviationSlopeDivider",
name = "Deviation slope divider",
description = ""
)
default int getDeviationSlope() {
return 10;
}
@ConfigItem(
position = 13,
keyName = "noisinessDivider",
name = "Noisiness divider",
description = ""
)
default String getNoisinessDivider() {
return "2.0D";
}
}

View File

@@ -0,0 +1,42 @@
package net.runelite.client.plugins.flexo;
import net.runelite.api.Client;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import javax.annotation.Nullable;
import javax.inject.Inject;
import java.awt.*;
import java.awt.geom.Ellipse2D;
public class FlexoOverlay extends Overlay {
public static Rectangle clickArea;
@Inject
private Client client;
@Inject
private FlexoPlugin plugin;
@Inject
private FlexoConfig config;
@Inject
public FlexoOverlay(@Nullable Client client, FlexoPlugin plugin, FlexoConfig config) {
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
this.client = client;
this.plugin = plugin;
this.config = config;
}
@Override
public Dimension render(Graphics2D graphics) {
if (clickArea!=null)
graphics.draw(clickArea);
return null;
}
}

View File

@@ -0,0 +1,127 @@
package net.runelite.client.plugins.flexo;
import com.github.joonasvali.naturalmouse.api.MouseMotionFactory;
import com.github.joonasvali.naturalmouse.support.DefaultNoiseProvider;
import com.github.joonasvali.naturalmouse.support.DefaultOvershootManager;
import com.github.joonasvali.naturalmouse.support.DefaultSpeedManager;
import com.github.joonasvali.naturalmouse.support.Flow;
import com.github.joonasvali.naturalmouse.support.SinusoidalDeviationProvider;
import com.github.joonasvali.naturalmouse.util.FlowTemplates;
import com.google.inject.Provides;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.flexo.Flexo;
import net.runelite.client.flexo.FlexoUtils;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.stretchedmode.StretchedModeConfig;
import net.runelite.client.ui.overlay.OverlayManager;
import javax.inject.Inject;
import java.util.ArrayList;
import java.util.List;
@PluginDescriptor(
name = "Flexo Config",
description = "Customizes Flexo, the MouseInput Assistant ;)",
tags = {"flexo", "null"},
type = "utility"
)
@Slf4j
public class FlexoPlugin extends Plugin {
@Inject
private Client client;
@Inject
private ConfigManager configManager;
@Inject
private OverlayManager overlayManager;
@Inject
private FlexoOverlay overlay;
@Provides
FlexoConfig getConfig(ConfigManager configManager) {
return configManager.getConfig(FlexoConfig.class);
}
@Subscribe
private void onConfigChanged(ConfigChanged event) {
if (event.getKey().compareTo("overlayEnabled")==0) {
if (getConfig(configManager).overlayEnabled()) {
overlayManager.add(overlay);
} else {
overlayManager.remove(overlay);
}
}
updateMouseMotionFactory();
}
@Subscribe
public void onGameTick(GameTick event) {
Flexo.isStretched = client.isStretchedEnabled();
Flexo.scale = configManager.getConfig(StretchedModeConfig.class).scalingFactor();
}
private void updateMouseMotionFactory() {
Flexo.minDelay = getConfig(configManager).minDelayAmt();
MouseMotionFactory factory = new MouseMotionFactory();
//TODO:Add Options for various flows to allow more personalization
List<Flow> flows = new ArrayList<>();
//Always add random
flows.add(new Flow(FlowTemplates.random()));
if (getConfig(configManager).getVariatingFlow())
flows.add(new Flow(FlowTemplates.variatingFlow()));
if (getConfig(configManager).getSlowStartupFlow())
flows.add(new Flow(FlowTemplates.slowStartupFlow()));
if (getConfig(configManager).getSlowStartup2Flow())
flows.add(new Flow(FlowTemplates.slowStartup2Flow()));
if (getConfig(configManager).getJaggedFlow())
flows.add(new Flow(FlowTemplates.jaggedFlow()));
if (getConfig(configManager).getInterruptedFlow())
flows.add(new Flow(FlowTemplates.interruptedFlow()));
if (getConfig(configManager).getInterruptedFlow2())
flows.add(new Flow(FlowTemplates.interruptedFlow2()));
if (getConfig(configManager).getStoppingFlow())
flows.add(new Flow(FlowTemplates.stoppingFlow()));
DefaultSpeedManager manager = new DefaultSpeedManager(flows);
//TODO:Add options for custom Deviation Provider and Noise Provider
factory.setDeviationProvider(new SinusoidalDeviationProvider(getConfig(configManager).getDeviationSlope()));
factory.setNoiseProvider(new DefaultNoiseProvider(Double.valueOf(getConfig(configManager).getNoisinessDivider())));
factory.getNature().setReactionTimeVariationMs(getConfig(configManager).getReactionTimeVariation());
manager.setMouseMovementBaseTimeMs(getConfig(configManager).getMouseDragSpeed());
DefaultOvershootManager overshootManager = (DefaultOvershootManager) factory.getOvershootManager();
overshootManager.setOvershoots(getConfig(configManager).getOvershoots());
factory.setSpeedManager(manager);
Flexo.currentMouseMotionFactory = factory;
}
@Override
protected void startUp() throws Exception {
Flexo.isStretched = client.isStretchedEnabled();
overlayManager.add(overlay);
updateMouseMotionFactory();
}
@Override
protected void shutDown() throws Exception {
overlayManager.remove(overlay);
}
}

View File

@@ -1,43 +1,68 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import lombok.Getter;
import net.runelite.api.Actor;
import net.runelite.client.plugins.freezetimers.Spell;
import net.runelite.client.util.Text;
import org.jetbrains.annotations.NotNull;
public class Barrage
extends Spell {
public static final long DURATION = 20000L;
public class Barrage extends Spell
{
@Getter
public static final long DURATION = 20000;
private long remainingTime;
@Getter
private boolean isFinished;
public Barrage(Actor affectedTarget, Actor caster) {
public Barrage(Actor affectedTarget, Actor caster)
{
super(affectedTarget, caster);
}
public long getRemainingTime() {
public long getRemainingTime()
{
long elapsedTime = System.currentTimeMillis() - this.startTime;
if (Barrage.getDURATION() > elapsedTime) {
return Barrage.getDURATION() - elapsedTime;
if (getDURATION() > elapsedTime)
{
return getDURATION() - elapsedTime;
}
this.isFinished = true;
return 0L;
}
public boolean equals(Object o) {
if (o instanceof Barrage) {
Barrage barrage = (Barrage)o;
return Text.standardize(this.getAffectedTarget().getName()).equals(Text.standardize(((Barrage)o).getAffectedTarget().getName())) && this.getStartTime() == ((Barrage)o).getStartTime();
else
{
this.isFinished = true;
return 0;
}
return false;
}
public static long getDURATION() {
return 20000L;
public boolean equals(Object o)
{
if (o instanceof Barrage)
{
Barrage barrage = (Barrage) o;
if (Text.standardize(this.getAffectedTarget().getName()).equals(Text.standardize(((Barrage) o)
.getAffectedTarget().getName())) && this.getStartTime() == ((Barrage) o).getStartTime())
{
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
@Override
public boolean isFinished() {
return this.isFinished;
}
}

View File

@@ -5,38 +5,75 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup(value="freezetimers")
public interface FreezeTimersConfig
extends Config {
@ConfigItem(position=0, keyName="freezeenable", name="Enable PvP freeze timers", description="Configures whether or not to show freeze timers.")
default public boolean EnableFreezeTimers() {
@ConfigGroup("freezetimers")
public interface FreezeTimersConfig extends Config
{
@ConfigItem(
position = 0,
keyName = "freezeenable",
name = "Enable PvP freeze timers",
description = "Configures whether or not to show freeze timers."
)
default boolean EnableFreezeTimers()
{
return false;
}
@ConfigItem(position=1, keyName="tilehighlight", name="Frozen opponent tile highlighting", description="Configures whether or not to highlight tiles frozen opponents are standing on.")
default public boolean drawTiles() {
@ConfigItem(
position = 1,
keyName = "tilehighlight",
name = "Frozen opponent tile highlighting",
description = "Configures whether or not to highlight tiles frozen opponents are standing on."
)
default boolean drawTiles()
{
return false;
}
@ConfigItem(position=2, keyName="timercolor", name="Freeze Timer Color", description="Color of freeze timer")
default public Color FreezeTimerColor() {
@ConfigItem(
position = 2,
keyName = "timercolor",
name = "Freeze Timer Color",
description = "Color of freeze timer"
)
default Color FreezeTimerColor()
{
return new Color(0, 184, 212);
}
@ConfigItem(position=3, keyName="spellIcon", name="Show spell icon", description="Shows the spell icon for the freeze spell affecting the target")
default public boolean spellIcon() {
@ConfigItem(
position = 3,
keyName = "spellIcon",
name = "Show spell icon",
description = "Shows the spell icon for the freeze spell affecting the target"
)
default boolean spellIcon()
{
return true;
}
@ConfigItem(position=4, keyName="refreezeTimer", name="Refreeze Timer", description="Show a timer that counts up until the target can be refrozen")
default public boolean refreezeTimer() {
@ConfigItem(
position = 4,
keyName = "refreezeTimer",
name = "Refreeze Timer",
description = "Show a timer that counts up until the target can be refrozen"
)
default boolean refreezeTimer()
{
return true;
}
@ConfigItem(position=5, keyName="refreezeTimerColor", name="Refreeze color", description="The color for the timer that counts until the target can be refrozen")
default public Color RefreezeTimerColor() {
@ConfigItem(
position = 5,
keyName = "refreezeTimerColor",
name = "Refreeze color",
description = "The color for the timer that counts until the target can be refrozen"
)
default Color RefreezeTimerColor()
{
return Color.red;
}
}
@ConfigItem(position = 6, keyName = "tbtimer", name = "Tele Block Timer", description = "Enables tele block timer")
default boolean TBTimer() {

View File

@@ -1,24 +1,25 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Stroke;
import java.awt.image.BufferedImage;
import java.util.function.BiConsumer;
import java.awt.font.TextLayout;
import java.awt.image.*;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.HeadIcon;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.*;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
import net.runelite.client.plugins.freezetimers.FreezeTimersPlugin;
import net.runelite.client.plugins.freezetimers.FreezeTimersService;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
@@ -26,8 +27,8 @@ import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
@Singleton
public class FreezeTimersOverlay
extends Overlay {
public class FreezeTimersOverlay extends Overlay
{
private final FreezeTimersService FreezeTimersService;
private final FreezeTimersConfig config;
private final FreezeTimersPlugin plugin;
@@ -35,123 +36,165 @@ extends Overlay {
private final Client client;
@Inject
private FreezeTimersOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService2, FreezeTimersPlugin plugin, Client client, SpriteManager spriteManager) {
private FreezeTimersOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService, FreezeTimersPlugin plugin, Client client, SpriteManager spriteManager)
{
this.config = config;
this.FreezeTimersService = FreezeTimersService2;
this.FreezeTimersService = FreezeTimersService;
this.plugin = plugin;
this.client = client;
this.spriteManager = spriteManager;
this.setPosition(OverlayPosition.DYNAMIC);
this.setPriority(OverlayPriority.MED);
setPosition(OverlayPosition.DYNAMIC);
setPriority(OverlayPriority.MED);
}
@Override
public Dimension render(Graphics2D graphics) {
if (!this.config.EnableFreezeTimers()) {
public Dimension render(Graphics2D graphics)
{
if (!config.EnableFreezeTimers())
{
return null;
}
this.FreezeTimersService.forEachPlayer((player, color) -> this.renderPlayerOverlay(graphics, (Player)player, (Color)color));
FreezeTimersService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color));
return null;
}
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) {
BufferedImage clanchatImage;
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
{
int timer = 0;
String name = actor.getName();
int freezetype = this.plugin.freezetype(name);
boolean frozenoverlay = false;
int freezetype = plugin.freezetype(name);
boolean frozenoverlay = false;
int offset = 5;
long dtime = this.plugin.opponentfreezetime(name);
long tbed = plugin.istbed(name);
long dtime = plugin.opponentfreezetime(name);
long tbed = plugin.istbed(name);
Point textLocation = null;
HeadIcon headIcon = actor.getOverheadIcon();
int freezetime = 0;
if (freezetype == 1 || freezetype == 4) {
if (freezetype == 1 || freezetype == 4)
{
freezetime = 5000;
} else if (freezetype == 2 || freezetype == 5) {
}
else if (freezetype == 2 || freezetype == 5)
{
freezetime = 10000;
} else if (freezetype == 3 || freezetype == 6) {
}
else if (freezetype == 3 || freezetype == 6)
{
freezetime = 15000;
} else if (freezetype == 7) {
}
else if (freezetype == 7)
{
freezetime = 20000;
} else if (freezetype == 8) {
}
else if (freezetype == 8)
{
freezetime = 2500;
} else if (freezetype == 9) {
}
else if (freezetype == 9)
{
freezetime = 5000;
} else if (freezetype == 10) {
}
else if (freezetype == 10)
{
freezetime = 7500;
}
long currenttime = System.currentTimeMillis();
long timediff = currenttime - dtime;
timer = (freezetime - (int)timediff) / 1000;
if (timediff < (long)freezetime) {
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf(timer), actor.getLogicalHeight() + config.FreezeTimerPos());
timer = (freezetime - (int) timediff) / 1000;
if (timediff < freezetime)
{
// if the freezetimer is still active. . .
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf((timer)), offset);
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
} else if (timediff < (long)(freezetime + 3000)) {
timer = Math.abs(timer);
++timer;
if (this.config.refreezeTimer()) {
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf(timer), actor.getLogicalHeight() + config.FreezeTimerPos());
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
graphics.setFont(FontManager.getRunescapeBoldFont());
if (headIcon != null) {
}
else
{
if (timediff < freezetime + 3000)
{
timer = Math.abs(timer);
timer += 1;
if (config.refreezeTimer())
{
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf((timer)), offset);
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
graphics.setFont(FontManager.getRunescapeBoldFont());
if (headIcon != null)
{
textLocation = new Point(textLocation.getX() + 10, textLocation.getY() + 5);
}
frozenoverlay = true;
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf((timer)), config.RefreezeTimerColor());
return;
}
frozenoverlay = true;
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), this.config.RefreezeTimerColor());
return;
}
} else {
this.plugin.deleteopponent(name);
}
if (textLocation != null && (clanchatImage = this.plugin.GetFreezeIcon(freezetype - 1)) != null) {
int width = clanchatImage.getWidth();
int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
Point imageLocation = new Point(textLocation.getX(), textLocation.getY() - (config.FreezeTimerPos() / 2));
graphics.setFont(FontManager.getRunescapeFont());
graphics.setStroke(new BasicStroke(3.0f));
if (this.config.spellIcon()) {
frozenoverlay = true;
graphics.drawOval(imageLocation.getX(), imageLocation.getY(), clanchatImage.getWidth(), clanchatImage.getHeight());
OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage);
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), color);
} else {
graphics.setColor(Color.cyan);
graphics.drawOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(), graphics.getFontMetrics().getHeight());
graphics.setColor(Color.blue);
graphics.fillOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(), graphics.getFontMetrics().getHeight());
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), Color.WHITE);
else
{
plugin.deleteopponent(name);
}
}
if (config.TBTimer()) {
if (tbed > 0) {
int type = plugin.tbtype(name);
int tbexpiry;
if (type > 0) {
if (type == 1) {
tbexpiry = 300000;
} else if (type == 2) {
tbexpiry = 150000;
} else {
return;
}
long tbtime = currenttime - tbed;
int tbtimer = (tbexpiry - (int) tbtime) / 1000;
if (tbtime < tbexpiry) {
textLocation = actor.getCanvasTextLocation(graphics, Integer.toString(tbtimer), actor.getLogicalHeight() + config.FreezeTimerPos());
if (frozenoverlay) {
textLocation = new Point(textLocation.getX() + 40, textLocation.getY() - config.FreezeTimerPos());
} else {
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
}
} else {
plugin.deletetb(name);
}
}
if (textLocation != null)
{
BufferedImage clanchatImage = plugin.GetFreezeIcon(freezetype - 1);
}
}
}
}
if (clanchatImage != null)
{
int width = clanchatImage.getWidth();
int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
Point imageLocation = new Point(textLocation.getX() - width, ((textLocation.getY() -
graphics.getFontMetrics().getHeight()) + 10));
graphics.setFont(FontManager.getRunescapeFont());
// graphics.setStroke(new BasicStroke(3));
if (config.spellIcon())
{
frozenoverlay = true;
// graphics.drawOval(imageLocation.getX(), imageLocation.getY(), clanchatImage.getWidth(), clanchatImage.getHeight());
OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage);
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), color);
}
else
{
graphics.setColor(Color.cyan);
graphics.drawOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(),
graphics.getFontMetrics().getHeight());
graphics.setColor(Color.blue);
graphics.fillOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(),
graphics.getFontMetrics().getHeight());
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), Color.WHITE);
}
}
if (config.TBTimer()) {
if (tbed > 0) {
int type = plugin.tbtype(name);
int tbexpiry;
if (type > 0) {
if (type == 1) {
tbexpiry = 300000;
} else if (type == 2) {
tbexpiry = 150000;
} else {
return;
}
long tbtime = currenttime - tbed;
int tbtimer = (tbexpiry - (int) tbtime) / 1000;
if (tbtime < tbexpiry) {
textLocation = actor.getCanvasTextLocation(graphics, Integer.toString(tbtimer), actor.getLogicalHeight() + config.FreezeTimerPos());
if (frozenoverlay) {
textLocation = new Point(textLocation.getX() + 40, textLocation.getY() - config.FreezeTimerPos());
} else {
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
}
} else {
plugin.deletetb(name);
}
}
}
}
}
}
}

View File

@@ -1,98 +1,86 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import net.runelite.api.events.*;
import net.runelite.client.eventbus.Subscribe;
import com.google.inject.Provides;
import javax.inject.Inject;
import java.awt.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.*;
import java.awt.image.BufferedImage;
import java.awt.image.ColorModel;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferByte;
import java.awt.image.ImageObserver;
import java.awt.image.IndexColorModel;
import java.awt.image.WritableRaster;
import java.util.*;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
import net.runelite.api.*;
import net.runelite.api.Actor;
import net.runelite.api.Client;
import net.runelite.api.events.*;
import net.runelite.api.GameState;
import net.runelite.api.HeadIcon;
import net.runelite.api.IndexedSprite;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ExperienceChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.freezetimers.Barrage;
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
import net.runelite.client.plugins.freezetimers.FreezeTimersOverlay;
import net.runelite.client.plugins.freezetimers.FreezeTimersTileOverlay;
import net.runelite.client.plugins.freezetimers.Spell;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ImageUtil;
import org.slf4j.Logger;
@PluginDescriptor(
name = "<font color=\"aqua\">!Freeze Timers</font>",
description = "PVP Freeze Timers",
tags = {"PvP", "Freeze", "Timers"}
name = "Freeze Timers",
description = "PVP Freeze Timers",
type = "PVP",
tags = {"PvP", "Freeze", "Timers", "pklite"}
)
public class FreezeTimersPlugin
extends Plugin {
public class FreezeTimersPlugin extends Plugin
{
@Inject
private OverlayManager overlayManager;
@Inject
private FreezeTimersConfig config;
@Inject
private FreezeTimersOverlay FreezeTimersOverlay;
@Inject
private FreezeTimersTileOverlay FreezeTimersTileOverlay;
@Inject
private Client client;
@Inject
private SpriteManager spriteManager;
private static final int[] FREEZE_ICONS = {
SpriteID.SPELL_BIND,
SpriteID.SPELL_SNARE,
SpriteID.SPELL_ENTANGLE,
SpriteID.SPELL_ICE_RUSH,
SpriteID.SPELL_ICE_BURST,
SpriteID.SPELL_ICE_BLITZ,
SpriteID.SPELL_ICE_BARRAGE,
SpriteID.SPELL_BIND,
SpriteID.SPELL_SNARE,
SpriteID.SPELL_ENTANGLE,
SpriteID.SPELL_TELE_BLOCK
};
private static final Dimension FREEZE_ICON_DIMENSION = new Dimension(25, 25);
@Provides
FreezeTimersConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(FreezeTimersConfig.class);
}
private static final int[] FREEZE_ICONS =
{
SpriteID.SPELL_BIND,
SpriteID.SPELL_SNARE,
SpriteID.SPELL_ENTANGLE,
SpriteID.SPELL_ICE_RUSH,
SpriteID.SPELL_ICE_BURST,
SpriteID.SPELL_ICE_BLITZ,
SpriteID.SPELL_ICE_BARRAGE,
SpriteID.SPELL_BIND,
SpriteID.SPELL_SNARE,
SpriteID.SPELL_ENTANGLE,
SpriteID.SPELL_TELE_BLOCK
};
private static final Dimension FREEZE_ICON_DIMENSION = new Dimension(25, 25);
private static final Color FREEZE_ICON_OUTLINE_COLOR = new Color(33, 33, 33);
private final BufferedImage[] FreezeIcons = new BufferedImage[FREEZE_ICONS.length];
private final int SPLASH_ID = 85;
Map<String, Long> tbedthings = new HashMap<>();
Map<String, Integer> tbtypes = new HashMap<>();
@@ -107,248 +95,319 @@ extends Plugin {
String currtarget;
String spell;
@Provides
FreezeTimersConfig provideConfig(ConfigManager configManager) {
return configManager.getConfig(FreezeTimersConfig.class);
}
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged) {
if (gameStateChanged.getGameState() == GameState.LOGGED_IN) {
this.loadFreezeIcons();
loadFreezeIcons();
}
}
@Override
protected void startUp() throws Exception {
this.overlayManager.add(this.FreezeTimersOverlay);
this.overlayManager.add(this.FreezeTimersTileOverlay);
overlayManager.add(FreezeTimersOverlay);
overlayManager.add(FreezeTimersTileOverlay);
}
@Override
protected void shutDown() throws Exception {
this.overlayManager.remove(this.FreezeTimersOverlay);
this.overlayManager.remove(this.FreezeTimersTileOverlay);
this.frozenthings.clear();
this.frozenthingpoints.clear();
this.tbedthings.clear();
this.tbtypes.clear();
overlayManager.remove(FreezeTimersOverlay);
overlayManager.remove(FreezeTimersTileOverlay);
frozenthings.clear();
frozenthingpoints.clear();
tbedthings.clear();
tbtypes.clear();
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event) {
if (event.getMenuTarget().contains("->")) {
Pattern spattern = Pattern.compile(">(.+?)</col>");
Pattern ppattern = Pattern.compile("> <col=ffffff>(.+?)<col=");
Matcher smatch = spattern.matcher(event.getMenuTarget());
Matcher pmatch = ppattern.matcher(event.getMenuTarget());
smatch.find();
pmatch.find();
if (smatch.group(1) != null && pmatch.group(1) != null) {
this.currticks = this.ticks;
this.spell = smatch.group(1);
this.currtarget = pmatch.group(1).replace("\u00a0", " ");
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuTarget().contains("->"))
{
final Pattern spattern = Pattern.compile(">(.+?)</col>");
final Pattern ppattern = Pattern.compile("> <col=ffffff>(.+?)<col=");
final Matcher smatch = spattern.matcher(event.getMenuTarget());
final Matcher pmatch = ppattern.matcher(event.getMenuTarget());
if (smatch.find() && smatch.group(1) != null &&
pmatch.find() && pmatch.group(1) != null)
{
currticks = ticks;
spell = smatch.group(1);
currtarget = pmatch.group(1).replace(" ", " ");
}
}
}
@Subscribe
public void onExperienceChanged(ExperienceChanged event) {
if (event.getSkill() == Skill.MAGIC) {
int xp = this.client.getSkillExperience(Skill.MAGIC);
int gains = xp - this.lastxp;
this.lastxp = xp;
if (!this.magexp.containsKey(this.ticks)) {
this.magexp.clear();
this.magexp.put(this.ticks, gains);
public void onExperienceChanged(ExperienceChanged event)
{
if (event.getSkill() == Skill.MAGIC)
{
final int xp = client.getSkillExperience(Skill.MAGIC);
int gains = xp - lastxp;
lastxp = xp;
if (!magexp.containsKey(ticks))
{
magexp.clear();
magexp.put(ticks, gains);
}
}
}
@Subscribe
private void onAnimationChanged(AnimationChanged event) {
Logger l = this.client.getLogger();
Actor subject = event.getActor();
Actor target = subject.getInteracting();
if (subject.getAnimation() == 1979) {
try {
if (target.getGraphic() == 85 || target.getGraphic() != -1) {
private void onAnimationChanged(AnimationChanged event)
{
Logger l = client.getLogger();
final Actor subject = event.getActor();
final Actor target = subject.getInteracting();
if (subject.getAnimation() == 1979)
{
try
{
if (target.getGraphic() == SPLASH_ID || target.getGraphic() != -1)
{
return;
}
if (this.frozenthings.containsKey(target.getName())) {
if (frozenthings.containsKey(target.getName()))
{
return;
}
this.testMap.put(target.getName(), new Barrage(target, subject));
this.freezetype.put(target.getName(), 7);
this.frozenthings.put(target.getName(), System.currentTimeMillis());
this.frozenthingpoints.put(target.getName(), target.getWorldLocation());
testMap.put(target.getName(), new Barrage(target, subject));
freezetype.put(target.getName(), 7);
frozenthings.put(target.getName(), System.currentTimeMillis());
frozenthingpoints.put(target.getName(), target.getWorldLocation());
}
catch (NullPointerException nullPointerException) {
// empty catch block
catch (NullPointerException e)
{
//no
}
}
}
@Subscribe
public void onGameTick(GameTick event) {
public void onGameTick(GameTick event)
{
int xp = 0;
boolean praymage = false;
if (this.magexp.containsKey(this.ticks)) {
xp = this.magexp.get(this.ticks);
if (magexp.containsKey(ticks))
{
xp = magexp.get(ticks);
}
if (xp > 0 && this.currtarget != null) {
if (this.frozenthings.containsKey(this.currtarget)) {
this.currtarget = null;
if (xp > 0 && currtarget != null)
{
if (frozenthings.containsKey(currtarget))
{
currtarget = null;
return;
}
WorldPoint targetPosition = null;
for (Player player : this.client.getPlayers()) {
String playerName;
if (player == null || !(playerName = player.getName()).equals(this.currtarget)) continue;
if (player.getOverheadIcon() != null && player.getOverheadIcon().equals((Object)HeadIcon.MAGIC)) {
praymage = true;
for (Player player : client.getPlayers())
{
if (player == null)
{
continue;
}
String playerName = player.getName();
if (playerName.equals(currtarget))
{
if (player.getOverheadIcon() != null)
{
if (player.getOverheadIcon().equals(HeadIcon.MAGIC))
{
praymage = true;
}
}
targetPosition = player.getWorldLocation();
break;
}
targetPosition = player.getWorldLocation();
break;
}
if (targetPosition != null) {
if (this.spell.equals("Bind") && xp > 30) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
if (praymage) {
this.freezetype.put(this.currtarget, 8);
} else {
this.freezetype.put(this.currtarget, 1);
if (targetPosition != null)
{
if (spell.equals("Bind") && xp > 30)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
if (praymage)
{
freezetype.put(currtarget, 8);
}
} else if (this.spell.equals("Snare") && xp > 60) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
if (praymage) {
this.freezetype.put(this.currtarget, 9);
} else {
this.freezetype.put(this.currtarget, 2);
else
{
freezetype.put(currtarget, 1);
}
} else if (this.spell.equals("Entangle") && xp >= 89) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
if (praymage) {
this.freezetype.put(this.currtarget, 10);
} else {
this.freezetype.put(this.currtarget, 3);
}
else if (spell.equals("Snare") && xp > 60)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
if (praymage)
{
freezetype.put(currtarget, 9);
}
} else if (this.spell.equals("Ice Rush") && xp > 34) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
this.freezetype.put(this.currtarget, 4);
} else if (this.spell.equals("Ice Burst") && xp > 40) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
this.freezetype.put(this.currtarget, 5);
} else if (this.spell.equals("Ice Blitz") && xp > 46) {
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
this.freezetype.put(this.currtarget, 6);
} else if (this.spell.equals("Ice Barrage") && xp > 52) {
Barrage barrage = new Barrage(this.client.getLocalPlayer().getInteracting(), this.client.getLocalPlayer());
this.testMap.put(this.currtarget, barrage);
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
this.frozenthingpoints.put(this.currtarget, targetPosition);
this.freezetype.put(this.currtarget, 7);
} else if (spell.equals("Tele Block") && xp == 95) {
if (config.TBTimer()) {
if (praymage) {
this.tbtypes.put(this.currtarget, 2);
} else {
this.tbtypes.put(this.currtarget, 1);
}
this.tbedthings.put(this.currtarget, System.currentTimeMillis());
}
else
{
freezetype.put(currtarget, 2);
}
}
else if (spell.equals("Entangle") && xp >= 89)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
if (praymage)
{
freezetype.put(currtarget, 10);
}
else
{
freezetype.put(currtarget, 3);
}
}
else if (spell.equals("Ice Rush") && xp > 34)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
freezetype.put(currtarget, 4);
}
else if (spell.equals("Ice Burst") && xp > 40)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
freezetype.put(currtarget, 5);
}
else if (spell.equals("Ice Blitz") && xp > 46)
{
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
freezetype.put(currtarget, 6);
}
else if (spell.equals("Ice Barrage") && xp > 52)
{
Barrage barrage = new Barrage(client.getLocalPlayer().getInteracting(), client.getLocalPlayer());
testMap.put(currtarget, barrage);
frozenthings.put(currtarget, System.currentTimeMillis());
frozenthingpoints.put(currtarget, targetPosition);
freezetype.put(currtarget, 7);
}
} else if (spell.equals("Tele Block") && xp == 95) {
if (config.TBTimer()) {
if (praymage) {
tbtypes.put(currtarget, 2);
} else {
tbtypes.put(currtarget, 1);
}
tbedthings.put(currtarget, System.currentTimeMillis());
}
}
}
if (this.currtarget != null && this.ticks > this.currticks + 1) {
Player local = this.client.getLocalPlayer();
if (currtarget != null && ticks > currticks + 1)
{
Player local = client.getLocalPlayer();
Actor interacting = local.getInteracting();
if (interacting != null) {
if (!interacting.getName().equals(this.currtarget)) {
this.currtarget = null;
if (interacting != null)
{
if (!interacting.getName().equals(currtarget))
{
currtarget = null;
}
} else {
this.currtarget = null;
}
else
{
currtarget = null;
}
}
++this.ticks;
ticks++;
}
public long opponentfreezetime(String name) {
if (this.frozenthings.containsKey(name)) {
return this.frozenthings.get(name);
public long opponentfreezetime(String name)
{
if (frozenthings.containsKey(name))
{
return frozenthings.get(name);
}
return 0L;
return 0;
}
public WorldPoint playerpos(String name) {
if (this.frozenthingpoints.containsKey(name)) {
return this.frozenthingpoints.get(name);
public WorldPoint playerpos(String name)
{
if (frozenthingpoints.containsKey(name))
{
return frozenthingpoints.get(name);
}
return null;
}
public void updatePosition(String name, WorldPoint point) {
if (this.frozenthingpoints.containsKey(name)) {
this.frozenthingpoints.remove(name);
this.frozenthingpoints.put(name, point);
public void updatePosition(String name, WorldPoint point)
{
if (frozenthingpoints.containsKey(name))
{
frozenthingpoints.remove(name);
frozenthingpoints.put(name, point);
}
}
public int freezetype(String name) {
if (this.freezetype.containsKey(name)) {
return this.freezetype.get(name);
public int freezetype(String name)
{
if (freezetype.containsKey(name))
{
return freezetype.get(name);
}
return 0;
}
public long istbed(String name) {
if (this.tbedthings.containsKey(name)) {
return this.tbedthings.get(name);
}
return 0;
}
public int tbtype(String name) {
if (this.tbtypes.containsKey(name)) {
return this.tbtypes.get(name);
}
return 0;
}
public void deleteopponent(String name) {
if (this.frozenthings.containsKey(name)) {
this.frozenthings.remove(name);
public long istbed(String name) {
if (tbedthings.containsKey(name)) {
return tbedthings.get(name);
}
if (this.frozenthingpoints.containsKey(name)) {
this.frozenthingpoints.remove(name);
return 0;
}
public int tbtype(String name) {
if (tbtypes.containsKey(name)) {
return tbtypes.get(name);
}
if (this.freezetype.containsKey(name)) {
this.freezetype.remove(name);
return 0;
}
public void deleteopponent(String name)
{
if (frozenthings.containsKey(name))
{
frozenthings.remove(name);
}
if (frozenthingpoints.containsKey(name))
{
frozenthingpoints.remove(name);
}
if (freezetype.containsKey(name))
{
freezetype.remove(name);
}
}
public void deletetb(String name) {
if (this.tbedthings.containsKey(name)) {
this.tbedthings.remove(name);
}
if (this.tbtypes.containsKey(name)) {
this.tbtypes.remove(name);
}
}
private void loadFreezeIcons() {
IndexedSprite[] freezeIcons = new IndexedSprite[]{};
IndexedSprite[] newfreezeIcons = Arrays.copyOf(freezeIcons, FREEZE_ICONS.length);
public void deletetb(String name) {
if (tbedthings.containsKey(name)) {
tbedthings.remove(name);
}
if (tbtypes.containsKey(name)) {
tbtypes.remove(name);
}
}
private void loadFreezeIcons()
{
final IndexedSprite[] freezeIcons = {};
final IndexedSprite[] newfreezeIcons = Arrays.copyOf(freezeIcons, FREEZE_ICONS.length);
int curPosition = 0;
int i = 0;
while (i < FREEZE_ICONS.length) {
int resource = FREEZE_ICONS[i];
this.FreezeIcons[i] = FreezeTimersPlugin.rgbaToIndexedBufferedImage(FreezeTimersPlugin.FreezeIconFromSprite(this.spriteManager.getSprite(resource, 0)));
newfreezeIcons[curPosition] = FreezeTimersPlugin.createIndexedSprite(this.client, this.FreezeIcons[i]);
++i;
++curPosition;
for (int i = 0; i < FREEZE_ICONS.length; i++, curPosition++)
{
final int resource = FREEZE_ICONS[i];
FreezeIcons[i] = rgbaToIndexedBufferedImage(FreezeIconFromSprite(spriteManager.getSprite(resource, 0)));
newfreezeIcons[curPosition] = createIndexedSprite(client, FreezeIcons[i]);
}
}
@@ -372,7 +431,7 @@ extends Plugin {
}
private static BufferedImage rgbaToIndexedBufferedImage(BufferedImage sourceBufferedImage) {
BufferedImage indexedImage = new BufferedImage(sourceBufferedImage.getWidth(), sourceBufferedImage.getHeight(), 13);
BufferedImage indexedImage = new BufferedImage(sourceBufferedImage.getWidth(), sourceBufferedImage.getHeight(), BufferedImage.TYPE_BYTE_INDEXED);
ColorModel cm = indexedImage.getColorModel();
IndexColorModel icm = (IndexColorModel)cm;
int size = icm.getMapSize();
@@ -382,21 +441,23 @@ extends Plugin {
icm.getReds(reds);
icm.getGreens(greens);
icm.getBlues(blues);
WritableRaster raster = indexedImage.getRaster();
int pixel = raster.getSample(0, 0, 0);
IndexColorModel resultIcm = new IndexColorModel(8, size, reds, greens, blues, pixel);
BufferedImage resultIndexedImage = new BufferedImage(resultIcm, raster, sourceBufferedImage.isAlphaPremultiplied(), null);
final WritableRaster raster = indexedImage.getRaster();
final int pixel = raster.getSample(0, 0, 0);
final IndexColorModel resultIcm = new IndexColorModel(8, size, reds, greens, blues, pixel);
final BufferedImage resultIndexedImage = new BufferedImage(resultIcm, raster, sourceBufferedImage.isAlphaPremultiplied(), null);
resultIndexedImage.getGraphics().drawImage(sourceBufferedImage, 0, 0, null);
return resultIndexedImage;
}
private static BufferedImage FreezeIconFromSprite(BufferedImage freezeSprite) {
BufferedImage freezeCanvas = ImageUtil.resizeCanvas(freezeSprite, FreezeTimersPlugin.FREEZE_ICON_DIMENSION.width, FreezeTimersPlugin.FREEZE_ICON_DIMENSION.height);
private static BufferedImage FreezeIconFromSprite(final BufferedImage freezeSprite)
{
final BufferedImage freezeCanvas = ImageUtil.resizeCanvas(freezeSprite, FREEZE_ICON_DIMENSION.width, FREEZE_ICON_DIMENSION.height);
return ImageUtil.outlineImage(freezeCanvas, FREEZE_ICON_OUTLINE_COLOR);
}
BufferedImage GetFreezeIcon(int id) {
return this.FreezeIcons[id];
BufferedImage GetFreezeIcon(int id)
{
return FreezeIcons[id];
}
}

View File

@@ -1,81 +1,123 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import java.awt.Color;
import java.util.List;
import java.util.Objects;
import java.util.function.BiConsumer;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
import net.runelite.client.plugins.freezetimers.FreezeTimersPlugin;
@Singleton
public class FreezeTimersService {
public class FreezeTimersService
{
private final Client client;
private final FreezeTimersConfig config;
private final FreezeTimersPlugin plugin;
@Inject
private FreezeTimersService(Client client, FreezeTimersConfig config, FreezeTimersPlugin plugin) {
private FreezeTimersService(Client client, FreezeTimersConfig config, FreezeTimersPlugin plugin)
{
this.config = config;
this.plugin = plugin;
this.client = client;
}
public void forEachPlayer(BiConsumer<Player, Color> consumer) {
for (Player player : this.client.getPlayers()) {
if (player == null || player.getName() == null) continue;
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
{
for (Player player : client.getPlayers())
{
if (player == null || player.getName() == null)
{
continue;
}
String name = player.getName();
int freezetype = this.plugin.freezetype(name);
long tbed = plugin.istbed(name);
long dtime = this.plugin.opponentfreezetime(name);
int freezetype = plugin.freezetype(name);
long dtime = plugin.opponentfreezetime(name);
long tbed = plugin.istbed(name);
int freezetime = 0;
if (freezetype == 1 || freezetype == 4) {
if (freezetype == 1 || freezetype == 4)
{
freezetime = 5000;
} else if (freezetype == 2 || freezetype == 5) {
}
else if (freezetype == 2 || freezetype == 5)
{
freezetime = 10000;
} else if (freezetype == 3 || freezetype == 6) {
}
else if (freezetype == 3 || freezetype == 6)
{
freezetime = 15000;
} else if (freezetype == 7) {
}
else if (freezetype == 7)
{
freezetime = 20000;
} else if (freezetype == 8) {
}
else if (freezetype == 8)
{
freezetime = 2500;
} else if (freezetype == 9) {
}
else if (freezetype == 9)
{
freezetime = 5000;
} else if (freezetype == 10) {
}
else if (freezetype == 10)
{
freezetime = 7500;
}
if (dtime <= 0L) continue;
long currenttime = System.currentTimeMillis();
long timediff = currenttime - dtime;
if (timediff < (long)freezetime) {
WorldPoint lastWorldPoint;
WorldPoint currentWorldPoint = player.getWorldLocation();
if (currentWorldPoint.equals(lastWorldPoint = this.plugin.playerpos(name))) {
consumer.accept(player, this.config.FreezeTimerColor());
continue;
if (dtime > 0)
{
long currenttime = System.currentTimeMillis();
long timediff = currenttime - dtime;
if (timediff < freezetime)
{
WorldPoint currentWorldPoint = player.getWorldLocation();
WorldPoint lastWorldPoint = plugin.playerpos(name);
if (currentWorldPoint.equals(lastWorldPoint))
{
consumer.accept(player, config.FreezeTimerColor());
}
else
{
if (timediff < 605)
{
plugin.updatePosition(name, currentWorldPoint);
consumer.accept(player, config.FreezeTimerColor());
}
else
{
plugin.deleteopponent(name);
}
}
}
if (timediff < 605L) {
this.plugin.updatePosition(name, currentWorldPoint);
consumer.accept(player, this.config.FreezeTimerColor());
continue;
else
{
if (timediff < freezetime + 3000)
{
consumer.accept(player, Color.YELLOW);
}
else
{
plugin.deleteopponent(name);
}
if (tbed > 0) {
consumer.accept(player, config.FreezeTimerColor());
return;
}
}
this.plugin.deleteopponent(name);
continue;
}
if (timediff < (long)(freezetime + 3000)) {
consumer.accept(player, Color.YELLOW);
continue;
} else {
this.plugin.deleteopponent(name);
}
if (tbed > 0) {
consumer.accept(player, config.FreezeTimerColor());
return;
}
}
}
}

View File

@@ -1,46 +1,57 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.util.function.BiConsumer;
import javax.inject.Inject;
import net.runelite.api.Player;
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
import net.runelite.client.plugins.freezetimers.FreezeTimersService;
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.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
public class FreezeTimersTileOverlay
extends Overlay {
public class FreezeTimersTileOverlay extends Overlay
{
private final FreezeTimersService FreezeTimersService;
private final FreezeTimersConfig config;
@Inject
private FreezeTimersTileOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService2) {
private FreezeTimersTileOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService)
{
this.config = config;
this.FreezeTimersService = FreezeTimersService2;
this.setLayer(OverlayLayer.ABOVE_SCENE);
this.setPosition(OverlayPosition.DYNAMIC);
this.setPriority(OverlayPriority.MED);
this.FreezeTimersService = FreezeTimersService;
setLayer(OverlayLayer.ABOVE_SCENE);
setPosition(OverlayPosition.DYNAMIC);
setPriority(OverlayPriority.MED);
}
@Override
public Dimension render(Graphics2D graphics) {
if (!this.config.drawTiles()) {
public Dimension render(Graphics2D graphics)
{
if (!config.drawTiles())
{
return null;
}
this.FreezeTimersService.forEachPlayer((player, color) -> {
Polygon poly = player.getCanvasTilePoly();
if (poly != null) {
FreezeTimersService.forEachPlayer((player, color) ->
{
final Polygon poly = player.getCanvasTilePoly();
if (poly != null)
{
OverlayUtil.renderPolygon(graphics, poly, color);
}
});
return null;
}
}

View File

@@ -1,35 +1,41 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
public enum PlayerSpellEffect {
import lombok.Getter;
import lombok.Setter;
public enum PlayerSpellEffect
{
BARRAGE("Ice Barrage", 20000, false),
BLITZ("Ice Blitz", 15000, false);
private final String SPELL_NAME;
private long startTime;
private int duration;
private boolean halvable;
private PlayerSpellEffect(String name, int duration, boolean halvable) {
@Getter
private final String SPELL_NAME;
@Getter
private long startTime;
@Getter
private int duration;
@Getter
private boolean halvable;
//private final BufferedImage SPELL_ICON;
PlayerSpellEffect(String name, int duration, boolean halvable)
{
this.SPELL_NAME = name;
this.duration = duration;
this.halvable = halvable;
this.startTime = System.currentTimeMillis();
}
public String getSPELL_NAME() {
return this.SPELL_NAME;
}
public long getStartTime() {
return this.startTime;
}
public int getDuration() {
return this.duration;
}
public boolean isHalvable() {
return this.halvable;
}
}

View File

@@ -1,34 +1,34 @@
/*
* Copyright (c) 2019. PKLite - All Rights Reserved
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
* Proprietary and confidential. Refer to PKLite License file for more information on
* full terms of this copyright and to determine what constitutes authorized use.
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
*
*/
package net.runelite.client.plugins.freezetimers;
import lombok.Getter;
import net.runelite.api.Actor;
public abstract class Spell {
public abstract class Spell
{
@Getter
private final Actor affectedTarget;
@Getter
private final Actor caster;
@Getter
public final long startTime;
private long remainingTime;
@Getter
private boolean isFinished;
protected Spell(Actor affectedTarget, Actor caster) {
protected Spell(Actor affectedTarget, Actor caster)
{
this.affectedTarget = affectedTarget;
this.caster = caster;
this.startTime = System.currentTimeMillis();
}
public Actor getAffectedTarget() {
return this.affectedTarget;
}
public Actor getCaster() {
return this.caster;
}
public long getStartTime() {
return this.startTime;
}
public boolean isFinished() {
return this.isFinished;
startTime = System.currentTimeMillis();
}
}

Some files were not shown because too many files have changed in this diff Show More