Esempio n. 1
0
 public bool IsMovmentImpared()
 {
     using (new FrameLock())
     {
         foreach (KeyValuePair <string, WoWAura> pair in Me.Auras)
         {
             WoWAura curAura = pair.Value;
             if (curAura.Spell.SpellEffect1.EffectType == WoWSpellEffectType.Stuck)
             {
                 Logging.Write("Buff Is  " + curAura.Name + " is healing him");
                 return(true);
             }
         }
         return(false);
     }
 }
        public static TimeSpan GetAuraTimeLeft(string auraName, WoWUnit onUnit, bool fromMyAura)
        {
            if (onUnit == null)
            {
                return(TimeSpan.Zero);
            }

            WoWAura wantedAura =
                onUnit.GetAllAuras().Where(a => a.Name == auraName && (!fromMyAura || a.CreatorGuid == Me.Guid)).FirstOrDefault();

            if (wantedAura != null)
            {
                return(wantedAura.TimeLeft);
            }
            return(TimeSpan.Zero);
        }
Esempio n. 3
0
 public bool SpellToSteal()
 {
     using (new FrameLock())
     {
         foreach (KeyValuePair <string, WoWAura> pair in Me.CurrentTarget.ActiveAuras)
         {
             WoWAura curAura = pair.Value;
             if (curAura.Spell.SpellEffect1.EffectType == WoWSpellEffectType.Heal)
             {
                 Logging.Write("CurrentTarget's Buff " + curAura.Name + " is healing him");
                 return(true);
             }
         }
         return(false);
     }
 }
Esempio n. 4
0
        private static WoWUnit GetPurgeEnemyTarget(string spellName)
        {
            if (SingularSettings.Instance.PurgeTargets == CheckTargets.Current)
            {
                if (Unit.ValidUnit(StyxWoW.Me.CurrentTarget))
                {
                    WoWAura aura = GetPurgeEnemyAura(StyxWoW.Me.CurrentTarget);
                    if (aura != null)
                    {
                        // expensive call, so do only if purgeable debuf found when checking only currenttarget
                        if (!StyxWoW.Me.IsSafelyFacing(StyxWoW.Me.CurrentTarget))
                        {
                            return(null);
                        }

                        Logger.WriteDebug("PurgeEnemyTarget: want to {0} {1} with '{2}' #{3}", spellName, StyxWoW.Me.CurrentTarget.SafeName(), aura.Name, aura.SpellId);
                        return(StyxWoW.Me.CurrentTarget);
                    }
                }
            }
            else if (SingularSettings.Instance.PurgeTargets == CheckTargets.All)
            {
                // WoWUnit target = Unit.NearbyUnfriendlyUnits.FirstOrDefault(u => StyxWoW.Me.IsSafelyFacing(u) && null != GetPurgeEnemyAura(u));
                WoWUnit target = Unit.NearbyUnfriendlyUnits.FirstOrDefault(u => {
                    if (StyxWoW.Me.SpellDistance(u) > 30)
                    {
                        return(false);
                    }
                    if (!StyxWoW.Me.IsSafelyFacing(u))
                    {
                        return(false);
                    }
                    WoWAura aura = GetPurgeEnemyAura(u);
                    if (aura == null)
                    {
                        return(false);
                    }

                    Logger.WriteDebug("PurgeEnemyTarget: want to {0} on {1} with '{2}' #{3}", spellName, u.SafeName(), aura.Name, aura.SpellId);
                    return(true);
                });

                return(target);
            }

            return(null);
        }
