Пример #1
0
    public static void Initialize()
    {
        Main.settingRange = _range;
        Main.Log("Initialized.");
        ZEMageSettings.Load();
        _settings = ZEMageSettings.CurrentSetting;
        Talents.InitTalents(_settings.AssignTalents, _settings.UseDefaultTalents, _settings.TalentCodes);

        // Fight end
        FightEvents.OnFightEnd += (ulong guid) =>
        {
            _isBackingUp      = false;
            _iCanUseWand      = false;
            _usingWand        = false;
            Main.settingRange = _range;
        };

        // Fight start
        FightEvents.OnFightStart += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            _iCanUseWand = ToolBox.HaveRangedWeaponEquipped();
        };

        // Fight Loop
        FightEvents.OnFightLoop += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            bool condition = ((ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                              ObjectManager.Target.IsAlive && ObjectManager.Target.GetDistance < _meleeRange + 4 && !Me.IsCast && !_isBackingUp &&
                              ObjectManager.Target.HealthPercent > 5 && Main.settingRange != _meleeRange);
            if (condition)
            {
                Main.LogDebug("Backing up");
                _isBackingUp = true;
                var pos = 1;
                if (Me.IsAlive && ObjectManager.Target.IsAlive && pos == 1)
                {
                    Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 15f);
                    MovementManager.Go(PathFinder.FindPath(position), false);

                    while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Target.GetDistance < 10f && ObjectManager.Target.IsAlive &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")))
                    {
                        // Wait follow path
                        Thread.Sleep(200);
                        if (_settings.BlinkWhenBackup)
                        {
                            if (Cast(Blink))
                            {
                                Main.LogDebug("Blink away");
                            }
                        }
                        pos = 0;
                    }
                    _isBackingUp = false;
                }
            }
        };

        Rotation();
    }
Пример #2
0
 public static void ShowConfiguration()
 {
     ZEMageSettings.Load();
     ZEMageSettings.CurrentSetting.ToForm();
     ZEMageSettings.CurrentSetting.Save();
 }
Пример #3
0
    public static void Initialize()
    {
        Main.SetRange(_distanceRange);
        Main.Log("Initialized.");
        ZEMageSettings.Load();
        _settings = ZEMageSettings.CurrentSetting;
        Talents.InitTalents(_settings.AssignTalents, _settings.UseDefaultTalents, _settings.TalentCodes);

        // Fight end
        FightEvents.OnFightEnd += (ulong guid) =>
        {
            _isBackingUp = false;
            _iCanUseWand = false;
            _usingWand   = false;
            _polymorphableEnemyInThisFight = false;
            _isPolymorphing = false;
            Main.SetRange(_distanceRange);

            if (!Fight.InFight &&
                Me.InCombatFlagOnly &&
                _polymorphedEnemy != null &&
                ObjectManager.GetNumberAttackPlayer() < 1 &&
                _polymorphedEnemy.IsAlive)
            {
                Main.Log($"Starting fight with {_polymorphedEnemy.Name} (polymorphed)");
                Fight.InFight       = false;
                Fight.CurrentTarget = _polymorphedEnemy;
                ulong _enemyGUID = _polymorphedEnemy.Guid;
                _polymorphedEnemy = null;
                Fight.StartFight(_enemyGUID);
            }
        };

        // Fight start
        FightEvents.OnFightStart += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            _iCanUseWand = ToolBox.HaveRangedWeaponEquipped();
        };

        // Fight Loop
        FightEvents.OnFightLoop += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            // Do we need to backup?
            if ((ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                ObjectManager.Target.GetDistance < 10f &&
                Me.IsAlive &&
                ObjectManager.Target.IsAlive &&
                !_isBackingUp &&
                !Me.IsCast &&
                !Main.CurrentRangeIsMelee() &&
                ObjectManager.Target.HealthPercent > 5 &&
                !_isPolymorphing)
            {
                _isBackingUp = true;
                int limiter = 0;

                // Using CTM
                if (_settings.BackupUsingCTM)
                {
                    Vector3 position = ToolBox.BackofVector3(Me.Position, Me, 15f);
                    MovementManager.Go(PathFinder.FindPath(position), false);
                    Thread.Sleep(500);

                    // Backup loop
                    while (MovementManager.InMoveTo &&
                           Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Target.GetDistance < 15f &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           (ObjectManager.Target.HaveBuff("Frostbite") || ObjectManager.Target.HaveBuff("Frost Nova")) &&
                           limiter < 10)
                    {
                        // Wait follow path
                        Thread.Sleep(300);
                        limiter++;
                        if (_settings.BlinkWhenBackup)
                        {
                            Cast(Blink);
                        }
                    }
                }
                // Using Keyboard
                else
                {
                    while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           ObjectManager.Me.IsAlive &&
                           ObjectManager.Target.IsAlive &&
                           ObjectManager.Target.GetDistance < 15f &&
                           limiter <= 6)
                    {
                        Move.Backward(Move.MoveAction.PressKey, 500);
                        limiter++;
                    }
                }
                _isBackingUp = false;
            }

            // Polymorph
            if (_settings.UsePolymorph &&
                ObjectManager.GetNumberAttackPlayer() > 1 &&
                Polymorph.KnownSpell &&
                !_isBackingUp &&
                _polymorphableEnemyInThisFight)
            {
                WoWUnit myNearbyPolymorphed = null;
                // Detect if a polymorph cast has succeeded
                if (_polymorphedEnemy != null)
                {
                    myNearbyPolymorphed = ObjectManager.GetObjectWoWUnit().Find(u => u.HaveBuff("Polymorph") && u.Guid == _polymorphedEnemy.Guid);
                }

                // If we don't have a polymorphed enemy
                if (myNearbyPolymorphed == null)
                {
                    _polymorphedEnemy = null;
                    _isPolymorphing   = true;
                    WoWUnit firstTarget = ObjectManager.Target;
                    WoWUnit potentialPolymorphTarget = null;

                    // Select our attackers one by one for potential polymorphs
                    foreach (WoWUnit enemy in ObjectManager.GetUnitAttackPlayer())
                    {
                        Interact.InteractGameObject(enemy.GetBaseAddress);

                        if ((enemy.CreatureTypeTarget == "Beast" || enemy.CreatureTypeTarget == "Humanoid") &&
                            enemy.Guid != firstTarget.Guid)
                        {
                            potentialPolymorphTarget = enemy;
                            break;
                        }
                    }

                    if (potentialPolymorphTarget == null)
                    {
                        _polymorphableEnemyInThisFight = false;
                    }

                    // Polymorph cast
                    if (potentialPolymorphTarget != null && _polymorphedEnemy == null)
                    {
                        Interact.InteractGameObject(potentialPolymorphTarget.GetBaseAddress);
                        while (!Cast(Polymorph) &&
                               ObjectManager.Target.IsAlive &&
                               ObjectManager.Me.IsAlive &&
                               Main._isLaunched &&
                               !Products.InPause)
                        {
                            Thread.Sleep(200);
                        }
                        _polymorphedEnemy = potentialPolymorphTarget;
                        Usefuls.WaitIsCasting();
                        Thread.Sleep(500);
                    }

                    // Get back to actual target
                    Interact.InteractGameObject(firstTarget.GetBaseAddress);
                    _isPolymorphing = false;
                }
            }
        };

        Rotation();
    }