private void OnInitTimer(object sender, ElapsedEventArgs e)
        {
            ActionManager.Start();
            KeyUtils.Start();
            Inventory.Clear();
            MouseOperations.Start();
            _initTimer.Stop();
            _updateTimer.Elapsed -= OnUpdate;
            _updateTimer.Stop();
            ActionManager.SendAction(() =>
            {
                WinUtils.ActivateWindow(Constants.KO_WINDOW);
            }, 0.3f, () =>
            {
                int attempts = 0;
                SkillBar.Reset();
                while (!SkillBar.IsInitialized && attempts++ < MAX_ATTEMPT_INITIALIZE_SKILLBAR)
                {
                    SkillBar.InitSkillsInfo();
                }

                if (SkillBar.IsInitialized)
                {
                    _gos.ForEach(g => { g.Active = true; });

                    Started?.Invoke();
                    _sendStart = false;
                    _updateTimer.Restart();
                    _updateTimer.Elapsed += OnUpdate;
                }
                else
                {
                    Stop();
                    throw new Exception("Failed to initialize SkillBarManager, aborting.");
                }
            });
        }
Example #2
0
        public override void OnEnter()
        {
            base.OnEnter();
            _buffingInProgress = false;
            _currentBuff       = null;
            if (_checkState == null)
            {
                _checkState = (CheckForBuffState)_sm.GetState(EState.CheckForBuff);
                _partyState = (CheckForPartyState)_sm.GetState(EState.CheckForParty);
            }

            if (!SavedData.UseBuffSkills)
            {
                FinishState();
                return;
            }
            else
            {
                SkillBar.InitSkillsInfo();
                _buffsToApply = _checkState.Buffs.Where((b) => { return(b.NeedsRefresh); }).ToList();
                _buffsToApply.Sort(SortBuffs);
                ApplyFirstOrFinish();
            }
        }
Example #3
0
        private void FormDebugSkillBar_Load(object sender, EventArgs e)
        {
            Theme.Changed += UpdateTheme;
            UpdateTheme();
            isInitializing        = true;
            skills                = new List <SkillDebugInfo>();
            skillsInt             = new List <int>();
            initedCursorPos       = false;
            timerUpdate           = new Timer();
            timerUpdate.Interval  = 30;
            timerUpdate.AutoReset = false;
            timerUpdate.Elapsed  += OnUpdate;
            timerUpdate.Disposed += OnDisposed;
            closed                = false;

            skills = new List <SkillDebugInfo>()
            {
                new SkillDebugInfo()
                {
                    lblSkill      = lblSkill1,
                    lblIsOnCd     = lblIsOnCd1,
                    LblPercentage = lblPercentage1,
                    lblCheckPoint = lblCheckPoint1,
                    LblCdColor    = lblCdColor1,
                    LblCurColor   = lblCurrentColor1,
                    PanCdColor    = panCdColor1,
                    PanCurColor   = panCurrentColor1
                },

                new SkillDebugInfo()
                {
                    lblSkill      = lblSkill2,
                    lblIsOnCd     = lblIsOnCd2,
                    LblPercentage = lblPercentage2,
                    lblCheckPoint = lblCheckPoint2,
                    LblCdColor    = lblCdColor2,
                    LblCurColor   = lblCurColor2,
                    PanCdColor    = panCdColor2,
                    PanCurColor   = panCurColor2
                },


                new SkillDebugInfo()
                {
                    lblSkill      = lblSkill3,
                    lblIsOnCd     = lblIsOnCd3,
                    LblPercentage = lblPercent3,
                    lblCheckPoint = lblCheckpoint3,
                    LblCdColor    = lblCdColor3,
                    LblCurColor   = lblCurColor3,
                    PanCdColor    = panCdColor3,
                    PanCurColor   = panCurColor3
                },

                new SkillDebugInfo()
                {
                    lblSkill      = lblSkill4,
                    lblIsOnCd     = lblIsOnCd4,
                    LblPercentage = lblPercent4,
                    lblCheckPoint = lblCheckpoint4,
                    LblCdColor    = lblCdColor4,
                    LblCurColor   = lblCurColor4,
                    PanCdColor    = panCdColor4,
                    PanCurColor   = panCurColor5
                }
            };

            SavedData.Init();
            for (int i = 0; i < 4; i++)
            {
                skillsInt.Add(SavedData.GetAttackSkillAtPos(i));
            }

            SavedData.Init();
            bool initialized = false;
            int  maxAttemps  = 5;
            int  attempts    = 0;

            while (!initialized && attempts++ < maxAttemps)
            {
                SkillBar.InitSkillsInfo();
                initialized = SkillBar.IsInitialized;
            }
            if (SkillBar.IsInitialized)
            {
                timerUpdate.Start();
                isInitializing = false;
            }
            else
            {
                MessageBox.Show("Failed to init skillbar.");
            }
        }