Esempio n. 1
0
        /// <summary>
        /// ログを読取った
        /// </summary>
        /// <param name="isImport">インポートログか?</param>
        /// <param name="logInfo">ログ情報</param>
        private void oFormActMain_OnLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            if (isImport)
            {
                return;
            }

            var player = FF14PluginHelper.GetPlayer();

            if (player == null)
            {
                return;
            }

            if (logInfo.logLine.Contains(player.Name + "に「アストラルファイア」の効果。") ||
                logInfo.logLine.Contains(player.Name + "に「アストラルファイアII」の効果。") ||
                logInfo.logLine.Contains(player.Name + "に「アストラルファイアIII」の効果。"))
            {
                this.CurrentMPRecoveryStatus = MPRecoveryStatus.AstralFire;
            }

            if (logInfo.logLine.Contains(player.Name + "に「アンブラルブリザード」の効果。"))
            {
                this.CurrentMPRecoveryStatus = MPRecoveryStatus.UmbralIce1;
            }

            if (logInfo.logLine.Contains(player.Name + "に「アンブラルブリザードII」の効果。"))
            {
                this.CurrentMPRecoveryStatus = MPRecoveryStatus.UmbralIce2;
            }

            if (logInfo.logLine.Contains(player.Name + "に「アンブラルブリザードIII」の効果。"))
            {
                this.CurrentMPRecoveryStatus = MPRecoveryStatus.UmbralIce3;
            }

            if (logInfo.logLine.Contains(player.Name + "に「賢人のバラード」の効果。"))
            {
                this.BalladEnabled = true;
            }

            if (logInfo.logLine.Contains(player.Name + "の「アストラルファイア」が切れた。") ||
                logInfo.logLine.Contains(player.Name + "の「アストラルファイアII」が切れた。") ||
                logInfo.logLine.Contains(player.Name + "の「アストラルファイアIII」が切れた。") ||
                logInfo.logLine.Contains(player.Name + "の「アンブラルブリザード」が切れた。") ||
                logInfo.logLine.Contains(player.Name + "の「アンブラルブリザードII」が切れた。") ||
                logInfo.logLine.Contains(player.Name + "の「アンブラルブリザードIII」が切れた。"))
            {
                this.CurrentMPRecoveryStatus = MPRecoveryStatus.Normal;
            }

            if (logInfo.logLine.Contains(player.Name + "の「賢人のバラード」が切れた。"))
            {
                this.BalladEnabled = false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// MP回復スパンを監視する
        /// </summary>
        public void WacthMPRecovery()
        {
            FF14PluginHelper.RefreshPlayer();
            var player = FF14PluginHelper.GetPlayer();

            if (player == null)
            {
                this.ExistPlayer = false;
                return;
            }

            this.ExistPlayer = true;

            // ジョブ指定?
            if (Settings.Default.TargetJobId != 0)
            {
                this.ExistPlayer = player.Job == Settings.Default.TargetJobId;
                if (!this.ExistPlayer)
                {
                    return;
                }
            }

            // 戦闘中のみ稼働させる?
            if (Settings.Default.CountInCombat)
            {
                // MPが満タンになった?
                if (player.CurrentMP > this.PreviousMP &&
                    player.CurrentMP >= player.MaxMP)
                {
                    this.LastMPFullDateTime = DateTime.Now;
                }

                // 現在がMP満タン状態?
                if (player.CurrentMP >= player.MaxMP ||
                    this.PreviousMP < 0)
                {
                    // 前回の満タンから20秒以上経過した?
                    if ((DateTime.Now - this.LastMPFullDateTime).TotalSeconds >=
                        Settings.Default.CountInCombatSpan)
                    {
                        this.InCombat = false;
                    }
                }
                else
                {
                    this.InCombat = true;
                }
            }

            // プレイヤーのステータスを取得する
            var playerStatus = FF14PluginHelper.GetPlayerData();

            var now = DateTime.Now;

            // MPが回復している?
            if (player.CurrentMP > this.PreviousMP)
            {
                // 現在のプレイヤー状態を辞書向けのキーに変換する
                var key = playerStatus.Pie.ToString() + "-" + this.CurrentMPRecoveryStatus.ToString();

                // 今回で満タンではない?
                if (this.PreviousMP > -1 &&
                    player.CurrentMP < player.MaxMP)
                {
                    // 回復量を算出する
                    var mpRecoveryValue = player.CurrentMP - this.PreviousMP;

                    // バラード中ではなくアストラルファイア中でもない?
                    if (!this.BalladEnabled &&
                        this.CurrentMPRecoveryStatus != MPRecoveryStatus.AstralFire)
                    {
                        // 現在の状態の回復量を記録する
                        this.MPRecoveryValueDictionary[key] = mpRecoveryValue;
                    }

                    // 今の状態の回復量の辞書がある?
                    if (this.MPRecoveryValueDictionary.ContainsKey(key))
                    {
                        // アストラファイア中ではない?
                        if (this.CurrentMPRecoveryStatus != MPRecoveryStatus.AstralFire)
                        {
                            // 記録された回復量と今回の回復量が一致する?
                            if (mpRecoveryValue == this.MPRecoveryValueDictionary[key])
                            {
                                this.LastRecoveryDateTime = now;
                                this.NextRecoveryDateTime = this.LastRecoveryDateTime.AddSeconds(3d);
                            }
                        }
                    }
                }
            }

            // 回復までの残り時間を算出する
            var remain = (this.NextRecoveryDateTime - now).TotalMilliseconds;

            // 回復までの時間が過ぎている?
            if (remain <= 0.0d)
            {
                this.LastRecoveryDateTime = now.AddMilliseconds(remain);
                this.NextRecoveryDateTime = this.LastRecoveryDateTime.AddSeconds(3d);
            }

            if (remain < 0d)
            {
                remain = 0d;
            }

            this.TimeOfRecovery = Convert.ToInt32(remain);

            // 回復までの残り時間の割合を算出する
            this.RateOfRecovery = (decimal)(3000 - this.TimeOfRecovery) / 3000m;

            // 現在のMPを保存する
            this.PreviousMP = player.CurrentMP;
        }