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;
|
spell1Id: number;
|
||||||
/** Second summoner spell ID. */
|
/** Second summoner spell ID. */
|
||||||
spell2Id: number;
|
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.
|
* Extract summoner spells from raw live client data.
|
||||||
*/
|
*/
|
||||||
export function getSummonerSpells(game: GameHistoryItem): SummonerSpells | null {
|
export function getSummonerSpells(game: GameHistoryItem): SummonerSpells | null {
|
||||||
const liveData = game.raw_live_client_data as {
|
const player : any = game.raw_end_game_stats?.localPlayer;
|
||||||
activePlayer?: {
|
const spell1Id : number = player?.spell1Id;
|
||||||
summonerSpells?: {
|
const spell2Id : number = player?.spell2Id;
|
||||||
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;
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
spell1Id,
|
spell1Id,
|
||||||
spell2Id,
|
spell2Id,
|
||||||
spell1Name: spells.summonerSpellOne?.displayName || null,
|
|
||||||
spell2Name: spells.summonerSpellTwo?.displayName || null,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user