Skip to content

Commit

Permalink
Add support for bulk upgrading gems
Browse files Browse the repository at this point in the history
  • Loading branch information
zys5945 authored and olegbl committed Apr 16, 2023
1 parent 16f0979 commit c0481ae
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
32 changes: 32 additions & 0 deletions StackableGems/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,38 @@ else if (
});
}
}

if (config.bulkUpgrade) {
for (let i = 0; i < ITEM_TYPES.length; i = i + 1) {
// no upgrade for perfect gems
if ((i+1) % 5 == 0) {
continue;
}
const itemtype = ITEM_TYPES[i];
const stacktype = converItemTypeToStackItemType(itemtype);
const upgradedItemtype = ITEM_TYPES[i + 1];
const upgradedStacktype = converItemTypeToStackItemType(upgradedItemtype);
for (let j = 30; j < config.maxStack; j = j + 1) {
cubemain.rows.push({
description: `Stack of ${j} ${itemtype} + 1 id scroll -> Stack`
+ ` of 10 ${upgradedItemtype} + Stack of ${j - 30} ${itemtype} + 1`
+ ` id scroll`,
enabled: 1,
version: 0,
op: 18, // skip recipe if item's Stat.Accr(param) != value
param: 70, // quantity (itemstatcost.txt)
value: j, // only execute rule if quantity == j
numinputs: 2,
'input 1': stacktype,
'input 2': 'isc',
output: `"${upgradedStacktype},qty=10"`,
'output b': j == 30 ? null : `"${stacktype},qty=${j - 30}"`,
'output c': 'isc',
'*eol': 0,
});
}
}
}
D2RMM.writeTsv(cubemainFilename, cubemain);

D2RMM.copyFile(
Expand Down
7 changes: 7 additions & 0 deletions StackableGems/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@
"name": "Convert When Destacking",
"description": "Enable to have the split off gem automatically convert to a non-stackable variant when splitting a stack. Warning: this adds 15k+ cube recipes which slows down the game's startup.",
"defaultValue": false
},
{
"id": "bulkUpgrade",
"type": "checkbox",
"name": "30 to 10 Bulk Upgrade",
"description": "Enable to add 30 to 10 bulk upgrade recipes. Warning: this adds 6k+ cube recipes which slows down the game's startup.",
"defaultValue": false
}
]
}

0 comments on commit c0481ae

Please sign in to comment.