Rewrote fence itemTypeLimits and itemCategoryRoublePriceLimit

Fixed bug where item limit was off by one
This commit is contained in:
Dev 2024-02-15 23:14:31 +00:00
parent a1d82af41f
commit d5627e0627
2 changed files with 91 additions and 47 deletions

View File

@ -72,42 +72,55 @@
},
"itemPriceMult": 1.2,
"presetPriceMult": 1.3,
"regenerateAssortsOnRefresh": false,
"regenerateAssortsOnRefresh": true,
"itemTypeLimits": {
"543be5cb4bdc2deb348b4568": 2,
"550aa4bf4bdc2dd6348b456b": 3,
"55818add4bdc2d5b648b456f": 5,
"5448bc234bdc2d3c308b4569": 5,
"55818b224bdc2dde698b456f": 5,
"555ef6e44bdc2de9068b457e": 5,
"5a341c4086f77401f2541505": 5,
"55818ad54bdc2ddc698b4569": 5,
"5448e53e4bdc2d60728b4567": 6,
"55818ac54bdc2d5b648b456e": 5,
"55818af64bdc2d5b648b4570": 5,
"55818a304bdc2db5418b457d": 4,
"5a74651486f7744e73386dd1": 5,
"55818a594bdc2db9688b456a": 5,
"55818a104bdc2db9688b4569": 5,
"55818a684bdc2ddd698b456d": 3,
"550aa4cd4bdc2dd8348b456c": 3,
"55818acf4bdc2dde698b456b": 5,
"55818a6f4bdc2db9688b456b": 5,
"5447b5f14bdc2d61278b4567": 3,
"5447b5cf4bdc2d65278b4567": 5,
"5447b6094bdc2dc3278b4567": 5,
"5447b5e04bdc2d62278b4567": 5,
"55818b164bdc2ddc698b456c": 3,
"617f1ef5e8b54b0998387733": 2,
"5448ecbe4bdc2d60728b4568": 2,
"57864a66245977548f04a81f": 2,
"5a341c4686f77469e155819e": 3,
"57864a3d24597754843f8721": 2,
"5448e54d4bdc2dcc718b4568": 4,
"5448f39d4bdc2d0a728b4568": 5,
"5795f317245977243854e041": 3,
"5c99f98d86f7745c314214b3": 2,
"5c164d2286f774194c5e69fa": 0
"5448eb774bdc2d0a728b4567": 10,
"5c518ec986f7743b68682ce2": 3,
"5c518ed586f774119a772aee": 0,
"5448bc234bdc2d3c308b4569": 16,
"55802f4a4bdc2ddb688b4569": 3,
"644120aa86ffbe10ee032b6f": 3,
"5c99f98d86f7745c314214b3": 0,
"5447b5cf4bdc2d65278b4567": 4,
"55818a104bdc2db9688b4569": 1,
"55818a304bdc2db5418b457d": 1,
"5448fe394bdc2d0d028b456c": 0,
"55818a594bdc2db9688b456a": 0,
"55818a604bdc2db5418b457e": 0,
"55818a684bdc2ddd698b456d": 1,
"55818a6f4bdc2db9688b456b": 1,
"55818ac54bdc2d5b648b456e": 1,
"55818acf4bdc2dde698b456b": 0,
"55818ad54bdc2ddc698b4569": 0,
"55818add4bdc2d5b648b456f": 0,
"55818ae44bdc2dde698b456c": 0,
"55818aeb4bdc2ddc698b456a": 0,
"55818af64bdc2d5b648b4570": 0,
"55818afb4bdc2dde698b456d": 1,
"55818b014bdc2ddc698b456b": 1,
"55818b084bdc2d5b648b4571": 1,
"55818b0e4bdc2dde698b456e": 0,
"55818b164bdc2ddc698b456c": 0,
"55818b1d4bdc2d5b648b4572": 1,
"55818b224bdc2dde698b456f": 1,
"550aa4cd4bdc2dd8348b456c": 0,
"550aa4dd4bdc2dc9348b4569": 1,
"5a74651486f7744e73386dd1": 0,
"5a2c3a9486f774688b05e574": 0,
"56ea9461d2720b67698b456f": 0,
"5448f3a64bdc2d60728b456a": 0,
"5a341c4686f77469e155819e": 7,
"5485a8684bdc2da71d8b4567": 23,
"5f4fbaaca5573a5ac31db429": 0,
"5447e0e74bdc2d3c308b4567": 4,
"57bef4c42459772e8d35a53b": 1,
"5b3f15d486f77432d0509248": 3,
"543be6564bdc2df4348b4568": 0,
"5448ecbe4bdc2d60728b4568": 0,
"5671435f4bdc2d96058b4569": 0
},
"weaponDurabilityPercentMinMax": {
"current": {
@ -138,21 +151,29 @@
"5485a8684bdc2da71d8b4567": {
"min": 80,
"max": 7000
}
},
"543be5cb4bdc2deb348b4568": {
"min": 1,
"max": 16
},
"5b432b965acfc47a8774094e": {
"min": 120,
"max": 352
}
},
"itemCategoryRoublePriceLimit": {
"5448eb774bdc2d0a728b4567": 14000,
"5485a8684bdc2da71d8b4567": 230,
"5795f317245977243854e041": 30000,
"5448ecbe4bdc2d60728b4568": 40000,
"57864a3d24597754843f8721": 50000,
"5447e1d04bdc2dff2f8b4567": 50000,
"5448e53e4bdc2d60728b4567": 90000,
"5a341c4686f77469e155819e": 75000,
"5a341c4686f77469e155819e": 24000,
"57864a66245977548f04a81f": 71000,
"5448e54d4bdc2dcc718b4568": 200000,
"5448e54d4bdc2dcc718b4568": 100000,
"5a2c3a9486f774688b05e574": 70000,
"5448f3a64bdc2d60728b456a": 70000,
"5447b6194bdc2d67278b4567": 195000,
"5447b6194bdc2d67278b4567": 103000,
"550aa4cd4bdc2dd8348b456c": 70000,
"57864ee62459775490116fc1": 95000,
"5448bc234bdc2d3c308b4569": 29000,
@ -163,7 +184,7 @@
"5447b5e04bdc2d62278b4567": 33006,
"5447b5fc4bdc2d87278b4567": 42005,
"5447b5f14bdc2d61278b4567": 44004,
"5447b5cf4bdc2d65278b4567": 30003,
"5447b5cf4bdc2d65278b4567": 28003,
"5447b6254bdc2dc3278b4568": 28002,
"5447e1d04bdc2dff2f8b4567": 19001,
@ -173,9 +194,18 @@
"57864bb7245977548b3b66c2": 85000,
"5448e5284bdc2dcb718b4567": 40001,
"5a341c4086f77401f2541505": 105000,
"5a341c4086f77401f2541505": 35000,
"5d21f59b6dbe99052b54ef83": 45000
"5d21f59b6dbe99052b54ef83": 45000,
"5645bcb74bdc2ded0b8b4578": 35000,
"644120aa86ffbe10ee032b6f": 20000,
"57864c8c245977548867e7f1": 15000,
"5447e0e74bdc2d3c308b4567": 20000,
"616eb7aea207f41933308f46": 40000,
"5b3f15d486f77432d0509248": 5000,
"5448f3ac4bdc2dce718b4569": 42000,
"5448f3a14bdc2d27728b4569": 20000
},
"presetSlotsToRemoveChancePercent": {
"mod_scope": 70,

View File

@ -541,14 +541,14 @@ export class FenceService
* @param assortCount Number to add
* @param assorts Assorts data to add to
* @param baseFenceAssort Base data to draw from
* @param itemTypeCounts
* @param itemTypeLimits
* @param loyaltyLevel Loyalty level to set new item to
*/
protected addItemAssorts(
assortCount: number,
assorts: ITraderAssort,
baseFenceAssort: ITraderAssort,
itemTypeCounts: Record<string, { current: number; max: number; }>,
itemTypeLimits: Record<string, { current: number; max: number; }>,
loyaltyLevel: number,
): void
{
@ -570,8 +570,8 @@ export class FenceService
);
const itemDbDetails = this.itemHelper.getItem(chosenBaseAssortRoot._tpl)[1];
const itemLimitCount = itemTypeCounts[itemDbDetails._parent];
if (itemLimitCount && itemLimitCount.current > itemLimitCount.max)
const itemLimitCount = this.getMatchingItemLimit(itemTypeLimits, itemDbDetails._id);
if (itemLimitCount?.current >= itemLimitCount?.max)
{
// Skip adding item as assort as limit reached, decrement i counter so we still get another item
i--;
@ -624,6 +624,20 @@ export class FenceService
}
}
protected getMatchingItemLimit(
itemTypeLimits: Record<string, { current: number; max: number; }>,
itemTpl: string,
): { current: number; max: number; }
{
for (const baseTypeKey in itemTypeLimits)
{
if (this.itemHelper.isOfBaseclass(itemTpl, baseTypeKey))
{
return itemTypeLimits[baseTypeKey];
}
}
}
/**
* Find presets in base fence assort and add desired number to 'assorts' parameter
* @param desiredWeaponPresetsCount