tauri-app: fix summoner spells handling
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m5s
All checks were successful
record-daemon / Build, check and test (push) Successful in 2m5s
This commit is contained in:
@@ -69,10 +69,6 @@ export interface SummonerSpells {
|
||||
spell1Id: number;
|
||||
/** Second summoner spell ID. */
|
||||
spell2Id: number;
|
||||
/** First summoner spell name. */
|
||||
spell1Name: string | null;
|
||||
/** Second summoner spell name. */
|
||||
spell2Name: string | null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -340,30 +336,12 @@ export function getFinalStats(game: GameHistoryItem): GameFinalStats | null {
|
||||
* Extract summoner spells from raw live client data.
|
||||
*/
|
||||
export function getSummonerSpells(game: GameHistoryItem): SummonerSpells | null {
|
||||
const liveData = game.raw_live_client_data as {
|
||||
activePlayer?: {
|
||||
summonerSpells?: {
|
||||
summonerSpellOne?: { spellId?: number; displayName?: string };
|
||||
summonerSpellTwo?: { spellId?: number; displayName?: string };
|
||||
spell1Id?: number;
|
||||
spell2Id?: number;
|
||||
}
|
||||
}
|
||||
} | null;
|
||||
|
||||
const spells = liveData?.activePlayer?.summonerSpells;
|
||||
if (!spells) return null;
|
||||
|
||||
const spell1Id = spells.summonerSpellOne?.spellId || spells.spell1Id || 0;
|
||||
const spell2Id = spells.summonerSpellTwo?.spellId || spells.spell2Id || 0;
|
||||
|
||||
if (spell1Id === 0 && spell2Id === 0) return null;
|
||||
|
||||
const player : any = game.raw_end_game_stats?.localPlayer;
|
||||
const spell1Id : number = player?.spell1Id;
|
||||
const spell2Id : number = player?.spell2Id;
|
||||
return {
|
||||
spell1Id,
|
||||
spell2Id,
|
||||
spell1Name: spells.summonerSpellOne?.displayName || null,
|
||||
spell2Name: spells.summonerSpellTwo?.displayName || null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user