Files
WT-Offline/patches/gui/battle/play-local-battle-replay/replace-lookup.nut
T
N0VAN0M4LY 6c55c64222 feat(replays): open local replays from battle reports
Store the offline session ID in native replay metadata. Match the battle report to its recording and reuse the native player, queue check, and return flow.

Verified TypeScript, GUI and executable patch checks on 2.61.0.37 and 2.61.0.43, and a temporary 2.61.0.43 build. In-game verification is pending.
2026-12-01 11:10:05 +08:00

38 lines
1.1 KiB
Plaintext

function playLocalReplay(path, onReturn, isBackToReplayList) {
setBackFromReplaysFn(onReturn, isBackToReplayList)
reqUnlockByClient("view_replay")
currentReplay.path = path
on_view_replay(currentReplay.path)
}
function getLocalBattleReplays() {
let replaysBySession = {}
if (!hasFeature("ClientReplay") || !is_replay_turned_on())
return replaysBySession
foreach (replay in get_replays_list()) {
if (!canPlayReplay(replay))
continue
let replayInfo = get_replay_info(replay.path)
if (replayInfo == null || isCorruptedReplay(replayInfo))
continue
let sessionId = replayInfo?.comments?.uiScriptsData?.wtoSessionId
if (typeof sessionId == "string" && !(sessionId in replaysBySession))
replaysBySession[sessionId] <- replay
}
return replaysBySession
}
function viewLocalBattleReplay(replay, onReturn) {
if (!canPlayReplay(replay) || !canJoinFlightMsgBox())
return
set_presence_to_player("replay")
playLocalReplay(replay.path, function() {
resetSessionLobbyPlayersInfo()
onReturn()
}, false)
}
function getReplayUrlBySessionId(sessionId) {