Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // overall sorting and filtering of data
- function sortParsedData(data) {
- // sorting out character info and progress info
- var sortData = {
- name: data[0].name,
- class: classIdentity(data[0].class),
- realm: data[0].realm,
- itemLevel: data[0].items.averageItemLevel,
- progress: data[0].progression.raids
- .filter((item, index) => {
- if(item.name == "The Emerald Nightmare") {
- return item;
- }
- })
- .map((item, index) => {
- return {
- name: item.name,
- bosses: item.bosses.map((item, index) => {
- return {
- name: item.name,
- bossId: wclBossId(item.name),
- lfrKills: item.lfrKills,
- normalKills: item.normalKills,
- heroicKills: item.heroicKills,
- mythicKills: item.mythicKills,
- warcraftLogs: false
- }
- }),
- totalBosses: bossTotal(item.bosses),
- lfrProgress: difficultyProgress("lfr", item),
- normalProgress: difficultyProgress("normal", item),
- heroicProgress: difficultyProgress("heroic", item),
- mythicProgress: difficultyProgress("mythic", item)
- };
- })
- };
- sortData.progress[0].bosses.map((item, index) => {
- var difficulty = 2;
- if(item.mythicKills > 0) {
- difficulty = 5;
- } else if(item.heroicKills > 0) {
- difficulty = 4;
- } else if(item.normalKills > 0) {
- difficulty = 3;
- }
- var updatedData;
- for(var p = 0; p < data[1].length; p++) {
- console.log('log item difficulty', data[1][p].difficulty);
- if (item.bossId == data[1][p].encounter && difficulty == data[1][p].difficulty) {
- console.log(item.name, '!!!');
- var reportUrl = "https://www.warcraftlogs.com/report/" + data[1][p].reportID;
- updatedData = {
- name: item.name,
- bossId: wclBossId(item.name),
- lfrKills: item.lfrKills,
- normalKills: item.normalKills,
- heroicKills: item.heroicKills,
- mythicKills: item.mythicKills,
- warcraftLogs: true,
- reportUrl: reportUrl,
- precentile: calculatePercentile(data[1][p].rank, data[1][p].outOf)
- };
- } else {
- console.log('nope!!!');
- updatedData = {
- name: item.name,
- bossId: wclBossId(item.name),
- lfrKills: item.lfrKills,
- normalKills: item.normalKills,
- heroicKills: item.heroicKills,
- mythicKills: item.mythicKills,
- warcraftLogs: false
- };
- }
- }
- return updatedData;
- });
- console.log('sortData', sortData.progress[0].bosses[0]);
- return sortData;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement