Skip to content

Commit

Permalink
Merge pull request #494 from robojumper/universal-ornament-aux-sets
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper authored Sep 24, 2023
2 parents 33285dc + 88dbe19 commit 66e318f
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
| symbol-name-sources.ts | well-known and useful Destiny 2 font symbols together with a way to retrieve localized names from the definitions |
| trait-to-enhanced-trait.json | a mapping between normal trait and its enhanced variant |
| universal-ornament-plugsethashes.json | an array of hashes for univeral ornament PlugSets, because you need to check canInsert instead of enabled for availability |
| universal-ornament-aux-sets.json | a mapping from classType -> universal ornament sets for sets where where set grouping cannot be derived from collections |
| unreferenced-collections-items.json | a map of collections entries to additional items they should cover |
| voice-dim-valid-perks.json | a listing of all valid perk names for use in voiceDIM |
| watermark-to-event.json | a mapping between watermark icon and the event it belongs to (see EVENTS.md) |
Expand Down
64 changes: 64 additions & 0 deletions output/universal-ornament-aux-sets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"0": {
"aux-0": [
880861204,
2067155809,
141761093,
3663467820,
744142366
],
"aux-1": [
2166685180,
2984466361,
1514122509,
1816178788,
1169613062
]
},
"1": {
"aux-0": [
389344040,
2044322464,
1731215697,
971580893,
1024752258
],
"aux-1": [
1961861544,
2261200416,
3303733201,
1188458845,
2597269762
],
"aux-2": [
476513004,
1540650548,
2013981053,
2750411529,
1122245142
],
"aux-3": [
3154193408,
3987309016,
3053891303,
259522459,
2339497078
]
},
"2": {
"aux-0": [
3128930155,
889513448,
3670132590,
2422973919,
236847737
],
"aux-1": [
1634414641,
2214399070,
1016461220,
3997262569,
1018337679
]
}
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"generate:weapons-from-quest": "dotenv node built/src/generate-weapons-from-quest.js",
"generate:voice-dim-perk-names": "dotenv node built/src/generate-perk-names-for-voiceDIM.js",
"generate:universal-ornament-plugsethashes": "dotenv node built/src/generate-universal-ornament-plugsethashes.js",
"generate:universal-ornament-aux-sets": "dotenv node built/src/generate-universal-ornament-aux-sets.js",
"generate:destiny-symbols": "dotenv node built/src/generate-symbols.js",
"generate:mod-cost-reductions": "dotenv node built/src/generate-mod-cost-reductions.js",
"generate:trait-definition-ids": "dotenv node built/src/generate-trait-definition-ids.js",
Expand Down
40 changes: 40 additions & 0 deletions src/generate-universal-ornament-aux-sets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { getDef, loadLocal } from '@d2api/manifest-node';
import { DestinyClass } from 'bungie-api-ts/destiny2';
import universalOrnamentPlugSetHashes from '../output/universal-ornament-plugset-hashes.json' assert { type: 'json' };
import { writeFile } from './helpers.js';

loadLocal();

const setsByClassType: { [classType: number]: (string | RegExp)[] } = {
[DestinyClass.Titan]: [/(Wrecked|Tattered) Titan/, 'Brave Titan'],
[DestinyClass.Hunter]: [
'Scorched Hunter',
'Daring Hunter',
/Sunlit [A-Za-z]+$/,
/Sunlit [A-Za-z]+ \(Unkindled\)/,
],
[DestinyClass.Warlock]: [/(Damaged|Shattered) Warlock/, 'Wise Warlock'],
};

const output: { [classType: number]: { [setKey: string]: number[] } } = {
[DestinyClass.Titan]: {},
[DestinyClass.Hunter]: {},
[DestinyClass.Warlock]: {},
};

const allItems = universalOrnamentPlugSetHashes.flatMap((hash) =>
getDef('PlugSet', hash)!.reusablePlugItems.map((item) =>
getDef('InventoryItem', item.plugItemHash)
)
);

for (const classType of [DestinyClass.Titan, DestinyClass.Hunter, DestinyClass.Warlock]) {
for (const [idx, pattern] of setsByClassType[classType].entries()) {
const itemHashes = allItems
.filter((i) => i?.displayProperties.name.match(pattern) && i.classType === classType)
.map((i) => i!.hash);
output[classType][`aux-${idx}`] = itemHashes;
}
}

writeFile('./output/universal-ornament-aux-sets.json', output);

0 comments on commit 66e318f

Please sign in to comment.