示例#1
0
        /// <summary>
        /// 表示切り替えボタン(スペスペボタン)の状態を切り替える
        /// </summary>
        /// <param name="visible">
        /// 切り替える状態</param>
        public static void ChangeSwitchVisibleButton(
            bool visible)
        {
            Settings.Default.OverlayVisible = visible;
            Settings.Default.Save();

            SpellTimerCore.Default.ClosePanels();
            OnePointTelopController.CloseTelops();

            FF14PluginHelper.RefreshPlayer();
            LogBuffer.RefreshPartyList();
            LogBuffer.RefreshPetID();

            if (Settings.Default.OverlayVisible)
            {
                SpellTimerCore.Default.ActivatePanels();
                OnePointTelopController.ActivateTelops();
            }

            ActInvoker.Invoke(() =>
            {
                if (Settings.Default.OverlayVisible)
                {
                    SwitchVisibleButton.BackColor = Color.OrangeRed;
                    SwitchVisibleButton.ForeColor = Color.WhiteSmoke;
                }
                else
                {
                    SwitchVisibleButton.BackColor = SystemColors.Control;
                    SwitchVisibleButton.ForeColor = Color.Black;
                }
            });
        }
示例#2
0
        /// <summary>
        /// 表示切り替えボタンを配置する
        /// </summary>
        private void SetSwitchVisibleButton()
        {
            var changeColor = new Action <Button>((button) =>
            {
                if (Settings.Default.OverlayVisible)
                {
                    button.BackColor = Color.OrangeRed;
                    button.ForeColor = Color.WhiteSmoke;
                }
                else
                {
                    button.BackColor = SystemColors.Control;
                    button.ForeColor = Color.Black;
                }
            });

            SwitchVisibleButton           = new Button();
            SwitchVisibleButton.Name      = "SpecialSpellTimerSwitchVisibleButton";
            SwitchVisibleButton.Size      = new Size(90, 24);
            SwitchVisibleButton.Text      = Utility.Translate.Get("SupeSupe");
            SwitchVisibleButton.TextAlign = ContentAlignment.MiddleCenter;
            SwitchVisibleButton.UseVisualStyleBackColor = true;
            SwitchVisibleButton.Click += (s, e) =>
            {
                var button = s as Button;

                Settings.Default.OverlayVisible = !Settings.Default.OverlayVisible;
                Settings.Default.Save();

                SpellTimerCore.Default.ClosePanels();
                OnePointTelopController.CloseTelops();

                FF14PluginHelper.RefreshPlayer();
                LogBuffer.RefreshPartyList();
                LogBuffer.RefreshPetID();

                if (Settings.Default.OverlayVisible)
                {
                    SpellTimerCore.Default.ActivatePanels();
                    OnePointTelopController.ActivateTelops();
                }

                changeColor(s as Button);
            };

            changeColor(SwitchVisibleButton);

            ActGlobals.oFormActMain.Resize += this.oFormActMain_Resize;
            ActGlobals.oFormActMain.Controls.Add(SwitchVisibleButton);
            ActGlobals.oFormActMain.Controls.SetChildIndex(SwitchVisibleButton, 1);

            this.oFormActMain_Resize(this, null);
        }
