diff --git a/static/game_configs/persona.csv b/static/game_configs/persona.csv index 74057f6..8207e30 100644 --- a/static/game_configs/persona.csv +++ b/static/game_configs/persona.csv @@ -6,8 +6,8 @@ id,name,exclusion_names,desc,rarity,condition,effects 4,冒险,怠惰;惜命,你总是会冒险,喜欢刺激,总想放手一搏。,N, 5,随性,理性;极端正义;极端邪恶,你总是会随机应变,性子到哪里了就是哪里,没有一定之规。,N, 6,贪财,,你对灵石和财富有着强烈的渴望。,N, -7,药师,,喜欢在山林中寻找各种奇花异草和灵药,对植物有着敏锐的直觉和深厚的兴趣。你认为大自然的恩赐需要用心去发现和珍惜。,R,,{extra_harvest_items: 1} -8,猎者,,享受在野外追踪猎物的刺激感,对各种动物的习性了如指掌,喜欢捕猎野兽。情况允许也会御兽。,R,,{extra_hunt_items: 1} +7,采集者,,喜欢在山林中寻找各种奇花异草和灵药,对植物有着敏锐的直觉和深厚的兴趣。你认为大自然的恩赐需要用心去发现和珍惜。,R,,{extra_harvest_items: 1} +8,猎人,,享受在野外追踪猎物的刺激感,对各种动物的习性了如指掌,喜欢捕猎野兽。情况允许也会御兽。,R,,{extra_hunt_items: 1} 9,沉思,无常,你总是会深思熟虑,思考问题比较有哲理。,N, 10,惜命,冒险;极端正义;极端邪恶,你总是会珍惜自己的生命,不会轻易冒险。,R,,{extra_escape_success_rate: 0.15} 11,友爱,孤僻;淡漠;好斗;复仇;极端正义;极端邪恶,你重视同伴与和谐,乐于助人,倾向通过协作与沟通化解矛盾。,N, diff --git a/tools/package/compress.ps1 b/tools/package/compress.ps1 new file mode 100644 index 0000000..9751f3a --- /dev/null +++ b/tools/package/compress.ps1 @@ -0,0 +1,106 @@ +$ErrorActionPreference = "Stop" + +# ============================================================================== +# 1. Environment & Path Setup +# ============================================================================== +$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path +$RepoRoot = (Resolve-Path (Join-Path $ScriptDir "..\..")).Path + +# ============================================================================== +# 2. Get Git Tag (Version) +# ============================================================================== +Push-Location $RepoRoot +$tag = "" +$tagDesc = & git describe --tags --abbrev=0 2>$null +if ($LASTEXITCODE -eq 0 -and $tagDesc) { + $tag = $tagDesc.Trim() +} +Pop-Location + +if (-not $tag) { + Write-Error "Cannot determine git tag. Please ensure this is a git repository with tags." + exit 1 +} + +Write-Host "Target Version (Tag): $tag" -ForegroundColor Cyan + +# ============================================================================== +# 3. Locate Source Directory +# ============================================================================== +# Instead of hardcoding the AppName (which may cause encoding issues with Chinese characters), +# we dynamically find the directory in tmp// +$TagBaseDir = Join-Path $RepoRoot "tmp\$tag" + +if (-not (Test-Path $TagBaseDir)) { + Write-Error "Build directory for tag '$tag' not found at: $TagBaseDir" + Write-Error "Please run 'tools/package/pack.ps1' first to build this version." + exit 1 +} + +# Find the first directory inside the tag folder (this should be the AppName folder) +$AppDirObj = Get-ChildItem -Path $TagBaseDir -Directory | Select-Object -First 1 + +if (-not $AppDirObj) { + Write-Error "No application directory found inside: $TagBaseDir" + exit 1 +} + +$AppName = $AppDirObj.Name +$SourceDir = $AppDirObj.FullName + +Write-Host "Found Application: $AppName" -ForegroundColor Gray +Write-Host "Source Directory: $SourceDir" -ForegroundColor Gray + +# ============================================================================== +# 4. Clean Sensitive Files +# ============================================================================== +Write-Host "Cleaning up sensitive/temporary files..." -ForegroundColor Yellow + +# 4.1 Remove local_config.yml (Recursively) +$SensitiveFiles = Get-ChildItem -Path $SourceDir -Include "local_config.yml" -Recurse -Force +if ($SensitiveFiles) { + foreach ($file in $SensitiveFiles) { + Remove-Item -Path $file.FullName -Force + Write-Host " [-] Deleted Config: $($file.FullName)" -ForegroundColor DarkGray + } +} else { + Write-Host " [i] No local_config.yml files found." -ForegroundColor DarkGray +} + +# 4.2 Remove log files (Recursively) - cleanup from testing +$LogFiles = Get-ChildItem -Path $SourceDir -Include "*.log" -Recurse -Force +if ($LogFiles) { + foreach ($file in $LogFiles) { + Remove-Item -Path $file.FullName -Force + Write-Host " [-] Deleted Log: $($file.FullName)" -ForegroundColor DarkGray + } +} + +# ============================================================================== +# 5. Compress +# ============================================================================== +$ZipFileName = "${AppName}_${tag}.zip" +$ZipPath = Join-Path $RepoRoot "tmp\$ZipFileName" + +if (Test-Path $ZipPath) { + Remove-Item -Path $ZipPath -Force + Write-Host "Removed existing archive: $ZipPath" -ForegroundColor DarkGray +} + +Write-Host "Compressing to: $ZipPath" -ForegroundColor Cyan +Write-Host "This may take a moment..." -ForegroundColor Gray + +try { + # Compressing $SourceDir puts the directory itself into the root of the zip + Compress-Archive -Path $SourceDir -DestinationPath $ZipPath -CompressionLevel Optimal + + if (Test-Path $ZipPath) { + Write-Host "`nSUCCESS: Package created at:" -ForegroundColor Green + Write-Host $ZipPath -ForegroundColor White + } else { + throw "Archive file was not created." + } +} catch { + Write-Error "Compression failed: $_" + exit 1 +}