Exemplo n.º 1
0
        /// <summary>
        /// sets the character's active rotation.
        /// Print the help located in the specific rotation
        /// </summary>
        /// <param name="rb">an instance of the rotationbase</param>
        private void SetActiveRotation(RotationBase rb)
        {
            CLULogger.Log(" Greetings, level {0} user!", Me.Level);
            CLULogger.Log(" I am CLU.");
            CLULogger.Log(" I will create the perfect system for you.");
            CLULogger.Log(" I suggest we use the " + rb.Name + " rotation. Revision: " + rb.Revision);
            CLULogger.Log(" as I know you have " + rb.KeySpell);
            CLULogger.Log(" BotBase: {0}  ({1})", BotManager.Current.Name, BotChecker.SupportedBotBase() ? "Supported" : "Currently Not Supported");
            CLULogger.Log(rb.Help);
            CLULogger.Log(" You can Access CLU's Settings by clicking the CLASS CONFIG button");
            CLULogger.Log(" Let's execute the plan!");

            this._rotationBase = rb;

            this.PulseEvent  = null;
            this.PulseEvent += rb.OnPulse;

            // Check for Instancebuddy and warn user that healing is not supported.
            if (BotChecker.BotBaseInUse("Instancebuddy") && this.ActiveRotation.GetType().BaseType == typeof(HealerRotationBase))
            {
                CLULogger.Log(" [BotChecker] Instancebuddy Detected. *UNABLE TO HEAL WITH CLU*");
                StopBot("You cannot use CLU with InstanceBuddy as Healer");
            }

            if (this.ActiveRotation.GetType().BaseType == typeof(HealerRotationBase))
            {
                CLULogger.TroubleshootLog(" [HealingChecker] HealerRotationBase Detected. *Activating Automatic HealableUnit refresh*");
                IsHealerRotationActive = true;
            }
        }