Esempio n. 5
0
        public async Task <bool> CleanseMethod()
        {
            // TODO UA 34439 http://www.wowhead.com/spell=34439/unstable-affliction
            // TODO Vampiric Touch 34914 http://www.wowhead.com/spell=34914/vampiric-touch

            if (!Globals.Pvp)
            {
                return(false);
            }

            var auras = new Dictionary <WoWPlayer, WoWAuraCollection>();

            if (PaladinSettings.Instance.UseCleanseGroup && Globals.InParty)
            {
                foreach (var groupmember in Unit.GroupMembers.Where(x => x.Distance <= 40 && x.InLineOfSight))
                {
                    auras.Add(groupmember, new WoWAuraCollection(groupmember.GetAllAuras().Where(x => x.Spell.DispelType == WoWDispelType.Poison || x.Spell.DispelType == WoWDispelType.Disease)));
                }
            }
            else
            {
                auras.Add(StyxWoW.Me, new WoWAuraCollection(StyxWoW.Me.GetAllAuras().Where(x => x.Spell.DispelType == WoWDispelType.Poison || x.Spell.DispelType == WoWDispelType.Disease)));
            }

            foreach (var aura in auras)
            {
                int index = CheckForCleanse(aura.Value);

                if (aura.Value.Count == 0 || index == -1)
                {
                    continue;
                }

                CleanseTarget      = aura.Key;
                CleanseAuraToClear = aura.Value[index];
                break;
            }

            if (CleanseTarget == null || CleanseAuraToClear == null)
            {
                return(false);
            }

            Helpers.Logger.DiagnosticLog("Cleansing {0}, Distance: {1}, LOS: {2}", CleanseTarget.SafeName, CleanseTarget.Distance, CleanseTarget.InLineOfSpellSight);

            return(await CleanseCast());
        }
Esempio n. 6
0
 public static double auraTimeLeft(WoWUnit Unit, int auraID, bool isMyAura = false)
 {
     try
     {
         if (Unit == null || !Unit.IsValid)
         {
             return(0);
         }
         WoWAura Aura = isMyAura ? Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID && A.CreatorGuid == Me.Guid) : Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID);
         return(Aura != null ? Aura.TimeLeft.TotalMilliseconds : 0);
     }
     catch (Exception xException)
     {
         L.diagnosticsLog("Exception in auraExists(); ", xException);
         return(9999);
     }
 }
Esempio n. 7
0
        private static Composite CreateDiscDiagnosticOutputBehavior(string context)
        {
            return(new Sequence(
                       new Decorator(
                           ret => SingularSettings.Debug,
                           new ThrottlePasses(1, 1,
                                              new Action(ret =>
            {
                WoWAura chakra = Me.GetAllAuras().Where(a => a.Name.Contains("Chakra")).FirstOrDefault();

                string line = string.Format(".... [{0}] h={1:F1}%/m={2:F1}%, combat={3}, evang={4}, archa={5}, spish={6}, brwtim={7}",
                                            context,
                                            Me.HealthPercent,
                                            Me.ManaPercent,
                                            Me.Combat.ToYN(),
                                            (int)Me.GetAuraStacks("Evangelism"),
                                            (long)Me.GetAuraTimeLeft("Archangel").TotalMilliseconds,
                                            (long)Me.GetAuraTimeLeft(SPIRIT_SHELL_SPELL).TotalMilliseconds,
                                            (long)Me.GetAuraTimeLeft("Borrowed Time").TotalMilliseconds
                                            );

                if (HealerManager.Instance == null || HealerManager.Instance.FirstUnit == null || !HealerManager.Instance.FirstUnit.IsValid)
                {
                    line += ", target=(null)";
                }
                else
                {
                    WoWUnit healtarget = HealerManager.Instance.FirstUnit;
                    line += string.Format(", target={0} th={1:F1}%/{2:F1}% @ {3:F1} yds, combat={4}, tlos={5}, pw:s={6}, spish={7}",
                                          healtarget.SafeName(),
                                          healtarget.HealthPercent,
                                          healtarget.PredictedHealthPercent(includeMyHeals: true),
                                          healtarget.SpellDistance(),
                                          healtarget.Combat.ToYN(),
                                          healtarget.InLineOfSpellSight.ToYN(),
                                          (long)healtarget.GetAuraTimeLeft("Power Word: Shield").TotalMilliseconds,
                                          (long)healtarget.GetAuraTimeLeft(SPIRIT_SHELL_ABSORB).TotalMilliseconds
                                          );
                }

                Logger.WriteDebug(Color.LightYellow, line);
                return RunStatus.Failure;
            }))
                           )
                       ));
        }
Esempio n. 8
0
        public static bool IsDiseased(this WoWUnit unit)
        {
            string fnname = "FTWExtensionMethods.IsDiseased";

            MyTimer.Start(fnname);
            if (unit == null)
            {
                MyTimer.Stop(fnname);
                return(false);
            }
            WoWAura aura = (from debuff in unit.Debuffs.Values
                            where debuff.Spell != null && FTWProps.dispels.Contains(debuff.Spell.DispelType)
                            select debuff).FirstOrDefault();

            MyTimer.Stop(fnname);
            return(aura != null);
        }
