tauri-app: fix win/lose status detection
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m4s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m4s
This commit is contained in:
@@ -216,8 +216,9 @@ export interface PlayerStats {
|
|||||||
TOTAL_DAMAGE_TAKEN?: number;
|
TOTAL_DAMAGE_TAKEN?: number;
|
||||||
/** Vision score. */
|
/** Vision score. */
|
||||||
VISION_SCORE?: number;
|
VISION_SCORE?: number;
|
||||||
/** Win status (1 = win). */
|
/** Win/Lose status (0/1 = False/True). */
|
||||||
WIN?: number;
|
WIN?: number;
|
||||||
|
LOSE?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -234,7 +235,7 @@ export function getGameResult(game: GameHistoryItem): GameResult {
|
|||||||
// Try to extract victory from raw_end_game_stats
|
// Try to extract victory from raw_end_game_stats
|
||||||
const stats = game.raw_end_game_stats as RawEndGameStats | null;
|
const stats = game.raw_end_game_stats as RawEndGameStats | null;
|
||||||
if (stats?.localPlayer?.stats?.WIN === 1) return 'Victory';
|
if (stats?.localPlayer?.stats?.WIN === 1) return 'Victory';
|
||||||
if (stats?.localPlayer?.stats?.WIN === 0) return 'Defeat';
|
if (stats?.localPlayer?.stats?.LOSE === 1) return 'Defeat';
|
||||||
return 'Terminated';
|
return 'Terminated';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user