From e1a54dd91bae6bc31f364537b3d22d3669d0e997 Mon Sep 17 00:00:00 2001 From: Dcrclub Date: Sat, 23 Nov 2024 14:46:09 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=AB=AF=E6=A8=A1=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ItemScanToMarkDown/README.MD | 15 ++++++ ItemScanToMarkDown/Scripts/PlayerBase.c | 69 +++++++++++++++++++++++++ ItemScanToMarkDown/config.cpp | 52 +++++++++++++++++++ README.md | 4 ++ 4 files changed, 140 insertions(+) create mode 100644 ItemScanToMarkDown/README.MD create mode 100644 ItemScanToMarkDown/Scripts/PlayerBase.c create mode 100644 ItemScanToMarkDown/config.cpp diff --git a/ItemScanToMarkDown/README.MD b/ItemScanToMarkDown/README.MD new file mode 100644 index 0000000..daad092 --- /dev/null +++ b/ItemScanToMarkDown/README.MD @@ -0,0 +1,15 @@ +### 扫描所有物品到文件 + +* 客户端模组 + +#### 使用方法: + +* 玩家挂载模组后,进入游戏, 将游戏UI的语言改为中文. + +* 然后在游戏中跳跃一下, 即可在游戏本地Profiles目录下找到一个名字为`ItemCodeComparisonTable.md`的文件 + +* 然后自行下载一个markdown编辑器,打开这个文件, 即可 + +### MarkDown编辑器推荐: + +* [https://github.com/marktext/marktext](https://github.com/marktext/marktext) \ No newline at end of file diff --git a/ItemScanToMarkDown/Scripts/PlayerBase.c b/ItemScanToMarkDown/Scripts/PlayerBase.c new file mode 100644 index 0000000..0acf6d5 --- /dev/null +++ b/ItemScanToMarkDown/Scripts/PlayerBase.c @@ -0,0 +1,69 @@ +modded class PlayerBase extends ManBase +{ + override void OnJumpStart() + { + super.OnJumpStart(); + + if ( GetGame().IsServer() ) + return; + + if ( GetCurrentUILanguage() != "zh_CN" ) + { + MessageAction( "Please set the UI language to Chinese" ); + return; + } + + string FilePathStr = "$profile:ItemCodeComparisonTable.md"; + + if ( FileExist( FilePathStr ) ) + DeleteFile( FilePathStr ); + + FileHandle file = OpenFile( FilePathStr, FileMode.APPEND ); + if ( file == 0 ) + { + MessageImportant( "存储文件创建失败. 请重试!" ); + return; + } + + string path = "cfgVehicles"; + int childcount = GetGame().ConfigGetChildrenCount( path ); + + FPrintln( file, "| ClassName | DisplayNmae |" ); + FPrintln( file, "| ----------- | ----------- |" ); + for(int i = 0; i < childcount; i++) + { + string itemname; + GetGame().ConfigGetChildName( path, i, itemname ); + string chilepath = path + " " + itemname; + int scope = GetGame().ConfigGetInt( chilepath + " scope" ); + if ( scope == 0 || scope == 1 ) + continue; + + string displayname; + GetGame().ConfigGetText( chilepath + " displayname", displayname ); + if ( !displayname || displayname == "" || displayname.Contains( "$UNT$" ) ) + continue; + + FPrintln( file, "| " + itemname + " | " + Widget.TranslateString( displayname ) + " |" ); + } + + CloseFile( file ); + } + + string GetCurrentUILanguage() + { + ListOptionsAccess language_option; + GameOptions gameOptions = new GameOptions; + language_option = ListOptionsAccess.Cast( gameOptions.GetOptionByType( OptionAccessType.AT_OPTIONS_LANGUAGE ) ); + int idx = -1; + if ( language_option ) + idx = language_option.GetIndex(); + + string languageName; + language_option.GetItemText( idx, languageName ); + if ( languageName == "#options_language_CHS" ) + return "zh_CN"; + + return "en_US"; + } +} \ No newline at end of file diff --git a/ItemScanToMarkDown/config.cpp b/ItemScanToMarkDown/config.cpp new file mode 100644 index 0000000..46d0f68 --- /dev/null +++ b/ItemScanToMarkDown/config.cpp @@ -0,0 +1,52 @@ +class CfgPatches +{ + class ItemScanToMarkDown + { + requiredVersion=0.1; + requiredAddons[]= + { + "DZ_Scripts", + "DZ_Data" + }; + units[]={}; + weapons[]={}; + }; +}; +class CfgMods +{ + class ItemScanToMarkDown + { + dir = "ItemScanToMarkDown"; + picture = ""; + action = ""; + hideName = 1; + hidePicture = 1; + name="ItemScanToMarkDown"; + credits = ""; + creditsJson = ""; + author = "稻草人"; + overview = ""; + authorID = "289986635"; + version = "1.0"; + extra = 0; + type = "mod"; + + dependencies[]= + { + "Game", + "World", + "Mission" + }; + class defs + { + class worldScriptModule + { + value=""; + files[]= + { + "ItemScanToMarkDown/Scripts/" + }; + }; + }; + }; +}; \ No newline at end of file diff --git a/README.md b/README.md index eeae051..cda7f4e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ 仓库中存放一些DayZ的服务端用脚本, 或者玩家端使用的脚本. +# MarkDown编辑器推荐 +- [https://github.com/marktext/marktext](https://github.com/marktext/marktext) + ## 目录说明: | 目录名 | 说明 | @@ -10,6 +13,7 @@ | PlayerDataReturnGear | 单玩家数据回档 | | DayZBoot | 玩家端 启动游戏 直连脚本 | | BootWorkBench | 自动挂载P盘,并启动WorkBench | +| ItemScanToMarkDown | 客户端模组: 提取所有物品代码,内附使用说明 | ## 如何在windows上启用powershell脚本的执行权限