private static bool InLFDQueue() { string s = GetLFDMode(); FTWLogger.log(Color.SandyBrown, "LFDMode: {0}", s); return(s == "queued" || s == "proposal"); }
public static bool CheckPull() { string fnname = "Evade.CheckPull"; MyTimer.Start(fnname); // Check for botpoi not being something else if (!(BotPoi.Current.Type == PoiType.Kill || BotPoi.Current.Type == PoiType.None)) { return(false); } // Check for pull taking too long WoWUnit target = StyxWoW.Me.CurrentTarget; if (target == null || target.IsFriendly) { MyTimer.Stop(fnname); return(false); } if (StyxWoW.Me.HealthPercent < 50 || StyxWoW.Me.ManaPercent < 50) { FTWLogger.log(Color.Red, "Health or mana is below 50%, not pulling!"); StyxWoW.Me.ClearTarget(); MyTimer.Stop(fnname); return(false); } //if (!target.IsValidUnit()) //{ // log("Blacklisting {0} for 60 seconds in CheckPull", target.SafeName()); // Blacklist.Add(target, TimeSpan.FromSeconds(60)); // StyxWoW.Me.ClearTarget(); // MyTimer.Stop(fnname); // return false; //} int clustersize = target.ClusterSize(); FTWLogger.log(Color.Violet, "PULL: Target = {0} at {1} ({2}) ({3} mobs surrounding)", target.SafeName(), target.DistanceCalc(), target.FactionId, clustersize); if (target.Guid != PullTargetGuid) { // New pull target - reset timer for maxPullTime seconds PullStopTime = DateTime.Now.AddSeconds(MaxPullTime); PullTargetGuid = target.Guid; } else if (DateTime.Now > PullStopTime) { // Still pulling after maxPullTime seconds FTWLogger.log(Color.Red, "Can't pull {0} after {1} seconds - blacklist for 5 minutes.", target.SafeName(), MaxPullTime); Blacklist.Add(target.Guid, TimeSpan.FromMinutes(5)); StyxWoW.Me.ClearTarget(); MyTimer.Stop(fnname); return(false); } MyTimer.Stop(fnname); return(true); }
public static bool IsCrowdControlled(this WoWUnit unit) { string fnname = "FTWExtensionMethods.IsCrowdControlled"; bool retval = false; MyTimer.Start(fnname); if (unit == null) { MyTimer.Stop(fnname); return(false); } foreach (WoWAura aura in unit.Debuffs.Values) { try { if (FTWProps.Stuns.Contains(aura.Name)) { retval = true; } else if (aura.Spell == null) { continue; } else if (( aura.Spell.Mechanic == WoWSpellMechanic.Asleep || aura.Spell.Mechanic == WoWSpellMechanic.Banished || aura.Spell.Mechanic == WoWSpellMechanic.Frozen || aura.Spell.Mechanic == WoWSpellMechanic.Horrified || aura.Spell.Mechanic == WoWSpellMechanic.Invulnerable2 || aura.Spell.Mechanic == WoWSpellMechanic.Incapacitated || aura.Spell.Mechanic == WoWSpellMechanic.Polymorphed || aura.Spell.Mechanic == WoWSpellMechanic.Rooted || aura.Spell.Mechanic == WoWSpellMechanic.Sapped || aura.Spell.Mechanic == WoWSpellMechanic.Shackled || aura.Spell.Mechanic == WoWSpellMechanic.Stunned || aura.Spell.Mechanic == WoWSpellMechanic.Turned || aura.Spell.Mechanic == WoWSpellMechanic.Fleeing) && aura.TimeLeft.TotalMilliseconds > 0) { retval = true; } } catch (Exception ex) { FTWLogger.log(Color.Red, "Error when examining aura {0} : {1}", aura.Name, ex.Message); retval = false; } if (retval == true) { break; } } if (retval) { FTWLogger.log(Color.GreenYellow, "{0} IS INCAPACITATED", unit.SafeName()); } MyTimer.Stop(fnname); return(retval); }
public static void HandleDungeonInvite(object sender, LuaEventArgs args) { if (AutoAcceptDungeon) { FTWLogger.log(Color.SandyBrown, "Accepting dungeon invite"); Lua.DoString("AcceptProposal()"); } }
public static void Pulse() { string fnname = "CheckForChest.Pulse"; MyTimer.Start(fnname); if (BotPoi.Current.Type == PoiType.Loot) { // Black list loot if it's taking too long FTWLogger.log(color, "LOOT CHESTS: Moving towards {0} ({1:X}) at {2} yards away", BotPoi.Current.Name, BotPoi.Current.Guid, BotPoi.Current.Location.Distance(StyxWoW.Me.Location)); if (BotPoi.Current.Guid == lastguid && DateTime.Now > stoptime) { FTWLogger.log(color, "LOOT CHESTS: Blacklisting {0} ({1:X}) - didn't get it after {2} seconds.", BotPoi.Current.Name, BotPoi.Current.Guid, blacklistMinutes); Blacklist.Add(lastguid, BlacklistFlags.All, TimeSpan.FromMinutes(60)); Clear(); } } else { // Look for new loot if (DateTime.Now < nexttime) { MyTimer.Stop(fnname); return; } // OMG DON'T run for a chest in a dungeon! // 'Tap tool' on beer keg in Stormstout causes you to pull multiple rooms of mobs. if (StyxWoW.Me.IsInInstance) { return; } nexttime = DateTime.Now.AddSeconds(checkInterval); List <WoWGameObject> chests = (from c in ObjectManager.GetObjectsOfType <WoWGameObject>(false, false) where c.Distance < Styx.CommonBot.LootTargeting.LootRadius where c.Type != WoWObjectType.Corpse && c.SubType == WoWGameObjectType.Chest && !Blacklist.Contains(c.Guid, BlacklistFlags.All) && c.CanLoot == true where c.IsHerb == false && c.IsMineral == false orderby c.Distance select c).ToList(); if (chests.Count > 0) { lastguid = chests[0].Guid; BotPoi.Current = new BotPoi(chests[0], PoiType.Loot); FTWLogger.log(color, "LOOT CHESTS: Going after {0} ({1:X}) at {2} yards away", chests[0].Name, chests[0].Guid, chests[0].Distance); stoptime = DateTime.Now.AddSeconds(pullSeconds); } } MyTimer.Stop(fnname); }
public static int UnitPower(this WoWPlayer p, int powertype) { string fnname = "FTWExtensionMethods.UnitPower"; MyTimer.Start(fnname); int cnt = 0; try { cnt = Convert.ToInt32(Lua.GetReturnValues(string.Format("return UnitPower('player', {0})", powertype), "PowerType.lua")[0]); } catch (Exception ex) { FTWLogger.log(Color.Red, "Error when getting UnitPower - {0}", ex.Message); cnt = 0; } MyTimer.Stop(fnname); return(cnt); }
public static bool CheckCombat() { // Check for combat taking too long string fnname = "Evade.CheckCombat"; MyTimer.Start(fnname); WoWUnit target = StyxWoW.Me.CurrentTarget; if (target == null || target.IsFriendly) { MyTimer.Stop(fnname); return(true); } if (target.IsDead == true && !target.IsFriendly) { StyxWoW.Me.ClearTarget(); return(true); } if (target.Guid != CurrentTargetGuid) { // New target CurrentTargetStopTime = DateTime.Now.AddSeconds(MaxCurrentTargetTime); CurrentTargetGuid = target.Guid; FTWLogger.log("Starting combat with {0} {1}", target.SafeName(), target.ShortGuid()); if (!FTWUtils.MovementDisabled()) { WoWMovement.MoveStop(); } } else if (DateTime.Now > CurrentTargetStopTime && target.HealthPercent > 99 && !target.Name.Contains("Training Dummy") && !StyxWoW.Me.GroupInfo.IsInParty && !StyxWoW.Me.GroupInfo.IsInRaid) { // I've been fighting the same target by myself for too long - blacklist FTWLogger.log("Combat with {0} has gone on {1} seconds with no health reduction - adding to blacklist", target.SafeName(), MaxCurrentTargetTime); Blacklist.Add(target.Guid, TimeSpan.FromMinutes(5)); StyxWoW.Me.ClearTarget(); MyTimer.Stop(fnname); return(false); } MyTimer.Stop(fnname); return(true); }
public static void UseTravelForm(object sender, MountUpEventArgs e) { float traveldist = 30; float dist = StyxWoW.Me.Location.Distance(e.Destination); string errmsg = string.Empty; while (SpellManager.GlobalCooldown || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null) { Thread.Sleep(10); } if (!SpellManager.HasSpell("Travel Form")) { errmsg = "Don't have travel form."; } else if (e.Destination == WoWPoint.Zero) { errmsg = "Destination is WoWPoint.Zero"; } else if (dist > traveldist) { errmsg = string.Format("Dist {0} > traveldist {1}", dist, traveldist); } else if (Battlegrounds.IsInsideBattleground && DateTime.Now < Battlegrounds.BattlefieldStartTime) { errmsg = "Battle hasn't started yet."; } if (errmsg != string.Empty) { FTWLogger.log("Not using travel form because {0}", errmsg); } else { e.Cancel = true; FTWLogger.log("Using travel form for point {0} yards away (MountDistance: {1})", dist, Styx.Helpers.CharacterSettings.Instance.MountDistance); if (!StyxWoW.Me.HasAura("Travel Form")) { SpellManager.Cast("Travel Form"); } } }
public static void Pulse() { string s = Lua.GetReturnVal <string>("local m,s = GetLFGMode(LE_LFG_CATEGORY_LFD); return m;", 0); if (s == null) { s = "<null>"; } //debug(Color.SandyBrown, "LFGMode: {0}", s); if (StyxWoW.Me.Level < 15 || AutoQueueDungeon == false || StyxWoW.Me.IsInInstance == true || IsLFGDeserter() == true || InLFDQueue() == true) { return; } FTWLogger.log(Color.SandyBrown, "Queuing for dungeon"); Lua.DoString("LFDQueueFrame_Join()"); }
private static void LoadRules() { fakecooldowns = LoadFakeCooldowns(gen_rules_path + "\\Spell_Overrides.txt"); AOESpells = LoadList(gen_rules_path + "\\Spell_Target_Circle.txt"); Stuns = LoadList(gen_rules_path + "\\Spell_Stuns.txt"); TankOnlySpells = LoadList(gen_rules_path + "\\Spell_Tank_Only.txt"); CastOver = LoadList(gen_rules_path + "\\Spell_Cast_Over.txt"); IgnoreMobsBattleground = LoadList(gen_rules_path + "\\Ignore_Mobs_Battleground.txt"); PropertyNames = File.ReadAllLines(gen_rules_path + "\\Properties.txt"); IgnoreCanCast = LoadList(gen_rules_path + "\\Spell_Ignore_CanCast.txt"); MobWeights = LoadWeights(gen_rules_path + "\\Mob_Weights.txt"); try { FTWLogger.log("Loading rules for {0}", ClassAndSpec); string filename = FTWProps.class_rules_path + "\\" + ClassAndSpec + ".txt"; rules[ClassAndSpec] = File.ReadAllText(filename); } catch (Exception ex) { FTWLogger.log(Color.Red, "Couldn't find a data file for {0}! {1}", ClassAndSpec, ex.Message); } }
public static void Pulse() { string fnname = "CheckForStuck.Pulse"; if (! (StyxWoW.IsInGame && StyxWoW.Me != null && StyxWoW.Me.IsValid && !StyxWoW.Me.IsDead && !StyxWoW.Me.IsGhost && !StyxWoW.Me.IsOnTransport && !StyxWoW.Me.OnTaxi) ) { return; } // Anti-AFK logic if (DateTime.Now > antiafk) { antiafk = DateTime.Now.AddMilliseconds(antiafkinterval + random.Next(3000, 5000)); KeyboardManager.PressKey((Char)System.Windows.Forms.Keys.Right); Thread.Sleep(random.Next(10, 20)); KeyboardManager.ReleaseKey((Char)System.Windows.Forms.Keys.Right); } if (!(",Gatherbuddy2,ArchaeologyBuddy,".Contains("," + Styx.CommonBot.BotManager.Current.Name + ","))) { return; } // Stuck logic MyTimer.Start(fnname); int numJumps; if (NotStuck() || DateTime.Now < stuckNextTime) { MyTimer.Stop(fnname); return; } stuckCtr += 1; FTWLogger.log(Color.Tomato, "Stuck for the {0} time - moving about a bit.", stuckCtr); // Just press the space bar first numJumps = random.Next(1, 3); for (int i = 0; i < numJumps; i++) { PressSpace(); if (NotStuck()) { MyTimer.Stop(fnname); return; } } // Back up numJumps = random.Next(1, 3); for (int i = 0; i < numJumps; i++) { WoWMovement.Move(WoWMovement.MovementDirection.Backwards); Thread.Sleep(random.Next(1000, 2000)); WoWMovement.MoveStop(); if (NotStuck()) { MyTimer.Stop(fnname); return; } } // Long jumps numJumps = random.Next(2, 4); for (int i = 0; i < numJumps; i++) { KeyboardManager.PressKey((char)Keys.Space); Thread.Sleep(random.Next(2000, 3000)); KeyboardManager.ReleaseKey((char)Keys.Space); Thread.Sleep(random.Next(250, 750)); if (NotStuck()) { MyTimer.Stop(fnname); return; } } // Up + space numJumps = random.Next(1, 3); for (int i = 0; i < numJumps; i++) { KeyboardManager.PressKey((char)Keys.Up); Thread.Sleep(random.Next(30, 50)); KeyboardManager.PressKey((char)Keys.Space); Thread.Sleep(random.Next(500, 750)); KeyboardManager.ReleaseKey((char)Keys.Up); KeyboardManager.ReleaseKey((char)Keys.Space); Thread.Sleep(random.Next(250, 750)); if (NotStuck()) { MyTimer.Stop(fnname); return; } } // Space + up numJumps = random.Next(1, 3); for (int i = 0; i < numJumps; i++) { KeyboardManager.PressKey((char)Keys.Space); Thread.Sleep(random.Next(30, 50)); KeyboardManager.PressKey((char)Keys.Up); Thread.Sleep(random.Next(500, 750)); KeyboardManager.ReleaseKey((char)Keys.Up); KeyboardManager.ReleaseKey((char)Keys.Space); Thread.Sleep(random.Next(250, 750)); if (NotStuck()) { MyTimer.Stop(fnname); return; } } MyTimer.Stop(fnname); }