# Setup Prerequisites Add-Type -AssemblyName System.Web [Console]::OutputEncoding = [System.Text.Encoding]::UTF8 enum RecordType { Weapon Character } function Get-AKERecords { [CmdletBinding()] param ( [RecordType]$Type = "Weapon", [Parameter(Mandatory)] [string]$Token, [Parameter(Mandatory)] [string]$ServerID, [int]$TargetSeqId ) $reqQuery = @{ 'lang' = 'en-us' 'token' = $Token 'server_id' = $ServerID } $rdata = @() # Now grab pull data Write-Host "`nGrabbing data for $($Type.ToString())" if ($Type -eq 0) { $uriBuilder = [System.UriBuilder]"https://ef-webview.gryphline.com/api/record/weapon" $pools = @('weap123') } else { $uriBuilder = [System.UriBuilder]"https://ef-webview.gryphline.com/api/record/char" $pools = @( 'E_CharacterGachaPoolType_Standard', 'E_CharacterGachaPoolType_Beginner', 'E_CharacterGachaPoolType_Special', 'E_CharacterGachaPoolType_Joint', 'E_CharacterGachaPoolType_Rerun') } foreach ($pl in $pools) { if ($pl -ne 'weap123') { $reqQuery["pool_type"] = $pl } $seq = 0 # Seq number for next page while($true) { # Cleanup sequence ID if ($seq -ne 0) { $reqQuery["seq_id"] = $seq } else { $reqQuery.Remove("seq_id") } $sq = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) foreach ($key in $reqQuery.Keys) { $sq.Add($key, $reqQuery.$key) } $uriBuilder.Query = $sq.ToString() $resp = Invoke-WebRequest -Uri $uriBuilder.Uri.OriginalString -UserAgent "Mozilla/5.0" -UseBasicParsing $respJson = $resp | ConvertFrom-Json $seq = [int]$respJson.data.list[-1].seqId # Skip when seqId lower than target if ($seq -ne 0 -and $seq -le $TargetSeqId) { if ($Type -eq 0) { Write-Host " Seq $seq (SKIP)" -ForegroundColor Red } else { Write-Host " Seq $seq pool $pl (SKIP)" -ForegroundColor Red } break; } if ($Type -eq 0) { Write-Host " Seq $seq" } else { Write-Host " Seq $seq pool $pl" } $rdata += $respJson.data.list if (-not $respJson.data.hasMore) { break } Start-Sleep -Milliseconds 250 } } if ($seq -gt 6 -and $TargetSeqId -eq 0) { if ($Type -eq 0) { Write-Host "`nWARNING: $($Type.ToString()) banner has more data before the end of sequence. Some pull data has been deleted. This can be normal, but if this is the first time you run this script, know that some pull data has been lost." -ForegroundColor Yellow } else { Write-Host "`nWARNING: $($Type.ToString()) banner and $pl pool has no more data before the end of sequence. Some pull data has been deleted. This can be normal, but if this is the first time you run this script, know that some pull data has been lost." -ForegroundColor Yellow } } return $rdata } # Load file at this location # $FilePath = $env:LOCALAPPDATA + "Low\Gryphline\Endfield\sdklogs\HGWebview.log" $FilePath = $env:LOCALAPPDATA + "\PlatformProcess\Cache\data_1" # Validate file exists if (-not (Test-Path -Path $FilePath)) { Write-Error "File not found: $FilePath" exit 1 } $lines = Get-Content -Path $FilePath [array]::Reverse($lines) # Regex to match a URL with a query string $urlPattern = 'https?://ef-webview.gryphline.com/api/record[^\s"''<>{}\0]+\?[^\s"''<>{}\0]+' $found = $false foreach ($line in $lines) { $match = [regex]::Match($line, $urlPattern) if (-not $match.Success) { continue } $fullUrl = $match.Value Write-Host "`nURL Found:" -ForegroundColor Green Write-Host $fullUrl # Get query string $uri = [System.Uri]$fullUrl $queryString = $uri.Query.TrimStart('?') $params = [System.Web.HttpUtility]::ParseQueryString($queryString) $data = @{ 'weapons' = @() 'characters' = @() } $recFile = "./akerecord.json" # Try loading existing akerecord.json to do partial update if (-not (Test-Path -Path $recFile)) { $highestCharSeqId = 0 $highestWeaponSeqId = 0 $jsonData = @{ 'weapons' = @() 'characters' = @() } Write-Host "Existing akerecord.json file not found. Starting from scratch." -ForegroundColor Yellow } else { $jsonContent = Get-Content -Path $recFile -Raw $jsonData = $jsonContent | ConvertFrom-Json $highestCharSeqId = ($jsonData.characters | ForEach-Object { [int]$_.seqId } | Measure-Object -Maximum).Maximum if (-not $highestCharSeqId) { $highestCharSeqId = 0 } $highestWeaponSeqId = ($jsonData.weapons | ForEach-Object { [int]$_.seqId } | Measure-Object -Maximum).Maximum if (-not $highestWeaponSeqId) { $highestWeaponSeqId = 0 } Write-Host "Existing akerecord.json file found. Grabbing character records newer than seqId $highestCharSeqId and weapon records newer than seqId $highestWeaponSeqId." -ForegroundColor Green } # Get token and server from query string $data.weapons = Get-AKERecords -Type Weapon -Token $params["token"] -ServerID $params["server_id"] -TargetSeqId $highestWeaponSeqId $data.characters = Get-AKERecords -Type Character -Token $params["token"] -ServerID $params["server_id"] -TargetSeqId $highestCharSeqId $data.weapons += $jsonData.weapons $data.characters += $jsonData.characters [System.IO.File]::WriteAllText("./akerecord.json", ($data | ConvertTo-Json -Compress), [System.Text.Encoding]::UTF8) Write-Host "`nDone! Record saved to $($PWD.Path + "/akerecord.json")" -ForegroundColor Green $found = $true break } if (-not $found) { Write-Host "`nNo URL found. Make sure that you have opened the in-game pull history at least once today." -ForegroundColor Red }