Ejemplo n.º 1
0
        public static Composite CreateMonkCombatBuffs()
        {
            UnitSelectionDelegate onunitRop;

            if (SingularRoutine.CurrentWoWContext == WoWContext.Battlegrounds)
            {
                onunitRop = on => Unit.UnfriendlyUnits(8).Any(u => u.CurrentTargetGuid == Me.Guid && u.IsPlayer) ? Me : Group.Healers.FirstOrDefault(h => h.SpellDistance() < 40 && Unit.UnfriendlyUnits((int)h.Distance2D + 8).Any(u => u.CurrentTargetGuid == h.Guid && u.SpellDistance(h) < 8));
            }
            else // Instances and Normal - just protect self
            {
                onunitRop = on => Unit.UnfriendlyUnits(8).Count(u => u.CurrentTargetGuid == Me.Guid) > 1 ? Me : null;
            }

            return(new PrioritySelector(

                       PartyBuff.BuffGroup("Legacy of the White Tiger", req => Me.Specialization == WoWSpec.MonkBrewmaster || Me.Specialization == WoWSpec.MonkWindwalker),
                       PartyBuff.BuffGroup("Legacy of the Emperor", req => Me.Specialization == WoWSpec.MonkMistweaver),

                       new Decorator(
                           req => !Unit.IsTrivial(Me.CurrentTarget),
                           new PrioritySelector(
                               // check our individual buffs here
                               Spell.Buff("Disable", ret => Me.GotTarget() && Me.CurrentTarget.IsPlayer && Me.CurrentTarget.ToPlayer().IsHostile&& !Me.CurrentTarget.HasAuraWithEffect(WoWApplyAuraType.ModDecreaseSpeed)),
                               Spell.Buff("Ring of Peace", onunitRop)
                               )
                           ),

                       CreateChiBurstBehavior()
                       ));
        }
Ejemplo n.º 2
0
        public static Composite CreateDruidPreCombatBuff()
        {
            // Cast motw if player doesn't have it or if in instance/bg, out of combat and 'Buff raid with Motw' is true or if in instance and in combat and both CatRaidRebuff and 'Buff raid with Motw' are true
            return(new PrioritySelector(

                       PartyBuff.BuffGroup(
                           "Mark of the Wild",
                           ret => DruidSettings.BuffRaidWithMotw && !Me.HasAura("Prowl") &&
                           (!Me.Combat || DruidSettings.CatRaidRebuff)
                           )

                       /*   This logic needs work.
                        * new Decorator(
                        *  ret =>
                        *  !Me.HasAura("Bear Form") &&
                        *  DruidSettings.PvPStealth && (Battlegrounds.IsInsideBattleground
                        || Me.CurrentMap.IsArena) &&
                        || !Me.Mounted && !Me.HasAura("Travel Form"),
                        || Spell.BuffSelf("Cat Form")
                        || ),
                        ||new Decorator(
                        || ret =>
                        || Me.HasAura("Cat Form") &&
                        || (DruidSettings.PvPStealth && (Battlegrounds.IsInsideBattleground
                        || Me.CurrentMap.IsArena)),
                        || Spell.BuffSelf("Prowl")
                        || )*/
                       ));
        }
Ejemplo n.º 3
0
        protected override void GetBuffBaseFXPath(Object p_sender, EventArgs p_args, out String out_buffBaseFXPath, out String out_buffNameKey)
        {
            PartyBuff partyBuff = (PartyBuff)p_sender;

            out_buffBaseFXPath = partyBuff.StaticData.Gfx;
            out_buffNameKey    = partyBuff.Type.ToString();
        }
