Exemplo n.º 1
0
        public static bool CheckPull()
        {
            string fnname = "Evade.CheckPull";

            MyTimer.Start(fnname);
            // Check for botpoi not being something else
            if (!(BotPoi.Current.Type == PoiType.Kill || BotPoi.Current.Type == PoiType.None))
            {
                return(false);
            }

            // Check for pull taking too long
            WoWUnit target = StyxWoW.Me.CurrentTarget;

            if (target == null || target.IsFriendly)
            {
                MyTimer.Stop(fnname);
                return(false);
            }

            if (StyxWoW.Me.HealthPercent < 50 || StyxWoW.Me.ManaPercent < 50)
            {
                FTWLogger.log(Color.Red, "Health or mana is below 50%, not pulling!");
                StyxWoW.Me.ClearTarget();
                MyTimer.Stop(fnname);
                return(false);
            }

            //if (!target.IsValidUnit())
            //{
            //    log("Blacklisting {0} for 60 seconds in CheckPull", target.SafeName());
            //    Blacklist.Add(target, TimeSpan.FromSeconds(60));
            //    StyxWoW.Me.ClearTarget();
            //    MyTimer.Stop(fnname);
            //    return false;
            //}

            int clustersize = target.ClusterSize();

            FTWLogger.log(Color.Violet, "PULL: Target = {0} at {1} ({2}) ({3} mobs surrounding)", target.SafeName(), target.DistanceCalc(), target.FactionId, clustersize);

            if (target.Guid != PullTargetGuid)
            {
                // New pull target - reset timer for maxPullTime seconds
                PullStopTime   = DateTime.Now.AddSeconds(MaxPullTime);
                PullTargetGuid = target.Guid;
            }
            else if (DateTime.Now > PullStopTime)
            {
                // Still pulling after maxPullTime seconds
                FTWLogger.log(Color.Red, "Can't pull {0} after {1} seconds - blacklist for 5 minutes.", target.SafeName(), MaxPullTime);
                Blacklist.Add(target.Guid, TimeSpan.FromMinutes(5));
                StyxWoW.Me.ClearTarget();
                MyTimer.Stop(fnname);
                return(false);
            }
            MyTimer.Stop(fnname);
            return(true);
        }
