public ActionBarPopulator(ILogger logger, ClassConfiguration config, AddonReader addonReader, ExecGameCommand execGameCommand) { this.logger = logger; this.config = config; this.addonReader = addonReader; this.execGameCommand = execGameCommand; }
public BotController(ILogger logger, IPPather pather, DataConfig dataConfig, IConfiguration configuration) { this.logger = logger; this.pather = pather; this.DataConfig = dataConfig; this.areaDb = new AreaDB(logger, dataConfig); updatePlayerPostion.Start(); wowProcess = new WowProcess(); WowScreen = new WowScreen(logger, wowProcess); WowProcessInput = new WowProcessInput(logger, wowProcess); var frames = DataFrameConfiguration.LoadFrames(); var scad = new StartupConfigAddonData(); configuration.GetSection(StartupConfigAddonData.Position).Bind(scad); if (scad.Mode == "Network") { logger.LogInformation("Using NetworkedAddonDataProvider"); addonDataProvider = new NetworkedAddonDataProvider(logger, scad.myPort, scad.connectTo, scad.connectPort); } else { logger.LogInformation("Using AddonDataProvider"); addonDataProvider = new AddonDataProvider(WowScreen, frames); } AddonReader = new AddonReader(logger, DataConfig, areaDb, addonDataProvider); minimapNodeFinder = new MinimapNodeFinder(WowScreen, new PixelClassifier()); MinimapImageFinder = minimapNodeFinder as IImageProvider; addonThread = new Thread(AddonRefreshThread); addonThread.Start(); // wait for addon to read the wow state var sw = new Stopwatch(); sw.Start(); while (AddonReader.PlayerReader.Sequence == 0 || !Enum.GetValues(typeof(PlayerClassEnum)).Cast <PlayerClassEnum>().Contains(AddonReader.PlayerReader.PlayerClass)) { if (sw.ElapsedMilliseconds > 5000) { logger.LogWarning("There is a problem with the addon, I have been unable to read the player class. Is it running ?"); sw.Restart(); } Thread.Sleep(100); } logger.LogDebug($"Woohoo, I have read the player class. You are a {AddonReader.PlayerReader.PlayerClass}."); npcNameFinder = new NpcNameFinder(logger, WowScreen, WowProcessInput); WowScreen.AddDrawAction(npcNameFinder.ShowNames); //ActionFactory = new GoalFactory(AddonReader, logger, wowProcess, npcNameFinder); screenshotThread = new Thread(ScreenshotRefreshThread); screenshotThread.Start(); }
public void Initialise(AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger) { this.playerReader = addonReader.PlayerReader; this.logger = logger; ResetCharges(); KeyReader.ReadKey(logger, this); UpdateMinResourceRequirement(addonReader.ActionBarCostReader); if (!string.IsNullOrEmpty(this.Requirement)) { Requirements.Add(this.Requirement); } requirementFactory.InitialiseRequirements(this); if (!string.IsNullOrEmpty(ShapeShiftForm)) { if (Enum.TryParse(typeof(ShapeshiftForm), ShapeShiftForm, out var desiredForm)) { this.ShapeShiftFormEnum = (ShapeshiftForm)desiredForm; } else { logger.LogInformation($"Unknown shapeshift form: {ShapeShiftForm}"); } } }
public ActionBarPopulator(ILogger logger, WowProcess wowProcess, WowProcessInput wowProcessInput, ClassConfiguration config, AddonReader addonReader) { this.logger = logger; this.wowProcess = wowProcess; this.wowProcessInput = wowProcessInput; this.config = config; this.addonReader = addonReader; }
public GoalFactory(ILogger logger, AddonReader addonReader, ConfigurableInput input, DataConfig dataConfig, NpcNameFinder npcNameFinder, IPPather pather) { this.logger = logger; this.addonReader = addonReader; this.input = input; this.dataConfig = dataConfig; this.npcNameFinder = npcNameFinder; this.pather = pather; }
public void Initialise(string prefix, AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger) { if (Sequence.Count > 0) { logger.LogInformation($"[{prefix}] Initialise KeyActions."); } Sequence.ForEach(i => i.Initialise(addonReader, requirementFactory, logger)); }
public GoalFactory(ILogger logger, AddonReader addonReader, ConfigurableInput input, DataConfig dataConfig, NpcNameFinder npcNameFinder, NpcNameTargeting npcNameTargeting, IPPather pather, ExecGameCommand execGameCommand) { this.logger = logger; this.addonReader = addonReader; this.input = input; this.dataConfig = dataConfig; this.npcNameFinder = npcNameFinder; this.npcNameTargeting = npcNameTargeting; this.pather = pather; this.exec = execGameCommand; }
public Blacklist(ILogger logger, AddonReader addonReader, int above, int below, bool checkTargetGivesExp, List <string> blacklisted) { this.addonReader = addonReader; playerReader = addonReader.PlayerReader; this.logger = logger; this.above = above; this.below = below; this.checkTargetGivesExp = checkTargetGivesExp; blacklisted.ForEach(npc => blacklist.Add(npc.ToUpper())); }
public void InitialiseForm(AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger) { Initialise(addonReader, requirementFactory, logger); if (HasFormRequirement()) { if (addonReader.PlayerReader.FormCost.ContainsKey(FormEnum)) { addonReader.PlayerReader.FormCost.Remove(FormEnum); } addonReader.PlayerReader.FormCost.Add(FormEnum, MinMana); logger.LogInformation($"[{Name}] Added {FormEnum} to FormCost with {MinMana}"); } }
public void Initialise(AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger) { this.playerReader = addonReader.PlayerReader; this.logger = logger; ResetCharges(); KeyReader.ReadKey(logger, this); if (!string.IsNullOrEmpty(this.Requirement)) { Requirements.Add(this.Requirement); } if (HasFormRequirement()) { if (Enum.TryParse(typeof(Form), Form, out var desiredForm)) { this.FormEnum = (Form)desiredForm; this.logger.LogInformation($"[{Name}] Required Form: {FormEnum}"); if (KeyReader.ActionBarSlotMap.TryGetValue(Key, out int slot)) { int offset = Stance.RuntimeSlotToActionBar(this, playerReader, slot); this.logger.LogInformation($"[{Name}] Actionbar Form key map: Key:{Key} -> Actionbar:{slot} -> Form Map:{slot + offset}"); } } else { logger.LogInformation($"Unknown form: {Form}"); } } ConsoleKeyFormHash = ((int)FormEnum * 1000) + (int)ConsoleKey; UpdateMinResourceRequirement(playerReader, addonReader.ActionBarCostReader); requirementFactory.InitialiseRequirements(this); }
public void Initialise(DataConfig dataConfig, AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile) { SpiritPathFilename = string.Empty; Interact.Key = InteractKey; Interact.Name = "Interact"; Interact.WaitForGCD = false; Interact.DelayAfterCast = 0; Interact.PressDuration = 30; Interact.Initialise(addonReader, requirementFactory, logger); Approach.Key = InteractKey; Approach.Name = "Approach"; Approach.WaitForGCD = false; Approach.DelayAfterCast = 0; Approach.PressDuration = 10; Approach.Cooldown = 150; Approach.Initialise(addonReader, requirementFactory, logger); AutoAttack.Key = InteractKey; AutoAttack.Name = "AutoAttack"; AutoAttack.WaitForGCD = false; AutoAttack.DelayAfterCast = 0; AutoAttack.Initialise(addonReader, requirementFactory, logger); StopAttack.PressDuration = 10; InitializeKeyActions(Pull, Interact, Approach, AutoAttack); InitializeKeyActions(Combat, Interact, Approach, AutoAttack); logger.LogInformation("[Form] Initialise KeyActions."); Form.ForEach(i => i.InitialiseForm(addonReader, requirementFactory, logger)); Pull.Initialise("Pull", addonReader, requirementFactory, logger); Combat.Initialise("Combat", addonReader, requirementFactory, logger); Adhoc.Initialise("Adhoc", addonReader, requirementFactory, logger); NPC.Initialise("AdhocNpc", addonReader, requirementFactory, logger); Parallel.Initialise("Parallel", addonReader, requirementFactory, logger); Jump.Key = JumpKey; Jump.Initialise(addonReader, requirementFactory, logger); TargetLastTarget.Key = TargetLastTargetKey; TargetLastTarget.Initialise(addonReader, requirementFactory, logger); StandUp.Key = StandUpKey; StandUp.Initialise(addonReader, requirementFactory, logger); ClearTarget.Key = ClearTargetKey; ClearTarget.Initialise(addonReader, requirementFactory, logger); StopAttack.Key = StopAttackKey; StopAttack.Initialise(addonReader, requirementFactory, logger); TargetNearestTarget.Key = TargetNearestTargetKey; TargetNearestTarget.Initialise(addonReader, requirementFactory, logger); TargetPet.Key = TargetPetKey; TargetPet.Initialise(addonReader, requirementFactory, logger); TargetTargetOfTarget.Key = TargetTargetOfTargetKey; TargetTargetOfTarget.Initialise(addonReader, requirementFactory, logger); PetAttack.Key = PetAttackKey; PetAttack.PressDuration = 10; PetAttack.Initialise(addonReader, requirementFactory, logger); Mount.Key = MountKey; Mount.Initialise(addonReader, requirementFactory, logger); GatherFindKeys.ForEach(key => { GatherFindKeyConfig.Add(new KeyAction { Key = key }); GatherFindKeyConfig.Last().Initialise(addonReader, requirementFactory, logger); }); OverridePathFilename = overridePathProfileFile; if (!string.IsNullOrEmpty(OverridePathFilename)) { PathFilename = OverridePathFilename; } if (!File.Exists(Path.Join(dataConfig.Path, PathFilename))) { if (!string.IsNullOrEmpty(OverridePathFilename)) { throw new Exception($"The `{OverridePathFilename}` path file does not exists!"); } else { throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!"); } } CheckConfigConsistency(logger); }
public Wait(AddonReader addonReader) { this.addonReader = addonReader; }
public async Task <List <WowPoint> > FindRouteTo(AddonReader addonReader, WowPoint destination) { int uiMapId = addonReader.UIMapId.Value; WowPoint fromPoint = addonReader.PlayerReader.PlayerLocation; WowPoint toPoint = destination; if (!Client.IsConnected) { return(new List <WowPoint>()); } if (targetMapId == 0) { targetMapId = uiMapId; } try { await Task.Delay(0); Vector3 start = worldMapAreaDB.GetWorldLocation(uiMapId, fromPoint, true); Vector3 end = worldMapAreaDB.GetWorldLocation(uiMapId, toPoint, true); var result = new List <WowPoint>(); if (!worldMapAreaDB.TryGet(uiMapId, out WorldMapArea area)) { return(new List <WowPoint>()); } // incase haven't asked a pathfinder for a route this value will be 0 // that case use the highest location if (start.Z == 0) { start.Z = area.LocTop / 2; end.Z = area.LocTop / 2; } logger.LogInformation($"Finding route from {fromPoint}({start}) map {uiMapId} to {toPoint}({end}) map {targetMapId}..."); var path = Client.Send((byte)EMessageType.PATH_LOCATIONS, (area.MapID, start, end, 2)).AsArray <Vector3>(); if (path == null) { return(result); } for (int i = 0; i < path.Length; i++) { // Z X Y -> X Y Z var p = worldMapAreaDB.ToMapAreaSpot(path[i].Z, path[i].X, path[i].Y, area.Continent, uiMapId); result.Add(new WowPoint(p.X, p.Y, p.Z)); logger.LogInformation($"new float[] {{ {path[i].Z}f, {path[i].X}f, {path[i].Y}f }},"); } if (result.Count > 0) { addonReader.PlayerReader.ZCoord = result[0].Z; logger.LogInformation($"PlayerLocation.Z = {addonReader.PlayerReader.PlayerLocation.Z}"); } return(result); } catch (Exception ex) { logger.LogError(ex, $"Finding route from {fromPoint} to {toPoint}"); Console.WriteLine(ex); return(new List <WowPoint>()); } }
public void Initialise(AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger) { Sequence.ForEach(i => i.Initialise(addonReader, requirementFactory, logger)); }
public Task <List <WowPoint> > FindRouteTo(AddonReader addonReader, WowPoint destination) { return(FindRoute(addonReader.UIMapId.Value, addonReader.PlayerReader.PlayerLocation, destination)); }
public RequirementFactory(ILogger logger, AddonReader addonReader) { this.logger = logger; this.addonReader = addonReader; this.playerReader = addonReader.PlayerReader; this.bagReader = addonReader.BagReader; this.equipmentReader = addonReader.EquipmentReader; this.spellBookReader = addonReader.SpellBookReader; this.talentReader = addonReader.TalentReader; this.creatureDb = addonReader.CreatureDb; this.itemDb = addonReader.ItemDb; keywordDictionary = new Dictionary <string, Func <string, Requirement> >() { { ">=", GetInclusiveValueBasedRequirement }, { "<=", GetInclusiveValueBasedRequirement }, { ">", GetExcusiveValueBasedRequirement }, { "<", GetExcusiveValueBasedRequirement }, { "==", GetEqualsValueBasedRequirement }, { "npcID:", CreateNpcRequirement }, { "BagItem:", CreateBagItemRequirement }, { "SpellInRange:", CreateSpellInRangeRequirement }, { "TargetCastingSpell", CreateTargetCastingSpellRequirement }, { "Form", CreateFormRequirement }, { "Race", CreateRaceRequirement }, { "Spell", CreateSpellRequirement }, { "Talent", CreateTalentRequirement }, { "Trigger:", CreateTriggerRequirement } }; booleanDictionary = new Dictionary <string, Func <bool> > { // Target Based { "TargetYieldXP", () => playerReader.TargetYieldXP }, // Range { "InMeleeRange", () => playerReader.IsInMeleeRange }, { "InDeadZoneRange", () => playerReader.IsInDeadZone }, { "OutOfCombatRange", () => !playerReader.WithInCombatRange }, { "InCombatRange", () => playerReader.WithInCombatRange }, // Pet { "Has Pet", () => playerReader.Bits.HasPet }, { "Pet Happy", () => playerReader.Bits.PetHappy }, // Auto Spell { "AutoAttacking", () => playerReader.Bits.IsAutoRepeatSpellOn_AutoAttack }, { "Shooting", () => playerReader.Bits.IsAutoRepeatSpellOn_Shoot }, { "AutoShot", () => playerReader.Bits.IsAutoRepeatSpellOn_AutoShot }, // Temporary Enchants { "HasMainHandEnchant", () => playerReader.Bits.MainHandEnchant_Active }, { "HasOffHandEnchant", () => playerReader.Bits.OffHandEnchant_Active }, // Equipment - Bag { "Items Broken", () => playerReader.Bits.ItemsAreBroken }, { "BagFull", () => bagReader.BagsFull }, { "HasRangedWeapon", () => equipmentReader.HasRanged() }, { "HasAmmo", () => playerReader.Bits.HasAmmo }, // General Buff Condition { "Eating", () => playerReader.Buffs.Eating }, { "Drinking", () => playerReader.Buffs.Drinking }, { "Mana Regeneration", () => playerReader.Buffs.ManaRegeneration }, { "Well Fed", () => playerReader.Buffs.WellFed }, { "Clearcasting", () => playerReader.Buffs.Clearcasting }, // Player Affected { "Swimming", () => playerReader.Bits.IsSwimming }, { "Falling", () => playerReader.Bits.IsFalling }, //Priest { "Fortitude", () => playerReader.Buffs.Fortitude }, { "InnerFire", () => playerReader.Buffs.InnerFire }, { "Divine Spirit", () => playerReader.Buffs.DivineSpirit }, { "Renew", () => playerReader.Buffs.Renew }, { "Shield", () => playerReader.Buffs.Shield }, // Druid { "Mark of the Wild", () => playerReader.Buffs.MarkOfTheWild }, { "Thorns", () => playerReader.Buffs.Thorns }, { "TigersFury", () => playerReader.Buffs.TigersFury }, { "Prowl", () => playerReader.Buffs.Prowl }, { "Rejuvenation", () => playerReader.Buffs.Rejuvenation }, { "Regrowth", () => playerReader.Buffs.Regrowth }, // Paladin { "Seal", () => playerReader.Buffs.Seal }, { "Aura", () => playerReader.Buffs.Aura }, { "Devotion Aura", () => playerReader.Buffs.Aura }, { "Blessing", () => playerReader.Buffs.Blessing }, { "Blessing of Might", () => playerReader.Buffs.Blessing }, // Mage { "Frost Armor", () => playerReader.Buffs.FrostArmor }, { "Ice Armor", () => playerReader.Buffs.FrostArmor }, { "Arcane Intellect", () => playerReader.Buffs.ArcaneIntellect }, { "Ice Barrier", () => playerReader.Buffs.IceBarrier }, { "Ward", () => playerReader.Buffs.Ward }, { "Fire Power", () => playerReader.Buffs.FirePower }, { "Mana Shield", () => playerReader.Buffs.ManaShield }, { "Presence of Mind", () => playerReader.Buffs.PresenceOfMind }, { "Arcane Power", () => playerReader.Buffs.ArcanePower }, // Rogue { "Slice and Dice", () => playerReader.Buffs.SliceAndDice }, { "Stealth", () => playerReader.Buffs.Stealth }, // Warrior { "Battle Shout", () => playerReader.Buffs.BattleShout }, // Warlock { "Demon Skin", () => playerReader.Buffs.Demon }, { "Demon Armor", () => playerReader.Buffs.Demon }, { "Soul Link", () => playerReader.Buffs.SoulLink }, { "Soulstone Resurrection", () => playerReader.Buffs.SoulstoneResurrection }, { "Shadow Trance", () => playerReader.Buffs.ShadowTrance }, // Shaman { "Lightning Shield", () => playerReader.Buffs.LightningShield }, { "Water Shield", () => playerReader.Buffs.WaterShield }, { "Shamanistic Focus", () => playerReader.Buffs.ShamanisticFocus }, { "Focused", () => playerReader.Buffs.ShamanisticFocus }, { "Stoneskin", () => playerReader.Buffs.Stoneskin }, //Hunter { "Aspect of the Cheetah", () => playerReader.Buffs.Aspect }, { "Aspect of the Pack", () => playerReader.Buffs.Aspect }, { "Aspect of the Beast", () => playerReader.Buffs.Aspect }, { "Aspect of the Hawk", () => playerReader.Buffs.Aspect }, { "Aspect of the Wild", () => playerReader.Buffs.Aspect }, { "Aspect of the Monkey", () => playerReader.Buffs.Aspect }, { "Rapid Fire", () => playerReader.Buffs.RapidFire }, { "Quick Shots", () => playerReader.Buffs.QuickShots }, // Debuff Section // Druid Debuff { "Demoralizing Roar", () => playerReader.TargetDebuffs.Roar }, { "Faerie Fire", () => playerReader.TargetDebuffs.FaerieFire }, { "Rip", () => playerReader.TargetDebuffs.Rip }, { "Moonfire", () => playerReader.TargetDebuffs.Moonfire }, { "Entangling Roots", () => playerReader.TargetDebuffs.EntanglingRoots }, { "Rake", () => playerReader.TargetDebuffs.Rake }, // Warrior Debuff { "Rend", () => playerReader.TargetDebuffs.Rend }, // Priest Debuff { "Shadow Word: Pain", () => playerReader.TargetDebuffs.ShadowWordPain }, // Mage Debuff { "Frostbite", () => playerReader.TargetDebuffs.Frostbite }, { "Slow", () => playerReader.TargetDebuffs.Slow }, // Warlock Debuff { "Curse of Weakness", () => playerReader.TargetDebuffs.Curseof }, { "Curse of Elements", () => playerReader.TargetDebuffs.Curseof }, { "Curse of Recklessness", () => playerReader.TargetDebuffs.Curseof }, { "Curse of Shadow", () => playerReader.TargetDebuffs.Curseof }, { "Curse of Agony", () => playerReader.TargetDebuffs.Curseof }, { "Curse of", () => playerReader.TargetDebuffs.Curseof }, { "Corruption", () => playerReader.TargetDebuffs.Corruption }, { "Immolate", () => playerReader.TargetDebuffs.Immolate }, { "Siphon Life", () => playerReader.TargetDebuffs.SiphonLife }, // Hunter Debuff { "Serpent Sting", () => playerReader.TargetDebuffs.SerpentSting }, }; valueDictionary = new Dictionary <string, Func <int> > { { "Health%", () => playerReader.HealthPercent }, { "TargetHealth%", () => playerReader.TargetHealthPercentage }, { "PetHealth%", () => playerReader.PetHealthPercentage }, { "Mana%", () => playerReader.ManaPercentage }, { "BagCount", () => bagReader.BagItems.Count }, { "MobCount", () => addonReader.CombatCreatureCount }, { "MinRange", () => playerReader.MinRange }, { "MaxRange", () => playerReader.MaxRange }, { "LastAutoShotMs", () => playerReader.AutoShot.ElapsedMs }, { "LastMainHandMs", () => playerReader.MainHandSwing.ElapsedMs } }; }