Feature, plates in armors listed by fence now have individual chances to be removed before listing based on plate protection level
This commit is contained in:
parent
843455602d
commit
bd28cbca57
@ -201,7 +201,12 @@
|
|||||||
"max": 100
|
"max": 100
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chancePlateExistsInArmorPercent": 50,
|
"chancePlateExistsInArmorPercent": {
|
||||||
|
"3": 95,
|
||||||
|
"4": 75,
|
||||||
|
"5": 25,
|
||||||
|
"6": 10
|
||||||
|
},
|
||||||
"armorMaxDurabilityPercentMinMax": {
|
"armorMaxDurabilityPercentMinMax": {
|
||||||
"current": {
|
"current": {
|
||||||
"min": 50,
|
"min": 50,
|
||||||
|
@ -33,7 +33,8 @@ export interface FenceConfig
|
|||||||
presetPriceMult: number
|
presetPriceMult: number
|
||||||
armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax
|
armorMaxDurabilityPercentMinMax: IItemDurabilityCurrentMax
|
||||||
weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax
|
weaponDurabilityPercentMinMax: IItemDurabilityCurrentMax
|
||||||
chancePlateExistsInArmorPercent: number
|
/** Keyed to plate protection level */
|
||||||
|
chancePlateExistsInArmorPercent: Record<string, number>
|
||||||
/** Key: item tpl */
|
/** Key: item tpl */
|
||||||
itemStackSizeOverrideMinMax: Record<string, MinMax>
|
itemStackSizeOverrideMinMax: Record<string, MinMax>
|
||||||
itemTypeLimits: Record<string, number>
|
itemTypeLimits: Record<string, number>
|
||||||
|
@ -1220,6 +1220,7 @@ export class FenceService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Randomise the durability values of plate items in armor
|
* Randomise the durability values of plate items in armor
|
||||||
|
* Has chance to remove plate
|
||||||
* @param plateSlots Slots of items to randomise
|
* @param plateSlots Slots of items to randomise
|
||||||
* @param armorItemAndMods Array of armor + inserts to get items from
|
* @param armorItemAndMods Array of armor + inserts to get items from
|
||||||
*/
|
*/
|
||||||
@ -1227,23 +1228,27 @@ export class FenceService
|
|||||||
{
|
{
|
||||||
for (const plateSlot of plateSlots!)
|
for (const plateSlot of plateSlots!)
|
||||||
{
|
{
|
||||||
// Chance to not add plate
|
|
||||||
if (!this.randomUtil.getChance100(this.traderConfig.fence.chancePlateExistsInArmorPercent))
|
|
||||||
{
|
|
||||||
// Remove plate from armor
|
|
||||||
armorItemAndMods = armorItemAndMods
|
|
||||||
.filter((item) => item.slotId!.toLowerCase() !== plateSlot._name.toLowerCase());
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
const plateTpl = plateSlot._props.filters[0].Plate;
|
const plateTpl = plateSlot._props.filters[0].Plate;
|
||||||
if (!plateTpl)
|
if (!plateTpl)
|
||||||
{
|
{
|
||||||
// Bsg data lacks a default plate, skip adding mod
|
// Bsg data lacks a default plate, skip randomisng for this mod
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modItemDbDetails = this.itemHelper.getItem(plateTpl)[1];
|
const modItemDbDetails = this.itemHelper.getItem(plateTpl)[1];
|
||||||
|
|
||||||
|
// Chance to remove plate
|
||||||
|
const plateExistsChance = this.traderConfig
|
||||||
|
.fence.chancePlateExistsInArmorPercent[modItemDbDetails._props?.armorClass ?? "3"];
|
||||||
|
if (!this.randomUtil.getChance100(plateExistsChance))
|
||||||
|
{
|
||||||
|
// Remove plate from armor
|
||||||
|
armorItemAndMods = armorItemAndMods
|
||||||
|
.filter((item) => item.slotId!.toLowerCase() !== plateSlot._name.toLowerCase());
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
const durabilityValues = this.getRandomisedArmorDurabilityValues(
|
const durabilityValues = this.getRandomisedArmorDurabilityValues(
|
||||||
modItemDbDetails,
|
modItemDbDetails,
|
||||||
this.traderConfig.fence.armorMaxDurabilityPercentMinMax,
|
this.traderConfig.fence.armorMaxDurabilityPercentMinMax,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user