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/multi-ability-game-test/session.json'),
    [string]$ReportDirectory = (Join-Path $PSScriptRoot '../artifacts/ability-bank-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 'The game must be connected to the isolated server with --game-test-control.'
    }
    $taskEvidence.build=$status.gameVersion; $taskEvidence.bridgeVersion=$status.version
    $gameLog=Join-Path $env:LOCALAPPDATA 'Warframe/EE.log'
    $errorsBefore=@(Select-String -LiteralPath $gameLog -Pattern 'Script \[Error\]: Script Error').Count
    $identity = Invoke-Engine ($taskPresetSteps + @(@{from=8;field='mItemId';literal=$true},@{from=9;field='mId';literal=$true}))
    if ($identity[10].text -ne $taskTest.suitId) { throw 'The live suit does not match the isolated fixture.' }
    $type = Invoke-Engine ($taskSuitSteps + @(@{from=6;field='GetType'},@{call=7;args=@(@{ref=6})},@{from=8;field='GetFullName'},@{call=9;args=@(@{ref=8})}))
    if ($type[10].text -ne '/Lotus/Powersuits/Infestation/Infestation') { throw 'Initialize the isolated Nidus bank fixture first.' }
    function Check($Kind, [bool]$Passed, $Details) {
        $taskEvidence.checks.Add(@{kind=$Kind;passed=$Passed;details=$Details})
        if (-not $Passed) { throw "Game validation failed: $Kind" }
        Write-Host "Passed: $Kind"
    }
    function Energy {
        $r=Invoke-Engine ($taskSuitSteps+@(@{from=6;field='0xEF680AA6'},@{call=7;args=@(@{ref=6})})); return $r[8].number
    }
    function FillEnergy {
        $null=Invoke-Engine ($taskSuitSteps+@(@{from=6;field='GetMaxEnergy'},@{call=7;args=@(@{ref=6})},@{from=6;field='SetEnergy'},@{call=9;args=@(@{ref=6},@{ref=8})}))
    }
    function SkillInput([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 -Milliseconds 200
    }
    function Weapon {
        $r=Invoke-Engine ($taskSuitSteps[0..4]+@(@{from=4;field='GetWeaponInSlot'},@{call=5;args=@(@{ref=4},0)},@{from=6;field='GetType'},@{call=7;args=@(@{ref=6})},@{from=8;field='GetFullName'},@{call=9;args=@(@{ref=8})}))
        return $r[10].text
    }
    $serverConfig=Get-Content -LiteralPath (Join-Path $taskTest.runtime 'server.json') -Raw | ConvertFrom-Json
    $inventory=Invoke-RestMethod ($taskTest.origin+'/control/v1/accounts/'+$taskTest.accountId+'/export') -Headers @{Authorization='Bearer '+$serverConfig.AdminToken}
    $ownedDonor=@($inventory.Suits | Where-Object ItemType -EQ '/Lotus/Powersuits/Choir/Choir').Count
    $ownedGlory=@($inventory.SPECIAL_A | Where-Object ItemType -EQ '/Lotus/Powersuits/Choir/ChoirEruptWeapon').Count
    Check 'donor-resources-without-owned-equipment' ($ownedDonor -eq 0 -and $ownedGlory -eq 0) @{ownedJade=$ownedDonor;ownedGlory=$ownedGlory}
    $savedSuit=@($inventory.Suits | Where-Object { $_.ItemId.'$oid' -eq $taskTest.suitId })[0]
    $choiceCounts=@(0..3 | ForEach-Object { @($savedSuit.Configs[0].XFEAbilityBanks."$_".PSObject.Properties).Count })
    Check 'twelve-choices-persisted' (($choiceCounts -join ',') -eq '3,3,3,3' -and -not $savedSuit.Configs[1].XFEAbilityBanks) @{choiceCounts=$choiceCounts;configBHasBanks=[bool]$savedSuit.Configs[1].XFEAbilityBanks}
    $scene=Invoke-Engine @(@{global='gGameRules'},@{from=0;field='GetType'},@{call=1;args=@(@{ref=0})},@{from=2;field='GetFullName'},@{call=3;args=@(@{ref=2})})
    if ($scene[4].text -notlike '*LotusDangerRoomGameRules') {
        $null=Invoke-Engine @(@{global='require'},@{call=0;args=@('Lotus.Scripts.SimulacrumUtilities')},@{from=1;field='LaunchDangerRoom'},@{call=2;args=@()})
        Wait-Engine { $r=Invoke-Engine @(@{global='gGameRules'},@{from=0;field='GetType'},@{call=1;args=@(@{ref=0})},@{from=2;field='GetFullName'},@{call=3;args=@(@{ref=2})});$r[4].text -like '*LotusDangerRoomGameRules' } 'Simulacrum'
    }
    Start-Sleep -Seconds 4
    $native=@('InfestRuptureAbility','InfestTendrilsAbility','InfestLinkAbility','InfestPodsAbility')
    $a=@('ShockAbility','PullAbility','IronSkinAbility','IronSkinAbility')
    $c=@('InfestRuptureAbility','InfestTendrilsAbility','InfestLinkAbility','ChoirEruptAbility')
    Select-Config 3 @('ShockAbility','InfestTendrilsAbility','InfestLinkAbility','InfestPodsAbility')
    $null=Invoke-Engine ($taskSuitSteps+@(@{global='_T'},@{from=7;field='INFESTED_AddStacks';literal=$true},@{call=8;args=@(@{ref=6},-10000)}))
    FillEnergy; $before=Energy
    SkillInput 3 70
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'native-nidus-four-requires-stacks' (-not $snapshot.slots[3].active -and (Energy) -eq $before) $snapshot
    Select-Config 0 $a
    $banks=@(
        @('ShockAbility','RhinoRoarAbility','PullAbility'),
        @('PullAbility','ShockAbility','RhinoRoarAbility'),
        @('IronSkinAbility','ShockAbility','RhinoRoarAbility'),
        @('IronSkinAbility','ShockAbility','RhinoRoarAbility')
    )
    foreach($slot in 0..3) {
        foreach($choice in 1,2,0) {
            $before=Energy; SkillInput $slot 70; $after=Energy
            $names=@(Get-Abilities); $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
            Check "tap-slot-$slot-choice-$choice" ($names[$slot] -eq $banks[$slot][$choice] -and $before -eq $after -and $snapshot.slots[$slot].count -eq 3) @{ability=$names[$slot];energyBefore=$before;energyAfter=$after;selected=$snapshot.slots[$slot].selected}
        }
    }
    SkillInput 0 70; FillEnergy; $before=Energy
    SkillInput 0 1000; $after=Energy
    Check 'hold-casts-roar-once' (($before-$after) -eq 75) @{energyBefore=$before;energyAfter=$after}
    Start-Sleep -Seconds 2
    FillEnergy; $before=Energy; SkillInput 3 500; $after=Energy
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'foreign-nidus-four-without-stacks' (($before-$after) -eq 50 -and $snapshot.slots[3].active) @{energyBefore=$before;energyAfter=$after;state=$snapshot}
    Start-Sleep -Seconds 2
    Select-Config 2 $c
    $original=(Invoke-Runtime '/runtime/v1/game/ability-state').animationController
    FillEnergy; SkillInput 3 500
    Wait-Engine { (Weapon) -eq '/Lotus/Powersuits/Choir/ChoirEruptWeapon' } 'Glory weapon'
    Start-Sleep -Seconds 2
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'jade-flight-controller-and-weapon' ($snapshot.slots[3].active -and $snapshot.donorAnimationActive -and $snapshot.animationController -like '*/ChoirAnimController') @{state=$snapshot;weapon=(Weapon)}
    SkillInput 3 70
    Wait-Engine { @(Get-Abilities)[3] -eq 'RhinoRoarAbility' } 'cycle while Jade remains active'
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'jade-cycle-preserves-channel-animation-and-weapon' ($snapshot.donorAnimationActive -and $snapshot.animationController -like '*/ChoirAnimController' -and
        @($snapshot.retained | Where-Object { $_.slot -eq 3 -and $_.choice -eq 0 -and $_.active }).Count -eq 1 -and
        (Weapon) -eq '/Lotus/Powersuits/Choir/ChoirEruptWeapon') $snapshot
    SkillInput 3 70; SkillInput 3 70
    FillEnergy; SkillInput 3 500
    Wait-Engine { -not (Invoke-Runtime '/runtime/v1/game/ability-state').donorAnimationActive } 'explicit Jade deactivation'
    Check 'return-and-toggle-off-restores-animation' ((Invoke-Runtime '/runtime/v1/game/ability-state').animationController -eq $original) (Invoke-Runtime '/runtime/v1/game/ability-state')
    FillEnergy; SkillInput 3 500
    Wait-Engine { (Invoke-Runtime '/runtime/v1/game/ability-state').donorAnimationActive } 'second Jade activation'
    # Cycle while the native startup coroutine is still waiting for animation events.
    SkillInput 3 70
    Wait-Engine { @(Get-Abilities)[3] -eq 'RhinoRoarAbility' } 'queued cycle during Jade startup'
    Start-Sleep -Seconds 2
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'jade-startup-cycle-preserves-flight' ($snapshot.donorAnimationActive -and $snapshot.animationController -like '*/ChoirAnimController') $snapshot
    SkillInput 3 70; SkillInput 3 70; FillEnergy; SkillInput 3 500
    Wait-Engine { -not (Invoke-Runtime '/runtime/v1/game/ability-state').donorAnimationActive } 'second explicit Jade deactivation'
    FillEnergy; SkillInput 3 500
    Start-Sleep -Seconds 3
    Select-Config 1 $native
    $snapshot=Invoke-Runtime '/runtime/v1/game/ability-state'
    Check 'configuration-switch-cleans-flight' (-not $snapshot.donorAnimationActive -and $snapshot.animationController -eq $original) $snapshot
    Select-Config 0 $a
    Check 'configuration-A-resets-bank-selection' (@((Invoke-Runtime '/runtime/v1/game/ability-state').slots | Where-Object selected -NE 0).Count -eq 0) @(Get-Abilities)
    Start-Sleep -Seconds 3
    $errorsAfter=@(Select-String -LiteralPath $gameLog -Pattern 'Script \[Error\]: Script Error').Count
    Check 'no-new-game-script-errors' ($errorsAfter -eq $errorsBefore) @{before=$errorsBefore;after=$errorsAfter}
    $taskEvidence.passed=$true
} catch { $taskEvidence.error=$_.Exception.Message; throw }
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 25 | Set-Content -LiteralPath (Join-Path $ReportDirectory 'result.json') -Encoding utf8
    $taskHttp.Dispose()
}
Write-Host "Ability bank game validation passed: $ReportDirectory/result.json"