Esempio n. 1
0
        /// <summary>
        /// Returns an appropriately selected TrinityPower and related information
        /// </summary>
        /// <returns></returns>
        internal static TrinityPower AbilitySelector()
        {
            using (new PerformanceLogger("AbilitySelector"))
            {
                // See if archon just appeared/disappeared, so update the hotbar
                if (Trinity.ShouldRefreshHotbarAbilities || Trinity.HotbarRefreshTimer.ElapsedMilliseconds > 5000)
                {
                    PlayerInfoCache.RefreshHotbar();
                }

                // Switch based on the cached character class

                TrinityPower power = CurrentPower;

                using (new PerformanceLogger("AbilitySelector.ClassAbility"))
                {
                    switch (Player.ActorClass)
                    {
                    // Barbs
                    case ActorClass.Barbarian:
                        power = BarbarianCombat.GetPower();
                        break;

                    case ActorClass.Crusader:
                        power = CrusaderCombat.GetPower();
                        break;
                        // Monks
                        //case ActorClass.Monk:
                        //    power = GetMonkPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                        //// Wizards
                        //case ActorClass.Wizard:
                        //    power = GetWizardPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                        //// Witch Doctors
                        //case ActorClass.Witchdoctor:
                        //    power = GetWitchDoctorPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                        //// Demon Hunters
                        //case ActorClass.DemonHunter:
                        //    power = GetDemonHunterPower(IsCurrentlyAvoiding, UseOOCBuff, UseDestructiblePower);
                        //    break;
                    }
                }
                // use IEquatable to check if they're equal
                if (CurrentPower == power)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Keeping {0}", CurrentPower.ToString());
                    return(CurrentPower);
                }
                if (power != null)
                {
                    Logger.Log(TrinityLogLevel.Debug, LogCategory.Behavior, "Selected new {0}", power.ToString());
                    return(power);
                }
                return(DefaultPower);
            }
        }