示例#1
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");
        }