Skip to content

Commit

Permalink
Improve progressions
Browse files Browse the repository at this point in the history
  • Loading branch information
dcaslin committed Sep 14, 2024
1 parent c9ca7de commit 3944c9c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 34 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d2-checklist",
"version": "24.6.2",
"version": "24.6.4",
"manifest": "227973.24.09.04.1730-2-bnet.56740",
"license": "MIT",
"scripts": {
Expand Down
83 changes: 50 additions & 33 deletions src/app/service/parse.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class ParseService {
MAX_LEVEL = 50;


HIDE_PROGRESSIONS = [
HIDE_FACTIONS = [
'3468066401', // The Nine
'1714509342', // Future War Cult
'2105209711', // New Monarchy
Expand All @@ -95,10 +95,10 @@ export class ParseService {


ACCOUNT_LEVEL = [
// '4203877294', // Fynch #UPDATEME
'527867935', // Xur
'1471185389', // Gunsmith
'784742260', // Cryptarchs
'1800684758', // Failsafe
// '527867935', // Xur // there is a progression that's better used
// '1471185389', // Gunsmith // there is a progression that's better used
'784742260', // Cryptarchs - this is worth promoting to account wide
// '1983115403', // House of light
// '3611983588', // CROW
// '2126988316', // Obelisk: Mars
Expand Down Expand Up @@ -279,6 +279,10 @@ export class ParseService {
info = 'Shaxx';
} else if (name === 'Gunsmith') {
info = 'Banshee';
} else if (name === 'AI Research Assistant') {
info = 'AI Research Assistant';
name = 'Failsafe';

} else if (name === 'Cryptarchs') {
info = 'Rahool';
} else if (name === 'Conscientious Objector') {
Expand All @@ -287,6 +291,9 @@ export class ParseService {
} else if (name === 'Purveyor of Strange Goods') {
name = 'Xur';
info = 'Purveyor of Strange Goods';
} else if (name === 'Strange Favor') {
name = 'Xur';
info = 'Strange Favor';
} else if (name === 'Hero of Six Fronts') {
name = 'Saint-14';
info = 'Trials';
Expand Down Expand Up @@ -578,31 +585,13 @@ export class ParseService {
}
}

const factions: Progression[] = [];
if (_prog.factions != null) {
for (const key2 of Object.keys(_prog.factions)) {
const p: PrivProgression = _prog.factions[key2];
const fDesc = await this.destinyCacheService.getFaction(p.factionHash);
const prog: Progression = ParseService.parseProgression(p, fDesc);
if (prog != null) {
if (this.HIDE_PROGRESSIONS.indexOf(prog.hash) >= 0) {
continue;
}
if (this.ACCOUNT_LEVEL.indexOf(prog.hash) < 0) {
factions.push(prog);
} else {
const found = accountProgressions.find(x => x.hash == prog.hash);
if (!found) {
ParseService.cookAccountProgression(prog);
accountProgressions.push(prog);
}
}
}
}
}
c.maxLevel = this.MAX_LEVEL;
// factions and progressions are confusingly mixed together
// progressions are account wide, factions are sometimes per character
// progressions are better, since they offer more information, like season resets

const perCharProgressions: Progression[] = [];


// only progression we care about right now are Legend, Glory, Crucible, and Season Pass
if (_prog.progressions) {
const sp = await this.getSeasonProgression();
const currentRankProgressionHashes: number[] = this.destinyCacheService.cacheLite.destiny2CoreSettings.currentRankProgressionHashes;
Expand Down Expand Up @@ -647,25 +636,53 @@ export class ParseService {
accountProgressions.push(prog);
}
}
} else if (key === '540048094') {
} else if (key === '540048094') {
// just to make things more confusing, this is the one progression that is still per character
const p: PrivProgression = _prog.progressions[key];
const pDesc = await this.destinyCacheService.getProgression(p.progressionHash);
const prog: Progression = ParseService.parseProgression(p, pDesc);
prog.name = 'Personal Clan XP';
prog.currentProgress = prog.weeklyProgress;
prog.percentToNextLevel = prog.currentProgress / 5000;
if (prog != null) {
factions.push(prog);
perCharProgressions.push(prog);
}
}
}
}

if (_prog.factions != null) {
for (const key2 of Object.keys(_prog.factions)) {
const p: PrivProgression = _prog.factions[key2];
const fDesc = await this.destinyCacheService.getFaction(p.factionHash);
const prog: Progression = ParseService.parseProgression(p, fDesc);
if (prog == null) {
continue;
}
// progressions are more valuable than factions
// so ignore any factions where we already found a progression for the hash
if (accountProgressions.find(x => x.hash == prog.hash)) {
continue;
}
if (this.HIDE_FACTIONS.indexOf(prog.hash) >= 0) {
continue;
}
if (this.ACCOUNT_LEVEL.indexOf(prog.hash) < 0) {
perCharProgressions.push(prog);
} else {
ParseService.cookAccountProgression(prog);
accountProgressions.push(prog);
}
}
}
c.maxLevel = this.MAX_LEVEL;



factions.sort(function (a, b) {
perCharProgressions.sort(function (a, b) {
return b.percentToNextLevel - a.percentToNextLevel;
});
c.factions = factions;
c.factions = perCharProgressions;
}

private static cookAccountProgression(prog: Progression) {
Expand Down

0 comments on commit 3944c9c

Please sign in to comment.