Ejemplo n.º 4
0
        private void UpdateDefense()
        {
            Character member = m_party.GetMember(m_party.CurrentCharacter);
            Int32     num    = (Int32)member.FightValues.EvadeValue;
            Int32     num2   = (Int32)(member.FightValues.GeneralBlockChance * 100f + 0.5f);
            String    text   = num.ToString();

            if (member.ConditionHandler.HasCondition(ECondition.POISONED))
            {
                text = m_colorRedHex + num + "[-]";
            }
            m_defAC.UpdateLabel(member.FightValues.ArmorValue.ToString(), LocaManager.GetText("CHARACTER_DEFENSE_AC_TT", member.FightValues.ArmorValue));
            PartyBuff buff = m_party.Buffs.GetBuff(EPartyBuffs.WIND_SHIELD);

            if (buff != null)
            {
                String text2 = String.Concat(new Object[]
                {
                    text,
                    "/",
                    m_colorGreenHex,
                    num + buff.GetRangedEvadeBonus(),
                    "[-]"
                });
                m_defEvade.UpdateLabel(text2, LocaManager.GetText("CHARACTER_DEFENSE_EVADE_VALUE_TT", text2));
            }
            else
            {
                m_defEvade.UpdateLabel(text, LocaManager.GetText("CHARACTER_DEFENSE_EVADE_VALUE_TT", num));
            }
            m_defBlockChance.UpdateLabel(LocaManager.GetText("CHARACTER_ATTACK_CRIT_CHANCE_INFO", num2.ToString()), LocaManager.GetText("CHARACTER_DEFENSE_BLOCK_CHANCE_TT", num2));
            m_defBlocksGeneral.UpdateLabel(member.FightHandler.CurrentGeneralBlockAttempts.ToString(), LocaManager.GetText("CHARACTER_DEFENSE_GENERAL_BLOCK_ATTEMPTS_TT", member.FightHandler.CurrentGeneralBlockAttempts));
            m_defBlocksMelee.UpdateLabel(member.FightHandler.CurrentMeleeBlockAttempts.ToString(), LocaManager.GetText("CHARACTER_DEFENSE_MELEE_BLOCK_ATTEMPTS_TT", member.FightHandler.CurrentMeleeBlockAttempts));
        }
Ejemplo n.º 5
0
 public static Composite CreateMonkPreCombatBuffs()
 {
     return(new PrioritySelector(
                new Decorator(ret => !Helpers.Rest.IsEatingOrDrinking,
                              PartyBuff.BuffGroup("Legacy of the White Tiger"))
                ));
 }
Ejemplo n.º 6
0
 public static Composite ShadowPreCombatBuffs()
 {
     return(new PrioritySelector(
                //new Decorator(ret => AdvancedAI.PvPRot,
                //    ShadowPriestPvP.CreateSPPvPBuffs),
                PartyBuff.BuffGroup("Power Word: Fortitude"),
                Spell.Cast("Shadowform", ret => !Me.CachedHasAura("Shadowform")),
                Spell.Cast("Inner Fire", ret => !Me.HasAura("Inner Fire"))));
 }
Ejemplo n.º 7
0
        public static Composite CreateProtectionNormalPreCombatBuffs()
        {
            return(new PrioritySelector(

                       Spell.BuffSelf("Defensive Stance"),

                       PartyBuff.BuffGroup("Battle Shout", ret => WarriorSettings.Shout == WarriorShout.BattleShout),

                       PartyBuff.BuffGroup("Commanding Shout", ret => WarriorSettings.Shout == WarriorShout.CommandingShout)
                       ));
        }
Ejemplo n.º 8
0
 public override void DoAction(Command p_command)
 {
     if (Party.CanRest)
     {
         PartyBuff buff = Party.Buffs.GetBuff(EPartyBuffs.WELL_RESTED);
         if (buff != null)
         {
             buff.ExpireNow();
         }
         LegacyLogic.Instance.EventManager.RegisterEvent(EEventType.PARTY_RESTED, new EventHandler(OnPartyRested));
         LegacyLogic.Instance.EventManager.InvokeEvent(this, EEventType.PARTY_RESTING, EventArgs.Empty);
     }
 }
Ejemplo n.º 9
0
 public static Composite AfflictionPreCombatBuffs()
 {
     return(new PrioritySelector(
                Spell.WaitForCastOrChannel(),
                new Decorator(
                    ret => !Spell.IsGlobalCooldown() && !Me.Mounted,
                    new PrioritySelector(
                        //SummonPet(),
                        new Throttle(5, Spell.Cast("Create Healthstone", mov => true, on => Me, ret => !HaveHealthStone && !Unit.NearbyUnfriendlyUnits.Any(u => u.Distance < 25), cancel => false)),
                        PartyBuff.BuffGroup("Dark Intent"),
                        Spell.BuffSelf("Grimoire of Sacrifice", ret => GetCurrentPet() != WarlockPet.None && GetCurrentPet() != WarlockPet.Other),
                        Spell.BuffSelf("Unending Breath", req => Me.IsSwimming)))));
 }
