diff --git a/CURRENT_VERSION b/CURRENT_VERSION new file mode 100644 index 0000000..09f0887 --- /dev/null +++ b/CURRENT_VERSION @@ -0,0 +1 @@ +v0.1.0.3116-Beta diff --git a/RELEASE_NOTES.Template.xml b/RELEASE_NOTES.Template.xml new file mode 100644 index 0000000..08847d3 --- /dev/null +++ b/RELEASE_NOTES.Template.xml @@ -0,0 +1,9 @@ + + 0.0.0.#BuildNo# + Beta + #Timestamp# + https://github.com/anoyetta-academy/kagami/releases/download/#Tag#/#ArchiveFileName# + + descriptions... + + diff --git a/RELEASE_NOTES.xml b/RELEASE_NOTES.xml new file mode 100644 index 0000000..a5e6ab5 --- /dev/null +++ b/RELEASE_NOTES.xml @@ -0,0 +1,31 @@ + + + kagami + + + + + 0.1.0.3116 + Beta + 2019-07-05T16:24:43.9716721+09:00 + https://github.com/anoyetta-academy/kagami/releases/download/v0.1.0.3116-Beta/kagami_v0_1_0_3116_Beta.zip + + * Beta1 + * 範囲スキルが重複してしまう場合がある不具合を修正した + * スキルが抜けてしまう場合がある不具合を修正した + * アクションのソート順をタイムスタンプ順から発生順に変更した + * isActiveフラグが機能していなかった不具合を修正した + * ログファイルのファイル名の書式を変更した + * ログファイルの出力タイミングを変更した + * encount の終了時に onEndEncounter イベントを発生させるようにした + * PCをターゲットまたはフォーカスターゲットしたときそのPCのアクションをキャプチャーするようにした + + + diff --git a/git_merge_into_master.ps1 b/git_merge_into_master.ps1 new file mode 100644 index 0000000..3414695 --- /dev/null +++ b/git_merge_into_master.ps1 @@ -0,0 +1,23 @@ +$cd = Split-Path -Parent $MyInvocation.MyCommand.Path +Set-Location $cd + +# version +$tag = $(Get-Content .\CURRENT_VERSION).Trim("\r").Trim("\n") +Write-Output ("-> " + $tag) + +'-> commit' +git commit -a -m $tag + +'-> checkout master' +git checkout master + +'-> merge develop into master' +git merge develop -m ("Merge branch develop " + $tag) --no-ff + +Write-Output ("-> tag " + $tag) +git tag $tag + +git checkout develop + +'done!' +pause diff --git a/git_pull.ps1 b/git_pull.ps1 new file mode 100644 index 0000000..775673d --- /dev/null +++ b/git_pull.ps1 @@ -0,0 +1,8 @@ +'-> pull master' +git pull origin master + +'-> pull develop' +git pull origin develop + +'done!' +pause diff --git a/git_push.ps1 b/git_push.ps1 new file mode 100644 index 0000000..6b2f104 --- /dev/null +++ b/git_push.ps1 @@ -0,0 +1,8 @@ +'-> push master' +git push origin master --tags + +'-> push develop' +git push origin develop --tags + +'done!' +pause diff --git a/make.ps1 b/make.ps1 new file mode 100644 index 0000000..f8ff50f --- /dev/null +++ b/make.ps1 @@ -0,0 +1,164 @@ +# DebugMode? +$isDebug = $false +#$isDebug = $true + +function EndMake() { + if (!$isDebug) { + Stop-Transcript | Out-Null + } + + '' + Read-Host "終了するには何かキーを教えてください..." + exit +} + +function GetBuildNo( + [datetime]$timestamp) { + return ([int]($timestamp.ToString("yy")) + $timestamp.Month + $timestamp.Day).ToString("00") + $timestamp.ToString("HH") +} + +# 現在のディレクトリを取得する +$cd = Split-Path -Parent $MyInvocation.MyCommand.Path +Set-Location $cd + +if (!$isDebug) { + Start-Transcript make.log | Out-Null +} + +# target +$targetClientDirectory = Get-Item .\source\kagami +$targetDirectories = @($targetClientDirectory) +$depolyDirectory = ".\source\deploy" + +# tools +$msbuild = "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\MSBuild.exe" + +# バージョンを取得する +## ビルド番号を決定する +$timestamp = Get-Date +$buildNo = GetBuildNo($timestamp) + +## リリースノートを取得する +if ($isDebug) { + if (Test-Path .\RELEASE_NOTES.bak) { + Copy-Item -Force .\RELEASE_NOTES.bak .\RELEASE_NOTES.xml + } +} +$releaseNotesXML = [xml] (Get-Content .\RELEASE_NOTES.xml -Encoding utf8) +if ($releaseNotesXML -eq $null) { + EndMake +} +$lastestNote = $releaseNotesXML.release_notes.note | Select-Object -Last 1 + +## バージョン番号を決定する +$version = $lastestNote.version.Replace("#BuildNo#", $buildNo) +$channel = $lastestNote.channel +$tag = ("v" + $version + "-" + $channel) + +## アプリケーション名を取得する +$appName = $releaseNotesXML.release_notes.name + +## アーカイブファイル名を決定する +$archiveFileName = $appName + "_v" + $version.Replace(".", "_") + "_" + $channel + ".zip" + +## リリースノートを置換する +$content = Get-Content .\RELEASE_NOTES.xml -Encoding utf8 +$content = $content.Replace("#BuildNo#", $buildNo) +$content = $content.Replace("#Timestamp#", $timestamp.ToString("o")) +$content = $content.Replace("#ArchiveFileName#", $archiveFileName) +$content = $content.Replace("#Tag#", $tag) +Copy-Item -Force .\RELEASE_NOTES.xml .\RELEASE_NOTES.bak +$content | Out-File -FilePath .\RELEASE_NOTES.xml -Encoding utf8 + +Write-Output "***" +Write-Output ("*** " + $appName + " v" + $version + " " + $channel + " ***") +Write-Output "***" + +# Version.cs を上書きする +$content = Get-Content .\source\tools\Version.master.cs -Encoding utf8 +$content = $content.Replace("#VERSION#", $version) +$content = $content.Replace("#CHANNEL#", $channel) +foreach ($d in $targetDirectories) { + $content | Out-File -FilePath (Join-Path $d "Version.cs") -Encoding utf8 +} + +'-> Build' +# Delete Release Directory +foreach ($d in $targetDirectories) { + $out = Join-Path $d "bin\Release\*" + if (Test-Path $out) { + Remove-Item -Recurse -Force $out + } +} + +$target = Get-Item .\source\*.sln +& $msbuild $target /nologo /v:minimal /t:Clean /p:Configuration=Release +Start-Sleep -m 100 + +'-> Build Client' +$target = Get-Item $targetClientDirectory\*.csproj +& $msbuild $target /nologo /v:minimal /t:Build /p:Configuration=Release | Write-Output +Start-Sleep -m 100 + +# Successed? build +foreach ($d in $targetDirectories) { + $out = Join-Path $d "bin\Release" + if (!(Test-Path $out)) { + EndMake + } +} + +foreach ($d in $targetDirectories) { + # pdb を削除する + # Remove-Item -Force (Join-Path $d "bin\Release\*.pdb") + + # app.config を削除する + $targets = @( + (Join-Path $d "bin\Release\RINGS.exe.config"), + (Join-Path $d "bin\Release\aframe.Updater.exe.config")) + + foreach ($t in $targets) { + if (Test-Path $t) { + Remove-Item -Force $t + } + } +} + +'-> Deploy' +# deploy ディレクトリを作る +if (!(Test-Path $depolyDirectory)) { + New-Item -ItemType Directory $depolyDirectory >$null +} + +$deployBase = Join-Path $depolyDirectory $archiveFileName.Replace(".zip", "") +if (Test-Path $deployBase) { + Get-ChildItem -Path $deployBase -Recurse | Remove-Item -Force -Recurse + Remove-Item -Recurse -Force $deployBase +} + +$deployClient = $deployBase +New-Item -ItemType Directory $deployClient >$null + +# client を配置する +'-> Deploy Client' +Copy-Item -Force -Recurse $targetClientDirectory\bin\Release\* $deployClient + +# client をアーカイブする +'-> Archive Client' +Compress-Archive -Force $deployClient\* $deployBase\..\$archiveFileName +Get-ChildItem -Path $deployBase -Recurse | Remove-Item -Force -Recurse +Remove-Item -Recurse -Force $deployBase + +if (!$isDebug) { + if (Test-Path .\RELEASE_NOTES.bak) { + Remove-Item -Force .\RELEASE_NOTES.bak + } +} + +$tag | Out-File .\CURRENT_VERSION -Encoding utf8 + +Write-Output "***" +Write-Output ("*** " + $appName + " v" + $version + " " + $channel + ", Completed! ***") +Write-Output "***" + +EndMake diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/FFXIV_ACT_Plugin.dll b/source/Thirdparty/FFXIV_ACT_Plugin/FFXIV_ACT_Plugin.dll new file mode 100644 index 0000000..da7356a Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/FFXIV_ACT_Plugin.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/.gitignore b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/.gitignore new file mode 100644 index 0000000..a57582c --- /dev/null +++ b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/.gitignore @@ -0,0 +1 @@ +/src diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Common.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Common.dll new file mode 100644 index 0000000..0651c0e Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Common.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Config.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Config.dll new file mode 100644 index 0000000..6228932 Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Config.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.LogFile.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.LogFile.dll new file mode 100644 index 0000000..0d65fea Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.LogFile.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Memory.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Memory.dll new file mode 100644 index 0000000..ad2fd42 Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Memory.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Network.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Network.dll new file mode 100644 index 0000000..4ac90d5 Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Network.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Overlay.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Overlay.dll new file mode 100644 index 0000000..763159a Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Overlay.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Parse.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Parse.dll new file mode 100644 index 0000000..125a697 Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Parse.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Resource.dll b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Resource.dll new file mode 100644 index 0000000..fb456c8 Binary files /dev/null and b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/FFXIV_ACT_Plugin.Resource.dll differ diff --git a/source/Thirdparty/FFXIV_ACT_Plugin/SDK/_dummy b/source/Thirdparty/FFXIV_ACT_Plugin/SDK/_dummy new file mode 100644 index 0000000..e69de29 diff --git a/source/deploy/kagami_v0_1_0_3116_Beta.zip b/source/deploy/kagami_v0_1_0_3116_Beta.zip new file mode 100644 index 0000000..d76b14d Binary files /dev/null and b/source/deploy/kagami_v0_1_0_3116_Beta.zip differ diff --git a/source/kagami.Core/Helpers/FFXIVPluginHelper.cs b/source/kagami.Core/Helpers/FFXIVPluginHelper.cs index 75b5ce9..9904129 100644 --- a/source/kagami.Core/Helpers/FFXIVPluginHelper.cs +++ b/source/kagami.Core/Helpers/FFXIVPluginHelper.cs @@ -1,11 +1,12 @@ using System; using System.Diagnostics; using System.Linq; -using System.Reflection; using System.Threading; using Advanced_Combat_Tracker; +using FFXIV_ACT_Plugin.Common; +using FFXIV_ACT_Plugin.Common.Models; using kagami.Helpers.Common; - + namespace kagami.Helpers { public class FFXIVPluginHelper @@ -22,102 +23,147 @@ private FFXIVPluginHelper() #endregion Singleton - private ThreadWorker attachWorker; - - private dynamic ffxivPlugin; - private dynamic ffxivPluginConfig; - private dynamic ffxivPluginLogParse; + private ThreadWorker pluginSubscriber; + private ThreadWorker combatantSubscriber; - public Process FFXIVProcess => this.ffxivPluginConfig?.Process; + private dynamic plugin; + private IDataRepository DataRepository { get; set; } + private IDataSubscription DataSubscription { get; set; } + + public Process FFXIVProcess => this.DataRepository?.GetCurrentFFXIVProcess(); - public string FFXIVPluginLanguage => (this.ffxivPluginLogParse?.Settings?.LanguageID ?? 0) switch - { - 1 => "English", - 2 => "French", - 3 => "German", - 4 => "Japanese", - _ => "English", - }; + public string FFXIVPluginLanguage => this.DataRepository?.GetSelectedLanguageID().ToString(); private static readonly double AttachSubscribeInterval = 3000; + private static readonly double CombatantSubscribeInterval = 500; public void Start() { - this.attachWorker = new ThreadWorker(() => + this.pluginSubscriber = new ThreadWorker(() => { if (ActGlobals.oFormActMain == null) { return; } - if (this.ffxivPlugin == null) - { - this.ffxivPlugin = ( - from x in ActGlobals.oFormActMain.ActPlugins - where - x.pluginFile.Name.ToUpper().Contains("FFXIV_ACT_Plugin".ToUpper()) && - x.lblPluginStatus.Text.ToUpper().Contains("FFXIV Plugin Started.".ToUpper()) - select - x.pluginObj).FirstOrDefault(); - } - - if (this.ffxivPlugin != null && - this.ffxivPluginConfig == null) - { - var fi = this.ffxivPlugin.GetType().GetField( - "_Memory", - BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance); - var memory = fi?.GetValue(this.ffxivPlugin); - if (memory == null) - { - return; - } - - fi = memory.GetType().GetField( - "_config", - BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance); - this.ffxivPluginConfig = fi?.GetValue(memory); - - Logger.Info("FFXIV_ACT_Plugin.Config attached."); - } - - if (this.ffxivPlugin != null && - this.ffxivPluginLogParse == null) - { - var fi = this.ffxivPlugin.GetType().GetField( - "_LogParse", - BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance); - - this.ffxivPluginLogParse = fi?.GetValue(this.ffxivPlugin); - - Logger.Info("FFXIV_ACT_Plugin.LogParse attached."); + if (this.plugin != null) + { + return; } - if (this.ffxivPlugin != null && - this.ffxivPluginConfig != null && - this.ffxivPluginLogParse != null) - { - Thread.Sleep(TimeSpan.FromMilliseconds(AttachSubscribeInterval)); - } + var ffxivPlugin = ( + from x in ActGlobals.oFormActMain.ActPlugins + where + x.pluginFile.Name.ToUpper().Contains("FFXIV_ACT_Plugin".ToUpper()) && + x.lblPluginStatus.Text.ToUpper().Contains("FFXIV Plugin Started.".ToUpper()) + select + x.pluginObj).FirstOrDefault(); + + if (ffxivPlugin != null) + { + this.plugin = ffxivPlugin; + this.DataRepository = this.plugin.DataRepository; + this.DataSubscription = this.plugin.DataSubscription; + + Logger.Info("FFXIV_ACT_Plugin attached."); + } }, AttachSubscribeInterval, - "FFXIV_ACT_Plugin Subscriber", + "FFXIV_ACT_Plugin subscriber", ThreadPriority.Lowest); - this.attachWorker.Run(); + this.pluginSubscriber.Run(); + + this.combatantSubscriber = new ThreadWorker( + this.DoRefreshCombatant, + CombatantSubscribeInterval, + "Combatant subscriber", + ThreadPriority.Lowest); + + this.combatantSubscriber.Run(); } public void Stop() { - if (this.attachWorker != null) + if (this.pluginSubscriber != null) { - this.attachWorker.Abort(); - this.attachWorker = null; + this.pluginSubscriber.Abort(); + this.pluginSubscriber = null; } - this.ffxivPlugin = null; - this.ffxivPluginConfig = null; - this.ffxivPluginLogParse = null; + if (this.combatantSubscriber != null) + { + this.combatantSubscriber.Abort(); + this.combatantSubscriber = null; + } + + this.plugin = null; + this.DataRepository = null; + this.DataSubscription = null; } + + public Combatant CurrentPlayer { get; private set; } + + public Combatant CurrentTarget { get; private set; } + + public Combatant CurrentFocusTarget { get; private set; } + + private void DoRefreshCombatant() + { + this.CurrentPlayer = this.DataRepository?.GetCombatantList().FirstOrDefault(); + this.CurrentTarget = this.DataRepository?.GetCombatantByOverlayType(OverlayType.Target); + this.CurrentFocusTarget = this.DataRepository?.GetCombatantByOverlayType(OverlayType.FocusTarget); + } + } + + public static class CombatantExtensions + { + public static Job GetJob( + this Combatant c) + => (Job)Enum.ToObject(typeof(Job), c.Job); + } + + public enum Job + { + Unknown = -1, + ADV = 0, + GLA = 1, + PUG = 2, + MRD = 3, + LNC = 4, + ARC = 5, + CNJ = 6, + THM = 7, + CRP = 8, + BSM = 9, + ARM = 10, + GSM = 11, + LTW = 12, + WVR = 13, + ALC = 14, + CUL = 15, + MIN = 16, + BOT = 17, + FSH = 18, + PLD = 19, + MNK = 20, + WAR = 21, + DRG = 22, + BRD = 23, + WHM = 24, + BLM = 25, + ACN = 26, + SMN = 27, + SCH = 28, + ROG = 29, + NIN = 30, + MCH = 31, + DRK = 32, + AST = 33, + SAM = 34, + RDM = 35, + BLU = 36, + GNB = 37, + DNC = 38, } -} +} diff --git a/source/kagami.Core/Helpers/SharlayanHelper.cs b/source/kagami.Core/Helpers/SharlayanHelper.cs index 1e9f643..7ef1123 100644 --- a/source/kagami.Core/Helpers/SharlayanHelper.cs +++ b/source/kagami.Core/Helpers/SharlayanHelper.cs @@ -95,11 +95,12 @@ private void DetectFFXIVProcess() MemoryHandler.Instance.SetProcess( model, - ffxivLanguage); + gameLanguage: ffxivLanguage, + useLocalCache: false); Logger.Info("Sharlayan attached."); } } } } -} +} diff --git a/source/kagami.Core/KagamiAddonCore.cs b/source/kagami.Core/KagamiAddonCore.cs index 2d3e5b3..c4de371 100644 --- a/source/kagami.Core/KagamiAddonCore.cs +++ b/source/kagami.Core/KagamiAddonCore.cs @@ -75,13 +75,10 @@ private void Initialize() FFXIVPluginHelper.Instance.Start(); SharlayanHelper.Instance.Start(); - // Actionリストを取得しておく - var a = SharlayanHelper.Instance.GetActionInfo(0); - await Task.Delay(100); XIVLogSubscriber.Instance.Start(); }); } } -} +} diff --git a/source/kagami.Core/KagamiOverlay.cs b/source/kagami.Core/KagamiOverlay.cs index d264b19..6393ec4 100644 --- a/source/kagami.Core/KagamiOverlay.cs +++ b/source/kagami.Core/KagamiOverlay.cs @@ -39,16 +39,17 @@ private void Config_PropertyChanged(object sender, PropertyChangedEventArgs e) private static readonly int LongInterval = 3000; private volatile bool isUpdating = false; private long previousSeq = 0; + private bool previousStats = false; protected override async void Update() { try - { - if (this.isUpdating) - { - return; - } - + { + if (this.isUpdating) + { + return; + } + this.isUpdating = true; if (!this.Config.IsDesignMode) @@ -68,31 +69,58 @@ protected override async void Update() else { this.timer.Interval = LongInterval; - } - - if (this.previousSeq != ActionEchoesModel.Instance.Seq || - this.Config.IsDesignMode) - { + } + + var stats = ActionEchoesModel.Instance.GetEncounterStats(); + var isNeedsSave = false; + + lock (this) + { + if (!this.Config.IsDesignMode && + this.previousSeq == ActionEchoesModel.Instance.Seq && + this.previousStats == stats) + { + return; + } + this.previousSeq = ActionEchoesModel.Instance.Seq; - var json = await ActionEchoesModel.Instance.ParseJsonAsync(); - - var updateScript = - $"var model =\n{ json };\n\n" + - "document.dispatchEvent(new CustomEvent('onActionUpdated', { detail: model }));\n"; - - this.Overlay?.Renderer?.Browser?.GetMainFrame()?.ExecuteJavaScript( - updateScript, - null, - 0); - } + if (this.previousStats != stats) + { + this.previousStats = stats; + isNeedsSave = !stats; + } + } + + var json = await ActionEchoesModel.Instance.ParseJsonAsync(); + + var updateScript = + $"var model =\n{ json };\n\n" + + "document.dispatchEvent(new CustomEvent('onActionUpdated', { detail: model }));\n"; + + this.Overlay?.Renderer?.Browser?.GetMainFrame()?.ExecuteJavaScript( + updateScript, + null, + 0); + + if (isNeedsSave) + { + var script = "document.dispatchEvent(new CustomEvent('onEndEncounter', null));\n"; + this.Overlay?.Renderer?.Browser?.GetMainFrame()?.ExecuteJavaScript( + script, + null, + 0); + + await ActionEchoesModel.Instance.SaveLogAsync(); + ActionEchoesModel.Instance.Clear(); + } } catch (Exception ex) { this.Log(LogLevel.Error, "Update: {0} {1}", this.Name, ex.ToString()); } finally - { + { this.isUpdating = false; } } diff --git a/source/kagami.Core/KagamiOverlayConfig.cs b/source/kagami.Core/KagamiOverlayConfig.cs index 89c23a0..81511ec 100644 --- a/source/kagami.Core/KagamiOverlayConfig.cs +++ b/source/kagami.Core/KagamiOverlayConfig.cs @@ -51,6 +51,22 @@ public bool IsDesignMode set => this.SetProperty(ref this.isDesignMode, value); } + private bool isEnableTargetCapture = true; + + public bool IsEnableTargetCapture + { + get => this.isEnableTargetCapture; + set => this.SetProperty(ref this.isEnableTargetCapture, value); + } + + private bool isEnableFocusTargetCapture = true; + + public bool IsEnableFocusTargetCapture + { + get => this.isEnableFocusTargetCapture; + set => this.SetProperty(ref this.isEnableFocusTargetCapture, value); + } + private int bufferSizeOfActionEcho = 30; public int BufferSizeOfActionEcho @@ -125,4 +141,4 @@ protected virtual bool SetProperty( #endregion INotifyPropertyChanged } -} +} diff --git a/source/kagami.Core/Models/ActionEchoesModel.cs b/source/kagami.Core/Models/ActionEchoesModel.cs index cfd7f71..ffb98d4 100644 --- a/source/kagami.Core/Models/ActionEchoesModel.cs +++ b/source/kagami.Core/Models/ActionEchoesModel.cs @@ -82,7 +82,7 @@ from x in source x.Timestamp <= this.Time && x.Timestamp >= this.Time.AddSeconds(this.Config.BufferSizeOfActionEcho * -1) orderby - x.Timestamp descending + x.Seq descending select x).ToArray(); @@ -108,6 +108,9 @@ public void Add(ActionEchoModel model) } } + public bool GetEncounterStats() + => ActGlobals.oFormActMain?.ActiveZone?.ActiveEncounter?.Active ?? false; + public async Task ParseJsonAsync() => await Task.Run(() => { var data = this.Config.IsDesignMode ? CreateDesignModeDataModel() : this; @@ -115,16 +118,17 @@ public async Task ParseJsonAsync() => await Task.Run(() => if (!this.Config.IsDesignMode) { - if (ActGlobals.oFormActMain?.ActiveZone?.ActiveEncounter != null) + var encounter = ActGlobals.oFormActMain?.ActiveZone?.ActiveEncounter; + if (encounter != null) { - var dpsList = ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetAllies(); + var dpsList = encounter.GetAllies(); var dps = dpsList.FirstOrDefault(x => x.Name == this.PlayerName || x.Name == "YOU"); this.EncDPS = Math.Round(dps?.EncDPS ?? 0); this.Duration = dps?.Duration ?? TimeSpan.Zero; - this.IsActive = true; + this.IsActive = encounter.Active; } else { @@ -148,8 +152,6 @@ public async Task ParseJsonAsync() => await Task.Run(() => return json; }); - private int takeCount; - public async Task SaveLogAsync() { if (this.echoes.Count < 1) @@ -161,10 +163,16 @@ public async Task SaveLogAsync() lock (this) { - this.takeCount++; + var encounter = ActGlobals.oFormActMain?.ActiveZone?.ActiveEncounter; + var zone = !string.IsNullOrEmpty(encounter?.ZoneName) ? + encounter?.ZoneName : + this.Zone; + var title = !string.IsNullOrEmpty(encounter?.Title) ? + encounter?.Title : + "UNKNOWN"; fileName = - $"{DateTime.Now:yyyy-MM-dd_HHmmss}.{this.PlayerName}[{this.PlayerJob}].{this.Zone}.{this.takeCount}.json"; + $"{DateTime.Now:yyMMdd_HHmmss}_{this.PlayerName}[{this.PlayerJob}]_{zone}({title}).json"; // 無効な文字を取り除く fileName = string.Concat(fileName.Where(c => !Path.GetInvalidFileNameChars().Contains(c))); diff --git a/source/kagami.Core/Version.cs b/source/kagami.Core/Version.cs index ace4b19..6c92775 100644 --- a/source/kagami.Core/Version.cs +++ b/source/kagami.Core/Version.cs @@ -1,4 +1,4 @@ -using System.Reflection; +using System.Reflection; -[assembly: AssemblyVersion("0.0.11.0")] -[assembly: AssemblyConfiguration("Alpha")] +[assembly: AssemblyVersion("0.1.0.3116")] +[assembly: AssemblyConfiguration("Beta")] diff --git a/source/kagami.Core/Views/KagamiConfigView.xaml b/source/kagami.Core/Views/KagamiConfigView.xaml index c221e83..3890c76 100644 --- a/source/kagami.Core/Views/KagamiConfigView.xaml +++ b/source/kagami.Core/Views/KagamiConfigView.xaml @@ -90,6 +90,8 @@