Exemplo n.º 2
0
        private double GetPropValue(WoWUnit theunit, string name)
        {
            double value = 0;

            switch (name)
            {
            case "IsHostile": value = theunit != null && theunit.IsHostile ? 1 : 0; break;

            case "AvgHealth": value = FTWProps.avgHealth; break;

            case "AddsCount": value = FTWProps.adds.Count; break;

            case "StunCount": value = theunit != null?FTWCoreStatus.StunCount(theunit.Location) : 0; break;

            case "Aggro": value = theunit != null ? (int)theunit.ThreatInfo.ThreatStatus : 5; break;

            case "MovementDisabled": value = theunit != null && FTWUtils.MovementDisabled() ? 1 : 0; break;

            case "ClusterSize": value = theunit != null?theunit.ClusterSize() : 0; break;

            case "CapsLock": value = FTWUtils.CapsLockDown() ? 1 : 0; break;

            case "BearForm": value = theunit != null && theunit.HasAura("Bear Form") ? 1 : 0; break;

            case "CatForm": value = theunit != null && theunit.HasAura("Cat Form") ? 1 : 0; break;

            case "MoonkinForm": value = theunit != null && theunit.HasAura("Moonkin Form") ? 1 : 0; break;

            case "NormalForm": value = theunit != null && (theunit.HasAura("Cat Form") == false && theunit.HasAura("Bear Form") == false && theunit.HasAura("Moonkin Form") == false) ? 1 : 0; break;

            case "FlightForm": value = theunit != null && (theunit.HasAura("Flight Form") || theunit.HasAura("Swift Flight Form")) ? 1 : 0; break;

            case "FeralForm": value = theunit != null && (theunit.HasAura("Bear Form") || theunit.HasAura("Cat Form")) ? 1 : 0; break;

            case "ComboPoints": value = StyxWoW.Me.ComboPoints; break;

            case "AllComboPoints": value = StyxWoW.Me.RawComboPoints; break;

            case "Rage": value = StyxWoW.Me.RageInfo.CurrentI; break;

            case "Focus": value = StyxWoW.Me.FocusInfo.CurrentI; break;

            case "Energy": value = StyxWoW.Me.EnergyInfo.CurrentI; break;

            case "ShadowOrbs": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.ShadowOrbs).CurrentI; break;

            case "SoulShards": value = StyxWoW.Me.SoulShardsInfo.CurrentI; break;

            case "Balance": value = StyxWoW.Me.UnitPower(8); break;

            case "HolyPower": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.HolyPower).CurrentI; break;

            case "Chi": value = StyxWoW.Me.UnitPower(12); break;

            case "BurningEmbers": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.BurningEmbers).CurrentI; break;

            case "DemonicFury": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.DemonicFury).CurrentI; break;

            case "EclipseDirection": value = FTWProps._eclipsedirection; break;

            case "Distance": value = theunit != null ? theunit.Distance2D : 0; break;

            case "MeleeRange": value = 4.95; break;

            case "IsTank": value = StyxWoW.Me.IsTank() ? 1 : 0; break;

            case "IsHealer": value = StyxWoW.Me.IsHealer() ? 1 : 0; break;

            case "IsDPS": value = StyxWoW.Me.IsDPS() ? 1 : 0; break;

            case "IsDemon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Demon ? 1 : 0; break;

            case "IsElemental": value = theunit != null && theunit.CreatureType == WoWCreatureType.Elemental ? 1 : 0; break;

            case "IsBeast": value = theunit != null && theunit.CreatureType == WoWCreatureType.Beast ? 1 : 0; break;

            case "IsCritter": value = theunit != null && theunit.CreatureType == WoWCreatureType.Critter ? 1 : 0; break;

            case "IsDragon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Dragon ? 1 : 0; break;

            case "IsGasCloud": value = theunit != null && theunit.CreatureType == WoWCreatureType.GasCloud ? 1 : 0; break;

            case "IsGiant": value = theunit != null && theunit.CreatureType == WoWCreatureType.Giant ? 1 : 0; break;

            case "IsHumanoid": value = theunit != null && theunit.CreatureType == WoWCreatureType.Humanoid ? 1 : 0; break;

            case "IsMechanical": value = theunit != null && theunit.CreatureType == WoWCreatureType.Mechanical ? 1 : 0; break;

            case "IsNonCombatPet": value = theunit != null && theunit.CreatureType == WoWCreatureType.NonCombatPet ? 1 : 0; break;

            case "IsTotem": value = theunit != null && theunit.CreatureType == WoWCreatureType.Totem ? 1 : 0; break;

            case "IsUndead": value = theunit != null && theunit.CreatureType == WoWCreatureType.Undead ? 1 : 0; break;

            case "Health": value = theunit != null ? (int)theunit.HealthPercent : 100; break;

            case "Mana": value = theunit != null && (theunit.PowerType == WoWPowerType.Mana || theunit.Class == WoWClass.Druid) ? theunit.ManaPercent : 100; break;

            case "Mounted": value = theunit != null && (theunit.Mounted) ? 1 : 0; break;

            case "InBattleground": value = Battlegrounds.IsInsideBattleground ? 1 : 0; break;

            case "InParty": value = StyxWoW.Me.GroupInfo.IsInParty || StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;

            case "InRaid": value = StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;

            case "IsDiseased": value = theunit != null && theunit.IsDiseased() ? 1 : 0; break;

            case "Dead": value = theunit != null && theunit.IsDead ? 1 : 0; break;

            case "IsCasting": value = theunit != null && (theunit.IsCasting || theunit.IsChanneling) ? 1 : 0; break;

            case "IsMoving": value = theunit != null && theunit.IsMoving ? 1 : 0; break;

            case "IsFlying": value = theunit != null && theunit.IsFlying ? 1 : 0; break;

            case "LineOfSight": value = theunit != null && theunit.InLineOfSight ? 1 : 0; break;

            case "Interruptable": value = theunit != null && theunit.CanInterruptCurrentSpellCast ? 1 : 0; break;

            case "IsElite": value = theunit != null && (theunit.Elite || theunit.Name.Contains("Training Dummy")) ? 1 : 0; break;

            case "IsBehind": value = theunit != null && theunit.CurrentTarget != null && theunit.CurrentTarget.MeIsSafelyBehind ? 1 : 0; break;

            case "IsFacingTarget": value = theunit != null && theunit.CurrentTarget != null && theunit.IsSafelyFacing(theunit.CurrentTarget) ? 1 : 0; break;

            case "IsFleeing": value = theunit != null && theunit.Fleeing ? 1 : 0; break;

            case "IsIncapacitated": value = theunit != null && (theunit.IsDead || theunit.IsCrowdControlled()) ? 1 : 0; break;

            case "IsRooted": value = theunit != null && theunit.HasAuraWithMechanic(WoWSpellMechanic.Rooted, WoWSpellMechanic.Shackled) ? 1 : 0; break;

            case "IsLooting": value = BotPoi.Current.Type == PoiType.Loot ? 1 : 0; break;

            case "PetIsMissing": value = StyxWoW.Me.PetIsMissing(); break;

            case "TotemCount": value = theunit != null?FTWCoreStatus.TotemCount() : 0; break;

            case "RuneCount": value = StyxWoW.Me.DeathRuneCount +
                                      StyxWoW.Me.FrostRuneCount +
                                      StyxWoW.Me.BloodRuneCount +
                                      StyxWoW.Me.UnholyRuneCount; break;

            case "DeathRune": value = StyxWoW.Me.DeathRuneCount; break;

            case "FrostRune": value = StyxWoW.Me.FrostRuneCount; break;

            case "BloodRune": value = StyxWoW.Me.BloodRuneCount; break;

            case "UnholyRune": value = StyxWoW.Me.UnholyRuneCount; break;

            case "RunicPower": value = StyxWoW.Me.RunicPowerPercent; break;

            case "LevelDiff": value = theunit != null ? theunit.Level - StyxWoW.Me.Level : 0; break;

            case "Level": value = theunit != null ? theunit.Level : 0; break;

            default: throw new Exception(string.Format("Unknown property {0}!", name));
            }
            return(value);
        }
