1- using BepInEx ;
1+ using System . Collections . Generic ;
2+ using BepInEx ;
23using BepInEx . Logging ;
34using HarmonyLib ;
45
56namespace BlackMossTemplate
67{
7- [ BepInPlugin ( "blackmoss.template " , "BlackMossTemplate " , "114514.1919.810 " ) ]
8+ [ BepInPlugin ( "blackmoss.consolescriptzh " , "ConsoleScriptZH " , "1.0.0 " ) ]
89 public class Plugin : BaseUnityPlugin
910 {
1011 internal static new ManualLogSource Logger ;
11- private readonly Harmony _harmony = new ( "blackmoss.template " ) ;
12+ private readonly Harmony _harmony = new ( "blackmoss.consolescriptzh " ) ;
1213 public static Plugin Instance { get ; private set ; } = null ! ;
1314
1415 public void Awake ( )
@@ -17,7 +18,76 @@ public void Awake()
1718 Instance = this ;
1819
1920 _harmony . PatchAll ( ) ;
20- Logger . LogInfo ( "Here's Black Moss!" ) ;
21+ Logger . LogInfo ( "控制台指令汉化补丁已启动!" ) ;
22+ }
23+
24+ [ HarmonyPatch ]
25+ public class ConsoleScriptPatch
26+ {
27+ [ HarmonyPostfix ]
28+ [ HarmonyPatch ( typeof ( ConsoleScript ) , nameof ( ConsoleScript . RegisterAllCommands ) ) ]
29+ public static void Postfix_RegisterAllCommands ( )
30+ {
31+ var commandDescriptions = new Dictionary < string , string >
32+ {
33+ { "help" , "显示所有可用命令的列表" } ,
34+ { "heal" , "瞬间治愈" } ,
35+ { "coagulate" , "停止所有出血" } ,
36+ { "kill" , "将脑组织完整度设为0立即杀死玩家" } ,
37+ { "spawn" , "在指定位置生成一个物品/环境物体" } ,
38+ { "spawncategory" , "从指定的战利品池生成所有物品,并且无重力" } ,
39+ { "tp" , "将玩家传送到指定位置。如果为空,则默认传送到光标位置" } ,
40+ { "skiplayer" , "如果未提供层级索引,则会立即跳到下一层;如果提供了层级索引,则会直接跳到该层" } ,
41+ { "log" , "在控制台历史中新增文本" } ,
42+ { "talk" , "让玩家说出一些话" } ,
43+ { "framerate" , "设置游戏的最大FPS。可能在构建版本中不起作用" } ,
44+ { "alert" , "显示一条提醒" } ,
45+ { "volume" , "设置音量" } ,
46+ { "saveandquit" , "立即保存游戏并退出到主菜单。加载存档时,你将回到当前关卡的起点" } ,
47+ { "resetskills" , "将所有技能设置为零" } ,
48+ { "fucklore" , "立即跳过任何全屏设定文本" } ,
49+ { "timescale" , "将时间刻度设置为所需的值" } ,
50+ { "setconsoleheight" , "将控制台高度设置为所需的值" } ,
51+ { "setconsolecolor" , "设置控制台某个元素的颜色。" } ,
52+ { "copylog" , "将整个控制台日志复制到剪贴板" } ,
53+ { "clear" , "清除控制台日志" } ,
54+ { "addxp" , "给予角色在选定技能上的经验" } ,
55+ { "loglocale" , "获取一个本地化字符串并将其记录到控制台" } ,
56+ { "openfolder" , "打开游戏文件夹" } ,
57+ { "setbodyfield" , "设置身体数值" } ,
58+ { "setlimbfield" , "设置肢体数值" } ,
59+ { "amputate" , "瞬间肢体断裂,不可逆转" } ,
60+ { "unchipped" , "打开/关闭无芯片模式" } ,
61+ { "pixelate" , "设置像素滤镜开/关" } ,
62+ { "addcustomcommand" , "向列表中增加自定义命令" } ,
63+ { "addliquid" , "向主手持有的物品中增加指定量的液体" } ,
64+ { "locate" , "搜索具有指定名称的任何物体,并传送到其中一个" } ,
65+ { "removecustomcommand" , "从列表中移除已有的自定义命令" } ,
66+ { "music" , "管理背景音乐。可以播放新曲目、跳过当前曲目的时间或打开MP3菜单" } ,
67+ { "bind" , "管理自定义命令绑定,可以增加、移除或列出它们" } ,
68+ { "repeat" , "以指定的次数运行指定的一系列命令,并带有延迟。" } ,
69+ { "explode" , "在指定位置发生爆炸,并可使用可选参数" } ,
70+ { "echo" , "切换所有新命令日志" } ,
71+ { "starterkit" , "以随机套装生成,包含基础容器、工具和药品" } ,
72+ { "noclip" , "切换无碰撞模式(启用飞行并禁用玩家碰撞)" } ,
73+ { "playsound" , "播放指定ID的音频" } ,
74+ { "fullbright" , "切换调试照明" } ,
75+ { "errorlogging" , "切换错误日志" }
76+ } ;
77+
78+ if ( ConsoleScript . Commands == null )
79+ {
80+ return ;
81+ }
82+
83+ foreach ( var command in ConsoleScript . Commands )
84+ {
85+ if ( commandDescriptions . TryGetValue ( command . name , out string description ) )
86+ {
87+ command . description = description ;
88+ }
89+ }
90+ }
2191 }
2292 }
2393}
0 commit comments