Administrator's Toolkit VS plugin
修订版 | 7093d8fa8159e7e8d1f356433224a5a4c1e818ad (tree) |
---|---|
时间 | 2020-11-18 10:39:14 |
作者 | ![]() |
Commiter | melchior |
WIP partly completed ML support
@@ -102,13 +102,22 @@ namespace AdminToolkit | ||
102 | 102 | double.TryParse(elapsedDayStr, out elapsedDays)) { |
103 | 103 | elapsedDays = ServerAPI.World.Calendar.TotalDays - elapsedDays; |
104 | 104 | var playerPos = byPlayer.Entity.Pos.AsBlockPos.Copy(); |
105 | - //No Localized Season names? | |
106 | - var welcomeMsg = $"Meantime... {elapsedDays:F1} days have passed. {ServerAPI.World.AllOnlinePlayers.Length} Players online. It is {ServerAPI.World.Calendar.GetSeason(playerPos)} in the {ServerAPI.World.Calendar.GetHemisphere(playerPos)}."; | |
107 | - | |
108 | - byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, welcomeMsg, EnumChatType.OthersMessage); | |
105 | + | |
106 | + //No Localized Season/Hemispehere names? | |
107 | + string welcomebackMsg = Lang.Get(@"welcomeback-message", | |
108 | + elapsedDays, | |
109 | + ServerAPI.World.AllOnlinePlayers.Length, | |
110 | + ServerAPI.World.Calendar.GetSeason(playerPos), | |
111 | + ServerAPI.World.Calendar.GetHemisphere(playerPos) | |
112 | + ); | |
113 | + | |
114 | + byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, welcomebackMsg, EnumChatType.OthersMessage); | |
109 | 115 | } |
110 | 116 | else { |
111 | - byPlayer.SendMessage(GlobalConstants.CurrentChatGroup, $"In the year; {ServerAPI.World.Calendar.PrettyDate( )}", EnumChatType.OthersMessage); | |
117 | + string welcomeMsg = Lang.Get(@"welcome-message", | |
118 | + ServerAPI.World.Calendar.PrettyDate( ) | |
119 | + ); | |
120 | + byPlayer.SendMessage(GlobalConstants.CurrentChatGroup,welcomeMsg, EnumChatType.OthersMessage); | |
112 | 121 | } |
113 | 122 | |
114 | 123 | byPlayer.ServerData.CustomPlayerData[AdminToolkit._lastGameDayCountKey] = ServerAPI.World.Calendar.TotalDays.ToString("R"); |
@@ -116,6 +125,12 @@ namespace AdminToolkit | ||
116 | 125 | |
117 | 126 | } |
118 | 127 | |
128 | + /* Something like: | |
129 | + | |
130 | + string GetLang(string key, string langCode, params object[ ] parameters) //No fallback | |
131 | + string GetLang_Fallback(string key, string langCode, params object[ ] parameters) //Uses 'Local' language for missing key | |
132 | + | |
133 | + */ | |
119 | 134 | } |
120 | 135 | } |
121 | 136 |
@@ -65,6 +65,10 @@ | ||
65 | 65 | <HintPath>VS_libs\VintagestoryLib.dll</HintPath> |
66 | 66 | <Private>False</Private> |
67 | 67 | </Reference> |
68 | + <Reference Include="Newtonsoft.Json"> | |
69 | + <HintPath>VS_libs\Newtonsoft.Json.dll</HintPath> | |
70 | + <Private>False</Private> | |
71 | + </Reference> | |
68 | 72 | </ItemGroup> |
69 | 73 | <ItemGroup> |
70 | 74 | <Compile Include="AdminToolkitMod.cs" /> |
@@ -78,10 +82,14 @@ | ||
78 | 82 | <Compile Include="Commands\PingerCommand.cs" /> |
79 | 83 | <Compile Include="Commands\VariableSpawnpoints.cs" /> |
80 | 84 | <Compile Include="ATK_BasicFeatures.cs" /> |
85 | + <Compile Include="MultiLang.cs" /> | |
81 | 86 | </ItemGroup> |
82 | 87 | <ItemGroup> |
83 | 88 | <Folder Include="VS_libs\" /> |
84 | 89 | <Folder Include="Commands\" /> |
90 | + <Folder Include="assets\" /> | |
91 | + <Folder Include="assets\atk\" /> | |
92 | + <Folder Include="assets\atk\lang\" /> | |
85 | 93 | </ItemGroup> |
86 | 94 | <ItemGroup> |
87 | 95 | <None Include="modinfo.json"> |
@@ -89,6 +97,9 @@ | ||
89 | 97 | </None> |
90 | 98 | <None Include="LICENSE.txt" /> |
91 | 99 | <None Include="readme.md" /> |
100 | + <None Include="assets\atk\lang\en.json"> | |
101 | + <CopyToOutputDirectory>Always</CopyToOutputDirectory> | |
102 | + </None> | |
92 | 103 | </ItemGroup> |
93 | 104 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> |
94 | 105 | </Project> |
\ No newline at end of file |
@@ -32,6 +32,8 @@ namespace AdminToolkit | ||
32 | 32 | * [???] Custom Server name : custom formats to indicate server state/time/things |
33 | 33 | * [IDEA]: Player VIRTUAL (temp) Inventory; Move Player inventory to alternate [world] D.B. as Inventory backup |
34 | 34 | * [WIP]: Variable Player (re)Spawn points from a list ~ at random |
35 | + * | |
36 | + * WORKAROUND -- Localized messages are by SERVERS Native Language code...Not the players... | |
35 | 37 | */ |
36 | 38 | |
37 | 39 | private ICoreAPI API { get; set; } |
@@ -1 +1,12 @@ | ||
1 | - | |
1 | +{ | |
2 | + "welcomeback-message": "Meantime... {0:F1} days have passed. {1} Players online. It is {2} in the {3}.", | |
3 | + "welcome-message":"In the year; {0}", | |
4 | + "display-rules":"Display server Rules", | |
5 | + "already-accept":"{0} ALREADY ACCEPTED RULES!", | |
6 | + "type-chat-rules":"{0} type in chat console: /rules {1}", | |
7 | + "missing-rules":"* MISSING RULES FILE ({0})! *", | |
8 | + "type-rules":"type ' /rules ' command for reading server rules.", | |
9 | + "accepted-rules":"{0} HAS ACCEPTED THE RULES!", | |
10 | + "promoted-to":"{0} have been promoted to: {1}", | |
11 | + "demoted-to":"{0} have been demoted to: {1}", | |
12 | +} |
@@ -1,11 +1,12 @@ | ||
1 | 1 | { |
2 | 2 | "type": "code", |
3 | 3 | "name": "Administrator's Toolkit mod", |
4 | - "description" : "Provides misc. Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & more...", | |
4 | + "ModID":"atk", | |
5 | + "description" : "Provides misc. Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & much more.", | |
5 | 6 | "authors": ["Melchior", ], |
6 | 7 | "version": "0.3.6", |
7 | 8 | "dependencies": { |
8 | - "game": "1.13.0" | |
9 | + "game": "1.13.4" | |
9 | 10 | }, |
10 | 11 | "requiredonclient":false, |
11 | 12 | "website": "https://osdn.net/users/melchior/pf/admintoolkit/" |