Esempio n. 9
0
        /// <summary>
        /// determines if an Aura with any slowing effect matching
        /// slowedPct or greater is affecting unit
        /// </summary>
        /// <param name="unit">WoWUnit to check</param>
        /// <param name="slowedPct">% slowing required for true</param>
        /// <returns>true: if slowed by slowedPct or more, false: if not slowed as much as specified</returns>
        public static bool IsSlowed(this WoWUnit unit, uint slowedPct = 50)
        {
            if (unit == null)
            {
                return(false);
            }

            int     slowedCompare = -(int)slowedPct;
            WoWAura foundAura     = null;

            Styx.WoWInternals.DBC.SpellEffect foundSE = null;
            int foundSpellId = 0;

            foreach (WoWAura aura in unit.GetAllAuras())
            {
                foreach (Styx.WoWInternals.DBC.SpellEffect se in aura.Spell.SpellEffects)
                {
                    if (se != null && se.AuraType == WoWApplyAuraType.ModDecreaseSpeed && se.BasePoints <= slowedCompare)
                    {
                        foundAura    = aura;
                        foundSE      = se;
                        foundSpellId = aura.SpellId;
                        break;
                    }
                }
            }

            if (SingularSettings.Debug)
            {
                if ((foundAura != null) != lastIsSlowedResult || lastIsSlowedTarget != unit.Guid || lastIsSlowedSpellId != foundSpellId)
                {
                    lastIsSlowedResult  = (foundAura != null);
                    lastIsSlowedTarget  = unit.Guid;
                    lastIsSlowedSpellId = foundSpellId;
                    if (foundAura != null)
                    {
                        if (foundSE != null)
                        {
                            Logger.WriteDebug("IsSlowed: target {0} slowed {1}% with [{2}] #{3}", unit.SafeName(), foundSE.BasePoints, foundAura.Name, foundSpellId);
                        }
                    }
                }
            }

            return(foundSE != null);
        }
Esempio n. 10
0
 public static uint auraStacks(WoWUnit Unit, int auraID, bool isMyAura = false)
 {
     try
     {
         if (Unit == null || !Unit.IsValid)
         {
             return(0);
         }
         WoWAura Aura = isMyAura ? Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID && A.CreatorGuid == Me.Guid) : Unit.GetAllAuras().FirstOrDefault(A => A.SpellId == auraID);
         return(Aura != null ? Aura.StackCount : 0);
     }
     catch (Exception xException)
     {
         L.diagnosticsLog("Exception in auraStacks(); ", xException);
         return(0);
     }
 }
