예제 #1
0
        public static Composite Buff(string spell, UnitSelectionDelegate onUnit, SimpleBooleanDelegate require, params string[] buffNames)
        {
            return(new Decorator(
                       ret =>
            {
                if (onUnit == null || require == null)
                {
                    return false;
                }

                _buffUnit = onUnit(ret);
                if (_buffUnit == null)
                {
                    return false;
                }

                if (spell == null)
                {
                    return false;
                }

                if (Spell.DoubleCastContains(_buffUnit, spell))
                {
                    return false;
                }

                if (!buffNames.Any())
                {
                    return !_buffUnit.HasAura(spell);
                }

                bool buffFound;
                try
                {
                    buffFound = buffNames.Any(b => _buffUnit.HasAura(b));
                }
                catch
                {
                    // mark as found buff, so we return false
                    buffFound = true;
                }

                return !buffFound;
            },
                       new Sequence(
                           // new Action(ctx => _lastBuffCast = name),
                           new Action(r => PetManager.CastPetAction(spell)),
                           new Action(ret => Spell.UpdateDoubleCast(spell, _buffUnit))
                           )
                       ));
        }
예제 #2
0
        public static bool Attack(WoWUnit unit)
        {
            if (unit == null || StyxWoW.Me.Pet == null || !IsPetUseAllowed)
            {
                return(false);
            }

            if (StyxWoW.Me.Pet.CurrentTargetGuid != unit.Guid && (lastPetAttack != unit.Guid || waitNextPetAttack.IsFinished))
            {
                lastPetAttack = unit.Guid;
                if (SingularSettings.Debug)
                {
                    Logger.WriteDebug("PetAttack: on {0} @ {1:F1} yds", unit.SafeName(), unit.SpellDistance());
                }
                PetManager.CastPetAction("Attack", unit);
                waitNextPetAttack.Reset();
                return(true);
            }

            return(false);
        }
예제 #3
0
        public static bool Passive()
        {
            if (lastPetAttack != WoWGuid.Empty)
            {
                lastPetAttack = WoWGuid.Empty;
            }

            if (StyxWoW.Me.Pet == null || StyxWoW.Me.Pet.CurrentTargetGuid == WoWGuid.Empty)
            {
                return(false);
            }

            if (StyxWoW.Me.Pet.CurrentTarget == null)
            {
                Logger.Write(LogColor.Hilite, "/petpassive");
            }
            else
            {
                Logger.Write(LogColor.Hilite, "/petpassive (stop attacking {0})", StyxWoW.Me.Pet.CurrentTarget.SafeName());
            }

            PetManager.CastPetAction("Passive");
            return(true);
        }