Skip to content

Commit

Permalink
Generate mutually-exclusive-mods
Browse files Browse the repository at this point in the history
  • Loading branch information
robojumper committed Mar 27, 2023
1 parent 59c2b00 commit cd66b97
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
| masterworks-with-cond-stats.json | an array containing a listing of all masterwork plugs that have conditional stats |
| missing-faction-tokens.json | a deprecated listing of faction tokens that were missing at one point |
| missing-source-info.ts | a listing of sources and item hashes that were missing a source hash |
| mutually-exclusive-mods.json | mapping from armor mod hash -> mutual exclusion category, for "Similar mod already applied" behavior |
| objective-richTexts.ts | a mapping for Destiny Rich Texts |
| powerful-rewards.json | an array of item hashes that contain powerful rewards |
| pursuits.json | a mapping between pursuits and the criteria to complete them |
Expand Down
14 changes: 14 additions & 0 deletions output/mutually-exclusive-mods.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"84503918": "finisher",
"1125986156": "finisher",
"1170405455": "finisher",
"1208761894": "finisher",
"2649291407": "fastball",
"3064687909": "finisher",
"4004774872": "finisher",
"4004774873": "finisher",
"4004774874": "finisher",
"4004774875": "finisher",
"4004774876": "finisher",
"4004774877": "finisher"
}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"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",
"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-data": "run-s build generate:*"
},
"husky": {
Expand Down
37 changes: 37 additions & 0 deletions src/generate-mutually-exclusive-mods.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import { getAllDefs, loadLocal } from '@d2api/manifest-node';
import { PlugCategoryHashes } from '../data/generated-enums.js';
import { writeFile } from './helpers.js';
loadLocal();

const failureMessage = 'Similar mod already applied';

const inventoryItems = getAllDefs('InventoryItem');

const exclusiveMods: {
[modHash: number]: string;
} = {};

for (const item of inventoryItems) {
if (
item.displayProperties?.name &&
item.plug?.plugCategoryHash &&
!item.displayProperties.name.includes('Deprecated') &&
item.plug.insertionRules?.some((rule) => rule.failureMessage.includes(failureMessage))
) {
if (
item.plug.plugCategoryHash === PlugCategoryHashes.EnhancementsV2ClassItem &&
item.displayProperties.name.includes('Finish')
) {
exclusiveMods[item.hash] = 'finisher';
} else if (
item.plug.plugCategoryHash === PlugCategoryHashes.EnhancementsV2Arms &&
item.displayProperties.name.includes('Fastball')
) {
exclusiveMods[item.hash] = 'fastball';
} else {
exclusiveMods[item.hash] = 'unknown-' + item.plug.plugCategoryIdentifier;
}
}
}

writeFile('./output/mutually-exclusive-mods.json', exclusiveMods);

0 comments on commit cd66b97

Please sign in to comment.