Experimental CN support

This commit is contained in:
Liza 2023-02-12 00:37:36 +01:00
parent e160ad1f92
commit 2afb1933e3
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 76 additions and 17 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.vs/ .vs/
obj/ obj/
dist/ dist/
dist-CN/
*.user *.user

View File

@ -8,4 +8,13 @@
MakeZip="true" MakeZip="true"
VersionComponents="2"/> VersionComponents="2"/>
</Target> </Target>
<Target Name="PackagePlugin" AfterTargets="Build" Condition="'$(Configuration)' == 'Release-CN'">
<DalamudPackager
ProjectDir="$(ProjectDir)"
OutputPath="$(OutputPath)"
AssemblyName="$(AssemblyName)"
MakeZip="true"
VersionComponents="2"/>
</Target>
</Project> </Project>

View File

@ -1,4 +1,4 @@
using Dalamud.Data; using Dalamud;
using Dalamud.Game.Gui; using Dalamud.Game.Gui;
using Dalamud.Game.Network; using Dalamud.Game.Network;
using Dalamud.Game.Text.SeStringHandling; using Dalamud.Game.Text.SeStringHandling;
@ -67,7 +67,7 @@ namespace FishNotify
return; return;
} }
var region = regions.Find(r => r.Region == "Global"); var region = regions.Find(r => r.Region == GetGameRegion());
if (region == null || region.Lists == null) if (region == null || region.Lists == null)
{ {
PluginLog.Warning("No global region found in opcode list"); PluginLog.Warning("No global region found in opcode list");
@ -96,6 +96,20 @@ namespace FishNotify
} }
} }
/// <summary>
/// Both ClientLanguage.Korean and ClientLanguage.ChineseSimplified have value 4, but the string representation differs depending on the dalamud fork.
/// </summary>
/// <returns></returns>
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) private void OnNetworkMessage(IntPtr dataPtr, ushort opCode, uint sourceActorId, uint targetActorId, NetworkMessageDirection direction)
{ {
if (direction != NetworkMessageDirection.ZoneDown || opCode != expectedOpCode) if (direction != NetworkMessageDirection.ZoneDown || opCode != expectedOpCode)

View File

@ -1,43 +1,71 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Authors></Authors>
<Company></Company>
<Version>5.0</Version> <Version>5.0</Version>
<Description>Plays a sound effect when a fish bites</Description> <Description>Plays a sound effect when a fish bites</Description>
<Copyright></Copyright> <Copyright></Copyright>
<PackageProjectUrl>https://github.com/carvelli/Fish-Notify</PackageProjectUrl> <PackageProjectUrl>https://github.com/carvelli/Fish-Notify</PackageProjectUrl>
<Configurations>Release</Configurations> <Configurations>Release;Release-CN</Configurations>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<TargetFramework>net7.0-windows</TargetFramework>
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
<OutputPath>dist</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release-CN'">
<TargetFramework>net6.0-windows</TargetFramework>
<DalamudLibPath>E:\ffxiv\CN-dalamud\XIVLauncherCN\Roaming\addon\Hooks\dev\</DalamudLibPath>
<OutputPath>dist-CN</OutputPath>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Platforms>x64</Platforms> <Platforms>x64</Platforms>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly> <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputPath>dist</OutputPath>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
<Compile Remove="dist-CN\**" />
<EmbeddedResource Remove="dist-CN\**" />
<None Remove="dist-CN\**" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release-CN'">
<Compile Remove="dist\**" />
<EmbeddedResource Remove="dist\**" />
<None Remove="dist\**" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="FishNotify.json"> <Content Include="FishNotify.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release'">
<DalamudLibPath>$(appdata)\XIVLauncher\addon\Hooks\dev\</DalamudLibPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>none</DebugType> <DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-CN'">
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<ItemGroup Condition="'$(Configuration)'=='Release'">
<PackageReference Include="DalamudPackager" Version="2.1.10" /> <PackageReference Include="DalamudPackager" Version="2.1.10" />
</ItemGroup>
<ItemGroup Condition="'$(Configuration)'=='Release-CN'">
<PackageReference Include="DalamudPackager" Version="2.1.8" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Windows.Extensions" Version="7.0.0" /> <PackageReference Include="System.Windows.Extensions" Version="7.0.0" />
<Reference Include="FFXIVClientStructs"> <Reference Include="FFXIVClientStructs">
<HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath> <HintPath>$(DalamudLibPath)FFXIVClientStructs.dll</HintPath>
@ -84,8 +112,12 @@
</EmbeddedResource> </EmbeddedResource>
</ItemGroup> </ItemGroup>
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin"> <Target Name="RenameLatestZip" AfterTargets="PackagePlugin" Condition="'$(Configuration)'=='Release'">
<Exec Command="rename &quot;$(OutDir)$(AssemblyName)\latest.zip&quot; &quot;$(AssemblyName)-$(Version).zip&quot;" /> <Exec Command="rename &quot;$(OutDir)$(AssemblyName)\latest.zip&quot; &quot;$(AssemblyName)-$(Version).zip&quot;" />
</Target> </Target>
<Target Name="RenameLatestZip" AfterTargets="PackagePlugin" Condition="'$(Configuration)'=='Release-CN'">
<Exec Command="rename &quot;$(OutDir)$(AssemblyName)\latest.zip&quot; &quot;$(AssemblyName)-$(Version)-CN.zip&quot;" />
</Target>
</Project> </Project>

View File

@ -1,17 +1,20 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16 # Visual Studio Version 17
VisualStudioVersion = 16.0.29709.97 VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1 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 EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Release|x64 = Release|x64 Release|x64 = Release|x64
Release-CN|x64 = Release-CN|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3F91A6A9-5F97-4F6D-864C-DA066F94121A}.Release|x64.ActiveCfg = Release|x64 {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|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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE