Refactor of ammo reward calculaton for daily quests

No longer give random value between config min and stack max size (mods that adjust max stack size were causing very broken behaviour)

Ammo stack size is now chosen based on rouble budget for reward, capped at a count of 100

Adjust config min stack size to be 5, this still achieves goal of preventing single stack ammos like grenades but allows inclusion of ammos like patron_12x70_buckshot
This commit is contained in:
Dev 2023-12-16 21:49:16 +00:00
parent 7950bef43e
commit cc916ff419
2 changed files with 16 additions and 8 deletions

View File

@ -807,7 +807,7 @@
}, },
"rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248", "59f32c3b86f77472a31742f0", "59f32bb586f774757e1e8442"], "rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248", "59f32c3b86f77472a31742f0", "59f32bb586f774757e1e8442"],
"rewardBlacklist": ["627bce33f21bc425b06ab967"], "rewardBlacklist": ["627bce33f21bc425b06ab967"],
"rewardAmmoStackMinSize": 20 "rewardAmmoStackMinSize": 5
}, { }, {
"id": "618035d38012292db3081bf0", "id": "618035d38012292db3081bf0",
"name": "Weekly", "name": "Weekly",
@ -1544,7 +1544,7 @@
}, },
"rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248", "59f32c3b86f77472a31742f0", "59f32bb586f774757e1e8442"], "rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248", "59f32c3b86f77472a31742f0", "59f32bb586f774757e1e8442"],
"rewardBlacklist": ["627bce33f21bc425b06ab967"], "rewardBlacklist": ["627bce33f21bc425b06ab967"],
"rewardAmmoStackMinSize": 15 "rewardAmmoStackMinSize": 5
}, { }, {
"id": "62825ef60e88d037dc1eb426", "id": "62825ef60e88d037dc1eb426",
"name": "Daily_Savage", "name": "Daily_Savage",
@ -1903,7 +1903,7 @@
}, },
"rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248"], "rewardBaseTypeBlacklist": ["543be5e94bdc2df1348b4568", "5b3f15d486f77432d0509248"],
"rewardBlacklist": ["627bce33f21bc425b06ab967"], "rewardBlacklist": ["627bce33f21bc425b06ab967"],
"rewardAmmoStackMinSize": 15 "rewardAmmoStackMinSize": 5
} }
], ],
"locationIdMap": { "locationIdMap": {

View File

@ -937,11 +937,19 @@ export class RepeatableQuestGenerator
continue; continue;
} }
// Randomise the cartridge count returned // The budget for this ammo stack
rewardItemStackCount = this.randomUtil.randInt( const stackRoubleBudget = roublesBudget / rewardNumItems;
repeatableConfig.rewardAmmoStackMinSize,
itemSelected._props.StackMaxSize, const singleCartridgePrice = this.handbookHelper.getTemplatePrice(itemSelected._id);
);
// Get a stack size of ammo that fits budget
const stackSizeThatFitsBudget = Math.round(stackRoubleBudget / singleCartridgePrice);
// Get itemDbs max stack size for ammo - dont go above 100 (some mods mess around with stack sizes)
const stackMaxCount = Math.min(itemSelected._props.StackMaxSize, 100);
// Choose smallest between stack max and budget fitting size
rewardItemStackCount = Math.min(stackSizeThatFitsBudget, stackMaxCount);
} }
// 25% chance to double reward stack (item should be stackable and not weapon) // 25% chance to double reward stack (item should be stackable and not weapon)