Ejemplo n.º 1
0
        public void Initialise(PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger)
        {
            Pull.Initialise(playerReader, requirementFactory, logger);
            Combat.Initialise(playerReader, requirementFactory, logger);
            Adhoc.Initialise(playerReader, requirementFactory, logger);
            Parallel.Initialise(playerReader, requirementFactory, logger);
            ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger));

            Interact.Key = InteractKey;
            Interact.Initialise(playerReader, requirementFactory, logger);

            if (string.IsNullOrEmpty(Blink.Key))
            {
                Blink.Key = " ";
            }
            Blink.Initialise(playerReader, requirementFactory, logger);

            TargetLastTarget.Key = TargetLastTargetKey;
            TargetLastTarget.Initialise(playerReader, requirementFactory, logger);

            GatherFindKeys.ForEach(key =>
            {
                GatherFindKeyConfig.Add(new KeyAction {
                    Key = key
                });
                GatherFindKeyConfig.Last().Initialise(playerReader, requirementFactory, logger);
            });
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Creates a dismount composite. This down't use thread.Sleep() like the buildin one thus it works nicely with behaviors and framelocks. This will decend until bot lands if flying.
 /// </summary>
 /// <param name="reason">The reason to dismount</param>
 /// <returns></returns>
 public static Composite CreateDismount(string reason)
 {
     return(new Sequence(
                new Action(ret => Logger.WriteDebug(Styx.Resources.StyxResources.Stop_and_dismount___ + (!string.IsNullOrEmpty(reason) ? (" Reason: " + reason) : string.Empty))),
                // stop moving
                new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                      new Sequence(
                                          new Action(ret => WoWMovement.MoveStop()),
                                          CreateWaitForLagDuration())
                                      ), // Land if we're flying
                new DecoratorContinue(ret => StyxWoW.Me.IsFlying,
                                      new Sequence(
                                          new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Descend)),
                                          new WaitContinue(30, ret => !StyxWoW.Me.IsFlying, new ActionAlwaysSucceed()),
                                          new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Descend))
                                          )), // and finally dismount.
                new Action(r =>
     {
         ShapeshiftForm shapeshift = StyxWoW.Me.Shapeshift;
         if ((shapeshift != ShapeshiftForm.FlightForm) && (shapeshift != ShapeshiftForm.EpicFlightForm))
         {
             Lua.DoString("Dismount()");
         }
         else
         {
             Lua.DoString("RunMacroText('/cancelform')");
         }
     })));
 }
Ejemplo n.º 3
0
        public void Initialise(PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger)
        {
            Pull.Initialise(playerReader, requirementFactory, logger);
            Combat.Initialise(playerReader, requirementFactory, logger);
            Adhoc.Initialise(playerReader, requirementFactory, logger);
            Parallel.Initialise(playerReader, requirementFactory, logger);
            ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger));

            Interact.Key = InteractKey;
            Interact.Initialise(playerReader, requirementFactory, logger);
            Blink.Initialise(playerReader, requirementFactory, logger);
        }
Ejemplo n.º 4
0
		protected internal override void CheckInitialize(CasterInfo casterInfo, Unit target, ref SpellFailedReason failReason)
		{
			form = (ShapeshiftForm)SpellEffect.MiscValue;
			if (target.ShapeshiftForm == form)
			{
				// stances can't be undone:
				if (form != ShapeshiftForm.BattleStance &&
					form != ShapeshiftForm.BerserkerStance &&
					form != ShapeshiftForm.DefensiveStance)
				{
					target.Auras.RemoveWhere(aura => aura.Spell.Id == m_spellEffect.Spell.Id);
					failReason = SpellFailedReason.DontReport;
				}
			}
		}
Ejemplo n.º 5
0
 protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference,
                                                  Unit target, ref SpellFailedReason failReason)
 {
     form = (ShapeshiftForm)SpellEffect.MiscValue;
     if (target.ShapeshiftForm != form || form == ShapeshiftForm.BattleStance ||
         (form == ShapeshiftForm.BerserkerStance || form == ShapeshiftForm.DefensiveStance))
     {
         return;
     }
     if (Aura != null)
     {
         target.Auras.RemoveWhere(aura => (int)aura.Spell.Id == (int)Aura.Spell.Id);
     }
     failReason = SpellFailedReason.DontReport;
 }
