Skip to content

Commit

Permalink
Merge pull request #591 from DestinyItemManager/thicc-event-info
Browse files Browse the repository at this point in the history
introduce d2-event-info-v2 as slim version
  • Loading branch information
delphiactual authored Apr 26, 2024
2 parents 53fc829 + 0962380 commit fd98306
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 2 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## v2.0.0

- [BREAKING] d2-event-info.ts
- [DEPRECATED] d2-event-info.ts in favor of d2-event-info-v2.ts
- [REMOVED] type D2EventIndex
- [REMOVED] const D2EventPredicateLookup
- [REMOVED] const D2SourcesToEvent
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ If your pre-commit hook fails, please run the following `pnpm dlx husky install`
| craftable-hashes.json | an array containing all craftable weapon hashes |
| crafting-enhanced-intrinsics.ts | a set containing all enhanced intrinsic perk hashes along with a comment labeling it |
| crafting-mementos.json | a mapping from memento source (string) to an array of memento hashes |
| d2-event-info.ts | a mapping containing information about event information (see EVENTS.md) |
| d2-event-info.ts | a mapping containing information about event information (see EVENTS.md) [DEPRECATED] |
| d2-event-info-v2.ts | a mapping containing information about event information (see EVENTS.md) |
| d2-font-glyphs.ts | an enum listing of the font glyphs |
| d2-season-info.ts | a mapping containing useful information about the seasons |
| d2-trials-objectives.json | a mapping containing trials objective hashes and trials passage hashes |
Expand Down
47 changes: 47 additions & 0 deletions output/d2-event-info-v2.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
export const enum D2EventEnum {
DAWNING = 1,
CRIMSON_DAYS,
SOLSTICE_OF_HEROES,
FESTIVAL_OF_THE_LOST,
REVELRY,
GUARDIAN_GAMES,
}

export const D2EventInfo = {
1: {
name: 'The Dawning',
shortname: 'dawning',
sources: [464727567, 547767158, 629617846, 2364515524, 3092212681, 3952847349, 4054646289],
engram: [1170720694, 2648089539, 3151770741, 3488374611],
},
2: {
name: 'Crimson Days',
shortname: 'crimsondays',
sources: [2502262376],
engram: [191363032, 3373123597],
},
3: {
name: 'Solstice',
shortname: 'solstice',
sources: [151416041, 641018908, 1666677522, 3724111213],
engram: [821844118],
},
4: {
name: 'Festival of the Lost',
shortname: 'fotl',
sources: [1054169368, 1677921161, 1919933822, 3190938946, 3693722471, 4041583267],
engram: [1451959506],
},
5: {
name: 'The Revelry',
shortname: 'revelry',
sources: [2187511136],
engram: [1974821348, 2570200927],
},
6: {
name: 'Guardian Games',
shortname: 'games',
sources: [611838069, 1568732528, 2006303146, 2011810450, 2473294025, 3388021959],
engram: [],
},
};
39 changes: 39 additions & 0 deletions output/d2-event-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,42 @@ export const D2EventInfo = {
engram: [],
},
};

export type D2EventIndex = keyof typeof D2EventInfo;

export const D2EventPredicateLookup = {
dawning: D2EventEnum.DAWNING,
crimsondays: D2EventEnum.CRIMSON_DAYS,
solstice: D2EventEnum.SOLSTICE_OF_HEROES,
fotl: D2EventEnum.FESTIVAL_OF_THE_LOST,
revelry: D2EventEnum.REVELRY,
games: D2EventEnum.GUARDIAN_GAMES,
};

export const D2SourcesToEvent = {
464727567: D2EventEnum.DAWNING,
547767158: D2EventEnum.DAWNING,
629617846: D2EventEnum.DAWNING,
2364515524: D2EventEnum.DAWNING,
3092212681: D2EventEnum.DAWNING,
3952847349: D2EventEnum.DAWNING,
4054646289: D2EventEnum.DAWNING,
2502262376: D2EventEnum.CRIMSON_DAYS,
151416041: D2EventEnum.SOLSTICE_OF_HEROES,
641018908: D2EventEnum.SOLSTICE_OF_HEROES,
1666677522: D2EventEnum.SOLSTICE_OF_HEROES,
3724111213: D2EventEnum.SOLSTICE_OF_HEROES,
1054169368: D2EventEnum.FESTIVAL_OF_THE_LOST,
1677921161: D2EventEnum.FESTIVAL_OF_THE_LOST,
1919933822: D2EventEnum.FESTIVAL_OF_THE_LOST,
3190938946: D2EventEnum.FESTIVAL_OF_THE_LOST,
3693722471: D2EventEnum.FESTIVAL_OF_THE_LOST,
4041583267: D2EventEnum.FESTIVAL_OF_THE_LOST,
2187511136: D2EventEnum.REVELRY,
611838069: D2EventEnum.GUARDIAN_GAMES,
1568732528: D2EventEnum.GUARDIAN_GAMES,
2006303146: D2EventEnum.GUARDIAN_GAMES,
2011810450: D2EventEnum.GUARDIAN_GAMES,
2473294025: D2EventEnum.GUARDIAN_GAMES,
3388021959: D2EventEnum.GUARDIAN_GAMES,
};
28 changes: 28 additions & 0 deletions src/generate-event-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ writeFile('./output/events.json', eventItemsLists);
||
\*===================================================================================*/
let D2EventEnum = '';
let D2EventPredicateLookup = ''; // DEPRECATED
let D2SourcesToEvent = ''; // DEPRECATED
let D2EventInfo = '';

Object.entries(eventInfo).forEach(function ([eventNumber, eventAttrs]) {
Expand All @@ -204,15 +206,41 @@ Object.entries(eventInfo).forEach(function ([eventNumber, eventAttrs]) {
engram: [${eventAttrs.engram}]
},
`;
D2EventPredicateLookup += `${eventAttrs.shortname}: D2EventEnum.${enumName},\n`;

eventAttrs.sources.forEach(function (source) {
D2SourcesToEvent += `${source}: D2EventEnum.${enumName},\n`;
});
});

const eventDataV2 = `export const enum D2EventEnum {
${D2EventEnum}
}
export const D2EventInfo = {
${D2EventInfo}
}`;

writeFile('./output/d2-event-info-v2.ts', eventDataV2);

// This is deprecated and will be removed in a future version

const eventData = `export const enum D2EventEnum {
${D2EventEnum}
}
export const D2EventInfo = {
${D2EventInfo}
}
export type D2EventIndex = keyof typeof D2EventInfo;
export const D2EventPredicateLookup = {
${D2EventPredicateLookup}
}
export const D2SourcesToEvent = {
${D2SourcesToEvent}
}`;

writeFile('./output/d2-event-info.ts', eventData);

0 comments on commit fd98306

Please sign in to comment.