Exemplo n.º 2
0
        public void CombatLogEventsOnStarted(object o)
        {
            try
            {
                CLULogger.TroubleshootLog("CombatLogEvents: Connected to the Grid");

                // means spell was cast (did not hit target yet)
                CLULogger.TroubleshootLog("CombatLogEvents: Connect UNIT_SPELLCAST_SUCCEEDED");
                Lua.Events.AttachEvent("UNIT_SPELLCAST_SUCCEEDED", this.OnSpellFired_ACK);

                // user got stunned, silenced, kicked...
                CLULogger.TroubleshootLog("CombatLogEvents: Connect UNIT_SPELLCAST_INTERRUPTED");
                Lua.Events.AttachEvent("UNIT_SPELLCAST_INTERRUPTED", this.OnSpellFired_NACK);

                // misc fails, due to stopcast, spell spam, etc.
                CLULogger.TroubleshootLog("CombatLogEvents: Connect UNIT_SPELLCAST_FAILED");
                Lua.Events.AttachEvent("UNIT_SPELLCAST_FAILED", this.OnSpellFired_FAIL);
                CLULogger.TroubleshootLog("CombatLogEvents: Connect UNIT_SPELLCAST_FAILED_QUIET");
                Lua.Events.AttachEvent("UNIT_SPELLCAST_FAILED_QUIET", this.OnSpellFired_FAIL);
                CLULogger.TroubleshootLog("CombatLogEvents: Connect UNIT_SPELLCAST_STOP");
                Lua.Events.AttachEvent("UNIT_SPELLCAST_STOP", this.OnSpellFired_FAIL);
                CLULogger.TroubleshootLog("CombatLogEvents: Connect PARTY_MEMBERS_CHANGED");
                Lua.Events.AttachEvent("PARTY_MEMBERS_CHANGED", this.HandlePartyMembersChanged);

                if ((CLU.LocationContext != GroupLogic.Battleground && CLU.LocationContext != GroupLogic.PVE) || TalentManager.CurrentSpec == WoWSpec.DruidFeral)
                {
                    AttachCombatLogEvent();
                }
            }
            catch (Exception ex)
            {
                CLULogger.DiagnosticLog("HandlePartyMembersChanged : {0}", ex);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Adds our current target to our listOfHealableUnits
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void addHealableUnit_Click(object sender, EventArgs e)
 {
     try {
         // Add a couple of HealableUnits to the list.
         if (Me.CurrentTarget != null && HealableUnit.Filter(Me.CurrentTarget))
         {
             if (!HealableUnit.Contains(Me.CurrentTarget))
             {
                 CLULogger.TroubleshootLog(" Adding: {0} because of user request.", CLULogger.SafeName(Me.CurrentTarget));
                 HealableUnit.ListofHealableUnits.Add(new HealableUnit(Me.CurrentTarget));
             }
         }
         else
         {
             MessageBox.Show(
                 "Please make sure that you have a CurrentTarget",
                 "Important Note",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Exclamation,
                 MessageBoxDefaultButton.Button1);
         }
         this.RefreshDataGridView();
     } catch (Exception ex) {
         CLULogger.DiagnosticLog("addHealableUnit_Click : {0}", ex);
     }
 }
Exemplo n.º 4
0
 private static void ProcessControls(Control ctrlContainer, ComboBox cmbobox)
 {
     foreach (Control ctrl in ctrlContainer.Controls)
     {
         if (ctrl.GetType() == typeof(ComboBox))
         {
             try {
                 if (ctrl.Name != cmbobox.Name)
                 {
                     bool matchs = ((ComboBox)ctrl).SelectedValue.ToString() == cmbobox.SelectedValue.ToString();
                     if (matchs && ((ComboBox)ctrl).SelectedValue.ToString() != "Nothing")
                     {
                         CLULogger.TroubleshootLog(" [Keybind Match] {0} == {1}. Please Make another selection", ctrl.Name, cmbobox.Name);
                         cmbobox.SelectedIndex = cmbobox.FindStringExact("Nothing");
                     }
                 }
             } catch {
             }
         }
         // if a control contains sub controls check
         if (ctrl.HasChildren)
         {
             ProcessControls(ctrl, cmbobox);
         }
     }
 }
Exemplo n.º 5
0
        public static Composite CreateShamanImbueOffHandBehavior(params Imbue[] imbueList)
        {
            return(new Decorator(ret => CanImbue(Me.Inventory.Equipped.OffHand),
                                 new PrioritySelector(
                                     imb => imbueList.FirstOrDefault(i => SpellManager.HasSpell(i.ToSpellName())),

                                     new Decorator(
                                         ret => Me.Inventory.Equipped.OffHand.TemporaryEnchantment.Id != (int)ret &&
                                         SpellManager.HasSpell(((Imbue)ret).ToSpellName()) &&
                                         SpellManager.CanCast(((Imbue)ret).ToSpellName(), null, false, false),
                                         new Sequence(
                                             new Action(ret => CLULogger.TroubleshootLog("Off hand currently imbued: " + ((Imbue)Me.Inventory.Equipped.OffHand.TemporaryEnchantment.Id).ToString())),
                                             new Action(ret => Lua.DoString("CancelItemTempEnchantment(2)")),
                                             new WaitContinue(1,
                                                              ret => Me.Inventory.Equipped.OffHand != null && (Imbue)Me.Inventory.Equipped.OffHand.TemporaryEnchantment.Id == Imbue.None,
                                                              new ActionAlwaysSucceed()),
                                             new DecoratorContinue(ret => ((Imbue)ret) != Imbue.None,
                                                                   new Sequence(
                                                                       new Action(ret => CLULogger.TroubleshootLog("Imbuing Off hand weapon with " + ((Imbue)ret).ToString())),
                                                                       new Action(ret => SpellManager.Cast(((Imbue)ret).ToSpellName(), null)),
                                                                       new Action(ret => SetNextAllowedImbueTime())
                                                                       )
                                                                   )
                                             )
                                         )
                                     )
                                 ));
        }
Exemplo n.º 6
0
        private static void DetachCombatLogEvent()
        {
            if (!_combatLogAttached)
            {
                return;
            }

            CLULogger.TroubleshootLog("Detached combat log");
            Lua.Events.DetachEvent("COMBAT_LOG_EVENT_UNFILTERED", HandleCombatLog);
            _combatLogAttached = false;
        }
Exemplo n.º 7
0
        /// <summary>
        /// Update the listOfHealableUnits
        /// </summary>
        private void updateListofHealableUnitsGrid_Click(object sender, EventArgs e)
        {
            CLULogger.TroubleshootLog("User clicked update - Re-Initialize list Of HealableUnits");
            HealableUnit.ListofHealableUnits.Clear();
            switch (CLUSettings.Instance.SelectedHealingAquisition)
            {
            case HealingAquisitionMethod.Proximity:
                HealableUnit.HealableUnitsByProximity();
                break;

            case HealingAquisitionMethod.RaidParty:
                HealableUnit.HealableUnitsByPartyorRaid();
                break;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        ///   Recalls any currently 'out' totems. This will use Totemic Recall if its known, otherwise it will destroy each totem one by one.
        /// </summary>
        /// <remarks>
        ///   Created 3/26/2011.
        /// </remarks>
        public static void RecallTotems()
        {
            CLULogger.TroubleshootLog("Recalling totems!");
            if (SpellManager.HasSpell("Totemic Recall"))
            {
                SpellManager.Cast("Totemic Recall");
                return;
            }

            List <WoWTotemInfo> totems = StyxWoW.Me.Totems;

            foreach (WoWTotemInfo t in totems)
            {
                if (t != null && t.Unit != null)
                {
                    DestroyTotem(t.Type);
                }
            }
        }
Exemplo n.º 9
0
        public bool CreateBehaviors()
        {
            CLULogger.TroubleshootLog("CreateBehaviors called.");

            // let behaviors be notified if context changes.
            if (OnLocationContextChanged != null)
            {
                OnLocationContextChanged(this, new LocationContextEventArg(LocationContext, LastLocationContext));
            }

            //Caching the context to not recreate same behaviors repeatedly.
            LastLocationContext = LocationContext;

            _rotationBase = null;

            if (_combatBehavior != null)
            {
                this._combatBehavior = new Decorator(ret => AllowPulse, new LockSelector(this.Rotation));
            }

            if (_combatBuffBehavior != null)
            {
                this._combatBuffBehavior = new Decorator(ret => AllowPulse, new LockSelector(this.Medic));
            }

            if (_preCombatBuffBehavior != null)
            {
                this._preCombatBuffBehavior = new Decorator(ret => AllowPulse, new LockSelector(this.PreCombat));
            }

            if (_restBehavior != null)
            {
                this._restBehavior = new Decorator(ret => !(CLUSettings.Instance.NeverDismount && IsMounted) && !Me.IsFlying, new LockSelector(this.Resting));
            }

            if (_pullBehavior != null)
            {
                this._pullBehavior = new Decorator(ret => AllowPulse, new LockSelector(this.Pulling));
            }

            return(true);
        }
Exemplo n.º 10
0
        public void Player_OnMapChanged(BotEvents.Player.MapChangedEventArgs args)
        {
            try
            {
                if ((CLU.LocationContext == GroupLogic.Battleground || CLU.LocationContext == GroupLogic.PVE) && TalentManager.CurrentSpec != WoWSpec.DruidFeral)
                {
                    DetachCombatLogEvent();
                }
                else
                {
                    AttachCombatLogEvent();
                }

                //Why would we create same behaviors all over ?
                if (CLU.LastLocationContext == CLU.LocationContext)
                {
                    return;
                }

                CLULogger.TroubleshootLog("Context changed. New context: " + CLU.LocationContext + ". Rebuilding behaviors.");
                CLU.Instance.CreateBehaviors();

                if (CLU.IsHealerRotationActive && StyxWoW.IsInGame)
                {
                    CLULogger.TroubleshootLog("CombatLogEvents: Party Members Changed - Re-Initialize list Of HealableUnits");
                    switch (CLUSettings.Instance.SelectedHealingAquisition)
                    {
                    case HealingAquisitionMethod.Proximity:
                        HealableUnit.HealableUnitsByProximity();
                        break;

                    case HealingAquisitionMethod.RaidParty:
                        HealableUnit.HealableUnitsByPartyorRaid();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                CLULogger.DiagnosticLog("Player_OnMapChanged : {0}", ex);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Removes a unit from our listOfHealableUnits by the currently selected row
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void removeUnitHealingGrid_Click(object sender, EventArgs e)
 {
     try {
         if (this.HealingGrid.SelectedRows.Count > 0)
         {
             CLULogger.TroubleshootLog(" Removing: {0} because of user request.", this.HealingGrid.SelectedRows[0].Cells[6].Value);
             HealableUnit.ListofHealableUnits.RemoveAt(this.HealingGrid.SelectedRows[0].Index);
         }
         else
         {
             MessageBox.Show(
                 "Please select a row to delete",
                 "Important Note",
                 MessageBoxButtons.OK,
                 MessageBoxIcon.Exclamation,
                 MessageBoxDefaultButton.Button1);
         }
         this.RefreshDataGridView(); // update
     } catch (Exception ex) {
         this.RefreshDataGridView(); // update
         CLULogger.DiagnosticLog("removeUnitHealingGrid_Click : {0}", ex);
     }
 }
Exemplo n.º 12
0
        private static void AttachCombatLogEvent()
        {
            if (_combatLogAttached)
            {
                return;
            }

            // DO NOT EDIT THIS UNLESS YOU KNOW WHAT YOU'RE DOING!
            // This ensures we only capture certain combat log events, not all of them.
            // This saves on performance, and possible memory leaks. (Leaks due to Lua table issues.)
            Lua.Events.AttachEvent("COMBAT_LOG_EVENT_UNFILTERED", HandleCombatLog);
            if (
                !Lua.Events.AddFilter(
                    "COMBAT_LOG_EVENT_UNFILTERED",
                    "return args[2] == 'SPELL_CAST_SUCCESS' or args[2] == 'SPELL_AURA_APPLIED' or args[2] == 'SPELL_DAMAGE' or args[2] == 'SPELL_AURA_REFRESH' or args[2] == 'SPELL_AURA_REMOVED'or args[2] == 'SPELL_MISSED' or args[2] == 'RANGE_MISSED' or args[2] =='SWING_MISSED'"))
            {
                CLULogger.TroubleshootLog(
                    "ERROR: Could not add combat log event filter! - Performance may be horrible, and things may not work properly!");
            }

            CLULogger.TroubleshootLog("Attached combat log");
            _combatLogAttached = true;
        }
Exemplo n.º 13
0
        private void HandlePartyMembersChanged(object sender, LuaEventArgs args)
        {
            try
            {
                if (CLU.IsHealerRotationActive && StyxWoW.IsInGame)
                {
                    CLULogger.TroubleshootLog("CombatLogEvents: Party Members Changed - Re-Initialize list Of HealableUnits");
                    switch (CLUSettings.Instance.SelectedHealingAquisition)
                    {
                    case HealingAquisitionMethod.Proximity:
                        HealableUnit.HealableUnitsByProximity();
                        break;

                    case HealingAquisitionMethod.RaidParty:
                        HealableUnit.HealableUnitsByPartyorRaid();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                CLULogger.DiagnosticLog("HandlePartyMembersChanged : {0}", ex);
            }
        }
Exemplo n.º 14
0
 private void RoutineManagerReloaded(object sender, EventArgs e)
 {
     CLULogger.TroubleshootLog("Routines were reloaded, re-creating behaviors");
     CreateBehaviors();
 }
Exemplo n.º 15
0
        /// <summary>This will: loop assemblies,
        /// loop types,
        /// filter types that are a subclass of RotationBase and not the abstract,
        /// create an instance of a RotationBase subclass so we can interigate KeySpell within the RotationBase subclass,
        /// Check if the character has the Keyspell,
        /// Set the active rotation to the matching RotationBase subclass.</summary>
        private void QueryClassTree()
        {
            try
            {
                Type type = typeof(RotationBase);

                //no need to get ALL Assemblies, need only the executed ones
                IEnumerable <Type> types = Assembly.GetExecutingAssembly().GetTypes().Where(p => p.IsSubclassOf(type));

                //_rotations.AddRange(new TypeLoader<RotationBase>(null));

                this._rotations = new List <RotationBase>();
                foreach (Type x in types)
                {
                    ConstructorInfo constructorInfo = x.GetConstructor(new Type[] { });
                    if (constructorInfo != null)
                    {
                        var rb = constructorInfo.Invoke(new object[] { }) as RotationBase;
                        if (rb != null && SpellManager.HasSpell(rb.KeySpellId))
                        {
                            CLULogger.TroubleshootLog(" Using " + rb.Name + " rotation. Character has " + rb.KeySpell);
                            this._rotations.Add(rb);
                        }
                        else
                        {
                            if (rb != null)
                            {
                                //TroubleshootLog(" Skipping " + rb.Name + " rotation. Character is missing " + rb.KeySpell);
                            }
                        }
                    }
                }

                // If there is more than one rotation then display the selector for the user, otherwise just load the one and only.

                if (this._rotations.Count > 1)
                {
                    string value = "null";
                    if (
                        GUIHelpers.RotationSelector
                            ("[CLU] " + Version + " Rotation Selector", this._rotations,
                            "Please select your prefered rotation:", ref value) == DialogResult.OK)
                    {
                        this.SetActiveRotation(this._rotations.First(x => value != null && x.Name == value));
                    }
                }
                else
                {
                    if (this._rotations.Count == 0)
                    {
                        CLULogger.Log("Couldn't finde a rotation for you, Contact us!");
                        StopBot("Unable to find Active Rotation");
                    }
                    else
                    {
                        RotationBase r = this._rotations.FirstOrDefault();
                        if (r != null)
                        {
                            CLULogger.Log("Found rotation: " + r.Name);
                            this.SetActiveRotation(r);
                        }
                    }
                }
            }
            catch (ReflectionTypeLoadException ex)
            {
                var sb = new StringBuilder();
                foreach (Exception exSub in ex.LoaderExceptions)
                {
                    sb.AppendLine(exSub.Message);
                    if (exSub is FileNotFoundException)
                    {
                        var exFileNotFound = exSub as FileNotFoundException;
                        if (!string.IsNullOrEmpty(exFileNotFound.FusionLog))
                        {
                            sb.AppendLine("CLU Log:");
                            sb.AppendLine(exFileNotFound.FusionLog);
                        }
                    }
                    sb.AppendLine();
                }
                string errorMessage = sb.ToString();
                CLULogger.Log(" Woops, we could not set the rotation.");
                CLULogger.Log(errorMessage);
                StopBot(" Unable to find Active Rotation: " + ex);
            }
        }
Exemplo n.º 16
0
        // Thanks to Singular Devs for the CombatLogEventArgs class and SpellImmunityManager.
        private static void HandleCombatLog(object sender, LuaEventArgs args)
        {
            var e = new CombatLogEventArgs(args.EventName, args.FireTimeStamp, args.Args);

            //var missType = Convert.ToString(e.Args[14]);

            switch (e.Event)
            {
            case "SWING_MISSED":
                if (e.Args[11].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading swing. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[11].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_MISSED":
            case "RANGE_MISSED":
                if (e.Args[14].ToString() == "EVADE")
                {
                    CLULogger.TroubleshootLog("Mob is evading ranged attack. Blacklisting it!");
                    Blacklist.Add(e.DestGuid, TimeSpan.FromMinutes(30));
                    if (StyxWoW.Me.CurrentTargetGuid == e.DestGuid)
                    {
                        StyxWoW.Me.ClearTarget();
                    }

                    BotPoi.Clear("Blacklisting evading mob");
                    StyxWoW.SleepForLagDuration();
                }
                else if (e.Args[14].ToString() == "IMMUNE")
                {
                    WoWUnit unit = e.DestUnit;
                    if (unit != null && !unit.IsPlayer)
                    {
                        CLULogger.TroubleshootLog("{0} is immune to {1} spell school", unit.Name, e.SpellSchool);
                        SpellImmunityManager.Add(unit.Entry, e.SpellSchool);
                    }
                }
                break;

            case "SPELL_AURA_REFRESH":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_APPLIED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RakeMultiplier = Classes.Druid.Common.RakeMultiplier * 1.25;
                        }
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 1;

                        //TF
                        if (StyxWoW.Me.HasAura(5217))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.15;
                        }

                        //Savage Roar
                        if (StyxWoW.Me.HasAura(127538))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.3;
                        }

                        //Doc
                        if (StyxWoW.Me.HasAura(108373))
                        {
                            Classes.Druid.Common.RipMultiplier = Classes.Druid.Common.RipMultiplier * 1.25;
                        }
                    }
                }
                break;

            case "SPELL_AURA_REMOVED":
                if (e.SourceGuid == StyxWoW.Me.Guid)
                {
                    if (e.SpellId == 1822)
                    {
                        Classes.Druid.Common.RakeMultiplier = 0;
                    }
                    if (e.SpellId == 1079)
                    {
                        Classes.Druid.Common.ExtendedRip   = 0;
                        Classes.Druid.Common.RipMultiplier = 0;
                    }
                }
                break;
            }
        }
Exemplo n.º 17
0
 private static void StopBot(string reason)
 {
     CLULogger.TroubleshootLog(reason);
     TreeRoot.Stop();
 }
Exemplo n.º 18
0
        public override void Initialize()
        {
            CLULogger.TroubleshootLog("Attatching BotEvents");
            BotEvents.OnBotStarted        += CombatLogEvents.Instance.CombatLogEventsOnStarted;
            BotEvents.OnBotStopped        += CombatLogEvents.Instance.CombatLogEventsOnStopped;
            BotEvents.OnBotChanged        += CombatLogEvents.Instance.BotBaseChange;
            BotEvents.Player.OnMapChanged += CombatLogEvents.Instance.Player_OnMapChanged;
            RoutineManager.Reloaded       += RoutineManagerReloaded;

            ///////////////////////////////////////////////////////////////////
            // Start non invasive user information
            ///////////////////////////////////////////////////////////////////
            CLULogger.TroubleshootLog("Character level: {0}", Me.Level);
            CLULogger.TroubleshootLog("Character Faction: {0}", Me.IsAlliance ? "Alliance" : "Horde");
            CLULogger.TroubleshootLog("Character Race: {0}", Me.Race);
            CLULogger.TroubleshootLog("Character Mapname: {0}", Me.MapName);
            CLULogger.TroubleshootLog("GroupType: {0}", GroupType.ToString());
            CLULogger.TroubleshootLog("LocationContext: {0}", LocationContext.ToString());

            // Talents
            CLULogger.TroubleshootLog("Retrieving Talent Spec");
            try
            {
                TalentManager.Update();
            }
            catch (Exception e)
            {
                StopBot(e.ToString());
            }
            CLULogger.TroubleshootLog(" Character Current Build: {0}", TalentManager.CurrentSpec.ToString());

            // Intialize Behaviors....TODO: Change this ?
            if (_combatBehavior == null)
            {
                _combatBehavior = new PrioritySelector();
            }

            if (_combatBuffBehavior == null)
            {
                _combatBuffBehavior = new PrioritySelector();
            }

            if (_preCombatBuffBehavior == null)
            {
                _preCombatBuffBehavior = new PrioritySelector();
            }

            if (_pullBehavior == null)
            {
                _pullBehavior = new PrioritySelector();
            }

            if (_restBehavior == null)
            {
                _restBehavior = new PrioritySelector();
            }

            // Behaviors
            if (!CreateBehaviors())
            {
                return;
            }
            CLULogger.TroubleshootLog(" Behaviors created!");

            // Racials
            CLULogger.TroubleshootLog("Retrieving Racial Abilities");
            foreach (WoWSpell racial in Racials.CurrentRacials)
            {
                CLULogger.TroubleshootLog(" Character Racial Abilitie: {0} ", racial.Name);
            }
            CLULogger.TroubleshootLog(" {0}", Me.IsInInstance ? "Character is currently in an Instance" : "Character seems to be outside an Instance");
            CLULogger.TroubleshootLog(" {0}", StyxWoW.Me.CurrentMap.IsArena ? "Character is currently in an Arena" : "Character seems to be outside an Arena");
            CLULogger.TroubleshootLog(" {0}", StyxWoW.Me.CurrentMap.IsBattleground ? "Character is currently in a Battleground  " : "Character seems to be outside a Battleground");
            CLULogger.TroubleshootLog(" {0}", StyxWoW.Me.CurrentMap.IsDungeon ? "Character is currently in a Dungeon  " : "Character seems to be outside a Dungeon");
            CLULogger.TroubleshootLog("Character HB Pull Range: {0}", Targeting.PullDistance);
            ///////////////////////////////////////////////////////////////////
            // END non invasive user information
            ///////////////////////////////////////////////////////////////////

            // Create the new List of HealableUnit type.
            CLULogger.TroubleshootLog("Initializing list of HealableUnits");
            switch (CLUSettings.Instance.SelectedHealingAquisition)
            {
            case HealingAquisitionMethod.Proximity:
                HealableUnit.HealableUnitsByProximity();
                break;

            case HealingAquisitionMethod.RaidParty:
                HealableUnit.HealableUnitsByPartyorRaid();
                break;
            }
            CLULogger.TroubleshootLog(" {0}", IsHealerRotationActive ? "Healer Base Detected" : "No Healer Base Detectected");

            // Initialize Botchecks
            CLULogger.TroubleshootLog("Initializing Bot Checker");
            BotChecker.Initialize();

            CLULogger.TroubleshootLog("Initializing Sound Player");
            SoundManager.Initialize();

            CLULogger.TroubleshootLog("Initializing Keybinds");
            this._clupulsetimer.Interval  = 1000;                 // 1second
            this._clupulsetimer.Elapsed  += ClupulsetimerElapsed; // Attatch
            this._clupulsetimer.Enabled   = true;                 // Enable
            this._clupulsetimer.AutoReset = true;                 // To keep raising the Elapsed event

            GC.KeepAlive(this._clupulsetimer);

            //TroubleshootLog("Initializing DpsMeter");
            //DpsMeter.Initialize();
            CLULogger.TroubleshootLog("Initialization Complete");
        }
Exemplo n.º 19
0
        private static Composite MovingFacingBehavior(CLU.UnitSelection onUnit)

        // TODO: Check if we have an obstacle in our way and clear it ALSO need a mounted CHECK!!.
        {
            var badStuff = ObjectManager.GetObjectsOfType <WoWUnit>(false, false).Where(q => q.CreatedByUnitGuid != Me.Guid && q.FactionId == 14 && !q.Attackable && q.Distance < 8).OrderBy(u => u.DistanceSqr).FirstOrDefault();

            return(new Sequence(

                       // No Target?
                       // Targeting Enabled?
                       // Aquire Target
                       new DecoratorContinue(ret => (onUnit == null || onUnit(ret) == null || onUnit(ret).IsDead || onUnit(ret).IsFriendly) && CLUSettings.Instance.EnableTargeting,
                                             new PrioritySelector(
                                                 ctx =>
            {
                // Clear our current target if its Dead or is Friendly.
                if (ctx != null && (onUnit(ctx).IsDead || onUnit(ctx).IsFriendly))
                {
                    CLULogger.TroubleshootLog(" Target Appears to be dead or a Friendly. Clearing Current Target [" + CLULogger.SafeName((WoWUnit)ctx) + "]");
                    Me.ClearTarget();
                }

                // Aquires a target.
                if (Unit.EnsureUnitTargeted != null)
                {
                    // Clear our current target if its blacklisted.
                    if (Blacklist.Contains(Unit.EnsureUnitTargeted.Guid) || Unit.EnsureUnitTargeted.IsDead)
                    {
                        CLULogger.TroubleshootLog(" EnsureUnitTargeted Appears to be dead or Blacklisted. Clearing Current Target [" + CLULogger.SafeName(Unit.EnsureUnitTargeted) + "]");
                        Me.ClearTarget();
                    }

                    return Unit.EnsureUnitTargeted;
                }

                return null;
            },
                                                 new Decorator(
                                                     ret => ret != null, //checks that the above ctx returned a valid target.
                                                     new Sequence(

                                                         //new Action(ret => SysLog.DiagnosticLog(" CLU targeting activated. Targeting " + SysLog.SafeName((WoWUnit)ret))),
                                                         // pending spells like mage blizard cause targeting to fail.
                                                         //new DecoratorContinue(ctx => StyxWoW.Me.CurrentPendingCursorSpell != null,
                                                         //        new Action(ctx => Lua.DoString("SpellStopTargeting()"))),
                                                         new Action(ret => ((WoWUnit)ret).Target()),
                                                         new WaitContinue(2, ret => onUnit(ret) != null && onUnit(ret) == (WoWUnit)ret, new ActionAlwaysSucceed()))))),

                       // Are we Facing the target?
                       // Is the Target in line of site?
                       // Face Target
                       new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsSafelyFacing(onUnit(ret), 45f) && onUnit(ret).InLineOfSight,
                                             new Sequence(
                                                 new Action(ret => WoWMovement.Face(onUnit(ret).Guid)))),

                       // Target in Line of site?
                       // We are not casting?
                       // We are not channeling?
                       // Move to Location
                       new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).InLineOfSight&& !Me.IsCasting && !Spell.PlayerIsChanneling,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Target not in LoS. Moving closer.")),
                                                 new Action(ret => Navigator.MoveTo(onUnit(ret).Location)))),

                       // Blacklist targets TODO:  check this.
                       new DecoratorContinue(ret => onUnit(ret) != null && !Me.IsInInstance && Navigator.GeneratePath(Me.Location, onUnit(ret).Location).Length <= 0,
                                             new Action(delegate
            {
                Blacklist.Add(Me.CurrentTargetGuid, TimeSpan.FromDays(365));
                CLULogger.MovementLog("[CLU] " + CLU.Version + ": Failed to generate path to: {0} blacklisted!", Me.CurrentTarget.Name);
                return RunStatus.Success;
            })),

                       // Move away from bad stuff
                       new DecoratorContinue(ret => badStuff != null,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog("[CLU Movement] Movin out of bad Stuff.")),
                                                 new Action(ret =>
            {
                if (badStuff != null)
                {
                    CLULogger.MovementLog("[CLU Movement] Movin out of {0}.", badStuff);
                    Navigator.MoveTo(WoWMovement.CalculatePointFrom(badStuff.Location, 10));
                }
            }))),

                       // Move Behind Target enabled?
                       // Target is Alive?
                       // Target is not Moving?
                       // Are we behind the target?
                       // We are not casting?
                       // We are not the tank?
                       // We are not channeling?
                       // Move Behind Target
                       new DecoratorContinue(ret => CLUSettings.Instance.EnableMoveBehindTarget && onUnit(ret) != null && onUnit(ret) != Me && // && !onUnit(ret).IsMoving
                                             onUnit(ret).InLineOfSight&& onUnit(ret).IsAlive&& !onUnit(ret).MeIsBehind&& !Me.IsCasting && !Spell.PlayerIsChanneling &&
                                             Unit.DistanceToTargetBoundingBox() >= 10,                                                         // && (Unit.Tanks != null && Unit.Tanks.Any(x => x.Guid != Me.Guid))
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Not behind the target. Moving behind target.")),
                                                 new Action(ret => Navigator.MoveTo(CalculatePointBehindTarget())))),

                       // Target is greater than CombatMinDistance?
                       // Target is Moving?
                       // We are not moving Forward?
                       // Move Forward to   wards target
                       new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMinDistance &&
                                             onUnit(ret).IsMoving&& !Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight&& !IsFlyingUnit,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)),
                                                 new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward)))),

                       // Target is less than CombatMinDistance?
                       // Target is Moving?
                       // We are moving Forward
                       // Stop Moving Forward
                       new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMinDistance &&
                                             onUnit(ret).IsMoving&& Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target (T[{0}] < P[{1}]). Movement Stopped.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMinDistance)),
                                                 new Action(ret => WoWMovement.MoveStop()))),

                       // Target is not Moving?
                       // Target is greater than CombatMaxDistance?
                       // We are not Moving?
                       // Move Forward
                       new DecoratorContinue(ret => onUnit(ret) != null && !onUnit(ret).IsMoving&&
                                             Unit.DistanceToTargetBoundingBox() >= CLU.Instance.ActiveRotation.CombatMaxDistance && onUnit(ret).InLineOfSight,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too far away from non moving target (T[{0}] >= P[{1}]). Moving forward.", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)),
                                                 new Action(ret => WoWMovement.Move(WoWMovement.MovementDirection.Forward, new TimeSpan(99, 99, 99))))),

                       // Target is less than CombatMaxDistance?
                       // We are Moving?
                       // We are moving Forward?
                       // Stop Moving
                       new DecoratorContinue(ret => onUnit(ret) != null && Unit.DistanceToTargetBoundingBox() < CLU.Instance.ActiveRotation.CombatMaxDistance &&
                                             Me.IsMoving && Me.MovementInfo.MovingForward && onUnit(ret).InLineOfSight,
                                             new Sequence(
                                                 new Action(ret => CLULogger.MovementLog(" [CLU Movement] Too close to target  (T[{0}] < P[{1}]). Movement Stopped", Unit.DistanceToTargetBoundingBox(), CLU.Instance.ActiveRotation.CombatMaxDistance)),
                                                 new Action(ret => WoWMovement.MoveStop())))));
        }