示例#1
0
 public static bool Load()
 {
     try
     {
         if (File.Exists(AdviserFilePathAndName("WholesomeTBCRogue",
                                                ObjectManager.Me.Name + "." + Usefuls.RealmName)))
         {
             CurrentSetting = Load <ZERogueSettings>(
                 AdviserFilePathAndName("WholesomeTBCRogue",
                                        ObjectManager.Me.Name + "." + Usefuls.RealmName));
             return(true);
         }
         CurrentSetting = new ZERogueSettings();
     }
     catch (Exception e)
     {
         Logging.WriteError("WholesomeTBCRogue > Load(): " + e);
     }
     return(false);
 }
 public static void ShowConfiguration()
 {
     ZERogueSettings.Load();
     ZERogueSettings.CurrentSetting.ToForm();
     ZERogueSettings.CurrentSetting.Save();
 }
    public static void Initialize()
    {
        Main.Log("Initialized");
        Main.SetRangeToMelee();
        ZERogueSettings.Load();
        _settings = ZERogueSettings.CurrentSetting;
        Talents.InitTalents(_settings.AssignTalents, _settings.UseDefaultTalents, _settings.TalentCodes);

        // Fight End
        FightEvents.OnFightEnd += (ulong guid) =>
        {
            _meleeTimer.Reset();
            _pullMeleeTimer.Reset();
            _stealthApproachTimer.Reset();
            _fightingACaster     = false;
            _pullFromAfar        = false;
            _isStealthApproching = false;
            _myBestBandage       = null;
            Main.SetRangeToMelee();
        };

        // Fight Start
        FightEvents.OnFightStart += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            _myBestBandage = ToolBox.GetBestMatchingItem(Bandages());
            if (_myBestBandage != null)
            {
                Main.LogDebug("Found best bandage : " + _myBestBandage);
            }
        };

        // We override movement to target when approaching in Stealth
        MovementEvents.OnMoveToPulse += (Vector3 point, CancelEventArgs cancelable) =>
        {
            if (_isStealthApproching &&
                !point.ToString().Equals(ToolBox.BackofVector3(ObjectManager.Target.Position, ObjectManager.Target, 2.5f).ToString()))
            {
                cancelable.Cancel = true;
            }
        };

        // Fight Loop - Go behind target when gouged
        FightEvents.OnFightLoop += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            if (IsTargetStunned() && !MovementManager.InMovement && Me.IsAlive && !Me.IsCast)
            {
                if (Me.IsAlive && ObjectManager.Target.IsAlive)
                {
                    Vector3 position = ToolBox.BackofVector3(ObjectManager.Target.Position, ObjectManager.Target, 2.5f);
                    MovementManager.Go(PathFinder.FindPath(position), false);

                    while (MovementManager.InMovement && Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause &&
                           IsTargetStunned())
                    {
                        // Wait follow path
                        Thread.Sleep(500);
                    }
                }
            }
        };

        // BL Hook
        OthersEvents.OnAddBlackListGuid += (ulong guid, int timeInMilisec, bool isSessionBlacklist, CancelEventArgs cancelable) =>
        {
            if (Me.HaveBuff("Stealth") && !_pullFromAfar)
            {
                Main.LogDebug("BL : " + guid + " ms : " + timeInMilisec + " is session: " + isSessionBlacklist);
                Main.Log("Cancelling Blacklist event");
                cancelable.Cancel = true;
            }
        };

        Rotation();
    }