Exemplo n.º 3
0
 private double GetPropValue(WoWUnit theunit, string name)
 {
     double value = 0;
     switch (name)
     {
         case "IsHostile": value = theunit != null && theunit.IsHostile ? 1 : 0; break;
         case "AvgHealth": value = FTWProps.avgHealth; break;
         case "AddsCount": value = FTWProps.adds.Count; break;
         case "StunCount": value = theunit != null ? FTWCoreStatus.StunCount(theunit.Location) : 0; break;
         case "Aggro": value = theunit != null ? (int)theunit.ThreatInfo.ThreatStatus : 5; break;
         case "MovementDisabled": value = theunit != null && FTWUtils.MovementDisabled() ? 1 : 0; break;
         case "ClusterSize": value = theunit != null ? theunit.ClusterSize() : 0; break;
         case "CapsLock": value = FTWUtils.CapsLockDown() ? 1 : 0; break;
         case "BearForm": value = theunit != null && theunit.HasAura("Bear Form") ? 1 : 0; break;
         case "CatForm": value = theunit != null && theunit.HasAura("Cat Form") ? 1 : 0; break;
         case "MoonkinForm": value = theunit != null && theunit.HasAura("Moonkin Form") ? 1 : 0; break;
         case "NormalForm": value = theunit != null && (theunit.HasAura("Cat Form") == false && theunit.HasAura("Bear Form") == false && theunit.HasAura("Moonkin Form") == false) ? 1 : 0; break;
         case "FlightForm": value = theunit != null && (theunit.HasAura("Flight Form") || theunit.HasAura("Swift Flight Form")) ? 1 : 0; break;
         case "FeralForm": value = theunit != null && (theunit.HasAura("Bear Form") || theunit.HasAura("Cat Form")) ? 1 : 0; break;
         case "ComboPoints": value = StyxWoW.Me.ComboPoints; break;
         case "AllComboPoints": value = StyxWoW.Me.RawComboPoints; break;
         case "Rage": value = StyxWoW.Me.RageInfo.CurrentI; break;
         case "Focus": value = StyxWoW.Me.FocusInfo.CurrentI; break;
         case "Energy": value = StyxWoW.Me.EnergyInfo.CurrentI; break;
         case "ShadowOrbs": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.ShadowOrbs).CurrentI; break;
         case "SoulShards": value = StyxWoW.Me.SoulShardsInfo.CurrentI; break;
         case "Balance": value = StyxWoW.Me.UnitPower(8); break;
         case "HolyPower": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.HolyPower).CurrentI; break;
         case "Chi": value = StyxWoW.Me.UnitPower(12); break;
         case "BurningEmbers": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.BurningEmbers).CurrentI; break;
         case "DemonicFury": value = StyxWoW.Me.GetPowerInfo(WoWPowerType.DemonicFury).CurrentI; break;
         case "EclipseDirection": value = FTWProps._eclipsedirection; break;
         case "Distance": value = theunit != null ? theunit.Distance2D : 0; break;
         case "MeleeRange": value = 4.95; break;
         case "IsTank": value = StyxWoW.Me.IsTank() ? 1 : 0; break;
         case "IsHealer": value = StyxWoW.Me.IsHealer() ? 1 : 0; break;
         case "IsDPS": value = StyxWoW.Me.IsDPS() ? 1 : 0; break;
         case "IsDemon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Demon ? 1 : 0; break;
         case "IsElemental": value = theunit != null && theunit.CreatureType == WoWCreatureType.Elemental ? 1 : 0; break;
         case "IsBeast": value = theunit != null && theunit.CreatureType == WoWCreatureType.Beast ? 1 : 0; break;
         case "IsCritter": value = theunit != null && theunit.CreatureType == WoWCreatureType.Critter ? 1 : 0; break;
         case "IsDragon": value = theunit != null && theunit.CreatureType == WoWCreatureType.Dragon ? 1 : 0; break;
         case "IsGasCloud": value = theunit != null && theunit.CreatureType == WoWCreatureType.GasCloud ? 1 : 0; break;
         case "IsGiant": value = theunit != null && theunit.CreatureType == WoWCreatureType.Giant ? 1 : 0; break;
         case "IsHumanoid": value = theunit != null && theunit.CreatureType == WoWCreatureType.Humanoid ? 1 : 0; break;
         case "IsMechanical": value = theunit != null && theunit.CreatureType == WoWCreatureType.Mechanical ? 1 : 0; break;
         case "IsNonCombatPet": value = theunit != null && theunit.CreatureType == WoWCreatureType.NonCombatPet ? 1 : 0; break;
         case "IsTotem": value = theunit != null && theunit.CreatureType == WoWCreatureType.Totem ? 1 : 0; break;
         case "IsUndead": value = theunit != null && theunit.CreatureType == WoWCreatureType.Undead ? 1 : 0; break;
         case "Health": value = theunit != null ? (int)theunit.HealthPercent : 100; break;
         case "Mana": value = theunit != null && (theunit.PowerType == WoWPowerType.Mana || theunit.Class == WoWClass.Druid) ? theunit.ManaPercent : 100; break;
         case "Mounted": value = theunit != null && (theunit.Mounted) ? 1 : 0; break;
         case "InBattleground": value = Battlegrounds.IsInsideBattleground ? 1 : 0; break;
         case "InParty": value = StyxWoW.Me.GroupInfo.IsInParty || StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;
         case "InRaid": value = StyxWoW.Me.GroupInfo.IsInRaid ? 1 : 0; break;
         case "IsDiseased": value = theunit != null && theunit.IsDiseased() ? 1 : 0; break;
         case "Dead": value = theunit != null && theunit.IsDead ? 1 : 0; break;
         case "IsCasting": value = theunit != null && (theunit.IsCasting || theunit.IsChanneling) ? 1 : 0; break;
         case "IsMoving": value = theunit != null && theunit.IsMoving ? 1 : 0; break;
         case "IsFlying": value = theunit != null && theunit.IsFlying ? 1 : 0; break;
         case "LineOfSight": value = theunit != null && theunit.InLineOfSight ? 1 : 0; break;
         case "Interruptable": value = theunit != null && theunit.CanInterruptCurrentSpellCast ? 1 : 0; break;
         case "IsElite": value = theunit != null && (theunit.Elite || theunit.Name.Contains("Training Dummy")) ? 1 : 0; break;
         case "IsBehind": value = theunit != null && theunit.CurrentTarget != null && theunit.CurrentTarget.MeIsSafelyBehind ? 1 : 0; break;
         case "IsFacingTarget": value = theunit != null && theunit.CurrentTarget != null && theunit.IsSafelyFacing(theunit.CurrentTarget) ? 1 : 0; break;
         case "IsFleeing": value = theunit != null && theunit.Fleeing ? 1 : 0; break;
         case "IsIncapacitated": value = theunit != null && (theunit.IsDead || theunit.IsCrowdControlled()) ? 1 : 0; break;
         case "IsRooted": value = theunit != null && theunit.HasAuraWithMechanic(WoWSpellMechanic.Rooted, WoWSpellMechanic.Shackled) ? 1 : 0; break;
         case "IsLooting": value = BotPoi.Current.Type == PoiType.Loot ? 1 : 0; break;
         case "PetIsMissing": value = StyxWoW.Me.PetIsMissing(); break;
         case "TotemCount": value = theunit != null ? FTWCoreStatus.TotemCount() : 0; break;
         case "RuneCount": value = StyxWoW.Me.DeathRuneCount +
             StyxWoW.Me.FrostRuneCount +
             StyxWoW.Me.BloodRuneCount +
             StyxWoW.Me.UnholyRuneCount; break;
         case "DeathRune": value = StyxWoW.Me.DeathRuneCount; break;
         case "FrostRune": value = StyxWoW.Me.FrostRuneCount; break;
         case "BloodRune": value = StyxWoW.Me.BloodRuneCount; break;
         case "UnholyRune": value = StyxWoW.Me.UnholyRuneCount; break;
         case "RunicPower": value = StyxWoW.Me.RunicPowerPercent; break;
         case "LevelDiff": value = theunit != null ? theunit.Level - StyxWoW.Me.Level : 0; break;
         case "Level": value = theunit != null ? theunit.Level : 0; break;
         default: throw new Exception(string.Format("Unknown property {0}!", name));
     }
     return value;
 }