Esempio n. 11
0
        /// <summary>
        ///   Checks if there is an aura created by you on the target. Useful for DoTs.
        ///   This will return false even while you have the aura on the unit but the stackcount is lower then provided value and
        ///   timeleft is lower then the expire time.
        ///   Useful to stack more dots or redot before the aura expires.
        /// </summary>
        /// <param name = "aura">Name of the spell</param>
        /// <param name = "unit">Unit to check</param>
        /// <param name = "timeLeft">Time left for the aura.</param>
        /// <param name = "stackCount">Stack count</param>
        /// <returns></returns>
        public bool HasMyAura(string aura, WoWUnit unit, TimeSpan timeLeft, int stackCount)
        {
            // Check for unit being null first, so we don't end up with an exception
            if (unit == null)
            {
                return(false);
            }

            // If the unit has that aura and it has been created by us return true
            if (unit.ActiveAuras.ContainsKey(aura))
            {
                WoWAura _aura = unit.ActiveAuras[aura];

                if (_aura.CreatorGuid == Me.Guid && _aura.TimeLeft > timeLeft && _aura.StackCount >= stackCount)
                {
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 12
0
        public static List <String[]> ListAuras(WoWUnit target)
        {
            List <String[]> lst = new List <String[]>();

            if (target == null)
            {
                return(lst);
            }
            List <String> keys = target.Auras.Keys.ToList();

            keys.Sort();
            foreach (String key in keys)
            {
                WoWAura  aura = target.Auras[key];
                String[] arr  = { "", "", "" };
                arr[0] = aura.Name;
                arr[1] = (aura.StackCount == 0 ? "" : aura.StackCount.ToString());
                arr[2] = (aura.TimeLeft.TotalSeconds == 0 ? "" : string.Format("{0:0.00}", aura.TimeLeft.TotalSeconds));
                lst.Add(arr);
            }
            return(lst);
        }
Esempio n. 13
0
        protected void CheckForAndApplyBuff(WoWUnit target, string name, bool sleep = true)
        {
            WoWAura buff = target.Auras[name];

            if (buff != null && buff.IsValid)
            {
                return;
            }

            WoWSpell spell = Manager.Spellbook[name];

            if (spell == null || !spell.IsValid)
            {
                return;
            }

            Print("Buffing {0} with {1}", target.Name, name);
            spell.Cast(target);
            if (sleep)
            {
                Sleep(1000);
            }
        }
Esempio n. 14
0
        private static Composite CreateHolyDiagnosticOutputBehavior(string context)
        {
            if (!SingularSettings.Debug)
            {
                return(new ActionAlwaysFail());
            }

            return(new ThrottlePasses(1, TimeSpan.FromSeconds(1), RunStatus.Failure,
                                      new Action(ret =>
            {
                WoWAura chakra = Me.GetAllAuras().FirstOrDefault(a => a.Name.Contains("Chakra"));

                string line = string.Format(".... [{0}] h={1:F1}%/m={2:F1}%, combat={3}, {4}, surge={5}, serendip={6}",
                                            context,
                                            Me.HealthPercent,
                                            Me.ManaPercent,
                                            Me.Combat.ToYN(),
                                            chakra == null ? "(null)" : chakra.Name,
                                            (long)Me.GetAuraTimeLeft("Surge of Light").TotalMilliseconds,
                                            (long)Me.GetAuraTimeLeft("Serendipity").TotalMilliseconds
                                            );

                WoWUnit healTarget = HealerManager.Instance == null ? null : HealerManager.Instance.FirstUnit;
                if (!HealerManager.NeedHealTargeting)
                {
                    line += ", healTargeting=disabled";
                }
                else if (Me.IsInGroup() || (Me.FocusedUnitGuid.IsValid && healTarget == Me.FocusedUnit))
                {
                    if (healTarget == null || !healTarget.IsValid)
                    {
                        line += ", target=(null)";
                    }
                    else
                    {
                        line += string.Format(", target={0} th={1:F1}%/{2:F1}%,  @ {3:F1} yds, combat={4}, tloss={5}, pw:s={6}, renew={7}",
                                              healTarget.SafeName(),
                                              healTarget.HealthPercent,
                                              healTarget.PredictedHealthPercent(includeMyHeals: true),
                                              healTarget.Distance,
                                              healTarget.Combat.ToYN(),
                                              healTarget.InLineOfSpellSight,
                                              (long)healTarget.GetAuraTimeLeft("Power Word: Shield").TotalMilliseconds,
                                              (long)healTarget.GetAuraTimeLeft("Renew").TotalMilliseconds
                                              );
                    }

                    if (SingularSettings.Instance.StayNearTank)
                    {
                        WoWUnit tank = HealerManager.TankToStayNear;
                        if (tank == null)
                        {
                            line += ",tank=(null)";
                        }
                        else if (!tank.IsAlive)
                        {
                            line += ",tank=(dead)";
                        }
                        else
                        {
                            float hh = (float)tank.HealthPercent;
                            float hph = tank.PredictedHealthPercent();
                            line += string.Format(",tank={0} {1:F1}% @ {2:F1} yds,tph={3:F1}%,tcombat={4},tmove={5},tloss={6}",
                                                  tank.SafeName(),
                                                  hh,
                                                  tank.SpellDistance(),
                                                  hph,
                                                  tank.Combat.ToYN(),
                                                  tank.IsMoving.ToYN(),
                                                  tank.InLineOfSpellSight.ToYN()
                                                  );
                        }
                    }
                }

                Logger.WriteDebug(Color.LightGreen, line);
                return RunStatus.Failure;
            })));
        }
Esempio n. 15
0
        public static Composite CreateCancelShadowmeld()
        {
            if (StyxWoW.Me.Race != WoWRace.NightElf)
            {
                return(new ActionAlwaysFail());
            }

            return(new Sequence(
                       ctx => StyxWoW.Me.GetAllAuras().FirstOrDefault(a => a.Name == "Shadowmeld"),

                       // fail sequence if no aura
                       new Action(r =>
            {
                if (r == null)
                {
                    return RunStatus.Failure;
                }
                return RunStatus.Success;
            }),

                       new PrioritySelector(
                           new Sequence(
                               new Action(r =>
            {
                const int timeLimitSeconds = 20;
                TimeSpan timeLimit = TimeSpan.FromSeconds(timeLimitSeconds);
                DateTime now = DateTime.UtcNow;

                if (shadowMeldStart == null || shadowMeldStart == DateTime.MinValue)
                {
                    shadowMeldStart = now;
                }

                WoWAura aura = (WoWAura)r;
                if ((now - shadowMeldStart) > timeLimit)
                {
                    Logger.Write(LogColor.Cancel, "/cancelaura shadowmeld (exceeded {0:F1} seconds)", timeLimit.TotalSeconds);
                    return RunStatus.Success;
                }

                shadowMeldAggro = Unit.UnfriendlyUnits()
                                  .Where(u => u.MyReaction == WoWUnitReaction.Hostile && u.SpellDistance() < (u.MyAggroRange + 5))
                                  .FirstOrDefault();
                if (shadowMeldAggro == null)
                {
                    Logger.Write(LogColor.Cancel, "/cancelaura shadowmeld (no hostile mobs in aggro range)");
                    return RunStatus.Success;
                }

                // otherwise, exit sequence with failure
                return RunStatus.Failure;
            }),
                               new Action(r => StyxWoW.Me.CancelAura("Shadowmeld")),
                               new PrioritySelector(
                                   new Wait(1, until => !StyxWoW.Me.HasAura("Shadowmeld"), new ActionAlwaysSucceed()),
                                   new Action(r =>
            {
                Logger.WriteDiagnostic("Shadowmeld: aura not removed after cancel");
                return RunStatus.Failure;
            })
                                   ),
                               new Action(r =>
            {
                Logger.WriteDiagnostic("Shadowmeld: removed - after {0:F1} seconds", (DateTime.UtcNow - shadowMeldStart).TotalSeconds);
                shadowMeldStart = DateTime.MinValue;
                return RunStatus.Success;
            })
                               ),
                           new ThrottlePasses(
                               1,
                               TimeSpan.FromSeconds(5),
                               RunStatus.Success,
                               new Action(r =>
            {
                WoWAura aura = (WoWAura)r;
                Logger.Write(LogColor.Hilite, "Shadowmeld: wait for {0} @ {1:F1} yds to clear area", shadowMeldAggro.SafeName(), shadowMeldAggro.SpellDistance());
                Logger.WriteDiagnostic("Shadowmeld: {0} @ {1:F1} has {2:F1} aggro range with me", shadowMeldAggro.SafeName(), shadowMeldAggro.SpellDistance(), shadowMeldAggro.MyAggroRange);
            })
                               )
                           )
                       ));
        }
Esempio n. 16
0
        protected override Composite CreateBehavior()
        {
            return(_behaviorRoot ?? (_behaviorRoot =
                                         new PrioritySelector(

                                             // If the quest is complete, and we need to press a final button...
                                             new Decorator(ret => Me.IsQuestComplete(QuestId),
                                                           new Sequence(
                                                               new DecoratorContinue(ret => ButtonOnQuestComplete.HasValue,
                                                                                     new Action(delegate
            {
                TreeRoot.StatusText = string.Format("Pressing Button {0} at Quest Complete.",
                                                    ButtonOnQuestComplete.Value);
                Lua.DoString("RunMacroText(\"/click OverrideActionBarButton{0}\")", ButtonOnQuestComplete.Value);
            })),

                                                               // If behavior done, bail...
                                                               // Note that this is also an implicit "is quest complete" exit criteria, also.
                                                               new Action(delegate
            {
                GuiShowProgress("quest complete");
                _isBehaviorDone = true;
            })
                                                               )),

                                             // Find next target...
                                             _behavior_HuntingGround.CreateBehavior_SelectTarget(),

                                             // Move to next target...
                                             _behavior_HuntingGround.CreateBehavior_MoveToTarget(),

                                             new PrioritySelector(context => TargetAurasShowing(CurrentTarget, _targetAuraToButtonMap).FirstOrDefault(),

                                                                  // If no aura showing, blacklist the target, we're done with it...
                                                                  new Decorator(auraShowing => (auraShowing == null),
                                                                                new Action(delegate
            {
                TreeRoot.StatusText = string.Format("Done with '{0}'... moving on", CurrentTarget.SafeName);
                CurrentTarget.LocallyBlacklist(_delay_MobConsumedExpiry);
            })),

                                                                  // Push the button associated with the next aura shown...
                                                                  // We assume the target may have multiple auras that need redress, so we don't
                                                                  // blacklist the target reacting to one aura.
                                                                  new Sequence(
                                                                      new Action(delegate { WoWMovement.MoveStop(); }),
                                                                      new DecoratorContinue(ret => (Me.CurrentTarget != CurrentTarget),
                                                                                            new Action(delegate { CurrentTarget.Target(); })),
                                                                      new DecoratorContinue(ret => !Me.IsSafelyFacing(CurrentTarget),
                                                                                            new Action(delegate { CurrentTarget.Face(); })),
                                                                      new Action(delegate { _behavior_HuntingGround.MobEngaged(CurrentTarget); }),
                                                                      new WaitContinue(Delay_WowClientLagTime, ret => false, new ActionAlwaysSucceed()),
                                                                      new Action(auraShowing =>
            {
                WoWAura aura = (WoWAura)auraShowing;
                TreeRoot.StatusText = string.Format("Pressing Button {0} on {1} for Aura({2}).",
                                                    _targetAuraToButtonMap[aura.SpellId],
                                                    CurrentTarget.SafeName,
                                                    aura.Name);
                Lua.DoString("RunMacroText(\"/click OverrideActionBarButton{0}\")", _targetAuraToButtonMap[aura.SpellId]);
            }),
                                                                      new WaitContinue(Delay_WowClientLagTime, ret => false, new ActionAlwaysSucceed()),
                                                                      new WaitContinue(PostInteractDelay, ret => false, new ActionAlwaysSucceed()),
                                                                      new Action(delegate { Me.ClearTarget(); })
                                                                      )
                                                                  )
                                             )));
        }
Esempio n. 17
0
        private static Composite CreateRestoDiagnosticOutputBehavior(UnitSelectionDelegate onHealUnit)
        {
            return(new ThrottlePasses(1, 1,
                                      new Decorator(
                                          ret => SingularSettings.Debug,
                                          new Action(ret =>
            {
                WoWUnit target = Me.CurrentTarget;
                uint actvstks = 0;

                WoWAura aura = Me.GetAllAuras()
                               .Where(a => a.Name == "Tidal Waves" && a.TimeLeft != TimeSpan.Zero)
                               .FirstOrDefault();

                if (aura != null)
                {
                    actvstks = aura.StackCount;
                    if (actvstks == 0)
                    {
                        actvstks = 1;
                    }
                }

                string line = string.Format("[{0}] h={1:F1}%/m={2:F1}%,combat={3},move={4},twaves={5},audtwaves={6}",
                                            Dynamics.CompositeBuilder.CurrentBehaviorType.ToString(),
                                            Me.HealthPercent,
                                            Me.ManaPercent,
                                            Me.Combat.ToYN(),
                                            Me.IsMoving.ToYN(),
                                            actvstks,
                                            _tidalWaveStacksAudit
                                            );

                WoWUnit healTarg = onHealUnit(ret);
                if (Me.IsInGroup() || (Me.FocusedUnitGuid.IsValid && healTarg == Me.FocusedUnit))
                {
                    if (healTarg == null)
                    {
                        line += ", heal=(null)";
                    }
                    else if (!healTarg.IsValid)
                    {
                        line += ", heal=(invalid)";
                    }
                    else
                    {
                        line += string.Format(",heal={0} hh={1:F1}% @ {2:F1} yds,hcombat={3},hph={4:F1}%,htloss={5},riptide={6}",
                                              healTarg.SafeName(),
                                              healTarg.HealthPercent,
                                              healTarg.Distance,
                                              healTarg.Combat.ToYN(),
                                              healTarg.PredictedHealthPercent(),
                                              healTarg.InLineOfSpellSight,
                                              (long)healTarg.GetAuraTimeLeft("Riptide").TotalMilliseconds
                                              );
                    }

                    if (SingularSettings.Instance.StayNearTank)
                    {
                        WoWUnit tank = HealerManager.TankToStayNear;
                        if (tank == null)
                        {
                            line += ",tank=(null)";
                        }
                        else if (!tank.IsAlive)
                        {
                            line += ",tank=(dead)";
                        }
                        else
                        {
                            float hh = (float)tank.HealthPercent;
                            float hph = tank.PredictedHealthPercent();
                            line += string.Format(",tank={0} {1:F1}% @ {2:F1} yds,tph={3:F1}%,tcombat={4},tmove={5},tloss={6}",
                                                  tank.SafeName(),
                                                  hh,
                                                  tank.SpellDistance(),
                                                  hph,
                                                  tank.Combat.ToYN(),
                                                  tank.IsMoving.ToYN(),
                                                  tank.InLineOfSpellSight.ToYN()
                                                  );
                        }
                    }
                }

                if (target == null)
                {
                    line += ", target=(null)";
                }
                else if (!target.IsValid)
                {
                    line += ", target=(invalid)";
                }
                else
                {
                    line += string.Format(",target={0} th={1:F1}%,{2:F1} yds,face={3},tloss={4},fs={5}",
                                          target.SafeName(),
                                          target.HealthPercent,
                                          target.Distance,
                                          Me.IsSafelyFacing(target),
                                          target.InLineOfSpellSight,
                                          (long)target.GetAuraTimeLeft("Flame Shock").TotalMilliseconds
                                          );
                }

                Logger.WriteDebug(Color.Yellow, line);
                return RunStatus.Failure;
            }))
                                      ));
        }
Esempio n. 18
0
        private static Composite CreateElementalDiagnosticOutputBehavior()
        {
            if (!SingularSettings.Debug)
            {
                return(new ActionAlwaysFail());
            }

            return(new ThrottlePasses(1, 1,
                                      new Action(ret =>
            {
                uint stks = 0;
                string shield;

                WoWAura aura = Me.GetAuraByName("Lightning Shield");
                if (aura != null)
                {
                    stks = aura.StackCount;
                    if (!Me.HasAura("Lightning Shield", (int)stks))
                    {
                        Logger.WriteDebug(Color.MediumVioletRed, "Inconsistancy Error:  have {0} stacks but Me.HasAura('Lightning Shield', {0}) was False!!!!", stks, stks);
                    }
                }
                else
                {
                    aura = Me.GetAuraByName("Water Shield");
                    if (aura == null)
                    {
                        aura = Me.GetAuraByName("Earth Shield");
                        if (aura != null)
                        {
                            stks = aura.StackCount;
                        }
                    }
                }

                shield = aura == null ? "(null)" : aura.Name;

                string line = string.Format(".... [{0}] h={1:F1}%/m={2:F1}%, shield={3}, stks={4}, moving={5}",
                                            CompositeBuilder.CurrentBehaviorType.ToString(),
                                            Me.HealthPercent,
                                            Me.ManaPercent,
                                            shield,
                                            stks,
                                            Me.IsMoving.ToYN()
                                            );

                WoWUnit target = Me.CurrentTarget;
                if (target == null)
                {
                    line += ", target=(null)";
                }
                else
                {
                    line += string.Format(", target={0} @ {1:F1} yds, th={2:F1}%, face={3} loss={4}, fs={5}",
                                          target.SafeName(),
                                          target.Distance,
                                          target.HealthPercent,
                                          Me.IsSafelyFacing(target).ToYN(),
                                          target.InLineOfSpellSight.ToYN(),
                                          (long)target.GetAuraTimeLeft("Flame Shock").TotalMilliseconds
                                          );
                }


                if (Totems.Exist(WoWTotemType.Fire))
                {
                    line += ", fire=" + Totems.GetTotem(WoWTotemType.Fire).Name;
                }

                if (Totems.Exist(WoWTotemType.Earth))
                {
                    line += ", earth=" + Totems.GetTotem(WoWTotemType.Earth).Name;
                }

                if (Totems.Exist(WoWTotemType.Water))
                {
                    line += ", water=" + Totems.GetTotem(WoWTotemType.Water).Name;
                }

                if (Totems.Exist(WoWTotemType.Air))
                {
                    line += ", air=" + Totems.GetTotem(WoWTotemType.Air).Name;
                }

                Logger.WriteDebug(Color.Yellow, line);
                return RunStatus.Failure;
            })
                                      ));
        }
Esempio n. 19
0
 /// <summary>
 /// Resets the properties fields used by the properties so that they can be reset.
 /// </summary>
 public void Reset()
 {
     _envenom = null;
     _rupture = null;
     _sliceAndDice = null;
 }
        private static void Mount_OnMountUp(object sender, MountUpEventArgs e)
        {
            if (SingularRoutine.CurrentWoWContext == WoWContext.Battlegrounds && PVP.PrepTimeLeft > 5)
            {
                e.Cancel = true;
                return;
            }

            if (!e.MoveDistance.HasValue)
            {
                return;
            }

            if (Spell.GcdActive || StyxWoW.Me.IsCasting || StyxWoW.Me.ChanneledSpell != null)
            {
                return;
            }

            if ((!Battlegrounds.IsInsideBattleground || !PVP.IsPrepPhase) && !Utilities.EventHandlers.IsShapeshiftSuppressed)
            {
                if (e.MoveDistance.Value < 60)
                {
                    if (StyxWoW.Me.Class == WoWClass.Shaman && SpellManager.HasSpell("Ghost Wolf") && SingularSettings.Instance.Shaman().UseGhostWolf)
                    {
                        e.Cancel = true;

                        if (!StyxWoW.Me.HasAura("Ghost Wolf"))
                        {
                            Logger.Write(LogColor.Hilite, "^Ghost Wolf instead of mounting");
                            Spell.LogCast("Ghost Wolf", StyxWoW.Me);
                            Spell.CastPrimative("Ghost Wolf");
                        }
                    }
                    else if (StyxWoW.Me.Class == WoWClass.Druid && SingularSettings.Instance.Druid().UseTravelForm&& SpellManager.HasSpell("Travel Form") && StyxWoW.Me.IsOutdoors)
                    {
                        e.Cancel = true;

                        if (!StyxWoW.Me.HasAura("Travel Form"))
                        {
                            WoWAura aura = StyxWoW.Me.GetAllAuras().FirstOrDefault(a => a.Spell.Name.Substring(a.Name.Length - 5).Equals(" Form"));
                            Logger.Write(LogColor.Hilite, "^Travel Form instead of mounting.");
                            Logger.WriteDiagnostic("MountManager: changing to form='{0}',  current='{1}',  hb-says='{2}'",
                                                   "Travel Form", aura == null ? "-none-" : aura.Name, StyxWoW.Me.Shapeshift.ToString()
                                                   ); Spell.LogCast("Travel Form", StyxWoW.Me);
                            Spell.CastPrimative("Travel Form");
                        }
                    }
                }
                else if (StyxWoW.Me.Class == WoWClass.Druid && ClassSpecific.Druid.Common.AllowAquaticForm)
                {
                    e.Cancel = true;

                    if (!StyxWoW.Me.HasAnyShapeshift(ShapeshiftForm.Aqua, ShapeshiftForm.Travel, ShapeshiftForm.FlightForm, ShapeshiftForm.EpicFlightForm))  // check flightform in case we jump cast it at water surface
                    {
                        WoWAura aura = StyxWoW.Me.GetAllAuras().FirstOrDefault(a => a.Spell.Name.Substring(a.Name.Length - 5).Equals(" Form"));
                        Logger.WriteDiagnostic("MountManager: changing to form='{0}',  current='{1}',  hb-says='{2}'",
                                               "Travel Form", aura == null ? "-none-" : aura.Name, StyxWoW.Me.Shapeshift.ToString()
                                               );
                        Logger.Write(LogColor.Hilite, "^Aquatic Form instead of mounting.");
                        Spell.LogCast("Travel Form", StyxWoW.Me);
                        Spell.CastPrimative("Travel Form");
                    }
                }
            }

            if (StyxWoW.Me.Class == WoWClass.Shaman && SingularRoutine.CurrentWoWContext != WoWContext.Battlegrounds && ClassSpecific.Shaman.Totems.NeedToRecallTotems)
            {
                Logger.WriteDiagnostic("OnMountUp: recalling totems since about to mount");
                ClassSpecific.Shaman.Totems.RecallTotems();
            }
        }