Răsfoiți Sursa

update: 添加一个客户端模组

Dcrclub 5 luni în urmă
părinte
comite
e1a54dd91b

+ 15 - 0
ItemScanToMarkDown/README.MD

@@ -0,0 +1,15 @@
+### 扫描所有物品到文件
+
+* 客户端模组
+
+#### 使用方法:
+
+* 玩家挂载模组后,进入游戏, 将游戏UI的语言改为中文.
+
+* 然后在游戏中跳跃一下, 即可在游戏本地Profiles目录下找到一个名字为`ItemCodeComparisonTable.md`的文件
+
+* 然后自行下载一个markdown编辑器,打开这个文件, 即可
+
+### MarkDown编辑器推荐:
+
+* [https://github.com/marktext/marktext](https://github.com/marktext/marktext)

+ 69 - 0
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";
+    }
+}

+ 52 - 0
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/"
+                };
+            };
+        };
+    };
+};

+ 4 - 0
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脚本的执行权限