From 2afb1933e3284693fd1b1ca4e9a5cd4b3ee9b107 Mon Sep 17 00:00:00 2001 From: Liza Carvelli Date: Sun, 12 Feb 2023 00:37:36 +0100 Subject: [PATCH] Experimental CN support --- .gitignore | 1 + DalamudPackager.targets | 9 +++++++ FishNotify.cs | 18 +++++++++++-- FishNotify.csproj | 56 ++++++++++++++++++++++++++++++++--------- FishNotify.sln | 9 ++++--- 5 files changed, 76 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index b6f3f18..c663a01 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .vs/ obj/ dist/ +dist-CN/ *.user \ No newline at end of file diff --git a/DalamudPackager.targets b/DalamudPackager.targets index c8a812a..8f68447 100644 --- a/DalamudPackager.targets +++ b/DalamudPackager.targets @@ -8,4 +8,13 @@ MakeZip="true" VersionComponents="2"/> + + + + \ No newline at end of file diff --git a/FishNotify.cs b/FishNotify.cs index 424a24b..9a3579e 100644 --- a/FishNotify.cs +++ b/FishNotify.cs @@ -1,4 +1,4 @@ -using Dalamud.Data; +using Dalamud; using Dalamud.Game.Gui; using Dalamud.Game.Network; using Dalamud.Game.Text.SeStringHandling; @@ -67,7 +67,7 @@ namespace FishNotify return; } - var region = regions.Find(r => r.Region == "Global"); + var region = regions.Find(r => r.Region == GetGameRegion()); if (region == null || region.Lists == null) { PluginLog.Warning("No global region found in opcode list"); @@ -96,6 +96,20 @@ namespace FishNotify } } + /// + /// Both ClientLanguage.Korean and ClientLanguage.ChineseSimplified have value 4, but the string representation differs depending on the dalamud fork. + /// + /// + private string GetGameRegion() + { + return Enum.GetName(typeof(ClientLanguage), 4) switch + { + "ChineseSimplified" => "CN", + "Korean" => "KR", + _ => "Global", + }; + } + private void OnNetworkMessage(IntPtr dataPtr, ushort opCode, uint sourceActorId, uint targetActorId, NetworkMessageDirection direction) { if (direction != NetworkMessageDirection.ZoneDown || opCode != expectedOpCode) diff --git a/FishNotify.csproj b/FishNotify.csproj index 6c521ee..dbdf9e2 100644 --- a/FishNotify.csproj +++ b/FishNotify.csproj @@ -1,43 +1,71 @@  - - 5.0 Plays a sound effect when a fish bites https://github.com/carvelli/Fish-Notify - Release + Release;Release-CN - + net7.0-windows + $(appdata)\XIVLauncher\addon\Hooks\dev\ + dist + + + + net6.0-windows + E:\ffxiv\CN-dalamud\XIVLauncherCN\Roaming\addon\Hooks\dev\ + dist-CN + + + x64 enable latest true false false - dist + + + + + + + + + + + + PreserveNewest - - $(appdata)\XIVLauncher\addon\Hooks\dev\ - - - + none false - + + none + false + + + + + + + + + + $(DalamudLibPath)FFXIVClientStructs.dll @@ -84,8 +112,12 @@ - + + + + + diff --git a/FishNotify.sln b/FishNotify.sln index 6589cba..0030809 100644 --- a/FishNotify.sln +++ b/FishNotify.sln @@ -1,17 +1,20 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29709.97 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33213.308 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{DFE2B530-7D7B-41FD-B03C-8E11371610E3}") = "FishNotify", "FishNotify.csproj", "{3F91A6A9-5F97-4F6D-864C-DA066F94121A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FishNotify", "FishNotify.csproj", "{3F91A6A9-5F97-4F6D-864C-DA066F94121A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Release|x64 = Release|x64 + Release-CN|x64 = Release-CN|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release|x64.ActiveCfg = Release|x64 {3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release|x64.Build.0 = Release|x64 + {3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release-CN|x64.ActiveCfg = Release-CN|x64 + {3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release-CN|x64.Build.0 = Release-CN|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE