コード例 #1
0
ファイル: Pet.cs プロジェクト: ywjb/Honorbuddy-434
 /// <summary>
 ///  Creates a behavior to cast a pet action by name of the pet spell on specified location, if extra conditions are met
 ///  (like Freeze of Water Elemental)
 /// </summary>
 /// <param name="action"> The name of the pet spell that will be casted. </param>
 /// <param name="location"> The point to click. </param>
 /// <param name="extra"> Extra conditions that will be checked. </param>
 /// <returns></returns>
 public static Composite CreateCastPetActionOnLocation(string action, LocationRetriever location, SimpleBooleanDelegate extra)
 {
     return(new Decorator(
                ret => extra(ret) && PetManager.CanCastPetAction(action),
                new Sequence(
                    new Action(ret => PetManager.CastPetAction(action)),
                    new ActionSleep(250),
                    new Action(ret => LegacySpellManager.ClickRemoteLocation(location(ret))))));
 }
コード例 #2
0
 /// <summary>
 ///  Creates a behavior to cast a pet action by name of the pet spell on specified location, if extra conditions are met
 ///  (like Freeze of Water Elemental)
 /// </summary>
 /// <param name="action"> The name of the pet spell that will be casted. </param>
 /// <param name="location"> The point to click. </param>
 /// <param name="extra"> Extra conditions that will be checked. </param>
 /// <returns></returns>
 public static Composite CreateCastPetActionOnLocation(string action, LocationRetriever location, SimpleBooleanDelegate extra)
 {
     return(new Decorator(
                ret => extra(ret) && PetManager.CanCastPetAction(action),
                new Sequence(
                    new Action(ret => PetManager.CastPetAction(action)),
                    new WaitContinue(System.TimeSpan.FromMilliseconds(250), ret => false, new ActionAlwaysSucceed()),
                    new Action(ret => SpellManager.ClickRemoteLocation(location(ret))))));
 }
コード例 #3
0
ファイル: Party.cs プロジェクト: github1-2-3/Singular
 public static Composite PetBuffGroup(string name, SimpleBooleanDelegate requirements, params string[] myMutexBuffs)
 {
     return(new Decorator(
                ret => IsItTimeToBuff() &&
                PetManager.CanCastPetAction("Qiraji Fortitude") &&
                (!StyxWoW.Me.Mounted || !PVP.IsPrepPhase),
                new PrioritySelector(
                    ctx => Unit.GroupMembers.FirstOrDefault(m => m.IsAlive && m.DistanceSqr < 30 * 30 && (PartyBuffType.None != (m.GetMissingPartyBuffs() & GetPartyBuffForSpell(name)))),
                    PetManager.Buff(name, on => (WoWUnit)on, requirements, myMutexBuffs)
                    )
                ));
 }
コード例 #4
0
ファイル: Pet.cs プロジェクト: elliottabirch/personalRoutines
        /// <summary>
        ///  Creates a behavior to cast a pet action by name of the pet spell on specified location, if extra conditions are met
        ///  (like Freeze of Water Elemental)
        /// </summary>
        /// <param name="action"> The name of the pet spell that will be casted. </param>
        /// <param name="location"> The point to click. </param>
        /// <param name="extra"> Extra conditions that will be checked. </param>
        /// <returns></returns>
        public static Composite CastPetActionOnLocation(string action, SimpleLocationRetriever location, SimpleBooleanDelegate extra)
        {
            return(new Decorator(
                       ret => StyxWoW.Me.GotAlivePet && extra(ret) && PetManager.CanCastPetAction(action),
                       new Sequence(
                           new Action(ret => PetManager.CastPetAction(action)),

                           new WaitContinue(TimeSpan.FromMilliseconds(500),
                                            ret => Spell.GetPendingCursorSpell != null, // && Spell.GetPendingOnCursor().Name == spell,
                                            new ActionAlwaysSucceed()
                                            ),

                           new Action(ret => SpellManager.ClickRemoteLocation(location(ret))),

                           // check for we are done via either success (no spell on cursor) or failure (cursor remains targeting)
                           new PrioritySelector(

                               // wait and if cursor clears, then Success!!!!
                               new Wait(TimeSpan.FromMilliseconds(500),
                                        ret => Spell.GetPendingCursorSpell == null,
                                        new ActionAlwaysSucceed()
                                        ),

                               // otherwise cancel spell and fail ----
                               new Action(ret =>
            {
                Logger.Write("pet:/cancel {0} - click {1} failed?  distance={2:F1} yds, loss={3}, face={4}",
                             action,
                             location(ret),
                             StyxWoW.Me.Location.Distance(location(ret)),
                             GameWorld.IsInLineOfSpellSight(StyxWoW.Me.Pet.GetTraceLinePos(), location(ret)),
                             StyxWoW.Me.Pet.IsSafelyFacing(location(ret))
                             );
                Lua.DoString("SpellStopTargeting()");
                return RunStatus.Failure;
            })
                               )
                           )
                       ));
        }
コード例 #5
0
ファイル: Pet.cs プロジェクト: ywjb/Honorbuddy-434
 /// <summary>
 ///  Creates a behavior to cast a pet action by name of the pet spell on the specified unit, if the extra conditions are met.
 /// </summary>
 /// <param name="action"> The name of the pet spell that will be casted. </param>
 /// <param name="onUnit"> The unit to cast the spell on. </param>
 /// <param name="extra"> Extra conditions that will be checked. </param>
 /// <returns></returns>
 public static Composite CreateCastPetActionOn(string action, UnitSelectionDelegate onUnit, SimpleBooleanDelegate extra)
 {
     return(new Decorator(
                ret => extra(ret) && PetManager.CanCastPetAction(action),
                new Action(ret => PetManager.CastPetAction(action, onUnit(ret)))));
 }