/// <summary> /// ペットIDを更新する /// </summary> public static void RefreshPetID() { // Combatantリストを取得する var combatant = FF14PluginHelper.GetCombatantList(); if (combatant != null && combatant.Count > 0) { var pet = ( from x in combatant where x.OwnerID == combatant[0].ID && ( x.Name.Contains("フェアリー・") || x.Name.Contains("・エギ") || x.Name.Contains("カーバンクル・") ) select x).FirstOrDefault(); if (pet != null) { petid = Convert.ToString((long)((ulong)pet.ID), 16).ToUpper(); petidZone = ActGlobals.oFormActMain.CurrentZone; // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); } } }
/// <summary> /// カスタムプレースホルダーを全て削除する /// </summary> public static void ClearCustomPlaceholderAll() { customPlaceholders.Clear(); // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); }
/// <summary> /// カスタムプレースホルダーに追加する /// <param name="name">追加するプレースホルダーの名称</param> /// <param name="value">置換する文字列</param> /// </summary> public static void SetCustomPlaceholder(string name, string value) { customPlaceholders.AddOrUpdate(ToCustomPlaceholderKey(name), value, (key, oldValue) => value); // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); }
/// <summary> /// カスタムプレースホルダーを削除する /// <param name="name">削除するプレースホルダーの名称</param> /// </summary> public static void ClearCustomPlaceholder(string name) { customPlaceholders.Remove(name); // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); }
/// <summary> /// カスタムプレースホルダーに追加する /// <param name="name">追加するプレースホルダーの名称</param> /// <param name="value">置換する文字列</param> /// </summary> public static void SetCustomPlaceholder(string name, string value) { customPlaceholders[name] = value; // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); }
/// <summary> /// カスタムプレースホルダーを削除する /// <param name="name">削除するプレースホルダーの名称</param> /// </summary> public static void ClearCustomPlaceholder(string name) { string beforeValue; customPlaceholders.TryRemove(ToCustomPlaceholderKey(name), out beforeValue); // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); }
/// <summary> /// 削除 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void DeleteButton_Click(object sender, EventArgs e) { this.EditSpellsTableBlock(() => { lock (SpellTimerTable.Table) { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { SpellTimerTable.Table.Remove(src); SpellTimerTable.ClearReplacedKeywords(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); this.DetailGroupBox.Visible = false; this.DetailPanelGroupBox.Visible = false; } } }); // 今の選択ノードを取り出す var targetNode = this.SpellTimerTreeView.SelectedNode; if (targetNode != null) { // 1個前のノードを取り出しておく var prevNode = targetNode.PrevNode; if (targetNode.Parent != null && targetNode.Parent.Nodes.Count > 1) { targetNode.Remove(); if (prevNode != null) { this.SpellTimerTreeView.SelectedNode = prevNode; } } else { targetNode.Parent.Remove(); } } // 標準のスペルタイマーへ変更を反映する SpellTimerCore.Default.ApplyToNormalSpellTimer(); }
/// <summary> /// キーワードを再生成する /// </summary> public static void RefeshKeywords() { if (!Settings.Default.DQXUtilityEnabled) { return; } // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); // スペルタイマーの再描画を行う SpellTimerTable.ClearUpdateFlags(); // モニタタブの情報を無効にする SpecialSpellTimerPlugin.ConfigPanel.InvalidatePlaceholders(); }
/// <summary> /// Load /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void ConfigPanel_Load(object sender, EventArgs e) { this.LoadSpellTimerTable(); this.DetailGroupBox.Visible = false; this.DetailPanelGroupBox.Visible = false; // コンボボックスにアイテムを装填する this.MatchSoundComboBox.DataSource = SoundController.Default.EnumlateWave(); this.MatchSoundComboBox.ValueMember = "FullPath"; this.MatchSoundComboBox.DisplayMember = "Name"; this.OverSoundComboBox.DataSource = SoundController.Default.EnumlateWave(); this.OverSoundComboBox.ValueMember = "FullPath"; this.OverSoundComboBox.DisplayMember = "Name"; this.BeforeSoundComboBox.DataSource = SoundController.Default.EnumlateWave(); this.BeforeSoundComboBox.ValueMember = "FullPath"; this.BeforeSoundComboBox.DisplayMember = "Name"; this.TimeupSoundComboBox.DataSource = SoundController.Default.EnumlateWave(); this.TimeupSoundComboBox.ValueMember = "FullPath"; this.TimeupSoundComboBox.DisplayMember = "Name"; this.SpellIconComboBox.DataSource = IconController.Default.EnumlateIcon() .OrderBy(x => x.RelativePath) .ToArray(); this.SpellIconComboBox.ValueMember = "RelativePath"; this.SpellIconComboBox.DisplayMember = "RelativePath"; // イベントを設定する this.SpellTimerTreeView.AfterSelect += this.SpellTimerTreeView_AfterSelect; this.AddButton.Click += this.AddButton_Click; this.UpdateButton.Click += this.UpdateButton_Click; this.DeleteButton.Click += this.DeleteButton_Click; this.Play1Button.Click += (s1, e1) => { SoundController.Default.Play((string)this.MatchSoundComboBox.SelectedValue ?? string.Empty); }; this.Play2Button.Click += (s1, e1) => { SoundController.Default.Play((string)this.OverSoundComboBox.SelectedValue ?? string.Empty); }; this.Play3Button.Click += (s1, e1) => { SoundController.Default.Play((string)this.TimeupSoundComboBox.SelectedValue ?? string.Empty); }; this.Play4Button.Click += (s1, e1) => { SoundController.Default.Play((string)this.BeforeSoundComboBox.SelectedValue ?? string.Empty); }; this.Speak1Button.Click += (s1, e1) => { SoundController.Default.Play(this.MatchTextToSpeakTextBox.Text); }; this.Speak2Button.Click += (s1, e1) => { SoundController.Default.Play(this.OverTextToSpeakTextBox.Text); }; this.Speak3Button.Click += (s1, e1) => { SoundController.Default.Play(this.TimeupTextToSpeakTextBox.Text); }; this.Speak4Button.Click += (s1, e1) => { SoundController.Default.Play(this.BeforeTextToSpeakTextBox.Text); }; this.SpellTimerTreeView.AfterCheck += (s1, e1) => { var source = e1.Node.Tag as SpellTimer; if (source != null) { source.Enabled = e1.Node.Checked; source.UpdateDone = false; } else { foreach (TreeNode node in e1.Node.Nodes) { var sourceChild = node.Tag as SpellTimer; if (sourceChild != null) { sourceChild.Enabled = e1.Node.Checked; } node.Checked = e1.Node.Checked; } } // キャッシュを無効にする SpellTimerTable.ClearReplacedKeywords(); // スペルの有効・無効が変化した際に、標準のスペルタイマーに反映する SpellTimerCore.Default.applyToNormalSpellTimer(); }; this.SelectJobButton.Click += (s1, e1) => { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { using (var f = new SelectJobForm()) { f.JobFilter = src.JobFilter; if (f.ShowDialog(this) == DialogResult.OK) { src.JobFilter = f.JobFilter; // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectJobButton.ForeColor = src.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; } } } }; this.SelectZoneButton.Click += (s1, e1) => { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { using (var f = new SelectZoneForm()) { f.ZoneFilter = src.ZoneFilter; if (f.ShowDialog(this) == DialogResult.OK) { src.ZoneFilter = f.ZoneFilter; // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectZoneButton.ForeColor = src.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; } } } }; this.SetConditionButton.Click += (s1, e1) => { var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { using (var f = new SetConditionForm()) { f.TimersMustRunning = src.TimersMustRunningForStart; f.TimersMustStopping = src.TimersMustStoppingForStart; if (f.ShowDialog(this) == DialogResult.OK) { src.TimersMustRunningForStart = f.TimersMustRunning; src.TimersMustStoppingForStart = f.TimersMustStopping; // 条件設定ボタンの色を変える(未設定:黒、設定有:青) this.SetConditionButton.ForeColor = (src.TimersMustRunningForStart.Length != 0 || src.TimersMustStoppingForStart.Length != 0) ? Color.Blue : Button.DefaultForeColor; } } } }; this.SpellIconComboBox.SelectionChangeCommitted += (s1, e1) => { this.SpellVisualSetting.SpellIcon = (string)this.SpellIconComboBox.SelectedValue; this.SpellVisualSetting.RefreshSampleImage(); }; this.SpellIconSizeUpDown.ValueChanged += (s1, e1) => { this.SpellVisualSetting.SpellIconSize = (int)this.SpellIconSizeUpDown.Value; this.SpellVisualSetting.RefreshSampleImage(); }; this.HideSpellNameCheckBox.CheckedChanged += (s1, e1) => { this.SpellVisualSetting.HideSpellName = this.HideSpellNameCheckBox.Checked; this.SpellVisualSetting.RefreshSampleImage(); }; this.OverlapRecastTimeCheckBox.CheckedChanged += (s1, e1) => { this.SpellVisualSetting.OverlapRecastTime = this.OverlapRecastTimeCheckBox.Checked; this.SpellVisualSetting.RefreshSampleImage(); }; // オプションのロードメソッドを呼ぶ this.LoadOption(); // ワンポイントテロップのロードメソッドを呼ぶ this.LoadOnePointTelop(); // 戦闘アナライザのロードメソッドを呼ぶ this.LoadCombatAnalyzer(); }
/// <summary> /// 更新 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void UpdateButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { if (string.IsNullOrWhiteSpace(this.PanelNameTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellPanelTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (string.IsNullOrWhiteSpace(this.SpellTitleTextBox.Text)) { MessageBox.Show( this, Translate.Get("UpdateSpellNameTitle"), "ACT.SpecialSpellTimer", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } var src = this.DetailGroupBox.Tag as SpellTimer; if (src != null) { src.Panel = this.PanelNameTextBox.Text; src.SpellTitle = this.SpellTitleTextBox.Text; src.SpellIcon = (string)this.SpellIconComboBox.SelectedValue ?? string.Empty; src.SpellIconSize = (int)this.SpellIconSizeUpDown.Value; src.DisplayNo = (int)this.DisplayNoNumericUpDown.Value; src.Keyword = this.KeywordTextBox.Text; src.RegexEnabled = this.RegexEnabledCheckBox.Checked; src.RecastTime = (long)this.RecastTimeNumericUpDown.Value; src.RepeatEnabled = this.RepeatCheckBox.Checked; src.ProgressBarVisible = this.ShowProgressBarCheckBox.Checked; src.KeywordForExtend1 = this.KeywordToExpand1TextBox.Text; src.RecastTimeExtending1 = (long)this.ExpandSecounds1NumericUpDown.Value; src.KeywordForExtend2 = this.KeywordToExpand2TextBox.Text; src.RecastTimeExtending2 = (long)this.ExpandSecounds2NumericUpDown.Value; src.ExtendBeyondOriginalRecastTime = this.ExtendBeyondOriginalRecastTimeCheckBox.Checked; src.UpperLimitOfExtension = (long)this.UpperLimitOfExtensionNumericUpDown.Value; src.MatchSound = (string)this.MatchSoundComboBox.SelectedValue ?? string.Empty; src.MatchTextToSpeak = this.MatchTextToSpeakTextBox.Text; src.OverSound = (string)this.OverSoundComboBox.SelectedValue ?? string.Empty; src.OverTextToSpeak = this.OverTextToSpeakTextBox.Text; src.OverTime = (int)this.OverTimeNumericUpDown.Value; src.BeforeSound = (string)this.BeforeSoundComboBox.SelectedValue ?? string.Empty; src.BeforeTextToSpeak = this.BeforeTextToSpeakTextBox.Text; src.BeforeTime = (int)this.BeforeTimeNumericUpDown.Value; src.TimeupSound = (string)this.TimeupSoundComboBox.SelectedValue ?? string.Empty; src.TimeupTextToSpeak = this.TimeupTextToSpeakTextBox.Text; src.IsReverse = this.IsReverseCheckBox.Checked; src.DontHide = this.DontHideCheckBox.Checked; src.HideSpellName = this.HideSpellNameCheckBox.Checked; src.OverlapRecastTime = this.OverlapRecastTimeCheckBox.Checked; src.ReduceIconBrightness = this.ReduceIconBrightnessCheckBox.Checked; src.ToInstance = this.ToInstanceCheckBox.Checked; src.Font = this.SpellVisualSetting.GetFontInfo(); src.FontColor = this.SpellVisualSetting.FontColor.ToHTML(); src.FontOutlineColor = this.SpellVisualSetting.FontOutlineColor.ToHTML(); src.BarColor = this.SpellVisualSetting.BarColor.ToHTML(); src.BarOutlineColor = this.SpellVisualSetting.BarOutlineColor.ToHTML(); src.BarWidth = this.SpellVisualSetting.BarSize.Width; src.BarHeight = this.SpellVisualSetting.BarSize.Height; src.BackgroundColor = this.SpellVisualSetting.BackgroundColor.ToHTML(); src.BackgroundAlpha = this.SpellVisualSetting.BackgroundColor.A; var panel = SpellTimerTable.Table.Where(x => x.Panel == src.Panel); foreach (var s in panel) { s.BackgroundColor = src.BackgroundColor; } SpellTimerTable.ClearReplacedKeywords(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); this.LoadSpellTimerTable(); // 一度全てのパネルを閉じる SpellTimerCore.Default.ClosePanels(); foreach (TreeNode root in this.SpellTimerTreeView.Nodes) { if (root.Nodes != null) { foreach (TreeNode node in root.Nodes) { var ds = node.Tag as SpellTimer; if (ds != null) { if (ds.ID == src.ID) { this.SpellTimerTreeView.SelectedNode = node; break; } } } } } } } }
/// <summary> /// 追加 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void AddButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Table) { var nr = new SpellTimer(); nr.ID = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.ID) + 1 : 1; nr.guid = Guid.NewGuid(); nr.Panel = "General"; nr.SpellTitle = "New Spell"; nr.SpellIcon = string.Empty; nr.SpellIconSize = 24; nr.ProgressBarVisible = true; nr.FontColor = Settings.Default.FontColor.ToHTML(); nr.FontOutlineColor = Settings.Default.FontOutlineColor.ToHTML(); nr.BarColor = Settings.Default.ProgressBarColor.ToHTML(); nr.BarOutlineColor = Settings.Default.ProgressBarOutlineColor.ToHTML(); nr.FontFamily = Settings.Default.Font.Name; nr.FontSize = Settings.Default.Font.Size; nr.FontStyle = (int)Settings.Default.Font.Style; nr.BarWidth = Settings.Default.ProgressBarSize.Width; nr.BarHeight = Settings.Default.ProgressBarSize.Height; nr.BackgroundColor = Settings.Default.BackgroundColor.ToHTML(); nr.JobFilter = string.Empty; nr.ZoneFilter = string.Empty; nr.TimersMustRunningForStart = new Guid[0]; nr.TimersMustStoppingForStart = new Guid[0]; // 現在選択しているノードの情報を一部コピーする if (this.SpellTimerTreeView.SelectedNode != null) { var baseRow = this.SpellTimerTreeView.SelectedNode.Tag != null ? this.SpellTimerTreeView.SelectedNode.Tag as SpellTimer : this.SpellTimerTreeView.SelectedNode.Nodes[0].Tag as SpellTimer; if (baseRow != null) { nr.Panel = baseRow.Panel; nr.SpellTitle = baseRow.SpellTitle + " New"; nr.SpellIcon = baseRow.SpellIcon; nr.SpellIconSize = baseRow.SpellIconSize; nr.Keyword = baseRow.Keyword; nr.RegexEnabled = baseRow.RegexEnabled; nr.RecastTime = baseRow.RecastTime; nr.KeywordForExtend1 = baseRow.KeywordForExtend1; nr.RecastTimeExtending1 = baseRow.RecastTimeExtending1; nr.KeywordForExtend2 = baseRow.KeywordForExtend2; nr.RecastTimeExtending2 = baseRow.RecastTimeExtending2; nr.ExtendBeyondOriginalRecastTime = baseRow.ExtendBeyondOriginalRecastTime; nr.UpperLimitOfExtension = baseRow.UpperLimitOfExtension; nr.RepeatEnabled = baseRow.RepeatEnabled; nr.ProgressBarVisible = baseRow.ProgressBarVisible; nr.IsReverse = baseRow.IsReverse; nr.FontColor = baseRow.FontColor; nr.FontOutlineColor = baseRow.FontOutlineColor; nr.BarColor = baseRow.BarColor; nr.BarOutlineColor = baseRow.BarOutlineColor; nr.DontHide = baseRow.DontHide; nr.HideSpellName = baseRow.HideSpellName; nr.OverlapRecastTime = baseRow.OverlapRecastTime; nr.ReduceIconBrightness = baseRow.ReduceIconBrightness; nr.FontFamily = baseRow.FontFamily; nr.FontSize = baseRow.FontSize; nr.FontStyle = baseRow.FontStyle; nr.Font = baseRow.Font; nr.BarWidth = baseRow.BarWidth; nr.BarHeight = baseRow.BarHeight; nr.BackgroundColor = baseRow.BackgroundColor; nr.BackgroundAlpha = baseRow.BackgroundAlpha; nr.JobFilter = baseRow.JobFilter; nr.ZoneFilter = baseRow.ZoneFilter; nr.TimersMustRunningForStart = baseRow.TimersMustRunningForStart; nr.TimersMustStoppingForStart = baseRow.TimersMustStoppingForStart; nr.ToInstance = baseRow.ToInstance; } } nr.MatchDateTime = DateTime.MinValue; nr.UpdateDone = false; nr.Enabled = true; nr.DisplayNo = SpellTimerTable.Table.Any() ? SpellTimerTable.Table.Max(x => x.DisplayNo) + 1 : 50; nr.Regex = null; nr.RegexPattern = string.Empty; SpellTimerTable.Table.Add(nr); SpellTimerTable.ClearReplacedKeywords(); SpellTimerTable.RemoveAllInstanceSpells(); SpellTimerTable.Save(); // 新しいノードを生成する var node = new TreeNode(nr.SpellTitle) { Tag = nr, ToolTipText = nr.Keyword, Checked = nr.Enabled }; // 親ノードがあれば追加する foreach (TreeNode item in this.SpellTimerTreeView.Nodes) { if (item.Text == nr.Panel) { item.Nodes.Add(node); this.SpellTimerTreeView.SelectedNode = node; break; } } // 親ノードがなかった if (this.SpellTimerTreeView.SelectedNode != node) { var parentNode = new TreeNode(nr.Panel, new TreeNode[] { node }) { Checked = true }; this.SpellTimerTreeView.Nodes.Add(parentNode); this.SpellTimerTreeView.SelectedNode = node; } // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectZoneButton.ForeColor = nr.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectJobButton.ForeColor = nr.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // 条件設定ボタンの色を変える(未設定:黒、設定有:青) this.SetConditionButton.ForeColor = (nr.TimersMustRunningForStart.Length != 0 || nr.TimersMustStoppingForStart.Length != 0) ? Color.Blue : Button.DefaultForeColor; } // 標準のスペルタイマーへ変更を反映する SpellTimerCore.Default.applyToNormalSpellTimer(); }
/// <summary> /// パーティリストを更新する /// </summary> public static void RefreshPartyList() { // プレイヤー情報を取得する var player = FF14PluginHelper.GetPlayer(); if (player == null) { return; } if (enabledPartyMemberPlaceHolder) { #if DEBUG Debug.WriteLine("PT: Refresh"); #endif // PTメンバの名前を記録しておく var combatants = FF14PluginHelper.GetCombatantListParty(); // FF14内部のPTメンバ自動ソート順で並び替える var sorted = from x in combatants join y in Job.JobList on x.Job equals y.JobId where x.ID != player.ID orderby y.Role, x.Job, x.ID descending select x.Name.Trim(); partyList = new List <string>(sorted); // パーティメンバが空だったら自分を補完しておく if (!combatants.Any()) { combatants.Add(player); } var newList = new Dictionary <string, string>(); // ジョブ名によるプレースホルダを登録する foreach (var job in Job.JobList) { // このジョブに該当するパーティメンバを抽出する var combatantsByJob = ( from x in combatants where x.Job == job.JobId orderby x.ID == player.ID ? 0 : 1, x.ID descending select x).ToArray(); if (!combatantsByJob.Any()) { continue; } // <JOBn>形式を置換する // ex. <PLD1> → Taro Paladin // ex. <PLD2> → Jiro Paladin for (int i = 0; i < combatantsByJob.Length; i++) { var placeholder = string.Format( "<{0}{1}>", job.JobName, i + 1); newList.Add(placeholder.ToUpper(), combatantsByJob[i].Name); } // <JOB>形式を置換する // ただし、この場合は正規表現のグループ形式とする // また、グループ名にはジョブの略称を設定する // ex. <PLD> → (?<PLDs>Taro Paladin|Jiro Paladin) var names = string.Join("|", combatantsByJob.Select(x => x.Name).ToArray()); var oldValue = string.Format("<{0}>", job.JobName); var newValue = string.Format( "(?<{0}s>{1})", job.JobName.ToUpper(), names); newList.Add(oldValue.ToUpper(), newValue); } placeholderToJobNameDictionaly = newList; } else { partyList = EMPTY_STRING_LIST; placeholderToJobNameDictionaly = EMPTY_STRING_PAIR_MAP; } // 置換後のマッチングキーワードを消去する SpellTimerTable.ClearReplacedKeywords(); OnePointTelopTable.Default.ClearReplacedKeywords(); // スペルタイマーの再描画を行う SpellTimerTable.ClearUpdateFlags(); // モニタタブの情報を無効にする SpecialSpellTimerPlugin.ConfigPanel.InvalidatePlaceholders(); }