Example #1
0
 public static bool Load()
 {
     try
     {
         if (File.Exists(AdviserFilePathAndName("WholesomeTBCDruid",
             ObjectManager.Me.Name + "." + Usefuls.RealmName)))
         {
             CurrentSetting = Load<ZEDruidSettings>(
                 AdviserFilePathAndName("WholesomeTBCDruid",
                 ObjectManager.Me.Name + "." + Usefuls.RealmName));
             return true;
         }
         CurrentSetting = new ZEDruidSettings();
     }
     catch (Exception e)
     {
         Logging.WriteError("WholesomeTBCDruid > Load(): " + e);
     }
     return false;
 }
 public static void ShowConfiguration()
 {
     ZEDruidSettings.Load();
     ZEDruidSettings.CurrentSetting.ToForm();
     ZEDruidSettings.CurrentSetting.Save();
 }
    public static void Initialize()
    {
        Main.Log("Initialized");
        Main.SetRange(_pullRange);

        ZEDruidSettings.Load();
        _settings = ZEDruidSettings.CurrentSetting;

        Talents.InitTalents(_settings.AssignTalents, _settings.UseDefaultTalents, _settings.TalentCodes);

        // Fight end
        FightEvents.OnFightEnd += (ulong guid) =>
        {
            _fightingACaster = false;
            _meleeTimer.Reset();
            _pullMeleeTimer.Reset();
            _stealthApproachTimer.Reset();
            _pullFromAfar = false;
            Main.SetRange(_pullRange);
            _isStealthApproching = false;
        };

        // Fight start
        FightEvents.OnFightStart += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            if (Regrowth.KnownSpell)
            {
                string bearFormSpell = DireBearForm.KnownSpell ? "Dire Bear Form" : "Bear Form";
                _bigHealComboCost = ToolBox.GetSpellCost("Regrowth") + ToolBox.GetSpellCost("Rejuvenation") +
                                    ToolBox.GetSpellCost(bearFormSpell);
                _smallHealComboCost = ToolBox.GetSpellCost("Regrowth") + ToolBox.GetSpellCost(bearFormSpell);
            }
        };

        // Fight Loop
        FightEvents.OnFightLoop += (WoWUnit unit, CancelEventArgs cancelable) =>
        {
            if ((ObjectManager.Target.HaveBuff("Pounce") || ObjectManager.Target.HaveBuff("Maim")) &&
                !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 &&
                           (ObjectManager.Target.HaveBuff("Pounce") || ObjectManager.Target.HaveBuff("Maim")))
                    {
                        // Wait follow path
                        Thread.Sleep(500);
                    }
                }
            }
        };

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

        // BL Hook
        OthersEvents.OnAddBlackListGuid += (ulong guid, int timeInMilisec, bool isSessionBlacklist, CancelEventArgs cancelable) =>
        {
            Main.LogDebug("BL : " + guid + " ms : " + timeInMilisec + " is session: " + isSessionBlacklist);
            if (Me.HaveBuff("Prowl"))
            {
                cancelable.Cancel = true;
            }
        };

        Rotation();
    }