Skip to content

Commit

Permalink
Merge pull request #517 from grSalonga/unstackableMods
Browse files Browse the repository at this point in the history
Creates a hash file for unstackable mods
  • Loading branch information
delphiactual authored Nov 30, 2023
2 parents 6bde816 + be6ff42 commit 36a1612
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
37 changes: 37 additions & 0 deletions output/unstackable-mods.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[
56663992,
534479613,
539051925,
579997810,
688956976,
802695661,
877723168,
1097608874,
1125986156,
1170405455,
1301391064,
1305848463,
1389309840,
1627901452,
1947468772,
2158846614,
2175577211,
2199590568,
2245839670,
2257238439,
2436471653,
2649291407,
2734674728,
2815817957,
3064687909,
3174771856,
3994043492,
4004774872,
4004774873,
4004774874,
4004774875,
4004774876,
4004774877,
4081595582,
4243059257
]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"generate:focusing-item-outputs": "dotenv node built/src/generate-focusing-item-outputs.js",
"generate:mutually-exclusive-mods": "dotenv node built/src/generate-mutually-exclusive-mods.js",
"generate:unreferenced-collections-items": "dotenv node built/src/generate-unreferenced-collections-items.js",
"generate:unstackable-mods": "dotenv node built/src/generate-unstackable-mods.js",
"generate-data": "run-s build generate:*"
},
"husky": {
Expand Down
27 changes: 27 additions & 0 deletions src/generate-unstackable-mods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { getAllDefs, loadLocal } from '@d2api/manifest-node';
import { writeFile } from './helpers.js';

loadLocal();

const inventoryItems = getAllDefs('InventoryItem');

function findAllUnstackableMods() {
const unstackableModHashes = new Set<number>();

for (const { tooltipNotifications, hash, displayProperties } of inventoryItems) {
if (
tooltipNotifications &&
(tooltipNotifications[0]?.displayString.includes('no benefit') ||
displayProperties.description.includes('will not improve')) &&
!displayProperties.name.includes('Deprecated Armor Mod')
) {
unstackableModHashes.add(hash);
}
}

return Array.from(unstackableModHashes);
}

const unstackModHashes = findAllUnstackableMods();

writeFile('./output/unstackable-mods.json', unstackModHashes);

0 comments on commit 36a1612

Please sign in to comment.