Ejemplo n.º 10
0
        public static Composite CreatePriestPreCombatBuffs()
        {
            return(new PrioritySelector(
                       Spell.BuffSelf("Shadowform"),
                       //Spell.BuffSelf("Vampiric Embrace"), // VE is now a CD, not a normal buff
                       // Spell.BuffSelf("Power Word: Fortitude", ret => Unit.NearbyFriendlyPlayers.Any(u => !u.IsDead && !u.IsGhost && (u.IsInMyPartyOrRaid || u.IsMe) && CanCastFortitudeOn(u))),
                       PartyBuff.BuffGroup("Power Word: Fortitude"),
                       //Spell.BuffSelf("Shadow Protection", ret => SingularSettings.Instance.Priest.UseShadowProtection && Unit.NearbyFriendlyPlayers.Any(u => !u.Dead && !u.IsGhost && (u.IsInMyPartyOrRaid || u.IsMe) && !Unit.HasAura(u, "Shadow Protection", 0))), // we no longer have Shadow resist
                       Spell.BuffSelf("Inner Fire", ret => SingularSettings.Instance.Priest.UseInnerFire),
                       Spell.BuffSelf("Inner Will", ret => !SingularSettings.Instance.Priest.UseInnerFire),
                       Spell.BuffSelf("Fear Ward", ret => SingularSettings.Instance.Priest.UseFearWard)

                       ));
        }
