public static bool On_UseBandage() { bool retval = true; if (!(BotPoi.Current.Type == PoiType.None || BotPoi.Current.Type == PoiType.Kill)) { return(false); } string fnname = "FTWCore.On_UseBandge"; if (StyxWoW.Me.HasAura("Recently Bandaged")) { return(false); } MyTimer.Start(fnname); using (StyxWoW.Memory.AcquireFrame()) { if (!FTWUtils.ValidState()) { retval = false; } else if (FTWUtils.MovementDisabled()) { retval = false; } else if (StyxWoW.Me.Mounted) { retval = false; } else { WoWItem potion = (from i in StyxWoW.Me.CarriedItems let spells = i.ItemSpells where i.GetItemName().Contains("Bandage") where i.ItemInfo != null && i.ItemInfo.RequiredLevel <= StyxWoW.Me.Level orderby i.ItemInfo.Level descending select i).FirstOrDefault(); if (potion == null) { retval = false; } else { potion.UseContainerItem(); retval = true; } } } MyTimer.Stop(fnname); return(retval); }
public override void Combat() { string fnname = "FTWRev.Combat"; MyTimer.Start(fnname); if (!FTWUtils.ValidState()) { //FTWLogger.debug(Color.Red, "Invalid state: {0}", FTWUtils.printState()); } else { CheckForChest.Clear(); Evade.CheckCombat(); FTWProps.core.EvaluateRules("@COMBAT"); }; MyTimer.Stop(fnname); }
public override void Pull() { string fnname = "FTWRev.Pull"; MyTimer.Start(fnname); if (!FTWUtils.ValidState()) { //FTWLogger.debug(Color.Red, "Invalid state: {0}", FTWUtils.printState()); } else { CheckForChest.Clear(); if (Evade.CheckPull()) { FTWProps.core.EvaluateRules("@PULL"); } } MyTimer.Stop(fnname); }
public void Pulse() { string fnname = "FTWCore.Pulse"; MyTimer.Start(fnname); try { if (!FTWUtils.ValidState()) { // Do nothing FTWLogger.log(Color.Red, "Not valid state"); } else { // Get lists of interesting people // Party or raid members FTWProps.people = FTWCoreUnits.GetGroup(); // Tank FTWProps.tank = FTWCoreUnits.GetTank(); // Healer FTWProps.healer = FTWCoreUnits.GetHealer(); // Party members within range FTWProps.closePeople = FTWProps.people.Where(p => p.DistanceCalc() <= 40).ToList(); // Party members within range, in line of sight, that need healing FTWProps.healTarget = FTWCoreUnits.GetHealTarget(); // Diseased party member // Only tanks and me get dispels, the rest can stay sick. // A necessary optimization to keep the speed up. FTWProps.cleanseTarget = (from unit in FTWProps.closePeople where unit.Role().Contains("Tank") || unit.Guid == StyxWoW.Me.Guid where unit.EligibleForCleanse() == true orderby unit.HealWeight() select unit).FirstOrDefault(); // Dead party member outside combat FTWProps.reviveTarget = (from unit in FTWProps.closePeople where unit.IsDead || unit.IsGhost select unit).FirstOrDefault(); if (FTWProps.reviveTarget != null) { FTWLogger.log(Color.Red, "{0} is dead - revive him if you can.", FTWProps.reviveTarget.SafeName()); } // Get average health of all party members. try { FTWProps.avgHealth = (int)(from p in FTWProps.closePeople where p.IsDead == false select p.HealthPercent).Average(); } catch (Exception ex) { FTWProps.avgHealth = (int)StyxWoW.Me.HealthPercent; } // Get mobs fighting us FTWProps.adds = FTWCoreUnits.GetAdds(); // Get mobs fighting us, that we're not targeting WoWUnit pettarget = null; if (StyxWoW.Me.GotAlivePet) { pettarget = StyxWoW.Me.Pet.CurrentTarget; } FTWProps.nontargetadds = (from unit in FTWProps.adds where unit != StyxWoW.Me.CurrentTarget && unit != pettarget select unit).ToList(); // Get a mob fighting us, that we're not targeting. FTWProps.add = FTWProps.nontargetadds.FirstOrDefault(); } } catch (Exception ex) { FTWLogger.log(Color.Red, ex.ToString()); } MyTimer.Stop(fnname); }
public override void Pulse() { string fnname = "FTWRev.Pulse"; MyTimer.Start(fnname); // Display startup message if (FTWProps.firstpulse == true) { FTWProps.firstpulse = false; // Eh, I don't like it. Uncomment if you really want it. //Mount.OnMountUp += UseTravelForm; FTWProps.core.Initialize(); FTWLogger.log("FTW starting at {0}", DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss")); FTWLogger.log("Current bot: {0}", Styx.CommonBot.BotManager.Current.Name); } // Unstick ourselves if necessary. CheckForStuck.Pulse(); // Display last red text if (StyxWoW.LastRedErrorMessage != FTWProps.redtext) { FTWProps.redtext = StyxWoW.LastRedErrorMessage; FTWLogger.debug(Color.Red, "Red text: {0}", FTWProps.redtext); } // Leave early if not in valid state if (!FTWUtils.ValidState()) { //FTWLogger.debug(Color.Red, "Invalid state: {0}", FTWUtils.printState()); } else { // Save current class and spec //FTWProps.ClassAndSpec = StyxWoW.Me.ClassAndSpec(); // List aura changes AuraWatcher.Pulse(); // Load rules if they're not loaded //if (!FTWProps.rules.ContainsKey(FTWProps.ClassAndSpec)) // FTWProps.LoadRules(); FTWProps.core.Pulse(); if (FTWUtils.MeOrPartyMemberInCombat()) { //if (BotPoi.Current.Type == PoiType.Loot) //{ // debug("Not done with combat, clearing loot flag"); // BotPoi.Clear(); //} // Force combat because me OR party/raid members in combat) Combat(); } } // Perform dungeon stuff DungeonWatcher.Pulse(); // Perform UI stuff UI.Pulse(); MyTimer.Stop(fnname); MyTimer.Pulse(); }
public static bool On_UsePotion(HashSet <String> spellnames) { bool retval = true; string fnname = "FTWCore.On_UsePotion"; MyTimer.Start(fnname); using (StyxWoW.Memory.AcquireFrame()) { if (!FTWUtils.ValidState()) { retval = false; } else { WoWItem potion = (from i in StyxWoW.Me.CarriedItems let spells = i.ItemSpells where i.ItemInfo != null && spells != null && spells.Count != 0 && i.Usable && i.Cooldown == 0 && i.ItemInfo.RequiredLevel <= StyxWoW.Me.Level && spells.Any(s => s.IsValid && s.ActualSpell != null && spellnames.Contains(s.ActualSpell.Name)) orderby i.ItemInfo.Level descending select i).FirstOrDefault(); if (FTWProps.debugitems.Count > 0) { foreach (WoWItem item in StyxWoW.Me.CarriedItems) { if (FTWProps.debugitems.Contains(item.Name)) { List <WoWItem.WoWItemSpell> spells = item.ItemSpells; ItemInfo inf = item.ItemInfo; FTWLogger.debug(string.Format("{0} {1} {2}", item.Name, item.Usable, item.Cooldown)); if (spells != null) { foreach (WoWItem.WoWItemSpell itemspell in spells) { FTWLogger.debug(string.Format(" {0} {1}", itemspell.Id, itemspell.ToString())); WoWSpell actualspell = itemspell.ActualSpell; if (actualspell != null) { FTWLogger.debug(string.Format(" {0} {1} {2}", actualspell.Id, actualspell.Name, actualspell.IsValid)); } } } } } } if (potion == null) { retval = false; } else { potion.UseContainerItem(); FTWLogger.log(Color.SkyBlue, "Using {0}", potion.Name); retval = true; } } } MyTimer.Stop(fnname); return(retval); }