Remove redundant return statements from RagfairOfferGenerator

This commit is contained in:
Dev 2024-01-29 11:22:04 +00:00
parent 330b1ebf28
commit a9517bb1cc

View File

@ -459,13 +459,13 @@ export class RagfairOfferGenerator
else if (isBarterOffer) else if (isBarterOffer)
{ {
// Apply randomised properties // Apply randomised properties
itemWithChildren = this.randomiseItemUpdProperties(randomUserId, itemWithChildren, itemDetails[1]); this.randomiseOfferItemUpdProperties(randomUserId, itemWithChildren, itemDetails[1]);
barterScheme = this.createBarterBarterScheme(itemWithChildren); barterScheme = this.createBarterBarterScheme(itemWithChildren);
} }
else else
{ {
// Apply randomised properties // Apply randomised properties
itemWithChildren = this.randomiseItemUpdProperties(randomUserId, itemWithChildren, itemDetails[1]); this.randomiseOfferItemUpdProperties(randomUserId, itemWithChildren, itemDetails[1]);
barterScheme = this.createCurrencyBarterScheme(itemWithChildren, isPackOffer); barterScheme = this.createCurrencyBarterScheme(itemWithChildren, isPackOffer);
} }
@ -563,14 +563,13 @@ export class RagfairOfferGenerator
* Get array of an item with its mods + condition properties (e.g durability) * Get array of an item with its mods + condition properties (e.g durability)
* Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition * Apply randomisation adjustments to condition if item base is found in ragfair.json/dynamic/condition
* @param userID id of owner of item * @param userID id of owner of item
* @param itemWithMods Item and mods, get condition of first item (only first array item is used) * @param itemWithMods Item and mods, get condition of first item (only first array item is modified)
* @param itemDetails db details of first item * @param itemDetails db details of first item
* @returns
*/ */
protected randomiseItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): Item[] protected randomiseOfferItemUpdProperties(userID: string, itemWithMods: Item[], itemDetails: ITemplateItem): void
{ {
// Add any missing properties to first item in array // Add any missing properties to first item in array
itemWithMods[0] = this.addMissingConditions(itemWithMods[0]); this.addMissingConditions(itemWithMods[0]);
if (!(this.ragfairServerHelper.isPlayer(userID) || this.ragfairServerHelper.isTrader(userID))) if (!(this.ragfairServerHelper.isPlayer(userID) || this.ragfairServerHelper.isTrader(userID)))
{ {
@ -578,7 +577,7 @@ export class RagfairOfferGenerator
if (!parentId) if (!parentId)
{ {
// No condition details found, don't proceed with modifying item conditions // No condition details found, don't proceed with modifying item conditions
return itemWithMods; return;
} }
// Roll random chance to randomise item condition // Roll random chance to randomise item condition
@ -587,8 +586,6 @@ export class RagfairOfferGenerator
this.randomiseItemCondition(parentId, itemWithMods, itemDetails); this.randomiseItemCondition(parentId, itemWithMods, itemDetails);
} }
} }
return itemWithMods;
} }
/** /**
@ -781,9 +778,8 @@ export class RagfairOfferGenerator
* Durabiltiy for repairable items * Durabiltiy for repairable items
* HpResource for medical items * HpResource for medical items
* @param item item to add conditions to * @param item item to add conditions to
* @returns Item with conditions added
*/ */
protected addMissingConditions(item: Item): Item protected addMissingConditions(item: Item): void
{ {
const props = this.itemHelper.getItem(item._tpl)[1]._props; const props = this.itemHelper.getItem(item._tpl)[1]._props;
const isRepairable = "Durability" in props; const isRepairable = "Durability" in props;
@ -816,8 +812,6 @@ export class RagfairOfferGenerator
{ {
item.upd.RepairKit = { Resource: props.MaxRepairResource }; item.upd.RepairKit = { Resource: props.MaxRepairResource };
} }
return item;
} }
/** /**