Ejemplo n.º 11
0
        public static Composite CreateMonkPreCombatBuffs()
        {
            return(new PrioritySelector(

                       PartyBuff.BuffGroup(
                           "Legacy of the Emperor",
                           ret => true,
                           "Legacy of the White Tiger"),

                       PartyBuff.BuffGroup(
                           "Legacy of the White Tiger",
                           ret => true,
                           "Legacy of the Emperor")
                       ));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// cast Blessing of Kings or Blessing of Might based upon configuration setting.
        ///
        /// </summary>
        /// <returns></returns>
        private static Composite CreatePaladinBlessBehavior()
        {
            return
                (new PrioritySelector(

                     PartyBuff.BuffGroup(
                         "Blessing of Kings",
                         ret => PaladinSettings.Blessings == PaladinBlessings.Auto || PaladinSettings.Blessings == PaladinBlessings.Kings,
                         "Blessing of Might"),

                     PartyBuff.BuffGroup(
                         "Blessing of Might",
                         ret => PaladinSettings.Blessings == PaladinBlessings.Auto || PaladinSettings.Blessings == PaladinBlessings.Might,
                         "Blessing of Kings")
                     ));
        }
Ejemplo n.º 13
0
 public static Composite BrewmasterPreCombatBuffs()
 {
     return(new PrioritySelector(
                PartyBuff.BuffGroup("Legacy of the Emperor")));
 }
Ejemplo n.º 14
0
        public override void Initialize()
        {
            DateTime timeStart = DateTime.UtcNow;

            Logger.WriteFile("Initialize: started"); // cannot call method which references SingularSettings

            TalentManager.Init();                    // initializes CurrentSpec which is referenced everywhere
            SingularSettings.Initialize();           // loads Singular global and spec-specific settings (must determine spec first)

            DetermineCurrentWoWContext();

            Task.Run(() => WriteSupportInfo());

            _lastLogLevel = GlobalSettings.Instance.LogLevel;

            // When we actually need to use it, we will.
            Spell.Init();
            Spell.GcdInitialize();

            EventHandlers.Init();
            MountManager.Init();
            HotkeyDirector.Init();
            MovementManager.Init();
            // SoulstoneManager.Init();   // switch to using Death behavior
            Dispelling.Init();
            PartyBuff.Init();
            Singular.Lists.BossList.Init();

            Targeting.Instance.WeighTargetsFilter += PullMoreWeighTargetsFilter;

            //Logger.Write("Combat log event handler started.");
            // Do this now, so we ensure we update our context when needed.
            BotEvents.Player.OnMapChanged += e =>
            {
                // Don't run this handler if we're not the current routine!
                if (!WeAreTheCurrentCombatRoutine)
                {
                    return;
                }

                // Only ever update the context. All our internal handlers will use the context changed event
                // so we're not reliant on anything outside of ourselves for updates.
                UpdateContext();
            };

            TreeHooks.Instance.HooksCleared += () =>
            {
                // Don't run this handler if we're not the current routine!
                if (!WeAreTheCurrentCombatRoutine)
                {
                    return;
                }

                Logger.Write(LogColor.Hilite, "Hooks cleared, re-creating behaviors");
                RebuildBehaviors(silent: true);
                Spell.GcdInitialize();   // probably not needed, but quick
            };

            GlobalSettings.Instance.PropertyChanged += (sender, e) =>
            {
                // Don't run this handler if we're not the current routine!
                if (!WeAreTheCurrentCombatRoutine)
                {
                    return;
                }

                // only LogLevel change will impact our behav trees
                // .. as we conditionally include/omit some diagnostic nodes if debugging
                // also need to keep a cached copy of prior value as the event
                // .. fires on the settor, not when the value is different
                if (e.PropertyName == "LogLevel" && _lastLogLevel != GlobalSettings.Instance.LogLevel)
                {
                    _lastLogLevel = GlobalSettings.Instance.LogLevel;
                    Logger.Write(LogColor.Hilite, "HonorBuddy {0} setting changed to {1}, re-creating behaviors", e.PropertyName, _lastLogLevel.ToString());
                    RebuildBehaviors();
                    Spell.GcdInitialize();   // probably not needed, but quick
                }
            };

            // install botevent handler so we can consolidate validation on whether
            // .. local botevent handlers should be called or not
            SingularBotEventInitialize();

            Logger.Write("Determining talent spec.");
            try
            {
                TalentManager.Update();
            }
            catch (Exception e)
            {
                StopBot(e.ToString());
            }
            Logger.Write("Current spec is " + SpecName());

            // write current settings to log file... only written at startup and when Save press in Settings UI
            Task.Run(() => SingularSettings.Instance.LogSettings());

            // Update the current WoWContext, and fire an event for the change.
            UpdateContext();

            // NOTE: Hook these events AFTER the context update.
            OnWoWContextChanged += (orig, ne) =>
            {
                Logger.Write(LogColor.Hilite, "Context changed, re-creating behaviors");
                SingularRoutine.DescribeContext();
                RebuildBehaviors();
                Spell.GcdInitialize();
                Singular.Lists.BossList.Init();
            };
            RoutineManager.Reloaded += (s, e) =>
            {
                Logger.Write(LogColor.Hilite, "Routines were reloaded, re-creating behaviors");
                RebuildBehaviors(silent: true);
                Spell.GcdInitialize();
            };


            // create silently since Start button will create a context change (at least first Start)
            // .. which will build behaviors again
            if (!Instance.RebuildBehaviors())
            {
                return;
            }

            //
            if (IsPluginEnabled("DrinkPotions"))
            {
                Logger.Write(LogColor.Hilite, "info: disabling DrinkPotions plugin, conflicts with Singular potion support");
                SetPluginEnabled("DrinkPotions", false);
            }

            SpellImmunityManager.Add(16292, WoWSpellSchool.Frost);      // http://www.wowhead.com/npc=16292/aquantion

            Logger.WriteDebug(Color.White, "Verified behaviors can be created!");
            Logger.Write("Initialization complete!");
            Logger.WriteDiagnostic(Color.White, "Initialize: completed taking {0:F2} seconds", (DateTime.UtcNow - timeStart).TotalSeconds);
        }
Ejemplo n.º 15
0
        private static Composite AfflictionCombatBuffs()
        {
            return(new PrioritySelector(

                       // Symbiosis
                       Spell.Cast("Rejuvenation", on => Me, ret => Me.HasAuraExpired("Rejuvenation", 1) && Me.HealthPercent < 95),

                       // won't live long with no Pet, so try to summon
                       //new Decorator(ret => GetCurrentPet() == WarlockPet.None && GetBestPet() != WarlockPet.None,
                       //    SummonPet()),

                       new Decorator(req => !Me.CurrentTarget.IsTrivial(),
                                     new PrioritySelector(
                                         Spell.Cast("Twilight Ward", ret => NeedTwilightWard && !Me.CachedHasAura("Twilight Ward")),
                                         // need combat healing?  check here since mix of buffs and abilities
                                         // heal / shield self as needed
                                         Spell.Cast("Dark Regeneration", ret => Me.HealthPercent < 45),
                                         new Decorator(
                                             ret => StyxWoW.Me.HealthPercent < 60 || Me.CachedHasAura("Dark Regeneration"),
                                             new PrioritySelector(
                                                 ctx => Item.FindFirstUsableItemBySpell("Healthstone", "Life Spirit"),
                                                 new Decorator(
                                                     ret => ret != null,
                                                     new Sequence(
                                                         new Action(ret => Logging.Write("Using {0}", ((WoWItem)ret).Name)),
                                                         new Action(ret => ((WoWItem)ret).UseContainerItem()),
                                                         Common.CreateWaitForLagDuration())))),


                                         new PrioritySelector(
                                             // find an add within 8 yds (not our current target)
                                             ctx => Unit.UnfriendlyUnits(8).FirstOrDefault(u => (u.Combat || Battlegrounds.IsInsideBattleground) && !u.IsStunned() && u.CurrentTargetGuid == Me.Guid && Me.CurrentTargetGuid != u.Guid),

                                             Spell.CastOnGround("Shadowfury", on => ((WoWUnit)on).Location, ret => ret != null),

                                             // treat as a heal, but we cast on what would be our fear target -- allow even when fear use disabled
                                             Spell.Cast("Mortal Coil", on => (WoWUnit)on, ret => !((WoWUnit)ret).IsUndead && Me.HealthPercent < 50),

                                             new Decorator(ret => (Me.GotTarget && AdvancedAI.Burst && (!Me.HasAura(113860) && SpellManager.CanCast(113860)) && (Me.CurrentTarget.IsPlayer || Me.CurrentTarget.IsBoss() || Me.CurrentTarget.TimeToDeath() > 20)) || Unit.NearbyUnfriendlyUnits.Count(u => u.IsTargetingMeOrPet) >= 3,
                                                           new PrioritySelector(
                                                               Spell.Cast("Dark Soul: Misery"))),

                                             Spell.Cast("Summon Doomguard", ret => AdvancedAI.Burst && Me.CurrentTarget.IsBoss() && (PartyBuff.WeHaveBloodlust || Me.CurrentTarget.HealthPercent <= 20)),

                                             // lower threat if tanks nearby to pickup
                                             Spell.Cast("Soulshatter",
                                                        ret => AdvancedAI.CurrentWoWContext == WoWContext.Instances &&
                                                        Group.AnyTankNearby &&
                                                        Unit.UnfriendlyUnits(30).Any(u => u.CurrentTargetGuid == Me.Guid)),

                                             // lower threat if voidwalker nearby to pickup
                                             Spell.Cast("Soulshatter",
                                                        ret => AdvancedAI.CurrentWoWContext != WoWContext.Battlegrounds &&
                                                        !Group.AnyTankNearby &&
                                                        GetCurrentPet() == WarlockPet.Voidwalker &&
                                                        Unit.UnfriendlyUnits(30).Any(u => u.CurrentTargetGuid == Me.Guid)),

                                             Spell.Cast("Dark Bargain", ret => Me.HealthPercent < 45),
                                             Spell.Cast("Sacrificial Pact", ret => Me.HealthPercent < 60 && GetCurrentPet() != WarlockPet.None && GetCurrentPet() != WarlockPet.Other && Me.Pet.HealthPercent > 50),

                                             new Decorator(ret => Me.HealthPercent < 40 && !Group.AnyHealerNearby,
                                                           new Sequence(
                                                               new PrioritySelector(
                                                                   CastSoulburn(ret => Spell.CanCastHack("Drain Life", Me.CurrentTarget)),
                                                                   new ActionAlwaysSucceed()),
                                                               Spell.Cast("Drain Life"))),

                                             new Decorator(ret => Unit.NearbyUnfriendlyUnits.Count(u => u.IsTargetingMeOrPet) >= 3 || Unit.NearbyUnfriendlyUnits.Any(u => u.IsPlayer && u.IsTargetingMeOrPet),
                                                           new PrioritySelector(
                                                               Spell.Cast("Dark Soul: Misery"),
                                                               Spell.Cast("Unending Resolve"),
                                                               new Decorator(ret => TalentManager.IsSelected((int)WarlockTalents.GrimoireOfService),
                                                                             new PrioritySelector(
                                                                                 Spell.Cast("Grimoire: Felhunter", ret => AdvancedAI.CurrentWoWContext == WoWContext.Battlegrounds),
                                                                                 //Spell.Cast("Grimoire: Voidwalker", ret => GetCurrentPet() != WarlockPet.Voidwalker),
                                                                                 Spell.Cast("Grimoire: Felhunter", ret => GetCurrentPet() != WarlockPet.Felhunter))))),
                                             new Decorator(ret => !Me.IsInGroup(),
                                                           HealthFunnel(40, 95)),
                                             Spell.Cast("Life Tap", ret => Me.ManaPercent < 30 && Me.HealthPercent > 85),
                                             PartyBuff.BuffGroup("Dark Intent"),

                                             new Decorator(ret => Me.GotTarget && Unit.ValidUnit(Me.CurrentTarget) && (Me.CurrentTarget.IsPlayer || Me.CurrentTarget.TimeToDeath() > 45),
                                                           new Throttle(2,
                                                                        new PrioritySelector(
                                                                            Spell.Cast("Curse of the Elements",
                                                                                       ret => !Me.CurrentTarget.CachedHasAura("Curse of the Elements") &&
                                                                                       !Me.CurrentTarget.HasMyAura("Curse of Enfeeblement") &&
                                                                                       !Me.CurrentTarget.HasAuraWithEffect(WoWApplyAuraType.ModDamageTaken)),
                                                                            Spell.Cast("Curse of Enfeeblement",
                                                                                       ret => !Me.CurrentTarget.CachedHasAura("Curse of Enfeeblement") &&
                                                                                       !Me.CurrentTarget.HasMyAura("Curse of the Elements") &&
                                                                                       !Me.CurrentTarget.HasDemoralizing())))),

                                             // mana restoration - match against survival cooldowns
                                             new Decorator(ret => Me.ManaPercent < 60,
                                                           new PrioritySelector(
                                                               Spell.BuffSelf("Life Tap", ret => Me.HealthPercent > 50 && Me.HasAnyAura("Unending Resolve")),
                                                               Spell.BuffSelf("Life Tap", ret => Me.HasAnyAura("Sacrificial Pact")),
                                                               Spell.BuffSelf("Life Tap", ret => Me.HasAnyAura("Dark Bargain"))))
                                             )))));
        }
 public DamagePreventedEntryEventArgs(PartyBuff p_buff, Int32 p_preventedDamage)
 {
     Buff            = p_buff;
     DamagePrevented = p_preventedDamage;
 }
Ejemplo n.º 17
0
 public void UpdateBuff(PartyBuff p_buff)
 {
     m_partyBuff       = p_buff;
     m_icon.spriteName = p_buff.StaticData.Icon;
 }
Ejemplo n.º 18
0
 public static Composite GuardianPreCombatBuffs()
 {
     return(new PrioritySelector(
                PartyBuff.BuffGroup("Mark of the Wild")));
 }
Ejemplo n.º 19
0
 public static Composite WindwalkerPreCombatBuffs()
 {
     return(new PrioritySelector(
                PartyBuff.BuffGroup("Legacy of the Emperor"),
                PartyBuff.BuffGroup("Legacy of the White Tiger")));
 }