Skip to content

Commit

Permalink
fix importing WCL reports
Browse files Browse the repository at this point in the history
  • Loading branch information
kayla-glick committed Jan 11, 2023
1 parent 8df7060 commit 3e4ecb9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion ui/core/proto_utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ export const talentTreeIcons: Record<Class, Array<string>> = {
'spell_holy_auraoflight.jpg',
],
[Class.ClassPriest]: [
'spell_holy_wordfortitude.jpg',
'spell_holy_powerwordshield.jpg',
'spell_holy_guardianspirit.jpg',
'spell_shadow_shadowwordpain.jpg',
'spell_holy_holysmite.jpg',
Expand Down
23 changes: 17 additions & 6 deletions ui/raid/import_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,23 +177,33 @@ export class RaidWCLImporter extends Importer {

const urlData = {
reportID: match[1],
fightID: match[2] ? match[3] : '0',
};
fightID: '',
}

if (urlData.fightID == 'last') {
// Make a separate query to determine # of fights, and replace 'last' with the last fight ID.
// If the URL has a Fight ID in it, use it
if (match[2] && match[3] && match[3] != 'last') {
urlData.fightID = match[3];
} else {
// Make a separate query to get the corresponding ReportFights
const fightDataQuery = `{
reportData {
report(code: "${urlData.reportID}") {
fights(translate: true) {
fights(killType: Kills, translate: true) {
id, name
}
}
}
}`;

const fightData = await this.queryWCL(fightDataQuery);
const fights = fightData.data.reportData.report.fights;
urlData.fightID = String(fights.length - 1);

if (match[3] == 'last') {
urlData.fightID = String(fights[fights.length - 1].id)
} else {
// Default to using the first Fight
urlData.fightID = String(fights[0].id);
}
}

console.debug(`Importing WCL report: ${JSON.stringify(urlData)}`);
Expand Down Expand Up @@ -629,6 +639,7 @@ class WCLSimPlayer {
const fullTypeToSpec: Record<string, Spec> = {
'DeathKnightBlood': Spec.SpecTankDeathknight,
'DeathKnightLichborne': Spec.SpecTankDeathknight,
'DeathKnightRuneblade': Spec.SpecTankDeathknight,
'DeathKnightFrost': Spec.SpecDeathknight,
'DeathKnightUnholy': Spec.SpecDeathknight,
'DruidBalance': Spec.SpecBalanceDruid,
Expand Down

0 comments on commit 3e4ecb9

Please sign in to comment.