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/fetch-game-validation-20261004/session.json'))
. (Join-Path $PSScriptRoot 'Fetch-TestHelpers.ps1') -SessionFile $SessionFile
$taskFetchEvidence = [ordered]@{started=[DateTimeOffset]::UtcNow.ToString('o');gamePid=$taskGame[0].Id;
    executableSha256=$taskEvidence.executableSha256;bridgeSha256=$taskEvidence.bridgeSha256;passed=$false;
    checks=[Collections.Generic.List[object]]::new()}
function Update-TestActivity {
    # Direct engine movement on this isolated avatar; no desktop or keyboard input.
    # NotifyActivity alone does not update the movement-specific Fetch AFK timer.
    $p = Get-PlayerPosition
    $null = Invoke-Engine @(@{global='gRegion'},@{from=0;field='GetLocalPlayerAvatar'},@{call=1;args=@(@{ref=0})},
        @{from=2;field='SetPosition'},@{global='Vector'},@{call=4;args=@(($p.x+3),$p.y,$p.z)},
        @{call=3;args=@(@{ref=2},@{ref=5})},@{from=2;field='GetPlayer'},@{call=7;args=@(@{ref=2})},
        @{from=8;field='NotifyActivity'},@{call=9;args=@(@{ref=8})})
}
function Get-NativeFetchTrigger {
    $r = Invoke-Engine ($taskPetSteps[0..6]+@(@{from=6;field='GetFullName'},@{call=7;args=@(@{ref=6})}))
    $name = $r[8].text
    if ($name -notmatch '^KubrowPetAvatar\d+$') { throw "Expected a combat pet, got $name." }
    $r = Invoke-Engine @(@{global='_T'},@{from=0;field='gSuckTriggers';literal=$true},@{global='rawget'},
        @{call=2;args=@(@{ref=1},$name)},@{from=3;field='GetRadius'},@{call=4;args=@(@{ref=3})},
        @{from=3;field='IsEnabled'},@{call=6;args=@(@{ref=3})})
    @{pet=$name;radius=$r[5].number;enabled=$r[7].hashOrBoolean -eq '0x00000001'}
}
function Restart-TestScene([int]$Config) {
    Select-PetConfig $Config
    $null = Invoke-Engine @(@{global='require'},@{call=0;args=@('Lotus.Scripts.SimulacrumUtilities')},
        @{from=1;field='LaunchDangerRoom'},@{call=2;args=@()})
    Start-Sleep -Seconds 6
    $null = Invoke-Engine @(@{global='_T'},@{from=0;field='BackgroundMovie';literal=$true},@{from=1;field='Execute'},
        @{call=2;args=@(@{ref=1},'OnLoginDone','')},@{global='rawset'},@{call=4;args=@(@{ref=0},'gShowingLoginScreen',$false)})
    # LaunchDangerRoom's test scene can pause the pet with this specific reason.
    # Release only that reason, following Agent:SetPaused's native binding.
    $null = Invoke-Engine ($taskPetSteps[0..6] + @(@{from=6;field='GetAgent'},@{call=7;args=@(@{ref=6})},
        @{global='Symbol'},@{call=9;args=@('SentinelAgentPaused')},@{from=8;field='SetPaused'},
        @{call=11;args=@(@{ref=8},$false,@{ref=10})}))
    Update-TestActivity
    Wait-Engine { (Get-NativeFetchTrigger).enabled } "native Fetch activation, config $Config" 15
}
function Test-Drop([int]$Config,[float]$Distance,[bool]$Expected,[float]$ExpectedRadius) {
    Update-TestActivity
    Start-Sleep -Milliseconds 500
    $before = Get-NativeFetchTrigger
    if (-not $before.enabled -or $before.radius -ne $ExpectedRadius) { throw 'The native Fetch trigger is not ready.' }
    $drop = New-TestPickup $Distance
    Start-Sleep -Seconds 3
    $result = Get-TestPickup
    $after = Get-NativeFetchTrigger
    $passed = $result.removed -eq $Expected -and $result.energy -eq $(if($Expected){50}else{0}) -and
        $after.enabled -and $after.radius -eq $ExpectedRadius
    $check = @{config=$Config;drop=$drop;before=$before;after=$after;result=$result;expectedPickup=$Expected;passed=$passed}
    $taskFetchEvidence.checks.Add($check)
    Write-Host "Config $Config; measured $([Math]::Round($drop.measuredDistance,3)) m; native radius $($after.radius) m; removed=$($result.removed); energy=$($result.energy); passed=$passed"
    if (-not $passed) { throw "Actual pickup validation failed at $Distance metres, config $Config." }
}
try {
    Restart-TestScene 0
    foreach($distance in @(25,100,299)) { Test-Drop 0 $distance $true 300 }
    Test-Drop 0 310 $false 300
    Restart-TestScene 2
    Test-Drop 2 10 $true 13.5
    Test-Drop 2 25 $false 13.5
    $taskFetchEvidence.passed = $true
} finally {
    $taskFetchEvidence.finished = [DateTimeOffset]::UtcNow.ToString('o')
    $taskFetchEvidence | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath (Join-Path $PSScriptRoot '../artifacts/fetch-game-validation-20261004/actual-pickup-evidence.json')
}