Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Drawing;
- using System.Linq;
- using System.Threading;
- using System.Text;
- using Turbo.plugins.patrick.parameters;
- using Turbo.plugins.patrick.parameters.types;
- using Turbo.plugins.patrick.util.diablo;
- using Turbo.Plugins.Patrick.forms;
- using Turbo.plugins.patrick.util.input;
- using Turbo.plugins.patrick.util.logger;
- using Turbo.plugins.patrick.util.thud;
- using Turbo.Plugins;
- using Turbo.Plugins.Default;
- namespace Turbo.plugins.patrick.hotkeys.actions.general {
- public class AutoFishing : BasePlugin, IAfterCollectHandler {
- public AutoFishing() {
- Enabled = true;
- }
- public static bool Battlefields { get; set; } = true;
- public static bool Festering { get; set; } = true;
- public static bool Spire { get; set; } = false;
- public static bool Desert { get; set; } = false;
- public static bool DesolateSands { get; set; } = true;
- public static bool FieldsOfMisery { get; set; } = true;
- public static bool Graveyard { get; set; } = true;
- public static bool SkipBadMobsets { get; set; } = false;
- // Edit these to mark them as good/bad mobsets for autofishing. Full info on http://warpath.eu
- // under "Monster Sets", search by the index.
- Dictionary<string, bool> GoodMobsets {get; set;} = new Dictionary<string, bool>{
- {"Ghosts", true}, // set #14
- {"Ice Clan", true}, // set #32
- {"Slashers", true}, // set #19
- {"Swarms", true}, // set #23
- {"Transformers", true}, // set #10
- {"Zombie Grotesque", true}, // set #26
- {"Armored Destroyer", true}, // set #29
- {"Bee Accursed", true}, // set #25
- {"Hellions", true}, // set #22
- {"Hulks", true}, // set #09
- {"Lacuni Phasebeast", true}, // set #13
- {"Petting Zoo", true}, // set #33
- {"Small Spiders", true}, // set #20
- {"Summoners", true}, // set #02
- {"Anarch Exarch", false}, // set #24
- {"Big Bogans", false}, // set #21
- {"Blue Fallen", false}, // set #12
- {"Boggen Trappers ", false}, // set #04
- {"Dark Berserker", false}, // set #01
- {"Frogs", false}, // set #27
- {"Red Fallen", false}, // set #15
- {"Red Spiders", false}, // set #07
- {"Big Spiders", false}, // set #08
- {"Blazing Guardian", false}, // set #31
- {"Lickers", false}, // set #11
- {"Lightning Snakes", false}, // set #18
- {"Morlu Hell Witch", false}, // set #03
- {"Oppressor Hell Witch", false}, // set #30
- {"Red Archers", false}, // set #17
- {"Shamans", false}, // set #28
- {"Smoldering Construct", false}, // set #16
- {"Spearmen", false}, // set #05
- {"Unburieds", false}, // set #06
- };
- public static bool PlaySoundWhenDone { get; set; } = true;
- public static uint ActingInterval { get; set; } = 550;
- public static bool DebugPrints { get; set; } = true;
- public static bool ToggledOn { get; set; } = false;
- private enum FishingSteps {
- ClickObelisk,
- OpenGR,
- DecideIfGRIsGood,
- TalkToOrek,
- CloseGR,
- STEP_MAX,
- STEP_INVALID,
- }
- private FishingSteps _currentStep = FishingSteps.STEP_INVALID;
- private uint _lastActed = 0;
- private bool preloaded = false;
- private uint _timeoutInterval = 6000;
- private bool simpleLock = false;
- // When exiting a GR you can experience a weird bug in THUD and/or an unexpected state in the game.
- // It will think you are still in a GR (according to IsInTown and SpecialArea) but the map name will be
- // something weird like "DREADJUDGE'S REALM 1" or "ZHAR THE MAD'S REALM 1", and the current tile
- // and the portals listed in Hud.Game.Portals will already be the town's portals, so obviously an exit
- // was not found. I will detect this state by checking if one of the portals leads back to the GR.
- private bool antiBugPortalFoundEarlierSignal = false;
- private void logthis(string message) {
- if (DebugPrints) {
- Logger.info(message);
- }
- }
- private void moveMouseAndClick(float x, float y, bool shouldMoveMouse) {
- if (x == 0 && y == 0) {
- return;
- }
- if (shouldMoveMouse) {
- InputSimulator.PostMouseMove((int)x, (int)y);
- }
- Thread.Sleep(30);
- InputSimulator.PostMessageMouseClickLeft((int)x, (int)y);
- }
- private void moveMouseAndClick(RectangleF rect, bool shouldMoveMouse) {
- moveMouseAndClick((int)(rect.X + (rect.Width / 2)), (int)(rect.Y + (rect.Height / 2)), shouldMoveMouse);
- }
- private void moveMouseAndClick(string uiPath, bool shouldMoveMouse) {
- var rect = Hud.Render.GetOrRegisterAndGetUiElement(uiPath).Rectangle;
- if (rect.X == 0 && rect.Y == 0) {
- rect = Hud.Render.GetOrRegisterAndGetUiElement(uiPath).Rectangle;
- if (rect.X == 0 && rect.Y == 0) {
- }
- logthis($"Couldn't get UI element for {uiPath}");
- }
- moveMouseAndClick(rect, shouldMoveMouse);
- }
- // should return NEW TRISTRAM, GREATER RIFT 1, OREK'S DREAM 1, etc
- IUiElement getAreaName() {
- return Hud.Render.GetOrRegisterAndGetUiElement("Root.NormalLayer.minimap_dialog_backgroundScreen.minimap_dialog_pve.area_name");
- }
- // the "Game Menu" button, located between the achievements button and the latency bar on the bottom.
- // the 2nd dialogue option, useful for the "close gr" option when talking to Orek.
- IUiElement getDialogueOption2Button() {
- return Hud.Render.GetOrRegisterAndGetUiElement("Root.NormalLayer.interact_dialog_mainPage.interact_dialog_Background.stack.interact_button_2");
- }
- private void preload() {
- getAreaName();
- getDialogueOption2Button();
- Hud.Render.GetOrRegisterAndGetUiElement(UiPathConstants.Buttons.GAME_MENU);
- }
- private bool isGRCurrentlyOpen() {
- return Hud.Render.GreaterRiftBarUiElement.Visible;
- }
- private bool isCurrentMapBattlefields() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("x1_pand_ext_120_edge");
- }
- private bool isCurrentMapFestering() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("px_festeringwoods_border");
- }
- private bool isCurrentMapSpire() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("a4dun_spire_corrupt");
- }
- private bool isCurrentMapDesert() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("px_desert_120_border");
- }
- private bool isCurrentMapDesolateSands() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("caout_boneyard");
- }
- private bool isCurrentMapFieldsOfMisery() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("px_tristramfields");
- }
- private bool isCurrentMapGraveyard() {
- return Hud.Game.Me.Scene.SnoScene.Code.StartsWith("x1_westm_graveyard");
- }
- private void tryClickingActor(ActorSnoEnum sno, string nameForDebug) {
- bool found = false;
- foreach (var actor in Hud.Game.Actors.ToList()) {
- if (actor.SnoActor != null && actor.SnoActor.Sno == sno) {
- logthis($"\tFound {nameForDebug}.");
- moveMouseAndClick(actor.ScreenCoordinate.X, actor.ScreenCoordinate.Y, true);
- found = true;
- }
- }
- if (!found) {
- logthis($"\tAutofishing Error - Didn't find {nameForDebug}.");
- ToggledOn = false;
- }
- }
- private bool isClickObeliskReady() {
- return Hud.Game.IsInTown && !isGRCurrentlyOpen();
- }
- private void executeClickObelisk() {
- logthis("I will click the rift obelisk.");
- tryClickingActor(ActorSnoEnum._x1_openworld_lootrunobelisk_b, "the Rift Obelisk");
- }
- private bool isOpenGRReady() {
- return Hud.Render.IsUiElementVisible(UiPathConstants.RiftObelisk.OBELISK_WINDOW);
- }
- private void executeOpenGR() {
- logthis("I will click \"start rift\".");
- moveMouseAndClick(UiPathConstants.RiftObelisk.GREATER_RIFT_BUTTON, false);
- moveMouseAndClick(UiPathConstants.RiftObelisk.ACCEPT_BUTTON, false);
- }
- private bool isDecideIfGRIsGoodReady() {
- return Hud.Game.SpecialArea == SpecialArea.GreaterRift;
- }
- private void executeDecideIfGRIsGood() {
- logthis("In greater rift. Should leave?");
- bool shouldStay = false;
- if (shouldStay == false) {
- var text = getAreaName().ReadText(Encoding.ASCII, true);
- Logger.info($"\t\"Map Name\" = {text}");
- // Could be either OREK'S DREAM 1 or GREATER RIFT 1
- if (text.ToUpper().StartsWith("OREK")) {
- shouldStay = true;
- }
- }
- if (shouldStay == false) {
- if ((Battlefields && isCurrentMapBattlefields()) ||
- (Festering && isCurrentMapFestering()) ||
- (Spire && isCurrentMapSpire()) ||
- (Desert && isCurrentMapDesert()) ||
- (DesolateSands && isCurrentMapDesolateSands()) ||
- (FieldsOfMisery && isCurrentMapFieldsOfMisery()) ||
- (Graveyard && isCurrentMapGraveyard())
- ) {
- if (SkipBadMobsets) {
- var sets = ZysMobsetDetection.getMatchingMonsterSets(Hud);
- logthis ($"\tFound good map, checking mobset (found {sets.Count()} sets).");
- if (sets.Count == 0 || sets.Count == ZysMobsetDetection.MonsterSetList.Count) {
- logthis("\tDidn't find any mobs, will stay just in case.");
- shouldStay = true;
- } else if (sets.Count > 1) {
- logthis("\tFound more than one matching mobset.");
- shouldStay = GoodMobsets[sets.First().Name];
- bool ambiguous = false;
- foreach (var set in sets) {
- if (GoodMobsets[set.Name] != shouldStay) {
- logthis($"\tFound two possible sets with conflicting ____: {sets.First().Name} and {set.Name}.");
- ambiguous = true;
- shouldStay = true;
- break;
- }
- }
- if (ambiguous) {
- logthis("\tWill stay due to ambiguity, just in case.");
- } else {
- logthis($"\tAll possible monster sets are considered {(shouldStay ? "good" : "bad")}. Therefore I will {(shouldStay ? "stay" : "leave")}");
- }
- } else {
- var set = sets.First();
- logthis($"\tMobset is {set.Name}, which is considered {(GoodMobsets[set.Name] ? "Good" : "Bad")}.");
- shouldStay = GoodMobsets[set.Name];
- }
- } else {
- logthis("\tFound good map, disregarding mobset, will stay.");
- shouldStay = true;
- }
- } else {
- logthis($"\tIn bad map ({Hud.Game.Me.Scene.SnoScene.Code}), will leave.");
- shouldStay = false;
- }
- }
- if (shouldStay) {
- logthis("Should stay, pausing the game.");
- if (PlaySoundWhenDone) {
- Hud.Sound.LoadSoundPlayer("notification_2.wav").Play();
- }
- moveMouseAndClick(UiPathConstants.Buttons.GAME_MENU, false);
- ToggledOn = false;
- } else {
- logthis("Shouldn't stay, looking for portal out.");
- InputSimulator.PressKey(Settings.Keybinds[(int)ActionKey.Close]);
- var portals = Hud.Game.Portals.ToList()
- .Where(portal => portal.TargetArea.NameEnglish.Equals("Bastion's Keep Stronghold") ||
- portal.TargetArea.NameEnglish.Equals("Hidden Camp") ||
- portal.TargetArea.NameEnglish.Equals("New Tristram") ||
- portal.TargetArea.NameEnglish.Equals("The Survivors' Enclave"))
- .OrderBy(portal => portal.CentralXyDistanceToMe);
- if (portals.Count() > 0) {
- var portal = portals.First();
- logthis($"\tFound a portal to {portal.TargetArea.NameEnglish} which is {portal.CentralXyDistanceToMe} yards away.");
- antiBugPortalFoundEarlierSignal = true;
- moveMouseAndClick(portal.FloorCoordinate.ToScreenCoordinate().X,
- portal.FloorCoordinate.ToScreenCoordinate().Y - 20, true);
- } else {
- // See comment above the declaration for antiBugPortalFoundEarlierSignal
- if (antiBugPortalFoundEarlierSignal) {
- logthis("\tGame is in transition state - skipping.");
- } else {
- logthis("\tAutofishing Error - Couldn't find a portal that leads out of the rift.");
- moveMouseAndClick(UiPathConstants.Buttons.GAME_MENU, false);
- ToggledOn = false;
- }
- }
- }
- }
- private bool isTalkToOrekReady() {
- return Hud.Game.IsInTown && (_currentStep == FishingSteps.DecideIfGRIsGood || isGRCurrentlyOpen());
- }
- private void executeTalkToOrek() {
- logthis("I will talk to Orek.");
- tryClickingActor(ActorSnoEnum._x1_lr_nephalem, "Orek");
- }
- private bool isCloseGRReady() {
- if (!Hud.Game.IsInTown) {
- return false;
- }
- var uiElement = getDialogueOption2Button();
- if (!uiElement.Visible) {
- return false;
- }
- return true; // uiElement.ReadText(Encoding.ASCII, true).Equals("Close Greater Rift");
- }
- private void executeCloseGR() {
- logthis("I will tell Orek to close the GR.");
- getDialogueOption2Button().Click();
- }
- private void performAutoFishingStep() {
- if (!preloaded) {
- preload();
- preloaded = true;
- }
- uint currentTime = (uint)DateTimeOffset.Now.ToUnixTimeMilliseconds();
- if (currentTime - _lastActed > _timeoutInterval) {
- logthis($"timed out - current time = {currentTime}, last acted = {_lastActed}");
- _currentStep = FishingSteps.STEP_INVALID;
- }
- bool movedStep = false;
- if (_currentStep == FishingSteps.STEP_INVALID) {
- movedStep = true;
- logthis("Refreshing step state.");
- if (!Hud.Game.IsInTown) {
- logthis("\tAutoFishing error - not in town and don't know what to do.");
- ToggledOn = false;
- return;
- } else if (isGRCurrentlyOpen()) {
- _currentStep = FishingSteps.TalkToOrek;
- } else {
- _currentStep = FishingSteps.ClickObelisk;
- }
- }
- try {
- if (_currentStep == FishingSteps.ClickObelisk) {
- if (isOpenGRReady()) {
- logthis($"Progressing to step OpenGR");
- _currentStep = FishingSteps.OpenGR;
- movedStep = true;
- }
- } else if (_currentStep == FishingSteps.OpenGR) {
- if (isDecideIfGRIsGoodReady()) {
- logthis($"Progressing to step DecideIfGRIsGood");
- _currentStep = FishingSteps.DecideIfGRIsGood;
- antiBugPortalFoundEarlierSignal = false;
- movedStep = true;
- }
- } else if (_currentStep == FishingSteps.DecideIfGRIsGood) {
- if (isTalkToOrekReady()) {
- logthis($"Progressing to step TalkToOrek");
- _currentStep = FishingSteps.TalkToOrek;
- movedStep = true;
- }
- } else if (_currentStep == FishingSteps.TalkToOrek) {
- if (isCloseGRReady()) {
- logthis($"Progressing to step CloseGR");
- _currentStep = FishingSteps.CloseGR;
- antiBugPortalFoundEarlierSignal = false; // redundant
- movedStep = true;
- }
- } else if (_currentStep == FishingSteps.CloseGR) {
- if (isClickObeliskReady()) {
- logthis($"Progressing to step ClickObelisk");
- _currentStep = FishingSteps.ClickObelisk;
- movedStep = true;
- }
- }
- } catch (Exception e) {
- Logger.error("AutoFishing Error in state check: " + e.ToString());
- ToggledOn = false;
- return;
- }
- if (!movedStep && (currentTime - _lastActed < ActingInterval)) {
- // logthis($"Didn't move to next step and we're still waiting for timeout on current step.");
- return;
- }
- // logthis($"Making an action at {currentTime} (currentStep = {_currentStep}, movedStep = {movedStep})");
- try {
- if (_currentStep == FishingSteps.ClickObelisk) {
- if (isClickObeliskReady()) {
- executeClickObelisk();
- _lastActed = currentTime;
- }
- } else if (_currentStep == FishingSteps.OpenGR) {
- if (isOpenGRReady()) {
- executeOpenGR();
- _lastActed = currentTime;
- }
- } else if (_currentStep == FishingSteps.DecideIfGRIsGood) {
- if (isDecideIfGRIsGoodReady()) {
- executeDecideIfGRIsGood();
- _lastActed = currentTime;
- }
- } else if (_currentStep == FishingSteps.TalkToOrek) {
- if (isTalkToOrekReady()) {
- executeTalkToOrek();
- _lastActed = currentTime;
- }
- } else if (_currentStep == FishingSteps.CloseGR) {
- if (isCloseGRReady()) {
- executeCloseGR();
- _lastActed = currentTime;
- }
- }
- } catch (Exception e) {
- Logger.error("AutoFishing Error in step execution: " + e.ToString());
- ToggledOn = false;
- return;
- }
- }
- public void AfterCollect() {
- if (!ToggledOn) {
- simpleLock = false;
- return;
- }
- if (Hud.Game.IsLoading) {
- return;
- }
- if (simpleLock) {
- return;
- }
- simpleLock = true;
- performAutoFishingStep();
- simpleLock = false;
- }
- // Copied code from Zy's plugin, to make this plugin standalone.
- private class ZysMobsetDetection {
- public class MonsterSet
- {
- public MonsterSet()
- {
- Index = 0;
- Name = "unknown";
- }
- public MonsterSet(uint Index_, string Name_, List<string> Monsters_)
- {
- Index = Index_;
- Name = Name_;
- Monsters = Monsters_;
- }
- public uint Index { get; }
- public string Name { get; }
- public List<string> Monsters;
- }
- public static List<MonsterSet> MonsterSetList = new List<MonsterSet>{
- new MonsterSet(01, "Dark Berserker", new List<string>
- { "Dark Berserker", "Dark Hellion", "Dark Skeletal Archer", "Dark Summoner", "Punisher",
- "Returned Executioner", "Returned Shieldman", "Revenant Soldier", "Savage Fiend" , "Skeletal Beast" , "Skeleton" , "Tomb Guardian" }),
- new MonsterSet(02, "Summoners", new List<string>
- { "Blazing Ghoul", "Corpse Worm", "Dark Skeletal Archer", "Deranged Cultist", "Dust Imp", "Grim Wraith", "Grotesque", "Hulking Phasebeast",
- "Quill Fiend", "Risen", "Skeletal Archer", "Skeletal Executioner", "Skeletal Shieldbearer", "Skeleton", "Tomb Guardian", "Unburied"}),
- new MonsterSet(03, "Morlu Hell Witch", new List<string>
- { "Bile Crawler","Corrupted Angel", "Demonic Hellflyer", "Gloom Wraith", "Hell Witch", "Mallet Lord", "Morlu Incinerator", "Morlu Legionnaire"}),
- new MonsterSet(04, "Boggen Trappers ", new List<string>
- { "Bogan Trapper", "Boggit", "Dark Moon Clan Impaler", "Dark Moon Clan Shaman", "Dark Moon Clan Warrior", "Fallen Hellhound", "Fallen Lunatic",
- "Fallen Slavelord", "Lacuni Slasher", "Lacuni Stalker", "Tusked Bogan"}),
- new MonsterSet(05, "Spearman", new List<string>
- { "Blood Clan Sorcerer", "Blood Clan Spearman", "Blood Clan Warrior", "Colossal Golgor", "Death Maiden", "Fallen Soldier", "Herald of Pestilence",
- "Revenant Shield Guard", "Summoned Archer", "Summoned Shield Guard", "Tormented Stinger"}),
- new MonsterSet(06, "Unburieds", new List<string>
- { "Carrion Bat", "Dark Moon Clan Shaman", "Darkmoth", "Ghoul", "Moon Clan Impaler", "Moon Clan Shaman", "Moon Clan Warrior", "Skeleton", "Unburied"}),
- new MonsterSet(07, "Red Spiders", new List<string>
- { "Armored Destroyer", "Colossal Golgor", "Corrupted Angel", "Dark Hellion", "Disentombed Hulk", "Enslaved Nightmare", "Exarch", "Fiery Spiderling",
- "Lacuni Huntress", "Lacuni Stalker", "Mallet Lord", "Oppressor", "Revenant Soldier", "Scorching Creeper", "Summoned Archer", "Winged Assassin"}),
- new MonsterSet(08, "Big Spiders", new List<string>
- { "Dark Hellion", "Darkmoth", "Death Maiden", "Moon Clan Shaman", "Stinging Swarm", "Stygian Crawler", "Summoned Archer", "Summoned Shield Guard",
- "Tormented Stinger", "Toxic Lurker", "Webspitter Spider"}),
- new MonsterSet(09, "Hulks", new List<string>
- { "Dark Skeletal Archer", "Disentombed Hulk", "Dust Biter", "Dust Eater", "Dust Imp", "Enraged Phantom", "Frost Guardian", "Inferno Zombie", "Lacuni Stalker",
- "Murderous Fiend", "Ravenous Dead", "Retching Cadaver", "Revenant Shield Guard", "Sand Dweller", "Smoldering Construct", "Vicious Mangler"}),
- new MonsterSet(10, "Transformers", new List<string>
- { "Dark Berserker", "Dark Cultist", "Dark Hellion", "Dark Summoner", "Dark Vessel", "Death Maiden", "Quill Fiend", "Revenant Archer", "Revenant Shield Guard", "Revenant Soldier",
- "Unburied", "Unholy Thrall"}),
- new MonsterSet(11, "Lickers", new List<string>
- { "Abomination", "Brood Hatchling", "Copperfang Lurker", "Deathly Haunt", "Fallen Grunt", "Fallen Mongrel", "Fallen Overlord", "Fallen Prophet",
- "Noxious Guardian", "Soul Lasher", "Spellwinder"}),
- new MonsterSet(12, "Blue Fallen", new List<string>
- { "Blazing Swordwielder", "Chilling Construct", "Demon Raider", "Exorcist", "Fallen Master", "Returned Executioner", "Reviled", "Skeletal Archer",
- "Skeletal Raider", "Spine Lasher", "Vengeful Summoner", "Vile Revenant"}),
- new MonsterSet(13, "Lacuni Phasebeast", new List<string>
- { "Corpse Worm", "Grotesque", "Hungry Corpse", "Hungry Torso", "Imp", "Lacuni Huntress", "Ravenous Dead", "Retching Cadaver", "Returned", "Returned Archer",
- "Returned Executioner", "Returned Shieldman", "Returned Summoner", "Summoned Soldier", "Unholy Thrall", "Warping Horror"}),
- new MonsterSet(14, "Ghosts", new List<string>
- { "Dark Zealot", "Enraged Phantom", "Ghastly Gravedigger", "Ghostly Murderer", "Horned Charger", "Moon Clan Ghost", "Pain Monger", "Shadow Vermin",
- "Summoned Archer", "Warping Horror", "Winged Assassin"}),
- new MonsterSet(15, "Red Fallen", new List<string>
- { "Anarch", "Carrion Bat", "Death Maiden", "Fallen", "Fallen Hound", "Fallen Lunatic", "Fallen Overseer", "Fallen Shaman", "Scarab", "Skeletal Archer", "Summoned Archer",
- "Summoned Shield Guard", "Summoned Soldier"}),
- new MonsterSet(16, "Smoldering Construct", new List<string>
- { "Accursed Hellion", "Dark Hellion", "Decayer", "Demon Trooper", "Enraged Phantom", "Foul Conjurer", "Quill Fiend", "Smoldering Construct", "Spewing Horror",
- "Stygian Crawler", "Voracious Zombie"}),
- new MonsterSet(17, "Red Archers", new List<string>
- { "Betrayed", "Bile Crawler", "Canine Bones", "Corpse Raiser", "Corrupted Angel", "Darkmoth", "Death Maiden", "Exarch", "Exorcist", "Hellhide Tremor",
- "Hungering Bones", "Risen Bones", "Skeletal Ranger", "Spitting Bones", "Summoned Archer", "Summoned Shield Guard", "Tormented Stinger",
- "Vile Bat", "Winged Assassin"}),
- new MonsterSet(18, "Lightning Snakes", new List<string>
- { "Blood Clan Mauler", "Blood Clan Sorcerer", "Canine Bones", "Corpse Raiser", "Corpse Worm", "Death Maiden", "Electric Eel", "Exarch", "Frenzied Lunatic",
- "Grotesque", "Hell Witch", "Hulking Phasebeast", "Hungering Bones", "Risen Bones", "Sand Wasp", "Scarab", "Serpent Magus", "Skeleton", "Spitting Bones",
- "Summoned Archer", "Summoned Shield Guard", "Terror Demon", "Vile Bat", "Writhing Deceiver"}),
- new MonsterSet(19, "Slashers", new List<string>
- { "Accursed Hellion", "Blood Clan Impaler", "Blood Clan Mauler", "Bogan Trapper", "Fallen", "Fallen Shaman", "Foul Conjurer", "Herald of Pestilence",
- "Horror", "Lacuni Slasher", "Skeletal Raider", "Zap Worm"}),
- new MonsterSet(20, "Small Spiders", new List<string>
- { "Arachnid Horror", "Bile Crawler", "Corpse Worm", "Exorcist", "Lacuni Huntress", "Moon Clan Impaler", "Spiderling"}),
- new MonsterSet(21, "Big Bogans", new List<string>
- { "Armored Destroyer", "Bogan Trapper", "Boggit", "Demon Trooper", "Enslaved Nightmare", "Lacuni Huntress", "Maggot", "Maggot Brood", "Mallet Lord", "Moon Clan Impaler",
- "Moon Clan Warrior", "Oppressor", "Shrieking Terror", "Tusked Bogan", "Vile Bat"}),
- new MonsterSet(22, "Hellions", new List<string>
- { "Accursed", "Accursed Hellion", "Barbed Lurker", "Blood Clan Impaler", "Blood Clan Mauler", "Crazed Cultist", "Dark Hellion", "Deranged Cultist", "Foul Conjurer",
- "Lacuni Huntress", "Lacuni Warrior", "Mallet Lord", "Pain Monger", "Savage Fiend", "Shadow of Death", "Vicious Mangler"}),
- new MonsterSet(23, "Swarms", new List<string>
- { "Blood Clan Impaler", "Brood Hatchling", "Darkmoth", "Dune Stinger", "Great Horned Goliath", "Hellhide Tremor", "Scarab", "Stygian Crawler", "Vile Swarm",
- "Vile Temptress", "Webspitter Spider", "Winged Assassin"}),
- new MonsterSet(24, "Anarch Exarch", new List<string>
- { "Anarch", "Death Maiden", "Demon Trooper", "Exarch", "Executioner", "Summoned Archer", "Summoned Shield Guard", "Summoned Soldier", "Winged Assassin"}),
- new MonsterSet(25, "Bee Accursed", new List<string>
- { "Accursed", "Corpse Worm", "Dune Stinger", "Fallen Conjurer", "Fallen Cur", "Fallen Peon", "Grotesque", "Noxious Guardian", "Reviled"}),
- new MonsterSet(26, "Zombie Grotesque", new List<string>
- { "Corpse Worm", "Dark Hellion", "Dark Summoner", "Decayer", "Grotesque", "Hungry Corpse", "Hungry Torso", "Imp", "Punisher", "Ravenous Dead", "Retching Cadaver",
- "Returned", "Returned Archer", "Returned Executioner", "Returned Shieldman", "Returned Summoner"}),
- new MonsterSet(27, "Frogs", new List<string>
- { "Anarch", "Burrowing Leaper", "Dark Hellion", "Dark Skeletal Archer", "Enraged Phantom", "Hungry Corpse", "Hungry Torso", "Maniacal Golgor",
- "Returned Executioner", "Scavenger", "Shock Guardian", "Skeletal Archer", "Skeleton", "Tomb Guardian"}),
- new MonsterSet(28, "Shamans", new List<string>
- { "Brood Hatchling", "Crazed Summoner", "Dark Conjurer", "Fallen", "Fallen Firemage", "Fallen Shaman", "Fallen Slavelord", "Frenzied Hellion",
- "Herald of Pestilence", "Quill Fiend", "Skeletal Ranger", "Soul Ripper", "Subjugator", "Unburied", "Vicious Ghoul", "Vicious Hellion"}),
- new MonsterSet(29, "Armored Destroyer", new List<string>
- { "Anarch", "Armored Destroyer", "Blood Clan Warrior", "Canine Bones", "Corpse Raiser", "Demonic Hellflyer", "Demon Trooper", "Hungering Bones", "Morlu Incinerator",
- "Plague Carrier", "Risen Bones", "Sand Wasp", "Shade Stalker", "Skeletal Beast", "Spitting Bones", "Terror Demon", "Vile Bat", "Winged Assassin"}),
- new MonsterSet(30, "Oppressor Hell Witch", new List<string>
- { "Blazing Ghoul", "Fallen Overseer", "Moon Clan Impaler", "Oppressor", "Subjugator", "Vile Temptress"}),
- new MonsterSet(31, "Blazing Guardian", new List<string>
- { "Barbed Lurker", "Bile Crawler", "Blazing Guardian", "Dark Berserker", "Dark Hellion", "Grim Wraith", "Hulking Phasebeast", "Hungry Corpse", "Hungry Torso", "Inferno Zombie",
- "Murderous Fiend", "Returned Archer", "Skeletal Raider"}),
- new MonsterSet(32, "Ice Clan", new List<string>
- { "Frost Maggot", "Glacial Colossus", "Ice Clan Impaler", "Ice Clan Shaman", "Ice Clan Warrior", "Ice Porcupine"}),
- new MonsterSet(33, "Petting Zoo", new List<string>
- { "Arachnid Horror", "Bone Warrior", "Dark Berserker", "Dark Cultist", "Enraged Phantom", "Fallen Conjurer", "Horned Charger", "Oppressor", "Quill Fiend",
- "Savage Beast", "Scavenger", "Skeleton", "Tomb Guardian"})
- };
- public static List<MonsterSet> getMatchingMonsterSets(IController Hud) {
- HashSet<string> MonstersOnTheScreen = new HashSet<string>();
- var monsters = Hud.Game.AliveMonsters.Where(m => (!m.IsElite));
- foreach (var monster in monsters)
- {
- if (monster.Rarity == ActorRarity.Normal)
- {
- MonstersOnTheScreen.Add(monster.SnoMonster.NameEnglish);
- }
- }
- var BadMonsters = new List<string>
- { "Shock Tower", "Hell Bringer", "Blazing Swordwielder", "Bloated Corpse", "Spiderling"};
- foreach (string monstername in BadMonsters)
- {
- if (MonstersOnTheScreen.Contains(monstername))
- {
- MonstersOnTheScreen.Remove(monstername);
- }
- }
- List<MonsterSet> MatchingMonsterSets = new List<MonsterSet>();
- foreach (MonsterSet monsterset in MonsterSetList)
- {
- MatchingMonsterSets.Add(new MonsterSet(monsterset.Index, monsterset.Name, monsterset.Monsters));
- }
- List<MonsterSet> RemoveList = new List<MonsterSet>();
- foreach (string monster in MonstersOnTheScreen)
- {
- foreach (MonsterSet monsterset in MatchingMonsterSets)//see if the monster fits the monsterset
- {
- //if monster is not in the monsterset delete the monsterset
- if (!monsterset.Monsters.Contains(monster))
- {
- RemoveList.Add(monsterset);
- }
- }
- foreach (MonsterSet monsterset in RemoveList)
- {
- MatchingMonsterSets.Remove(monsterset);
- }
- }
- return MatchingMonsterSets;
- }
- }
- }
- public class ToggleAutoFishing : AbstractHotkeyAction {
- public override HotkeyType type => HotkeyType.General;
- public bool FieldsOfMisery { get; set; } = true;
- public bool Festering { get; set; } = true;
- public bool Graveyard { get; set; } = true;
- public bool Battlefields { get; set; } = true;
- public bool DesolateSands { get; set; } = false;
- public bool Spire { get; set; } = false;
- public bool Desert { get; set; } = false;
- public bool SkipBadMobsets { get; set; } = false;
- public bool PlaySoundWhenDone { get; set; } = true;
- public uint ActingInterval { get; set; } = 850;
- public bool DebugPrints { get; set; } = false;
- protected override string GetAttributes() => $@"Battlefields: {Battlefields}, Festering: {Festering}, Spire: {Spire},
- Desert: {Desert}, DesolateSands: {DesolateSands}, FieldsOfMisery: {FieldsOfMisery}, Graveyard: {Graveyard},
- SkipBadMobsets: {SkipBadMobsets}, PlaySoundWhenDone: {PlaySoundWhenDone}, ActingInterval: {ActingInterval}, DebugPrints: {DebugPrints}";
- public override List<AbstractParameter> GetParameters()
- {
- return new List<AbstractParameter>{
- SimpleParameter<bool>.of(nameof(Battlefields), x => Battlefields = x),
- SimpleParameter<bool>.of(nameof(Festering), x => Festering = x),
- SimpleParameter<bool>.of(nameof(Spire), x => Spire = x),
- SimpleParameter<bool>.of(nameof(Desert), x => Desert = x),
- SimpleParameter<bool>.of(nameof(DesolateSands), x => DesolateSands = x),
- SimpleParameter<bool>.of(nameof(FieldsOfMisery), x => FieldsOfMisery = x),
- SimpleParameter<bool>.of(nameof(Graveyard), x => Graveyard = x),
- SimpleParameter<bool>.of(nameof(SkipBadMobsets), x => SkipBadMobsets = x),
- SimpleParameter<bool>.of(nameof(PlaySoundWhenDone), x => PlaySoundWhenDone = x),
- SimpleParameter<int>.of(nameof(ActingInterval), x => ActingInterval = (uint)x),
- SimpleParameter<bool>.of(nameof(DebugPrints), x => DebugPrints = x),
- };
- }
- public override bool PreconditionSatisfied(IController hud)
- {
- return true;
- }
- public override string tooltip => "Toggle AutoFishing on/off.";
- public override void Invoke(IController hud)
- {
- AutoFishing.ToggledOn = !AutoFishing.ToggledOn;
- AutoFishing.Battlefields = Battlefields;
- AutoFishing.Festering = Festering;
- AutoFishing.Spire = Spire;
- AutoFishing.Desert = Desert;
- AutoFishing.DesolateSands = DesolateSands;
- AutoFishing.FieldsOfMisery = FieldsOfMisery;
- AutoFishing.Graveyard = Graveyard;
- AutoFishing.SkipBadMobsets = SkipBadMobsets;
- AutoFishing.PlaySoundWhenDone = PlaySoundWhenDone;
- AutoFishing.ActingInterval = ActingInterval;
- AutoFishing.DebugPrints = DebugPrints;
- Logger.info($"Autofishing is now {AutoFishing.ToggledOn}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement