Files
WT-Offline/patches/gui/battle/open-replay-from-battle-log/replace-click.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

31 lines
1.2 KiB
Plaintext

function onViewLocalBattleReplay(obj) {
let logIdx = to_integer_safe(obj?.logIdx, -1)
let startReplay = function() {
if (!isInMenu.get() || !checkObj(this.scene))
return
let logObj = this.logs?.findvalue(@(entry) entry.idx == logIdx)
if (logObj?.type != EULT_SESSION_RESULT || logObj?.wtoSessionId == null)
return
let replayScreen = require("%scripts/replays/replayScreen.nut")
// The recording may have been renamed or deleted since the log was opened.
this.localBattleReplays = replayScreen?.getLocalBattleReplays?() ?? {}
let replay = this.localBattleReplays?[logObj.wtoSessionId]
if (replay == null) {
this.initPage(this.curPage)
return
}
replayScreen?.viewLocalBattleReplay?(replay, function() {
require("%scripts/mainmenu/guiStartMainmenu.nut").gui_start_mainmenu()
let { loadHandler } = require("%scripts/baseGuiHandlerManagerWT.nut")
let { get_gui_handler } = require("%scripts/sqDagui/framework/gui_handlers.nut")
loadHandler(get_gui_handler("UserLogHandler"))
})
}.bindenv(this)
this.checkedNewFlight(@() defer(startReplay))
}
function copyToClipboard() {