Skip to content

Commit

Permalink
add pack script
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaohengying committed Apr 20, 2021
1 parent 3e06aba commit 564e0cd
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@ version/*
.idea/misc.xml
.idea/vcs.xml
.idea/modules.xml
*.zip
venv/
log/
2 changes: 2 additions & 0 deletions 更新日志.md → changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- 增加和假人联动的功能
### bug修复
- 修复prof测试红石用时计算错误的问题(#32)
### 开发
- 增加release的打包功能
## 1.16.4-0.9.40

### 开发
Expand Down
8 changes: 4 additions & 4 deletions inject.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions mod/test/TrapdoorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]));
}
}
}
Expand Down
Empty file removed pack.py
Empty file.
File renamed without changes.
6 changes: 3 additions & 3 deletions lang/zh_cn.json → package/lang/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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命令,然后重试"
}
71 changes: 71 additions & 0 deletions package/pack.py
Original file line number Diff line number Diff line change
@@ -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')
134 changes: 134 additions & 0 deletions package/trapdoor-config.json
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit 564e0cd

Please sign in to comment.