Make use of global values when sending player back unsold offer items + rep loss

This commit is contained in:
Dev 2023-12-16 15:50:35 +00:00
parent d2f6a16312
commit 7950bef43e
2 changed files with 7 additions and 4 deletions

View File

@ -160,7 +160,7 @@ export class RagfairServerHelper
MessageType.MESSAGE_WITH_ITEMS, MessageType.MESSAGE_WITH_ITEMS,
RagfairServerHelper.goodsReturnedTemplate, RagfairServerHelper.goodsReturnedTemplate,
returnedItems, returnedItems,
this.timeUtil.getHoursAsSeconds(this.questConfig.redeemTime), this.timeUtil.getHoursAsSeconds(this.databaseServer.getTables().globals.config.RagFair.yourOfferDidNotSellMaxStorageTimeInHour),
); );
} }

View File

@ -240,15 +240,18 @@ export class RagfairOfferService
); );
} }
profile.RagfairInfo.rating -= this.ragfairConfig.sell.reputation.loss; // Reduce player ragfair rep
profile.RagfairInfo.rating -= this.databaseServer.getTables().globals.config.RagFair.ratingDecreaseCount;
profile.RagfairInfo.isRatingGrowing = false; profile.RagfairInfo.isRatingGrowing = false;
if (offer.items[0].upd.StackObjectsCount > offer.items[0].upd.OriginalStackObjectsCount) const firstOfferItem = offer.items[0];
if (firstOfferItem.upd.StackObjectsCount > firstOfferItem.upd.OriginalStackObjectsCount)
{ {
offer.items[0].upd.StackObjectsCount = offer.items[0].upd.OriginalStackObjectsCount; offer.items[0].upd.StackObjectsCount = firstOfferItem.upd.OriginalStackObjectsCount;
} }
delete offer.items[0].upd.OriginalStackObjectsCount; delete offer.items[0].upd.OriginalStackObjectsCount;
// Send failed offer items to player in mail
this.ragfairServerHelper.returnItems(profile.sessionId, offer.items); this.ragfairServerHelper.returnItems(profile.sessionId, offer.items);
profile.RagfairInfo.offers.splice(offerIndex, 1); profile.RagfairInfo.offers.splice(offerIndex, 1);