/// <summary> /// 指定されたSpellTimerの条件を確認する /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>条件を満たしていればtrue</returns> public static bool CheckConditionsForSpell( SpellTimer spell) { return(CheckConditions( spell.TimersMustRunningForStart, spell.TimersMustStoppingForStart)); }
/// <summary> /// 指定されたSpellTimerが稼働中か判定する /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>稼働中であればtrue</returns> private static bool IsRunning( SpellTimer spell) { var recastTime = (spell.CompleteScheduledTime - DateTime.Now).TotalSeconds; return(recastTime >= 0); }
public override void StartAttack(GameObject attackTarget) { if (attackTarget == null) { return; } if (attackTarget is GameLiving && GameServer.ServerRules.IsAllowedToAttack(this, (GameLiving)attackTarget, true) == false) { return; } if (Brain is IControlledBrain) { if ((Brain as IControlledBrain).AggressionState == eAggressionState.Passive) { return; } GamePlayer playerowner; if ((playerowner = ((IControlledBrain)Brain).GetPlayerOwner()) != null) { playerowner.Stealth(false); } } TargetObject = attackTarget; if (TargetObject.Realm == 0 || Realm == 0) { m_lastAttackTickPvE = m_CurrentRegion.Time; } else { m_lastAttackTickPvP = m_CurrentRegion.Time; } if (m_attackers.Count == 0) { if (SpellTimer == null) { SpellTimer = new SpellAction(this); } if (!SpellTimer.IsAlive) { SpellTimer.Start(1); } } if (Brain is TurretMainPetTankBrain) { base.StartAttack(TargetObject); } }
/// <summary> /// 後方参照を置換したTitleを返す /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>置換後のTitle</returns> public static string GetReplacedTitle(SpellTimer spell) { var builder = new StringBuilder(spell.SpellTitle); int index = 1; index += ReplaceMessageWithSpell(builder, spell.TimersMustRunningForStart, index); index += ReplaceMessageWithSpell(builder, spell.TimersMustStoppingForStart, index); index += ReplaceMessageWithTelop(builder, spell.TimersMustRunningForStart, index); index += ReplaceMessageWithTelop(builder, spell.TimersMustStoppingForStart, index); return builder.ToString(); }
/// <summary> /// 指定されたSpellTimerの条件を確認する /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>条件を満たしていればtrue</returns> public static bool CheckConditionsForSpell( SpellTimer spell) { if (Settings.Default.DisableStartCondition) { return(true); } return(CheckConditions( spell.TimersMustRunningForStart, spell.TimersMustStoppingForStart)); }
/// <summary> /// 後方参照を置換したTitleを返す /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>置換後のTitle</returns> public static string GetReplacedTitle(SpellTimer spell) { var builder = new StringBuilder(spell.SpellTitle); int index = 1; index += ReplaceMessageWithSpell(builder, spell.TimersMustRunningForStart, index); index += ReplaceMessageWithSpell(builder, spell.TimersMustStoppingForStart, index); index += ReplaceMessageWithTelop(builder, spell.TimersMustRunningForStart, index); index += ReplaceMessageWithTelop(builder, spell.TimersMustStoppingForStart, index); return(builder.ToString()); }
public override void OnAfterSpellCastSequence(ISpellHandler handler) { if (SpellTimer != null) { if (this == null || this.ObjectState != eObjectState.Active || !this.IsAlive || this.TargetObject == null || (this.TargetObject is GameLiving && this.TargetObject.ObjectState != eObjectState.Active || !(this.TargetObject as GameLiving).IsAlive)) { SpellTimer.Stop(); } else { SpellTimer.Start(1); } } if (m_runningSpellHandler != null) { //prevent from relaunch m_runningSpellHandler.CastingCompleteEvent -= new CastingCompleteCallback(OnAfterSpellCastSequence); m_runningSpellHandler = null; } Brain.Notify(GameNPCEvent.CastFinished, this, new CastingEventArgs(handler)); }
public static Task <IconDialogResult> ShowDialogAsync( string iconRelativePath, IWin32Window owner = null, SpellTimer spell = null) { return(Task.Run(() => { var result = new IconDialogResult() { Result = false, Icon = iconRelativePath, }; if (owner != null) { var font = (owner as Control)?.Font; instance.Font = font; instance.FolderTreeView.Font = font; instance.FolderTreeView.ItemHeight = (int)(font.Size * 3); instance.ClearButton.Font = font; instance.CloseButton.Font = font; instance.IconsFlowLayoutPanel.Font = font; } instance.SelectedIconRelativePath = iconRelativePath; instance.ParrentSpell = spell; if (instance.ShowDialog(owner) == DialogResult.OK) { result.Result = true; result.Icon = instance.SelectedIconRelativePath; } return result; })); }
/// <summary> /// 指定されたSpellTimerが稼働中か判定する /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>稼働中であればtrue</returns> private static bool IsRunning(SpellTimer spell) { var recastTime = (spell.CompleteScheduledTime - DateTime.Now).TotalSeconds; return recastTime >= 0; }
/// <summary> /// 指定されたSpellTimerの条件を確認する /// </summary> /// <param name="spell">SpellTimer</param> /// <returns>条件を満たしていればtrue</returns> public static bool CheckConditionsForSpell(SpellTimer spell) { return CheckConditions(spell.TimersMustRunningForStart, spell.TimersMustStoppingForStart); }
public SerializableSpellTimerEntry(SpellTimer spellTimer) { this.StartTime = DateTime.Now; this.Original = spellTimer; }
/// <summary> /// 詳細を表示する /// </summary> /// <param name="dataSource">データソース</param> private void ShowDetail( SpellTimer dataSource) { var src = dataSource; if (src == null) { this.DetailGroupBox.Visible = false; return; } this.DetailGroupBox.Visible = true; // データソースをタグに突っ込んでおく this.DetailGroupBox.Tag = src; // アイコンを設定する this.SelectIconButton.Tag = src.SpellIcon; this.SelectIconButton.BackgroundImageLayout = ImageLayout.Zoom; this.SelectIconButton.BackgroundImage = null; this.SelectIconButton.FlatAppearance.BorderSize = 1; var icon = IconController.Instance.GetIconFile(src.SpellIcon); if (icon != null && File.Exists(icon.FullPath)) { this.SelectIconButton.BackgroundImage = System.Drawing.Image.FromFile( icon.FullPath); this.SelectIconButton.FlatAppearance.BorderSize = 0; } this.PanelNameTextBox.Text = src.Panel; this.SpellTitleTextBox.Text = src.SpellTitle; this.SpellIconSizeUpDown.Value = src.SpellIconSize; this.DisplayNoNumericUpDown.Value = src.DisplayNo; this.KeywordTextBox.Text = src.Keyword; this.RegexEnabledCheckBox.Checked = src.RegexEnabled; this.RecastTimeNumericUpDown.Value = (decimal)src.RecastTime; this.RepeatCheckBox.Checked = src.RepeatEnabled; this.ShowProgressBarCheckBox.Checked = src.ProgressBarVisible; this.KeywordToExpand1TextBox.Text = src.KeywordForExtend1; this.ExpandSecounds1NumericUpDown.Value = (decimal)src.RecastTimeExtending1; this.KeywordToExpand2TextBox.Text = src.KeywordForExtend2; this.ExpandSecounds2NumericUpDown.Value = (decimal)src.RecastTimeExtending2; this.ExtendBeyondOriginalRecastTimeCheckBox.Checked = src.ExtendBeyondOriginalRecastTime; this.UpperLimitOfExtensionNumericUpDown.Value = (decimal)src.UpperLimitOfExtension; this.WarningTimeNumericUpDown.Value = (decimal)src.WarningTime; this.WarningTimeCheckBox.Checked = src.ChangeFontColorsWhenWarning; this.MatchSoundComboBox.SelectedValue = src.MatchSound; this.MatchTextToSpeakTextBox.Text = src.MatchTextToSpeak; this.OverSoundComboBox.SelectedValue = src.OverSound; this.OverTextToSpeakTextBox.Text = src.OverTextToSpeak; this.OverTimeNumericUpDown.Value = (decimal)src.OverTime; this.BeforeSoundComboBox.SelectedValue = src.BeforeSound; this.BeforeTextToSpeakTextBox.Text = src.BeforeTextToSpeak; this.BeforeTimeNumericUpDown.Value = (decimal)src.BeforeTime; this.TimeupSoundComboBox.SelectedValue = src.TimeupSound; this.TimeupTextToSpeakTextBox.Text = src.TimeupTextToSpeak; this.IsReverseCheckBox.Checked = src.IsReverse; this.DontHideCheckBox.Checked = src.DontHide; this.HideSpellNameCheckBox.Checked = src.HideSpellName; this.OverlapRecastTimeCheckBox.Checked = src.OverlapRecastTime; this.ReduceIconBrightnessCheckBox.Checked = src.ReduceIconBrightness; this.ToInstanceCheckBox.Checked = src.ToInstance; this.WarningTimeCheckBox.Checked = src.ChangeFontColorsWhenWarning; this.WarningTimeNumericUpDown.Value = (decimal)src.WarningTime; this.BlinkTimeNumericUpDown.Value = (decimal)src.BlinkTime; this.BlinkIconCheckBox.Checked = src.BlinkIcon; this.BlinkBarCheckBox.Checked = src.BlinkBar; this.SpellVisualSetting.SetFontInfo(src.Font); this.SpellVisualSetting.BarColor = string.IsNullOrWhiteSpace(src.BarColor) ? Settings.Default.ProgressBarColor : src.BarColor.FromHTML(); this.SpellVisualSetting.BarOutlineColor = string.IsNullOrWhiteSpace(src.BarOutlineColor) ? Settings.Default.ProgressBarOutlineColor : src.BarOutlineColor.FromHTML(); this.SpellVisualSetting.FontColor = string.IsNullOrWhiteSpace(src.FontColor) ? Settings.Default.FontColor : src.FontColor.FromHTML(); this.SpellVisualSetting.FontOutlineColor = string.IsNullOrWhiteSpace(src.FontOutlineColor) ? Settings.Default.FontOutlineColor : src.FontOutlineColor.FromHTML(); this.SpellVisualSetting.WarningFontColor = string.IsNullOrWhiteSpace(src.WarningFontColor) ? Settings.Default.WarningFontColor : src.WarningFontColor.FromHTML(); this.SpellVisualSetting.WarningFontOutlineColor = string.IsNullOrWhiteSpace(src.WarningFontOutlineColor) ? Settings.Default.WarningFontOutlineColor : src.WarningFontOutlineColor.FromHTML(); this.SpellVisualSetting.BarSize = new Size(src.BarWidth, src.BarHeight); this.SpellVisualSetting.BackgroundColor = string.IsNullOrWhiteSpace(src.BackgroundColor) ? Settings.Default.BackgroundColor : Color.FromArgb(src.BackgroundAlpha, src.BackgroundColor.FromHTML()); this.SpellVisualSetting.SpellIcon = src.SpellIcon; this.SpellVisualSetting.SpellIconSize = src.SpellIconSize; this.SpellVisualSetting.HideSpellName = src.HideSpellName; this.SpellVisualSetting.OverlapRecastTime = src.OverlapRecastTime; this.TemporarilyDisplaySpellCheckBox.Checked = src.IsTemporaryDisplay; this.NotifyToDiscordCheckBox.Checked = src.NotifyToDiscord; this.AlsoCompletionCheckBox.Checked = src.NotifyToDiscordAtComplete; this.SpellVisualSetting.RefreshSampleImage(); // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectZoneButton.ForeColor = src.ZoneFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // ジョブ限定ボタンの色を変える(未設定:黒、設定有:青) this.SelectJobButton.ForeColor = src.JobFilter != string.Empty ? Color.Blue : Button.DefaultForeColor; // 条件設定ボタンの色を変える(未設定:黒、設定有:青) this.SetConditionButton.ForeColor = (src.TimersMustRunningForStart.Length != 0 || src.TimersMustStoppingForStart.Length != 0) ? Color.Blue : Button.DefaultForeColor; }
/// <summary> /// 追加 Click /// </summary> /// <param name="sender">イベント発生元</param> /// <param name="e">イベント引数</param> private void AddButton_Click(object sender, EventArgs e) { lock (SpellTimerTable.Instance.Table) { var nr = new SpellTimer(); nr.ID = SpellTimerTable.Instance.Table.Any() ? SpellTimerTable.Instance.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.WarningFontColor = Settings.Default.WarningFontColor.ToHTML(); nr.WarningFontOutlineColor = Settings.Default.WarningFontOutlineColor.ToHTML(); nr.BarColor = Settings.Default.ProgressBarColor.ToHTML(); nr.BarOutlineColor = Settings.Default.ProgressBarOutlineColor.ToHTML(); 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.WarningFontColor = baseRow.WarningFontColor; nr.WarningFontOutlineColor = baseRow.WarningFontOutlineColor; nr.BarColor = baseRow.BarColor; nr.BarOutlineColor = baseRow.BarOutlineColor; nr.DontHide = baseRow.DontHide; nr.HideSpellName = baseRow.HideSpellName; nr.WarningTime = baseRow.WarningTime; nr.BlinkTime = baseRow.BlinkTime; nr.BlinkIcon = baseRow.BlinkIcon; nr.BlinkBar = baseRow.BlinkBar; nr.ChangeFontColorsWhenWarning = baseRow.ChangeFontColorsWhenWarning; nr.OverlapRecastTime = baseRow.OverlapRecastTime; nr.ReduceIconBrightness = baseRow.ReduceIconBrightness; 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.NotifyToDiscord = baseRow.NotifyToDiscord; nr.NotifyToDiscordAtComplete = baseRow.NotifyToDiscordAtComplete; } } nr.MatchDateTime = DateTime.MinValue; nr.UpdateDone = false; nr.Enabled = true; nr.DisplayNo = SpellTimerTable.Instance.Table.Any() ? SpellTimerTable.Instance.Table.Max(x => x.DisplayNo) + 1 : 50; nr.Regex = null; nr.RegexPattern = string.Empty; SpellTimerTable.Instance.Table.Add(nr); TableCompiler.Instance.RecompileSpells(); SpellTimerTable.Instance.RemoveInstanceSpellsAll(); SpellTimerTable.Instance.Save(true); // 新しいノードを生成する 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; this.SpellTimerTreeView.SelectedNode.EnsureVisible(); break; } } // 親ノードがなかった if (this.SpellTimerTreeView.SelectedNode != node) { var parentNode = new TreeNode(nr.Panel, new TreeNode[] { node }) { Checked = true }; SpellsController.Instance.GetPanelSettings(nr.Panel); this.SpellTimerTreeView.Nodes.Add(parentNode); this.SpellTimerTreeView.SelectedNode = node; this.SpellTimerTreeView.SelectedNode.EnsureVisible(); } // ゾーン限定ボタンの色を変える(未設定:黒、設定有:青) 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; } // 標準のスペルタイマーへ変更を反映する SpellsController.Instance.ApplyToNormalSpellTimer(); }