diff --git a/.gitignore b/.gitignore index 5a8c349..11dd99a 100644 --- a/.gitignore +++ b/.gitignore @@ -17,5 +17,6 @@ version/* .idea/misc.xml .idea/vcs.xml .idea/modules.xml +*.zip venv/ log/ \ No newline at end of file diff --git "a/\346\233\264\346\226\260\346\227\245\345\277\227.md" b/changelog.md similarity index 98% rename from "\346\233\264\346\226\260\346\227\245\345\277\227.md" rename to changelog.md index 0f916ce..209e113 100644 --- "a/\346\233\264\346\226\260\346\227\245\345\277\227.md" +++ b/changelog.md @@ -3,6 +3,8 @@ - 增加和假人联动的功能 ### bug修复 - 修复prof测试红石用时计算错误的问题(#32) +### 开发 +- 增加release的打包功能 ## 1.16.4-0.9.40 ### 开发 diff --git a/inject.ps1 b/inject.ps1 index e8ca2ba..54ef629 100644 --- a/inject.ps1 +++ b/inject.ps1 @@ -1,11 +1,11 @@ chcp 65001 -$INJECTOR = "MCDllInject.exe" +$INJECTOR = "MCDllInject.exe" $GAME_VERSION = "1.16.40.02" -$BDS_DIR = "C:\Users\xhy\Desktop\MC\bedrock-server-"+$GAME_VERSION+"\" +$BDS_DIR = "C:\Users\xhy\Desktop\MC\bedrock-server-" + $GAME_VERSION + "\" $TD_BUILD_DIR = "C:\Users\xhy\dev\TrapDoor\cmake-build-release\" -$BDS_FILE = $BDS_DIR+"bedrock_server.exe" +$BDS_FILE = $BDS_DIR + "bedrock_server.exe" $LOG_DIR = "C:\Users\xhy\dev\TrapDoor\log\" -$Date = $(get-date -f yyyy-MM-dd)+" "+$(get-date -f HH-mm-ss) +$Date = $( get-date -f yyyy-MM-dd ) + " " + $( get-date -f HH-mm-ss ) Write-Output "ues injector "$INJECTOR Write-Output "game version is "$GAME_VERSION diff --git a/mod/test/TrapdoorTest.cpp b/mod/test/TrapdoorTest.cpp index eb4c480..19e65ce 100644 --- a/mod/test/TrapdoorTest.cpp +++ b/mod/test/TrapdoorTest.cpp @@ -97,8 +97,8 @@ namespace mod::test { for (int j = 0; j < 4; j++) { auto index = i * 4 + j; if (index < blocks.size()) { - trapdoor::BlockPos p = player->getStandPosition() + trapdoor::BlockPos(i+2,0,j+2); - bs->setBlock(&p,getBlockByID(blocks[index])); + trapdoor::BlockPos p = player->getStandPosition() + trapdoor::BlockPos(i + 2, 0, j + 2); + bs->setBlock(&p, getBlockByID(blocks[index])); } } } diff --git a/pack.py b/pack.py deleted file mode 100644 index e69de29..0000000 diff --git a/lang/en_us.json b/package/lang/en_us.json similarity index 100% rename from lang/en_us.json rename to package/lang/en_us.json diff --git a/lang/zh_cn.json b/package/lang/zh_cn.json similarity index 97% rename from lang/zh_cn.json rename to package/lang/zh_cn.json index fe19219..2a5f103 100644 --- a/lang/zh_cn.json +++ b/package/lang/zh_cn.json @@ -123,8 +123,8 @@ "command.fakeplayer.add.desc": "添加一个假玩家", "command.fakeplayer.remove.desc": "删除一个假玩家", "command.fakeplayer.tp.desc": "将假冒玩家传送到指定位置", - "fp.error.noConnect": "Web socket未连接", - "fp.error.status": "Web socket已连接", + "fp.error.noConnect": "Websocket未连接", + "fp.error.status": "Websocket已连接", "fp.error.noSource": "你之所以收到这条消息是因玩家%s 已经离线", "fp.info.connected": "trapdoor已连接到:%s", "fp.error.connect": "无法连接:%s,请检查ws的url", @@ -136,5 +136,5 @@ "fp.connect.success": "成功%s添加假人[%s]", "fp.connect.fail": "无法%s添加假人 [%s],原因:%s", "fp.tp.success": "假玩家已被传送到玩家[%s]的位置", - "fp.tp.fail": "假人,请尝试执行fakeplayer list命令,然后重试" + "fp.tp.fail": "找不到假人,请尝试执行fakeplayer list命令,然后重试" } diff --git a/package/pack.py b/package/pack.py new file mode 100644 index 0000000..7f85b27 --- /dev/null +++ b/package/pack.py @@ -0,0 +1,71 @@ +import builtins +import os +from os import path +import zipfile + + +build_dir = '../cmake-build-release' +lang_folders = 'lang/' +config_file = 'trapdoor-config.json' +other_files = ['../changelog.md','../README.md','../README_zh.md','../trapdoor-disclaimer.md','../LICENSE'] + + +#get dll files +dll_files = [] +for file in os.listdir(build_dir): + if file.endswith('.dll'): + dll_files.append(file) + +if len(dll_files) == 0: + input('warning: no valid files') + exit(0) +dll_files.sort() +tips = 'choose one to pack\n' +index = 0 +for file in reversed(dll_files): + tips += '['+ str(index)+ '] : '+ file+'\n' + index += 1 + +#choose version +idx = 0 +if len(dll_files) > 1: + idx = input(tips) + idx = int(idx) + if idx <0 or idx >= len(dll_files): + input('invalid files\n') + exit(0) + + +dll_file = dll_files[len(dll_files)-1-idx] + + +## check lang and config.json +if not (path.exists(lang_folders) and path.exists(config_file)): + input('can not find land folder or config_file') + exit(0) + +## check other files +for other_file in other_files: + if not path.exists(other_file): + input('can not find file'+other_file+'\n') + exit(0) + +#get version +version = dll_file[:-4] +print('version is '+version) +print('begin packing...') + +#begin pack +release_zip_file = zipfile.ZipFile(version +'.zip','w') +release_zip_file.write(build_dir+'/'+ dll_file,arcname=dll_file) +print('pack: ' + dll_file) +for file in os.listdir(lang_folders): + if file.endswith('.json'): + print('pack: ' + file) + release_zip_file.write(lang_folders+file) +for other_file in other_files: + other_file_name = other_file[3:] + print('pack: ' + other_file_name) + release_zip_file.write(other_file,arcname=other_file_name) +release_zip_file.close() +input('success pack release:' + version+'.zip\n') diff --git a/package/trapdoor-config.json b/package/trapdoor-config.json new file mode 100644 index 0000000..e2ca8b5 --- /dev/null +++ b/package/trapdoor-config.json @@ -0,0 +1,134 @@ +{ + "EULA":true, + "commands": { + "/tick": { + "enable": true, + "permissionLevel": 1 + }, + "/village": { + "enable": true, + "permissionLevel": 0 + }, + "/prof": { + "enable": true, + "permissionLevel": 0 + }, + "/mspt": { + "enable": true, + "permissionLevel": 0 + }, + "/o": { + "enable": true, + "permissionLevel": 1 + }, + "/c": { + "enable": true, + "permissionLevel": 1 + }, + "/s": { + "enable": true, + "permissionLevel": 1 + }, + "/hsa": { + "enable": true, + "permissionLevel": 0 + }, + "/func": { + "enable": true, + "permissionLevel": 1 + }, + "/counter": { + "enable": true, + "permissionLevel": 1 + }, + "/td?": { + "enable": true, + "permissionLevel": 0 + }, + "/os": { + "enable": true, + "permissionLevel": 0 + }, + "/apicfg": { + "enable": true, + "permissionLevel": 1 + }, + "/draw": { + "enable": true, + "permissionLevel": 0 + }, + "/slime": { + "enable": true, + "permissionLevel": 0 + }, + "/backup": { + "enable": true, + "permissionLevel": 1 + }, + "/self": { + "enable": true, + "permissionLevel": 0 + }, + "/cl": { + "enable": true, + "permissionLevel": 0 + }, + "/dev": { + "enable": true, + "permissionLevel": 1 + }, + "/here": { + "enable": true, + "permissionLevel": 0 + }, + + "/l": { + "enable": true, + "permissionLevel": 1 + }, + "/lang":{ + "enable":true, + "permissionLevel": 1 + }, + "/spawn":{ + "enable":true, + "permissionLevel": 0 + }, + "/fakeplayer":{ + "enable":true, + "permissionLevel": 1 + }, + "/rs":{ + "enable":true, + "permissionLevel": 1 + } + }, + "lowLevelVanillaCommands":[ + "stop", + "whitelist" + ], + + "server":{ + "levelName": "Bedrock level", + "lang": "zh_cn" + }, + + "village":{ + "bound": "red", + "spawn": "red", + "poiQuery": "red", + "center": "minecraft:heart_particle" + }, + "functionsEnable":{ + "hopperCounter": false, + "spawnHelper":false, + "cactusRotate":false, + "simpleDraw":false, + "playerStat":false + }, + "selfEnable":{ + "chunkShow":true, + "distanceMeasure":true, + "redstoneStick":true + } +} \ No newline at end of file