XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEWarframe

【WinUI】基于Warframe游戏本体的公开服务器以及安装器

公开
关注 0 Fork 0 Star 0
UTF-8
#requires -Version 7.0
param(
    [string]$SessionFile = (Join-Path $PSScriptRoot '../artifacts/ability-bank-game-test/session.json'),
    [string]$ReportDirectory = (Join-Path $PSScriptRoot '../artifacts/ability-audio-validation')
)
. (Join-Path $PSScriptRoot 'Game-TestHelpers.ps1') -SessionFile $SessionFile -ReportDirectory $ReportDirectory
try {
    $status=Invoke-Runtime '/runtime/v1/status'
    if ($status.serverUrl -ne $taskTest.origin -or -not ($status.capabilities | Where-Object { $_.key -eq 'game_test_control' -and $_.available })) {
        throw 'Expected the isolated engine test session.'
    }
    $taskEvidence.build=$status.gameVersion; $taskEvidence.bridgeVersion=$status.version
    $taskEvidence.scope='Native skill input, energy cost and original native sound playback requests. This test does not record the audio device output.'
    function Input([int]$Slot, [int]$Milliseconds) {
        $null=Invoke-Runtime '/runtime/v1/game/ability-input' @{slot=$Slot;pressed=$true;exclusive=$true}
        Start-Sleep -Milliseconds $Milliseconds
        $null=Invoke-Runtime '/runtime/v1/game/ability-input' @{slot=$Slot;pressed=$false;exclusive=$true}
        Start-Sleep -Seconds 2
    }
    function Energy {
        (Invoke-Engine ($taskSuitSteps+@(@{from=6;field='0xEF680AA6'},@{call=7;args=@(@{ref=6})})))[8].number
    }
    Select-Config 0 @('ShockAbility','PullAbility','IronSkinAbility','IronSkinAbility')
    foreach($test in @(
        @{slot=3;choice=0;ability='IronSkinAbility';cost=50;sound='*/RhinoAbilityCast'},
        @{slot=0;choice=1;ability='RhinoRoarAbility';cost=75;sound='*/RhinoAbilityCast'},
        @{slot=0;choice=2;ability='PullAbility';cost=25;sound='*/MagPullCast'}
    )) {
        if ($test.choice -ne 0) { Input $test.slot 70 }
        $null=Invoke-Engine ($taskSuitSteps+@(@{from=6;field='GetMaxEnergy'},@{call=7;args=@(@{ref=6})},@{from=6;field='SetEnergy'},@{call=9;args=@(@{ref=6},@{ref=8})}))
        $before=Invoke-Runtime '/runtime/v1/game/ability-state'; $energyBefore=Energy
        $sequence=if ($before.soundEvents.events.Count -gt 0) { $before.soundEvents.events[-1].sequence } else { 0 }
        Input $test.slot 500
        $after=Invoke-Runtime '/runtime/v1/game/ability-state'; $energyAfter=Energy
        $sounds=@($after.soundEvents.events | Where-Object { $_.sequence -gt $sequence -and $_.source -eq 'native' })
        $passed=@(Get-Abilities)[$test.slot] -eq $test.ability -and ($energyBefore-$energyAfter) -eq $test.cost -and
            @($sounds | Where-Object resource -Like $test.sound).Count -gt 0
        $taskEvidence.checks.Add(@{kind="candidate-$($test.choice)-native-sound";passed=$passed;ability=$test.ability;
            energyBefore=$energyBefore;energyAfter=$energyAfter;sounds=$sounds;state=$after.slots[$test.slot]})
        if (-not $passed) { throw "Native sound validation failed for $($test.ability)." }
        Write-Host "Passed: candidate $($test.choice), $($test.ability), original sound and energy cost."
    }
    $taskEvidence.passed=$true
} finally {
    try { $null=Invoke-Runtime '/runtime/v1/game/ability-input' @{slot=0;pressed=$false;exclusive=$false} } catch { }
    $taskEvidence.finished=[DateTimeOffset]::UtcNow.ToString('o')
    $taskEvidence | ConvertTo-Json -Depth 30 | Set-Content -LiteralPath (Join-Path $ReportDirectory 'result.json') -Encoding utf8
    $taskHttp.Dispose()
}