diff --git a/src/app/(home)/log-parser/page.tsx b/src/app/(home)/log-parser/page.tsx
index 6e98b82..a2dc933 100644
--- a/src/app/(home)/log-parser/page.tsx
+++ b/src/app/(home)/log-parser/page.tsx
@@ -35,7 +35,7 @@ import {
} from '@/components/ui/tooltip'
import { jokers } from '@/shared/jokers'
import { useFormatter } from 'next-intl'
-import { useState } from 'react'
+import { Fragment, useState } from 'react'
// Define the structure for individual log events within a game
type LogEvent = {
@@ -85,6 +85,7 @@ type Game = {
opponentFinalJokers: string[] // Opponent's final jokers
events: LogEvent[]
rerolls: number
+ winner: 'logOwner' | 'opponent' | null // Who won the game
}
// Helper to initialize a new game object
@@ -114,6 +115,7 @@ const initGame = (id: number, startDate: Date): Game => ({
opponentFinalJokers: [],
events: [],
rerolls: 0,
+ winner: null,
})
// Helper to format duration
@@ -431,6 +433,27 @@ export default function LogParser() {
continue
}
+ // Detect win/lose game messages
+ if (line.includes('Client got winGame message: (action: winGame)')) {
+ currentGame.winner = 'logOwner'
+ currentGame.events.push({
+ timestamp,
+ text: 'You won the game!',
+ type: 'system',
+ })
+ continue
+ }
+
+ if (line.includes('Client got loseGame message: (action: loseGame)')) {
+ currentGame.winner = 'opponent'
+ currentGame.events.push({
+ timestamp,
+ text: 'You lost the game.',
+ type: 'system',
+ })
+ continue
+ }
+
// --- Log Owner Actions/Events (Client sent ...) ---
if (lineLower.includes('client sent')) {
// Log owner gained/spent money directly
@@ -607,10 +630,10 @@ export default function LogParser() {
return (
+ Winner:{' '} + {game.winner === null + ? 'Unknown' + : game.winner === 'logOwner' + ? ownerLabel + : opponentLabel} +
Rerolls:{' '}
{game.rerolls || 'Unknown'}
@@ -728,7 +760,8 @@ export default function LogParser() {
{game.events.map((event, index) => {
console.log(event.img)
return (
- <>
+ // biome-ignore lint/suspicious/noArrayIndexKey: simple list
+
{game.logOwnerFinalJokers.map((joker, i) => {
@@ -816,7 +849,7 @@ export default function LogParser() {
)}
{game.opponentFinalJokers.map((joker, i) => {
@@ -866,7 +899,7 @@ export default function LogParser() {
{game.hostMods.map((mod, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: Simple list
-
) : (
@@ -883,7 +916,7 @@ export default function LogParser() {
{game.guestMods.map((mod, i) => (
// biome-ignore lint/suspicious/noArrayIndexKey: Simple list
-
) : (
@@ -940,9 +973,11 @@ function ShopSpendingTable({