Add comments
This commit is contained in:
parent
928e406b76
commit
5eda074dbe
@ -480,6 +480,7 @@ export class FenceService
|
|||||||
rootItemToPush.upd.BuyRestrictionCurrent = 0;
|
rootItemToPush.upd.BuyRestrictionCurrent = 0;
|
||||||
rootItemToPush.upd.UnlimitedCount = false;
|
rootItemToPush.upd.UnlimitedCount = false;
|
||||||
|
|
||||||
|
// Need to add mods to armors so they dont show as red in the trade screen
|
||||||
if (this.itemHelper.isOfBaseclasses(rootItemToPush._tpl, [BaseClasses.HEADWEAR, BaseClasses.VEST, BaseClasses.ARMOR]))
|
if (this.itemHelper.isOfBaseclasses(rootItemToPush._tpl, [BaseClasses.HEADWEAR, BaseClasses.VEST, BaseClasses.ARMOR]))
|
||||||
{
|
{
|
||||||
this.addModsToArmorModSlots(itemsToPush, itemDbDetails);
|
this.addModsToArmorModSlots(itemsToPush, itemDbDetails);
|
||||||
@ -492,17 +493,23 @@ export class FenceService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add soft inserts + armor plates to an armor
|
||||||
|
* @param armor Armor item array to add mods into
|
||||||
|
* @param itemDbDetails Armor items db template
|
||||||
|
*/
|
||||||
protected addModsToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void
|
protected addModsToArmorModSlots(armor: Item[], itemDbDetails: ITemplateItem): void
|
||||||
{
|
{
|
||||||
const hasMods = itemDbDetails._props.Slots.length >0;
|
// Armor has no mods, make no additions
|
||||||
|
const hasMods = itemDbDetails._props.Slots.length > 0;
|
||||||
if (!hasMods)
|
if (!hasMods)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for and add required soft inserts to armors
|
||||||
const requiredSlots = itemDbDetails._props.Slots.filter(slot => slot._required);
|
const requiredSlots = itemDbDetails._props.Slots.filter(slot => slot._required);
|
||||||
const hasRequiredSlots = requiredSlots.length > 0;
|
const hasRequiredSlots = requiredSlots.length > 0;
|
||||||
|
|
||||||
if (hasRequiredSlots)
|
if (hasRequiredSlots)
|
||||||
{
|
{
|
||||||
for (const requiredSlot of requiredSlots)
|
for (const requiredSlot of requiredSlots)
|
||||||
@ -511,7 +518,7 @@ export class FenceService
|
|||||||
const durabilityValues = this.getRandomisedArmorDurabilityValues(modItemDbDetails, this.traderConfig.fence.armorMaxDurabilityPercentMinMax);
|
const durabilityValues = this.getRandomisedArmorDurabilityValues(modItemDbDetails, this.traderConfig.fence.armorMaxDurabilityPercentMinMax);
|
||||||
armor.push({
|
armor.push({
|
||||||
_id: this.hashUtil.generate(),
|
_id: this.hashUtil.generate(),
|
||||||
_tpl: requiredSlot._props.filters[0].Plate,
|
_tpl: requiredSlot._props.filters[0].Plate, // `Plate` property appears to be the 'default' item for slot
|
||||||
parentId: armor[0]._id,
|
parentId: armor[0]._id,
|
||||||
slotId: requiredSlot._name,
|
slotId: requiredSlot._name,
|
||||||
upd: {
|
upd: {
|
||||||
@ -524,21 +531,24 @@ export class FenceService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for and add plate items
|
||||||
const plateSlots = itemDbDetails._props.Slots.filter(slot => ["front_plate", "back_plate", "side_plate"].includes(slot._name.toLowerCase()));
|
const plateSlots = itemDbDetails._props.Slots.filter(slot => ["front_plate", "back_plate", "side_plate"].includes(slot._name.toLowerCase()));
|
||||||
const hasPlateSlots = plateSlots.length > 0;
|
const hasPlateSlots = plateSlots.length > 0;
|
||||||
if (hasPlateSlots)
|
if (hasPlateSlots)
|
||||||
{
|
{
|
||||||
for (const plateSlot of plateSlots)
|
for (const plateSlot of plateSlots)
|
||||||
{
|
{
|
||||||
if (this.randomUtil.getChance100(this.traderConfig.fence.chancePlateExistsInArmorPercent))
|
// Chance to not add plate
|
||||||
|
if (!this.randomUtil.getChance100(this.traderConfig.fence.chancePlateExistsInArmorPercent))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const modItemDbDetails = this.itemHelper.getItem(plateSlot._props.filters[0].Plate)[1];
|
const modItemDbDetails = this.itemHelper.getItem(plateSlot._props.filters[0].Plate)[1];
|
||||||
const durabilityValues = this.getRandomisedArmorDurabilityValues(modItemDbDetails, this.traderConfig.fence.armorMaxDurabilityPercentMinMax);
|
const durabilityValues = this.getRandomisedArmorDurabilityValues(modItemDbDetails, this.traderConfig.fence.armorMaxDurabilityPercentMinMax);
|
||||||
armor.push({
|
armor.push({
|
||||||
_id: this.hashUtil.generate(),
|
_id: this.hashUtil.generate(),
|
||||||
_tpl: plateSlot._props.filters[0].Plate,
|
_tpl: plateSlot._props.filters[0].Plate, // `Plate` property appears to be the 'default' item for slot
|
||||||
parentId: armor[0]._id,
|
parentId: armor[0]._id,
|
||||||
slotId: plateSlot._name,
|
slotId: plateSlot._name,
|
||||||
upd: {
|
upd: {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user