Ejemplo n.º 6
0
		protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
		{
			form = (ShapeshiftForm)SpellEffect.MiscValue;
			if (target.ShapeshiftForm == form)
			{
				// stances can't be undone:
				if (form != ShapeshiftForm.BattleStance &&
					form != ShapeshiftForm.BerserkerStance &&
					form != ShapeshiftForm.DefensiveStance)
				{
                    if (Aura != null)
                    {
                        target.Auras.RemoveWhere(aura => aura.Spell.Id == Aura.Spell.Id);
                    }
				    failReason = SpellFailedReason.DontReport;
				}
			}
		}
Ejemplo n.º 7
0
 protected internal override void CheckInitialize(SpellCast creatingCast, ObjectReference casterReference, Unit target, ref SpellFailedReason failReason)
 {
     form = (ShapeshiftForm)SpellEffect.MiscValue;
     if (target.ShapeshiftForm == form)
     {
         // stances can't be undone:
         if (form != ShapeshiftForm.BattleStance &&
             form != ShapeshiftForm.BerserkerStance &&
             form != ShapeshiftForm.DefensiveStance)
         {
             if (Aura != null)
             {
                 target.Auras.RemoveWhere(aura => aura.Spell.Id == Aura.Spell.Id);
             }
             failReason = SpellFailedReason.DontReport;
         }
     }
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Creates a dismount composite that only stops if we are flying.
 /// </summary>
 /// <param name="reason">The reason to dismount</param>
 /// <returns></returns>
 public static Composite CreateDismount(string reason)
 {
     return(new Decorator(
                ret => StyxWoW.Me.Mounted,
                new Sequence(
                    new DecoratorContinue(ret => StyxWoW.Me.IsFlying,
                                          new Sequence(
                                              new DecoratorContinue(ret => StyxWoW.Me.IsMoving,
                                                                    new Sequence(
                                                                        new Action(ret => Logging.WriteDiagnostic("Stopping to descend..." + (!string.IsNullOrEmpty(reason) ? (" Reason: " + reason) : string.Empty))),
                                                                        new Action(ret => WoWMovement.MoveStop()),
                                                                        new Wait(1, ret => !StyxWoW.Me.IsMoving, new ActionAlwaysSucceed())
                                                                        )
                                                                    ),
                                              new Action(ret => Logging.WriteDiagnostic("Descending to land..." + (!string.IsNullOrEmpty(reason) ? (" Reason: " + reason) : string.Empty))),
                                              new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Descend)),
                                              new PrioritySelector(
                                                  new Wait(1, ret => StyxWoW.Me.IsMoving, new ActionAlwaysSucceed()),
                                                  new Action(ret => Logging.WriteDiagnostic("warning -- tried to descend but IsMoving == false ....!"))
                                                  ),
                                              new WaitContinue(30, ret => !StyxWoW.Me.IsFlying, new ActionAlwaysSucceed()),
                                              new DecoratorContinue(
                                                  ret => StyxWoW.Me.IsFlying,
                                                  new Action(ret => Logging.WriteDiagnostic("error -- still flying -- descend appears to have failed....!"))
                                                  ),
                                              new Action(ret => WoWMovement.MoveStop(WoWMovement.MovementDirection.Descend))
                                              )
                                          ), // and finally dismount.
                    new Action(r => {
         Logging.WriteDiagnostic("Dismounting..." + (!string.IsNullOrEmpty(reason) ? (" Reason: " + reason) : string.Empty));
         ShapeshiftForm shapeshift = StyxWoW.Me.Shapeshift;
         if (StyxWoW.Me.Class == WoWClass.Druid && (shapeshift == ShapeshiftForm.FlightForm || shapeshift == ShapeshiftForm.EpicFlightForm))
         {
             Lua.DoString("RunMacroText('/cancelform')");
         }
         else
         {
             Lua.DoString("Dismount()");
         }
     })
                    )
                ));
 }
