diff --git a/data/bounties/mod-config.ts b/data/bounties/mod-config.ts new file mode 100644 index 00000000..ce8a50e2 --- /dev/null +++ b/data/bounties/mod-config.ts @@ -0,0 +1,148 @@ +import { DamageType } from 'bungie-api-ts/destiny2'; + +// TODO: could draw icons... maybe after mods get redone +export enum ModEffect { + None = 0, // Reserve 0 + // Standardized per-weapon mods + Finder, + Targeting, + Dexterity, + Loader, + Reserves, + Unflinching, + Holster, + Scavenger, + Siphon, + Scout, + // More like effects that any mod can have + Stat, + Resistance, + Super, + ClassAbility, + Grenade, + Orbs, + Finisher, + Champion, + ArmorCharge, +} + +/** Interesting things about mods that we can't figure out from the translated defs */ +export interface ModInfo { + effects?: ModEffect[]; + element?: DamageType[]; // effects arc + // element cost + // modslot + // raid + // artifact mods +} + +export const matchTable: { + assign: ModInfo; + name?: (string | RegExp)[]; + desc?: (string | RegExp)[]; + type?: (string | RegExp)[]; +}[] = [ + { + assign: { effects: [ModEffect.Finder] }, + name: ['Finder'], + }, + { + assign: { effects: [ModEffect.Targeting] }, + name: ['Targeting'], + }, + { + assign: { effects: [ModEffect.Dexterity] }, + name: ['Dexterity'], + }, + { + assign: { effects: [ModEffect.Loader] }, + name: ['Loader'], + }, + { + assign: { effects: [ModEffect.Reserves] }, + name: ['Reserves'], + }, + { + assign: { effects: [ModEffect.Siphon] }, + name: ['Siphon'], + }, + { + assign: { effects: [ModEffect.Scout] }, + name: ['Scout'], + }, + { + assign: { effects: [ModEffect.Unflinching] }, + name: ['Unflinching'], + }, + { + assign: { effects: [ModEffect.Holster] }, + name: ['Holster'], + }, + { + assign: { effects: [ModEffect.Scavenger] }, + name: ['Scavenger'], + }, + + { + assign: { effects: [ModEffect.Resistance] }, + name: ['Resistance', 'Dampener'], + desc: [/resistance/i], + }, + { + assign: { effects: [ModEffect.Super] }, + desc: ['Super'], + }, + { + assign: { effects: [ModEffect.Champion] }, + desc: ['Champion'], + }, + { + assign: { effects: [ModEffect.ClassAbility] }, + desc: [/class ability/i], + }, + { + assign: { effects: [ModEffect.Finisher] }, + desc: [/finisher/i], + }, + { + assign: { effects: [ModEffect.Grenade] }, + desc: [/grenade/i], + }, + { + assign: { effects: [ModEffect.Orbs] }, + desc: ['Orb of Power'], + }, + { + assign: { effects: [ModEffect.ArmorCharge] }, + desc: ['Armor Charge'], + }, + { + assign: { effects: [ModEffect.Stat] }, + desc: ['Intellect', 'Discipline', 'Strength', 'Resilience', 'Recovery', 'Mobility'], + }, + + { + assign: { element: [DamageType.Arc] }, + desc: ['Arc'], + }, + { + assign: { element: [DamageType.Thermal] }, + desc: ['Solar'], + }, + { + assign: { element: [DamageType.Void] }, + desc: ['Void'], + }, + { + assign: { element: [DamageType.Stasis] }, + desc: ['Stasis'], + }, + { + assign: { element: [DamageType.Strand] }, + desc: ['Strand'], + }, + { + assign: { element: [DamageType.Kinetic] }, + desc: ['Kinetic'], + }, +]; diff --git a/output/mods.json b/output/mods.json new file mode 100644 index 00000000..e0bd6c25 --- /dev/null +++ b/output/mods.json @@ -0,0 +1,1922 @@ +{ + "644105": { + "effects": [ + 1 + ] + }, + "14520248": { + "effects": [ + 19 + ], + "element": [ + 1 + ] + }, + "25154119": { + "effects": [ + 10 + ] + }, + "40751621": { + "effects": [ + 14, + 16 + ] + }, + "48578555": { + "effects": [ + 19 + ] + }, + "56663992": { + "effects": [ + 8 + ], + "element": [ + 3 + ] + }, + "84503918": { + "effects": [ + 17, + 19 + ] + }, + "95934356": { + "effects": [ + 4 + ], + "element": [ + 7 + ] + }, + "96682422": { + "effects": [ + 2 + ], + "element": [ + 2 + ] + }, + "110793779": { + "effects": [ + 9, + 16 + ], + "element": [ + 4, + 7 + ] + }, + "193878019": { + "effects": [ + 3 + ], + "element": [ + 6 + ] + }, + "199176566": { + "effects": [ + 11 + ] + }, + "293178904": { + "effects": [ + 6 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "319908131": { + "effects": [ + 6 + ], + "element": [ + 2 + ] + }, + "331268185": { + "effects": [ + 2 + ], + "element": [ + 3 + ] + }, + "335129856": { + "effects": [ + 7 + ], + "element": [ + 6 + ] + }, + "350061697": { + "effects": [ + 11 + ] + }, + "377010989": { + "effects": [ + 15 + ] + }, + "399528760": { + "effects": [ + 14 + ] + }, + "411014648": { + "effects": [ + 5 + ], + "element": [ + 3 + ] + }, + "422994787": { + "effects": [ + 19 + ] + }, + "450381139": { + "effects": [ + 5 + ], + "element": [ + 2 + ] + }, + "467550918": { + "effects": [ + 3 + ], + "element": [ + 4 + ] + }, + "518521233": { + "effects": [ + 13, + 16 + ] + }, + "531665167": { + "effects": [ + 3 + ], + "element": [ + 3 + ] + }, + "534479613": { + "effects": [ + 8 + ], + "element": [ + 2 + ] + }, + "539051925": { + "element": [ + 6 + ] + }, + "539459624": { + "effects": [ + 11 + ] + }, + "554409585": { + "effects": [ + 1 + ] + }, + "579997810": { + "effects": [ + 8 + ], + "element": [ + 1 + ] + }, + "617569843": { + "effects": [ + 11 + ] + }, + "633101315": { + "effects": [ + 19 + ] + }, + "634608391": { + "effects": [ + 4 + ], + "element": [ + 3 + ] + }, + "638704972": { + "effects": [ + 12 + ], + "element": [ + 6 + ] + }, + "657773637": { + "effects": [ + 12 + ] + }, + "686455429": { + "effects": [ + 19 + ] + }, + "688956976": { + "effects": [ + 8 + ], + "element": [ + 3 + ] + }, + "703902595": { + "effects": [ + 4 + ], + "element": [ + 6 + ] + }, + "707237917": { + "effects": [ + 12 + ] + }, + "721001747": { + "effects": [ + 2 + ], + "element": [ + 6 + ] + }, + "792400107": { + "effects": [ + 6 + ], + "element": [ + 2 + ] + }, + "802695661": { + "effects": [ + 8 + ], + "element": [ + 4 + ] + }, + "837201397": { + "effects": [ + 9, + 16 + ], + "element": [ + 6 + ] + }, + "852793406": { + "element": [ + 4 + ] + }, + "856936828": { + "effects": [ + 13, + 15 + ] + }, + "877723168": { + "effects": [ + 8 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "897335593": { + "effects": [ + 9, + 16 + ], + "element": [ + 1 + ] + }, + "899058084": { + "effects": [ + 15 + ] + }, + "930759851": { + "effects": [ + 12 + ] + }, + "953234331": { + "effects": [ + 12 + ], + "element": [ + 2 + ] + }, + "965934024": { + "effects": [ + 15 + ] + }, + "967052942": { + "effects": [ + 2 + ], + "element": [ + 2 + ] + }, + "1017385934": { + "effects": [ + 3 + ], + "element": [ + 4 + ] + }, + "1019574576": { + "effects": [ + 6 + ], + "element": [ + 3 + ] + }, + "1024379611": { + "effects": [ + 19 + ] + }, + "1036557198": { + "effects": [ + 13 + ] + }, + "1039115606": { + "effects": [ + 16 + ] + }, + "1044888195": { + "effects": [ + 14, + 19 + ] + }, + "1079896271": { + "effects": [ + 4 + ], + "element": [ + 3 + ] + }, + "1086997255": { + "effects": [ + 9, + 16 + ], + "element": [ + 3 + ] + }, + "1097608874": { + "effects": [ + 8 + ], + "element": [ + 1 + ] + }, + "1098978103": { + "effects": [ + 15 + ] + }, + "1103878128": { + "effects": [ + 5 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1118428792": { + "effects": [ + 6 + ], + "element": [ + 6 + ] + }, + "1125523126": { + "effects": [ + 4 + ], + "element": [ + 2 + ] + }, + "1125986156": { + "effects": [ + 17, + 19 + ] + }, + "1130820873": { + "effects": [ + 19 + ] + }, + "1139671158": { + "effects": [ + 19 + ] + }, + "1153260021": { + "effects": [ + 15 + ] + }, + "1170405455": { + "effects": [ + 17, + 19 + ] + }, + "1180408010": { + "effects": [ + 11 + ] + }, + "1193713026": { + "effects": [ + 19 + ] + }, + "1208761894": { + "effects": [ + 17, + 19 + ] + }, + "1210012576": { + "effects": [ + 9, + 16 + ], + "element": [ + 4 + ] + }, + "1237786518": { + "effects": [ + 11 + ] + }, + "1255614814": { + "effects": [ + 19 + ] + }, + "1262438062": { + "effects": [ + 6 + ], + "element": [ + 1 + ] + }, + "1274140735": { + "effects": [ + 10 + ] + }, + "1291268260": { + "element": [ + 1 + ] + }, + "1293710444": { + "effects": [ + 12 + ], + "element": [ + 2, + 3, + 4, + 6 + ] + }, + "1301391064": { + "effects": [ + 8 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1305536863": { + "effects": [ + 2 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1305848463": { + "effects": [ + 8 + ], + "element": [ + 7 + ] + }, + "1362793604": { + "effects": [ + 15 + ] + }, + "1388734897": { + "effects": [ + 9, + 16 + ], + "element": [ + 1 + ] + }, + "1389309840": { + "element": [ + 2 + ] + }, + "1401506404": { + "effects": [ + 13, + 15, + 16 + ] + }, + "1401506405": { + "effects": [ + 15 + ] + }, + "1435557120": { + "effects": [ + 11 + ] + }, + "1501094193": { + "effects": [ + 19 + ], + "element": [ + 7 + ] + }, + "1553790504": { + "effects": [ + 6 + ], + "element": [ + 3 + ] + }, + "1561736585": { + "effects": [ + 3 + ], + "element": [ + 1 + ] + }, + "1565861116": { + "effects": [ + 15 + ] + }, + "1578165808": { + "effects": [ + 14, + 11 + ] + }, + "1589556860": { + "effects": [ + 2 + ], + "element": [ + 4 + ] + }, + "1604394872": { + "effects": [ + 13, + 14 + ] + }, + "1627901452": { + "effects": [ + 16, + 19 + ] + }, + "1666207336": { + "effects": [ + 15 + ] + }, + "1666207338": { + "effects": [ + 12 + ] + }, + "1669792723": { + "effects": [ + 5 + ], + "element": [ + 4 + ] + }, + "1672155562": { + "effects": [ + 19 + ] + }, + "1677180919": { + "effects": [ + 3 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1702273159": { + "effects": [ + 4 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1703647492": { + "effects": [ + 11 + ] + }, + "1750845415": { + "effects": [ + 15, + 16 + ] + }, + "1755737153": { + "effects": [ + 19 + ] + }, + "1763668984": { + "effects": [ + 12 + ] + }, + "1763780622": { + "effects": [ + 19 + ] + }, + "1781551382": { + "effects": [ + 19 + ] + }, + "1783952505": { + "effects": [ + 19 + ] + }, + "1801153435": { + "effects": [ + 2 + ], + "element": [ + 6 + ] + }, + "1834163303": { + "effects": [ + 19 + ], + "element": [ + 2 + ] + }, + "1848187513": { + "effects": [ + 16 + ] + }, + "1891463783": { + "effects": [ + 2 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1901221009": { + "effects": [ + 19 + ] + }, + "1924584408": { + "effects": [ + 15, + 19 + ] + }, + "1947468772": { + "element": [ + 4 + ] + }, + "1956421814": { + "effects": [ + 14 + ] + }, + "1971149752": { + "effects": [ + 5 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "1996040463": { + "effects": [ + 13 + ] + }, + "2031584061": { + "effects": [ + 15 + ] + }, + "2037533514": { + "effects": [ + 12 + ] + }, + "2045123179": { + "effects": [ + 15 + ] + }, + "2059068466": { + "effects": [ + 3 + ], + "element": [ + 2 + ] + }, + "2074494595": { + "element": [ + 6 + ] + }, + "2076329105": { + "effects": [ + 3 + ], + "element": [ + 1 + ] + }, + "2136310244": { + "effects": [ + 13, + 15 + ] + }, + "2158846614": { + "element": [ + 7 + ] + }, + "2175577211": { + "effects": [ + 16, + 19 + ] + }, + "2194294579": { + "effects": [ + 16 + ] + }, + "2199590568": { + "effects": [ + 13, + 19 + ] + }, + "2214424583": { + "effects": [ + 2 + ], + "element": [ + 1 + ] + }, + "2237975061": { + "effects": [ + 4 + ], + "element": [ + 1 + ] + }, + "2245839670": { + "effects": [ + 17 + ] + }, + "2246316031": { + "effects": [ + 19 + ], + "element": [ + 2 + ] + }, + "2257238439": { + "effects": [ + 8 + ], + "element": [ + 7 + ] + }, + "2267311547": { + "effects": [ + 3 + ], + "element": [ + 6 + ] + }, + "2283894334": { + "effects": [ + 19 + ], + "element": [ + 3 + ] + }, + "2303417969": { + "effects": [ + 5 + ], + "element": [ + 7 + ] + }, + "2305736470": { + "effects": [ + 5 + ], + "element": [ + 1 + ] + }, + "2318667184": { + "effects": [ + 19 + ], + "element": [ + 1 + ] + }, + "2319885414": { + "effects": [ + 19 + ], + "element": [ + 3 + ] + }, + "2322202118": { + "effects": [ + 11 + ] + }, + "2325151798": { + "effects": [ + 6 + ], + "element": [ + 1 + ] + }, + "2407398462": { + "effects": [ + 5 + ], + "element": [ + 1 + ] + }, + "2413278875": { + "effects": [ + 5 + ], + "element": [ + 4 + ] + }, + "2414626352": { + "effects": [ + 13, + 14 + ] + }, + "2436471653": { + "effects": [ + 8 + ], + "element": [ + 2 + ] + }, + "2452545487": { + "effects": [ + 7 + ], + "element": [ + 4 + ] + }, + "2467203039": { + "effects": [ + 2 + ], + "element": [ + 1 + ] + }, + "2479297167": { + "effects": [ + 3 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "2485657760": { + "effects": [ + 15 + ] + }, + "2507624050": { + "effects": [ + 11 + ] + }, + "2526773280": { + "effects": [ + 5 + ], + "element": [ + 3 + ] + }, + "2526922422": { + "effects": [ + 19 + ], + "element": [ + 6 + ] + }, + "2532323436": { + "effects": [ + 11 + ] + }, + "2562645296": { + "effects": [ + 12 + ] + }, + "2577472338": { + "effects": [ + 19 + ] + }, + "2586562813": { + "effects": [ + 4 + ], + "element": [ + 1 + ] + }, + "2589105944": { + "effects": [ + 15 + ] + }, + "2595839237": { + "effects": [ + 1 + ] + }, + "2634786903": { + "effects": [ + 7 + ], + "element": [ + 4 + ] + }, + "2639422088": { + "effects": [ + 11 + ] + }, + "2649291407": { + "effects": [ + 15 + ] + }, + "2657604783": { + "effects": [ + 4 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "2719698929": { + "effects": [ + 2 + ], + "element": [ + 3 + ] + }, + "2724068510": { + "effects": [ + 9, + 16 + ], + "element": [ + 2 + ] + }, + "2724608735": { + "effects": [ + 11 + ] + }, + "2725575870": { + "effects": [ + 13 + ] + }, + "2725575871": { + "effects": [ + 13 + ] + }, + "2734674728": { + "effects": [ + 8 + ], + "element": [ + 6 + ] + }, + "2771425787": { + "effects": [ + 19 + ] + }, + "2773358872": { + "effects": [ + 9, + 16 + ], + "element": [ + 4 + ] + }, + "2779468392": { + "effects": [ + 9, + 13, + 15 + ] + }, + "2788997987": { + "effects": [ + 12 + ], + "element": [ + 4 + ] + }, + "2793473444": { + "effects": [ + 16 + ] + }, + "2793548555": { + "effects": [ + 4 + ], + "element": [ + 6 + ] + }, + "2794359402": { + "effects": [ + 3 + ], + "element": [ + 2 + ] + }, + "2801811288": { + "effects": [ + 7 + ], + "element": [ + 6 + ] + }, + "2805854721": { + "effects": [ + 7 + ], + "element": [ + 7 + ] + }, + "2815817957": { + "effects": [ + 8 + ], + "element": [ + 4 + ] + }, + "2831374162": { + "effects": [ + 9, + 16 + ], + "element": [ + 3, + 7 + ] + }, + "2851458940": { + "effects": [ + 15 + ] + }, + "2859541905": { + "effects": [ + 15 + ] + }, + "2874957617": { + "effects": [ + 13 + ] + }, + "2887845822": { + "effects": [ + 12 + ] + }, + "2888195476": { + "effects": [ + 2 + ], + "element": [ + 4 + ] + }, + "2921714558": { + "effects": [ + 19 + ], + "element": [ + 6 + ] + }, + "2959504464": { + "effects": [ + 6 + ], + "element": [ + 6 + ] + }, + "2982306509": { + "effects": [ + 13 + ] + }, + "3000428062": { + "effects": [ + 2 + ], + "element": [ + 7 + ] + }, + "3013778406": { + "effects": [ + 2 + ], + "element": [ + 7 + ] + }, + "3046678542": { + "effects": [ + 4 + ], + "element": [ + 2 + ] + }, + "3047946307": { + "effects": [ + 19 + ] + }, + "3064687909": { + "effects": [ + 17, + 19 + ] + }, + "3067648983": { + "effects": [ + 3 + ], + "element": [ + 3 + ] + }, + "3075302157": { + "effects": [ + 19 + ] + }, + "3094620656": { + "effects": [ + 6 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "3112965625": { + "effects": [ + 19 + ], + "element": [ + 7 + ] + }, + "3149307605": { + "effects": [ + 13 + ] + }, + "3160387771": { + "effects": [ + 14, + 19 + ] + }, + "3160845295": { + "effects": [ + 11 + ] + }, + "3174771856": { + "effects": [ + 8 + ], + "element": [ + 6 + ] + }, + "3181984586": { + "effects": [ + 19 + ] + }, + "3184690956": { + "effects": [ + 16 + ] + }, + "3188328909": { + "effects": [ + 9, + 16 + ], + "element": [ + 6 + ] + }, + "3194530172": { + "effects": [ + 12 + ], + "element": [ + 3 + ] + }, + "3224649746": { + "effects": [ + 4 + ], + "element": [ + 4 + ] + }, + "3245543337": { + "effects": [ + 14, + 15 + ] + }, + "3268255645": { + "effects": [ + 13, + 18, + 15 + ] + }, + "3276278122": { + "effects": [ + 7 + ], + "element": [ + 1 + ] + }, + "3279257734": { + "effects": [ + 9 + ], + "element": [ + 7 + ] + }, + "3294892432": { + "effects": [ + 5 + ], + "element": [ + 6 + ] + }, + "3323910164": { + "effects": [ + 3 + ], + "element": [ + 7 + ] + }, + "3325390304": { + "effects": [ + 14, + 16 + ] + }, + "3410844187": { + "effects": [ + 12 + ], + "element": [ + 4 + ] + }, + "3437323171": { + "effects": [ + 6 + ], + "element": [ + 4 + ] + }, + "3456250548": { + "effects": [ + 12 + ], + "element": [ + 6 + ] + }, + "3461249873": { + "effects": [ + 19 + ] + }, + "3462414552": { + "effects": [ + 5 + ], + "element": [ + 6 + ] + }, + "3467460423": { + "effects": [ + 19 + ], + "element": [ + 4 + ] + }, + "3539253011": { + "effects": [ + 12 + ], + "element": [ + 2 + ] + }, + "3540739611": { + "element": [ + 3 + ] + }, + "3573031954": { + "effects": [ + 7 + ], + "element": [ + 1 + ] + }, + "3581696649": { + "effects": [ + 7 + ], + "element": [ + 7 + ] + }, + "3598972737": { + "effects": [ + 6 + ], + "element": [ + 7 + ] + }, + "3599522901": { + "effects": [ + 15 + ] + }, + "3643044286": { + "element": [ + 2 + ] + }, + "3651607301": { + "effects": [ + 17, + 16 + ] + }, + "3657186535": { + "effects": [ + 14 + ] + }, + "3675553168": { + "effects": [ + 7 + ], + "element": [ + 3 + ] + }, + "3683811620": { + "effects": [ + 13, + 14 + ] + }, + "3685945823": { + "effects": [ + 14 + ] + }, + "3719981603": { + "effects": [ + 12 + ] + }, + "3726719281": { + "effects": [ + 14, + 15 + ] + }, + "3736152098": { + "effects": [ + 15 + ] + }, + "3775800797": { + "effects": [ + 1 + ] + }, + "3775916472": { + "effects": [ + 7 + ], + "element": [ + 3 + ] + }, + "3791691774": { + "effects": [ + 16 + ] + }, + "3798468567": { + "effects": [ + 7 + ], + "element": [ + 2 + ] + }, + "3808234135": { + "effects": [ + 15 + ] + }, + "3829100654": { + "effects": [ + 13 + ] + }, + "3832366019": { + "effects": [ + 9, + 16 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "3846931924": { + "effects": [ + 12 + ], + "element": [ + 3 + ] + }, + "3847471926": { + "effects": [ + 9, + 16 + ], + "element": [ + 2 + ] + }, + "3887037435": { + "effects": [ + 6 + ], + "element": [ + 4 + ] + }, + "3914973263": { + "effects": [ + 19 + ], + "element": [ + 4 + ] + }, + "3926119246": { + "effects": [ + 9 + ], + "element": [ + 7 + ] + }, + "3938489430": { + "effects": [ + 13 + ] + }, + "3969361392": { + "effects": [ + 7 + ], + "element": [ + 2, + 3, + 4, + 6, + 7 + ] + }, + "3979300428": { + "effects": [ + 3 + ], + "element": [ + 7 + ] + }, + "3979621113": { + "effects": [ + 6 + ], + "element": [ + 7 + ] + }, + "3980769162": { + "effects": [ + 4 + ], + "element": [ + 4 + ] + }, + "3994043492": { + "effects": [ + 16, + 19 + ] + }, + "4004774872": { + "effects": [ + 17, + 19 + ] + }, + "4004774873": { + "effects": [ + 17, + 19 + ] + }, + "4004774874": { + "effects": [ + 17, + 19 + ] + }, + "4004774875": { + "effects": [ + 17, + 19 + ] + }, + "4004774876": { + "effects": [ + 17, + 19 + ] + }, + "4004774877": { + "effects": [ + 17, + 15, + 19 + ] + }, + "4021790309": { + "effects": [ + 11 + ] + }, + "4039026690": { + "effects": [ + 14 + ] + }, + "4046357305": { + "effects": [ + 19 + ] + }, + "4076776733": { + "effects": [ + 13, + 16 + ] + }, + "4081595582": { + "effects": [ + 17 + ] + }, + "4087056174": { + "effects": [ + 16 + ] + }, + "4149682173": { + "effects": [ + 14, + 16 + ] + }, + "4160037471": { + "effects": [ + 14 + ] + }, + "4182064480": { + "effects": [ + 15, + 19 + ] + }, + "4183296050": { + "effects": [ + 11 + ] + }, + "4188291233": { + "effects": [ + 14, + 15 + ] + }, + "4204488676": { + "effects": [ + 11 + ] + }, + "4230067633": { + "effects": [ + 15 + ] + }, + "4243059257": { + "element": [ + 3 + ] + }, + "4244246940": { + "effects": [ + 4 + ], + "element": [ + 7 + ] + }, + "4255093903": { + "effects": [ + 9, + 16 + ], + "element": [ + 3 + ] + }, + "4267244538": { + "effects": [ + 14 + ] + }, + "4283953067": { + "effects": [ + 5 + ], + "element": [ + 2 + ] + }, + "4287799666": { + "effects": [ + 11 + ] + }, + "4287822553": { + "effects": [ + 5 + ], + "element": [ + 7 + ] + }, + "4294909663": { + "effects": [ + 7 + ], + "element": [ + 2 + ] + } +} diff --git a/package.json b/package.json index 3a06258d..2dfa35e8 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "generate:ghost": "dotenv node built/src/generate-ghost-data.js", "generate:objective": "dotenv node built/src/generate-objective-to-triumph.js", "generate:bounty": "dotenv node built/src/generate-bounty-data.js", + "generate:mods": "dotenv node built/src/generate-mods-data.js", "generate:catalyst": "dotenv node built/src/generate-catalyst-data.js", "generate:crafting": "dotenv node built/src/generate-craftable-hashes.js", "generate:rewards": "dotenv node built/src/generate-powerful-rewards.js", diff --git a/src/generate-mod-slot-data.ts b/src/generate-mod-slot-data.ts index d91285eb..52bf9483 100644 --- a/src/generate-mod-slot-data.ts +++ b/src/generate-mod-slot-data.ts @@ -22,7 +22,7 @@ for (let season = 4; season <= D2CalculatedSeason; season++) { } interface ModSocketMetadata { - /** this allows us to sort mods chronologically for LO purposes */ + /** The season a mod was released in. This allows us to sort mods chronologically for LO purposes. */ season: number; /** we use these two to match with search filters */ tag: string; diff --git a/src/generate-mods-data.ts b/src/generate-mods-data.ts new file mode 100644 index 00000000..7cdf71e6 --- /dev/null +++ b/src/generate-mods-data.ts @@ -0,0 +1,102 @@ +import { getAllDefs, getDef, loadLocal } from '@d2api/manifest-node'; +import { DestinyInventoryItemDefinition } from 'bungie-api-ts/destiny2'; +import { matchTable, ModEffect, ModInfo } from '../data/bounties/mod-config.js'; +import { ItemCategoryHashes } from '../data/generated-enums.js'; +import { writeFile } from './helpers.js'; + +type Ruleset = typeof matchTable[number]; +type BountyMetadata = Ruleset['assign']; +type AssignmentCategory = keyof BountyMetadata; + +loadLocal(); + +const inventoryItems = getAllDefs('InventoryItem'); + +const debug = true; + +function escapeRegExp(string: string) { + return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string +} + +// collects mod->definition associations +const mods: Record = {}; + +const accessors = { + name: (item: DestinyInventoryItemDefinition) => item.displayProperties.name, + desc: (item: DestinyInventoryItemDefinition) => + item.perks + ?.flatMap((p) => { + const perk = getDef('SandboxPerk', p.perkHash); + return [perk?.displayProperties.description]; + }) + .join(' '), + type: (item: DestinyInventoryItemDefinition) => item.itemTypeAndTierDisplayName, +}; + +const matchTypes = ['name', 'desc', 'type'] as const; + +function assign(ruleset: Ruleset, mod: ModInfo) { + Object.entries(ruleset.assign).forEach(([assignTo, assignValues]) => { + //:[keyof typeof ruleset,number[]] + // add these values to the bounty's attributes + const assignTo_ = assignTo as AssignmentCategory; + mod[assignTo_] = [...new Set([...(mod[assignTo_] ?? []), ...(assignValues ?? [])])]; + }); +} + +// loop through the manifest's bounties +for (const inventoryItem of inventoryItems) { + // filter loops through acceptable categories -- includes loops through item's hashes + if ( + !inventoryItem.itemCategoryHashes?.includes(ItemCategoryHashes.ArmorMods) || + !inventoryItem.itemTypeAndTierDisplayName.includes('Mod') || + inventoryItem.itemTypeAndTierDisplayName.includes('Deprecated') || + inventoryItem.itemTypeAndTierDisplayName.includes('Empty') || + inventoryItem.displayProperties.name.includes('Empty') || + inventoryItem.displayProperties.description.includes('deprecated') + ) { + continue; + } + + // normalize bounty's available data + + const thisMod: ModInfo = {}; + // loop through matching conditions + for (const ruleset of matchTable) { + // match against strings or regexen + for (const matchType of matchTypes) { + ruleset[matchType]?.forEach((match) => { + // convert regex||string to regex + match = match instanceof RegExp ? match : new RegExp(escapeRegExp(match)); + + // and run the regex + const stringToTest = accessors[matchType](inventoryItem); + if (stringToTest && match.test(stringToTest)) { + assign(ruleset, thisMod); + } + }); + } + } + + if (Object.keys(thisMod).length > 0) { + mods[inventoryItem.hash] = thisMod; + } else { + // These bounties won't show up in pursuits.json + if (debug) { + console.log('Skipped: ' + inventoryItem.displayProperties.name); + } + } + + if (debug) { + console.log({ + ...thisMod, + hash: inventoryItem.hash, + name: accessors.name(inventoryItem), + desc: accessors.desc(inventoryItem), + type: accessors.type(inventoryItem), + effects: thisMod.effects?.map((e) => ModEffect[e]), + }); + } +} + +writeFile('./output/mods.json', mods, true);