示例#3
0
        /// <summary>
        /// Commandとマッチングする
        /// </summary>
        /// <param name="logLines">
        /// ログ行</param>
        public static void MatchCommand(
            IReadOnlyList <string> logLines)
        {
            var commandDone = false;

            foreach (var log in logLines)
            {
                // 正規表現の前にキーワードがなければ抜けてしまう
                if (!log.ToLower().Contains("/spespe"))
                {
                    continue;
                }

                var match = regexCommand.Match(log);
                if (!match.Success)
                {
                    continue;
                }

                var command     = match.Groups["command"].ToString().ToLower();
                var target      = match.Groups["target"].ToString().ToLower();
                var windowname  = match.Groups["windowname"].ToString().Replace(@"""", string.Empty);
                var valueAsText = match.Groups["value"].ToString();
                var value       = false;
                if (!bool.TryParse(valueAsText, out value))
                {
                    value = false;
                }

                switch (command)
                {
                case "analyze":
                    switch (target)
                    {
                    case "on":
                        SpecialSpellTimerPlugin.ConfigPanel.CombatAnalyzerEnabled = true;
                        commandDone = true;
                        break;

                    case "off":
                        SpecialSpellTimerPlugin.ConfigPanel.CombatAnalyzerEnabled = false;
                        commandDone = true;
                        break;
                    }

                    break;

                case "refresh":
                    switch (target)
                    {
                    case "spells":
                        SpellTimerCore.Default.ClosePanels();
                        commandDone = true;
                        break;

                    case "telops":
                        OnePointTelopController.CloseTelops();
                        commandDone = true;
                        break;

                    case "me":
                        FF14PluginHelper.RefreshPlayer();
                        commandDone = true;
                        break;

                    case "pt":
                        LogBuffer.RefreshPartyList();
                        commandDone = true;
                        break;

                    case "pet":
                        LogBuffer.RefreshPetID();
                        commandDone = true;
                        break;
                    }

                    break;

                case "changeenabled":
                    var changed = false;
                    switch (target)
                    {
                    case "spells":
                        foreach (var spell in SpellTimerTable.Table)
                        {
                            if (spell.Panel.Trim().ToLower() == windowname.Trim().ToLower() ||
                                spell.SpellTitle.Trim().ToLower() == windowname.Trim().ToLower() ||
                                windowname.Trim().ToLower() == "all")
                            {
                                changed       = true;
                                spell.Enabled = value;
                            }
                        }

                        if (changed)
                        {
                            ActInvoker.Invoke(() =>
                            {
                                SpecialSpellTimerPlugin.ConfigPanel.LoadSpellTimerTable();
                            });

                            commandDone = true;
                        }

                        break;

                    case "telops":
                        foreach (var telop in OnePointTelopTable.Default.Table)
                        {
                            if (telop.Title.Trim().ToLower() == windowname.Trim().ToLower() ||
                                windowname.Trim().ToLower() == "all")
                            {
                                changed       = true;
                                telop.Enabled = value;
                            }
                        }

                        if (changed)
                        {
                            ActInvoker.Invoke(() =>
                            {
                                SpecialSpellTimerPlugin.ConfigPanel.LoadTelopTable();
                            });

                            commandDone = true;
                        }

                        break;
                    }

                    break;

                case "set":
                    switch (target)
                    {
                    case "placeholder":
                        if (windowname.Trim().ToLower() != "all" &&
                            windowname.Trim() != string.Empty &&
                            valueAsText.Trim() != string.Empty)
                        {
                            LogBuffer.SetCustomPlaceholder(windowname.Trim(), valueAsText.Trim());

                            commandDone = true;
                        }

                        break;
                    }

                    break;

                case "clear":
                    switch (target)
                    {
                    case "placeholder":
                        if (windowname.Trim().ToLower() == "all")
                        {
                            LogBuffer.ClearCustomPlaceholderAll();

                            commandDone = true;
                        }
                        else if (windowname.Trim() != string.Empty)
                        {
                            LogBuffer.ClearCustomPlaceholder(windowname.Trim());

                            commandDone = true;
                        }

                        break;
                    }

                    break;

                case "on":
                    SpecialSpellTimerPlugin.ChangeSwitchVisibleButton(true);
                    commandDone = true;
                    break;

                case "off":
                    SpecialSpellTimerPlugin.ChangeSwitchVisibleButton(false);
                    commandDone = true;
                    break;
                }
            }   // loop end logLines

            // コマンドを実行したらシステム音を鳴らす
            if (commandDone)
            {
                SystemSounds.Asterisk.Play();
            }
        }   // method end
示例#4
0
        /// <summary>
        /// ログ行を返す
        /// </summary>
        /// <returns>
        /// ログ行の配列</returns>
        public IReadOnlyList <string> GetLogLines()
        {
            var playerRefreshed = false;
            var partyRefreshed  = false;

            // 最後のログから1min間が空いた?
            if ((DateTime.Now - this.lastLogineTimestamp).TotalMinutes >= 1.0d)
            {
                FF14PluginHelper.RefreshPlayer();
                playerRefreshed = true;

                RefreshPartyList();
                partyRefreshed = true;
            }

            if (logInfoQueue.IsEmpty)
            {
                return(EMPTY_STRING_LIST);
            }

            var list         = new List <string>(logInfoQueue.Count);
            var partyChanged = false;
            var jobChanged   = false;
            var summoned     = false;
            var zoneChanged  = false;

            LogLineEventArgs logInfo;

            while (logInfoQueue.TryDequeue(out logInfo))
            {
                string logLine = logInfo.logLine.Trim();
                // ジョブに変化あり?
                if (!jobChanged)
                {
                    if (IsJobChanged(logLine))
                    {
                        jobChanged = true;
                        if (!playerRefreshed)
                        {
                            FF14PluginHelper.RefreshPlayer();
                            playerRefreshed = true;
                        }

                        if (!partyRefreshed)
                        {
                            RefreshPartyList();
                            partyRefreshed = true;
                        }
                    }
                }

                // パーティに変化あり
                if (!partyChanged)
                {
                    if (IsPartyChanged(logLine))
                    {
                        partyChanged = true;
                    }
                }

                if (!(summoned && zoneChanged))
                {
                    // ペットIDのCacheを更新する
                    var player = FF14PluginHelper.GetPlayer();
                    if (player != null)
                    {
                        var jobName = Job.GetJobName(player.Job);
                        if (player.AsJob().IsSummoner())
                        {
                            if (logLine.Contains(player.Name + "の「サモン") ||
                                logLine.Contains("You cast Summon"))
                            {
                                summoned = true;
                            }

                            if (petIdCheckedZone != ActGlobals.oFormActMain.CurrentZone)
                            {
                                zoneChanged = true;
                            }
                        }
                    }
                }

                list.Add(logLine);
                // ログファイルに出力する
                this.AppendLogFile(logLine);
            }

            if (partyChanged)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(5));
                    RefreshPartyList();
                });
            }

            if (summoned)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(5));
                    RefreshPetID();
                });
            }

            if (zoneChanged)
            {
                var oldSource = petIdRefreshTaskCancelTokenSource;
                if (oldSource != null)
                {
                    lock (oldSource)
                    {
                        if (!oldSource.IsCancellationRequested)
                        {
                            try
                            {
                                oldSource.Cancel();
                            }
                            catch { }
                        }
                    }
                }

                var newSource = petIdRefreshTaskCancelTokenSource = new CancellationTokenSource();
                var token     = newSource.Token;
                var count     = 0;

                Task.Run(async() =>
                {
                    while (petIdCheckedZone != ActGlobals.oFormActMain.CurrentZone)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(15));

                        RefreshPetID();
                        count++;

                        if (count >= 6)
                        {
                            return;
                        }
                    }
                }, token);
            }

            // ログのタイムスタンプを記録する
            this.lastLogineTimestamp = DateTime.Now;

            return(list);
        }
        /// <summary>
        /// ログを一行読取った
        /// </summary>
        /// <param name="isImport">Importか?</param>
        /// <param name="logInfo">ログ情報</param>
        private void oFormActMain_OnLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            if (isImport)
            {
                return;
            }

#if false
            Debug.WriteLine(logInfo.logLine);
#endif

            var logLine = logInfo.logLine.Trim();

            // ジョブに変化あり?
            if (logLine.Contains("にチェンジした。") || logLine.Contains("You change to "))
            {
                FF14PluginHelper.RefreshPlayer();
            }

            // パーティに変化あり?
            if (ptmember == null ||
                logLine.Contains("パーティを解散しました。") ||
                logLine.Contains("がパーティに参加しました。") ||
                logLine.Contains("がパーティから離脱しました。") ||
                logLine.Contains("をパーティから離脱させました。") ||
                logLine.Contains("の攻略を開始した。") ||
                logLine.Contains("の攻略を終了した。") ||
                (logLine.Contains("You join ") && logLine.Contains("'s party.")) ||
                logLine.Contains("You left the party.") ||
                logLine.Contains("You dissolve the party.") ||
                logLine.Contains("The party has been disbanded.") ||
                logLine.Contains("joins the party.") ||
                logLine.Contains("has left the party.") ||
                logLine.Contains("was removed from the party."))
            {
                Task.Run(() =>
                {
                    Thread.Sleep(5 * 1000);
                    RefreshPTList();
                }).ContinueWith((t) =>
                {
                    t.Dispose();
                });
            }

            // ペットIDのCacheを更新する
            var player = FF14PluginHelper.GetPlayer();
            if (player != null)
            {
                var jobName = Job.GetJobName(player.Job);
                Debug.WriteLine("JOB NAME!! " + jobName);
                if (jobName == "巴術士" || jobName == "ARC" ||
                    jobName == "学者" || jobName == "SCH" ||
                    jobName == "召喚士" || jobName == "SMN")
                {
                    if (logLine.Contains(player.Name + "の「サモン") || logLine.Contains("You cast Summon"))
                    {
                        Task.Run(() =>
                        {
                            Thread.Sleep(5 * 1000);
                            RefreshPetID();
                        }).ContinueWith((t) =>
                        {
                            t.Dispose();
                        });
                    }

                    if (petidZone != ActGlobals.oFormActMain.CurrentZone)
                    {
                        Task.Run(() =>
                        {
                            lock (lockPetidObject)
                            {
                                var count = 0;
                                while (petidZone != ActGlobals.oFormActMain.CurrentZone)
                                {
                                    Thread.Sleep(15 * 1000);
                                    RefreshPetID();
                                    count++;

                                    if (count >= 6)
                                    {
                                        petidZone = ActGlobals.oFormActMain.CurrentZone;
                                        break;
                                    }
                                }
                            }
                        }).ContinueWith((t) =>
                        {
                            t.Dispose();
                        });
                    }
                }
            }

            lock (this.buffer)
            {
                this.buffer.Add(logLine);
            }
        }
示例#6
0
        /// <summary>
        /// ログを一行読取った
        /// </summary>
        /// <param name="isImport">Importか?</param>
        /// <param name="logInfo">ログ情報</param>
        private void oFormActMain_OnLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            if (isImport)
            {
                return;
            }

#if false
            Debug.WriteLine(logInfo.logLine);
#endif

            var logLine = logInfo.logLine.Trim();

            // 最後のログから1min間が空いた?
            if ((DateTime.Now - this.lastLogineTimestamp).TotalMinutes >= 1.0d)
            {
                FF14PluginHelper.RefreshPlayer();
                RefreshPTList();
            }

            // ジョブに変化あり?
            if (logLine.Contains("にチェンジした。") ||
                logLine.Contains("You change to "))
            {
                FF14PluginHelper.RefreshPlayer();
                RefreshPTList();
            }

            // パーティに変化あり?
            if (enabledPartyMemberPlaceHolder)
            {
                if (ptmember == null ||
                    replacementsByJobs == null ||
                    logLine.Contains("パーティを解散しました。") ||
                    logLine.Contains("がパーティに参加しました。") ||
                    logLine.Contains("がパーティから離脱しました。") ||
                    logLine.Contains("をパーティから離脱させました。") ||
                    logLine.Contains("の攻略を開始した。") ||
                    logLine.Contains("の攻略を終了した。") ||
                    (logLine.Contains("You join ") && logLine.Contains("'s party.")) ||
                    logLine.Contains("You left the party.") ||
                    logLine.Contains("You dissolve the party.") ||
                    logLine.Contains("The party has been disbanded.") ||
                    logLine.Contains("joins the party.") ||
                    logLine.Contains("has left the party.") ||
                    logLine.Contains("was removed from the party."))
                {
                    Task.Run(() =>
                    {
                        Thread.Sleep(5 * 1000);
                        RefreshPTList();
                    });
                }
            }

            // ペットIDのCacheを更新する
            var player = FF14PluginHelper.GetPlayer();
            if (player != null)
            {
                var jobName = Job.GetJobName(player.Job);
#if DEBUG
                Debug.WriteLine("JOB NAME!! " + jobName);
#endif
                if (jobName == "巴術士" || jobName == "ARC" ||
                    jobName == "学者" || jobName == "SCH" ||
                    jobName == "召喚士" || jobName == "SMN")
                {
                    if (logLine.Contains(player.Name + "の「サモン") ||
                        logLine.Contains("You cast Summon"))
                    {
                        Task.Run(() =>
                        {
                            Thread.Sleep(5 * 1000);
                            RefreshPetID();
                        });
                    }

                    if (petidZone != ActGlobals.oFormActMain.CurrentZone)
                    {
                        Task.Run(() =>
                        {
                            lock (lockPetidObject)
                            {
                                var count = 0;
                                while (petidZone != ActGlobals.oFormActMain.CurrentZone)
                                {
                                    Thread.Sleep(15 * 1000);
                                    RefreshPetID();
                                    count++;

                                    if (count >= 6)
                                    {
                                        petidZone = ActGlobals.oFormActMain.CurrentZone;
                                        break;
                                    }
                                }
                            }
                        });
                    }
                }
            }

            lock (this.buffer)
            {
                this.buffer.Add(logLine);

                // ログのタイムスタンプを記録する
                this.lastLogineTimestamp = DateTime.Now;
            }

            // ログファイルに出力する
            this.AppendLogFile(logLine);
        }
示例#7
0
        /// <summary>
        /// ログ行を返す
        /// </summary>
        /// <returns>ログ行の配列</returns>
        public IReadOnlyList <string> GetLogLines()
        {
            var playerRefreshed = false;
            var partyRefreshed  = false;

            // 最後のログから1min間が空いた?
            if ((DateTime.Now - this.lastLogineTimestamp).TotalMinutes >= 1.0d)
            {
                FF14PluginHelper.RefreshPlayer();
                playerRefreshed = true;

                RefreshPartyList();
                partyRefreshed = true;
            }

            if (logInfoQueue.IsEmpty)
            {
                return(EMPTY_STRING_LIST);
            }

            var list              = new List <string>(logInfoQueue.Count);
            var playerChanged     = false;
            var partyChanged      = false;
            var jobChanged        = false;
            var summoned          = false;
            var zoneChanged       = false;
            var partyChangedAtDQX = false;

            LogLineEventArgs logInfo;

            while (logInfoQueue.TryDequeue(out logInfo))
            {
                var logLine = logInfo.logLine.Trim();

                // エフェクトに付与されるツールチップ文字を除去する
                if (Settings.Default.RemoveTooltipSymbols)
                {
                    logLine = TooltipCharsRegex.Replace(logLine, string.Empty);
                }

                // FFXIVでの使用?
                if (!Settings.Default.UseOtherThanFFXIV)
                {
                    // プレイヤーに変化あり?
                    if (!playerChanged)
                    {
                        if (IsPlayerChanged(logInfo.logLine))
                        {
                            if (!playerRefreshed)
                            {
                                FF14PluginHelper.RefreshPlayer();
                                playerRefreshed = true;
                            }

                            if (!partyRefreshed)
                            {
                                RefreshPartyList();
                                partyRefreshed = true;
                            }

                            Logger.Write("primary player changed.");

                            playerChanged = true;
                        }
                    }

                    // ジョブに変化あり?
                    if (!jobChanged)
                    {
                        if (IsJobChanged(logLine))
                        {
                            jobChanged = true;
                            if (!playerRefreshed)
                            {
                                FF14PluginHelper.RefreshPlayer();
                                playerRefreshed = true;
                            }

                            if (!partyRefreshed)
                            {
                                RefreshPartyList();
                                partyRefreshed = true;
                            }
                        }
                    }

                    // パーティに変化あり
                    if (!partyChanged)
                    {
                        if (IsPartyChanged(logLine))
                        {
                            partyChanged = true;
                        }
                    }

                    if (!(summoned && zoneChanged))
                    {
                        // ペットIDのCacheを更新する
                        var player = FF14PluginHelper.GetPlayer();
                        if (player != null)
                        {
                            var job = player.AsJob();
                            if (job != null)
                            {
                                if (player.AsJob().IsSummoner())
                                {
                                    if (logLine.Contains(player.Name + "の「サモン") ||
                                        logLine.Contains("You cast Summon"))
                                    {
                                        summoned = true;
                                    }

                                    if (petIdCheckedZone != ActGlobals.oFormActMain.CurrentZone)
                                    {
                                        zoneChanged = true;
                                    }
                                }
                            }
                        }
                    }
                }

                // パーティに変化があるか?(対DQX)
                var r = DQXUtility.IsPartyChanged(logLine);
                if (!partyChangedAtDQX)
                {
                    partyChangedAtDQX = r;
                }

                list.Add(logLine);

                // ログファイルに出力する
                this.AppendLogFile(logLine);
            }

            if (partyChanged)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(5));
                    RefreshPartyList();
                });
            }

            if (partyChangedAtDQX)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(1));
                    DQXUtility.RefeshKeywords();
                });
            }

            if (summoned)
            {
                Task.Run(async() =>
                {
                    await Task.Delay(TimeSpan.FromSeconds(5));
                    RefreshPetID();
                });
            }

            if (zoneChanged)
            {
                var oldSource = petIdRefreshTaskCancelTokenSource;
                if (oldSource != null)
                {
                    lock (oldSource)
                    {
                        if (!oldSource.IsCancellationRequested)
                        {
                            try
                            {
                                oldSource.Cancel();
                            }
                            catch { }
                        }
                    }
                }

                var newSource = petIdRefreshTaskCancelTokenSource = new CancellationTokenSource();
                var token     = newSource.Token;
                var count     = 0;

                Task.Run(async() =>
                {
                    while (petIdCheckedZone != ActGlobals.oFormActMain.CurrentZone)
                    {
                        await Task.Delay(TimeSpan.FromSeconds(15));

                        RefreshPetID();
                        count++;

                        if (count >= 6)
                        {
                            return;
                        }
                    }
                }, token);
            }

            // ログのタイムスタンプを記録する
            this.lastLogineTimestamp = DateTime.Now;

            return(list);
        }