Ejemplo n.º 9
0
        public int GetShapeshiftModel(ShapeshiftForm form, Races race, int model)
        {
            switch (form)
            {
            case ShapeshiftForm.FORM_CAT:
            {
                if (race == Races.RACE_NIGHT_ELF)
                {
                    return(892);
                }

                if (race == Races.RACE_TAUREN)
                {
                    return(8571);
                }

                break;
            }

            case ShapeshiftForm.FORM_BEAR:
            case ShapeshiftForm.FORM_DIREBEAR:
            {
                if (race == Races.RACE_NIGHT_ELF)
                {
                    return(2281);
                }

                if (race == Races.RACE_TAUREN)
                {
                    return(2289);
                }

                break;
            }

            case ShapeshiftForm.FORM_MOONKIN:
            {
                if (race == Races.RACE_NIGHT_ELF)
                {
                    return(15374);
                }

                if (race == Races.RACE_TAUREN)
                {
                    return(15375);
                }

                break;
            }

            case ShapeshiftForm.FORM_TRAVEL:
            {
                return(632);
            }

            case ShapeshiftForm.FORM_AQUA:
            {
                return(2428);
            }

            case ShapeshiftForm.FORM_FLIGHT:
            {
                if (race == Races.RACE_NIGHT_ELF)
                {
                    return(20857);
                }

                if (race == Races.RACE_TAUREN)
                {
                    return(20872);
                }

                break;
            }

            case ShapeshiftForm.FORM_SWIFT:
            {
                if (race == Races.RACE_NIGHT_ELF)
                {
                    return(21243);
                }

                if (race == Races.RACE_TAUREN)
                {
                    return(21244);
                }

                break;
            }

            case ShapeshiftForm.FORM_GHOUL:
            {
                return(race == Races.RACE_NIGHT_ELF ? 10045 : model);
            }

            case ShapeshiftForm.FORM_CREATUREBEAR:
            {
                return(902);
            }

            case ShapeshiftForm.FORM_GHOSTWOLF:
            {
                return(4613);
            }

            case ShapeshiftForm.FORM_SPIRITOFREDEMPTION:
            {
                return(12824);
            }

            default:
            {
                return(model);
            }
                // Case ShapeshiftForm.FORM_CREATURECAT
                // Case ShapeshiftForm.FORM_AMBIENT
                // Case ShapeshiftForm.FORM_SHADOW
            }

            return(default);
Ejemplo n.º 10
0
 public static ShapeshiftMask ToMask(this ShapeshiftForm form)
 {
     return((ShapeshiftMask)(1 << (int)(form - 1 & ShapeshiftForm.Moonkin)));
 }
Ejemplo n.º 11
0
 public static ShapeshiftEntry GetShapeshiftEntry(ShapeshiftForm form)
 {
     return(ShapeshiftEntries[(int)form]);
 }
Ejemplo n.º 12
0
 public static ShapeshiftEntry GetShapeshiftEntry(ShapeshiftForm form)
 {
     return ShapeshiftEntries[(int)form];
 }
Ejemplo n.º 13
0
        public void Initialise(DataConfig dataConfig, AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile)
        {
            SpiritPathFilename = string.Empty;

            Interact.Key  = InteractKey;
            Interact.Name = "Interact";
            Interact.Initialise(addonReader, requirementFactory, logger);

            Approach.Key  = InteractKey;
            Approach.Name = "Approach";
            Approach.Initialise(addonReader, requirementFactory, logger);

            AutoAttack.Key            = InteractKey;
            AutoAttack.Name           = "AutoAttack";
            AutoAttack.DelayAfterCast = 0;
            AutoAttack.Initialise(addonReader, requirementFactory, logger);

            InitializeKeyActions(Pull, Interact, Approach, AutoAttack);
            InitializeKeyActions(Combat, Interact, Approach, AutoAttack);

            Pull.Initialise(addonReader, requirementFactory, logger);
            Combat.Initialise(addonReader, requirementFactory, logger);
            Adhoc.Initialise(addonReader, requirementFactory, logger);
            NPC.Initialise(addonReader, requirementFactory, logger);
            Parallel.Initialise(addonReader, requirementFactory, logger);
            ShapeshiftForm.ForEach(i => i.Initialise(addonReader, requirementFactory, logger));

            Jump.Key = JumpKey;
            Jump.Initialise(addonReader, requirementFactory, logger);

            TargetLastTarget.Key = TargetLastTargetKey;
            TargetLastTarget.Initialise(addonReader, requirementFactory, logger);

            StandUp.Key = StandUpKey;
            StandUp.Initialise(addonReader, requirementFactory, logger);

            ClearTarget.Key = ClearTargetKey;
            ClearTarget.Initialise(addonReader, requirementFactory, logger);

            StopAttack.Key = StopAttackKey;
            StopAttack.Initialise(addonReader, requirementFactory, logger);

            TargetNearestTarget.Key = TargetNearestTargetKey;
            TargetNearestTarget.Initialise(addonReader, requirementFactory, logger);

            TargetPet.Key = TargetPetKey;
            TargetPet.Initialise(addonReader, requirementFactory, logger);

            TargetTargetOfTarget.Key = TargetTargetOfTargetKey;
            TargetTargetOfTarget.Initialise(addonReader, requirementFactory, logger);

            PetAttack.Key = PetAttackKey;
            PetAttack.Initialise(addonReader, requirementFactory, logger);

            GatherFindKeys.ForEach(key =>
            {
                GatherFindKeyConfig.Add(new KeyAction {
                    Key = key
                });
                GatherFindKeyConfig.Last().Initialise(addonReader, requirementFactory, logger);
            });

            OverridePathFilename = overridePathProfileFile;
            if (!string.IsNullOrEmpty(OverridePathFilename))
            {
                PathFilename = OverridePathFilename;
            }

            if (!File.Exists(Path.Join(dataConfig.Path, PathFilename)))
            {
                if (!string.IsNullOrEmpty(OverridePathFilename))
                {
                    throw new Exception($"The `{OverridePathFilename}` path file does not exists!");
                }
                else
                {
                    throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!");
                }
            }
        }
Ejemplo n.º 14
0
 public static ShapeshiftMask ToMask(this ShapeshiftForm form)
 {
     return((ShapeshiftMask)(1 << ((int)form - 1)));
 }
Ejemplo n.º 15
0
        public static Composite CastForm(ShapeshiftForm shape, SimpleBooleanDelegate requirements = null)
        {
            string spellName = string.Empty;
            int spellId = 0;
            switch(shape)
            {
                case ShapeshiftForm.Cat: //  1,
                    spellName = "Cat Form";
                    break;
                case ShapeshiftForm.Travel: //  3,
                    spellName = "Travel Form";
                    break;
                case ShapeshiftForm.Aqua: //  4,
                    spellName = "Travel Form";
                    break;
                case ShapeshiftForm.Bear: //  5,
                    spellName = "Bear Form";
                    break;
                case ShapeshiftForm.Moonkin: //  31,
                    spellName = "Moonkin Form";
                    break;

                default:
                    Logger.Write(LogColor.Diagnostic, "Programming Error: shape shift {0} not supported in Singular Druid");
                    return new ActionAlwaysFail();
            }

            SpellFindResults sfr;
            if (!SpellManager.FindSpell(spellName, out sfr))
            {
                Logger.WriteDiagnostic("CastForm: disabled for [{0}], spell not learned yet", spellName);
                return new ActionAlwaysFail();
            }

            spellId = sfr.Original.Id;
            if (sfr.Override != null)
            {
                Logger.WriteDiagnostic("CastForm: using [{0}] as override for [{1}] spell and aura names", sfr.Override.Name, spellName);
                spellName = sfr.Override.Name;
                spellId = sfr.Override.Id;
            }

            return new Decorator(
                req => Me.Shapeshift != shape && !Me.HasShapeshiftAura(spellName) && (requirements == null || requirements(req)),
                new Sequence(
                    new Action(r => Logger.WriteDiagnostic( "CastForm: changing to form='{0}', current='{1}', using spell '{2}'", shape, Me.Shapeshift, spellName)),
                    Spell.BuffSelfAndWait( spellId, requirements)
                    )
                );
        }