diff --git a/project/assets/configs/ragfair.json b/project/assets/configs/ragfair.json index 32ffa038..78dc3f7c 100644 --- a/project/assets/configs/ragfair.json +++ b/project/assets/configs/ragfair.json @@ -16,7 +16,8 @@ "reputation": { "gain": 0.0000002, "loss": 0.0000002 - } + }, + "expireSeconds": 71 }, "traders": { "54cb50c76803fa8b248b4571": true, diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index f5f90c98..e67bd6ed 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -501,10 +501,10 @@ export class RagfairController return this.httpResponse.appendErrorToOutput(this.eventOutputHolder.getOutput(sessionID), this.localisationService.getText("ragfair-offer_not_found_in_profile_short")); } - const differenceInMins = (offers[index].endTime - this.timeUtil.getTimestamp()) / 6000; - if (differenceInMins > 1) + const differenceInSeconds = (offers[index].endTime - this.timeUtil.getTimestamp()); + if (differenceInSeconds > this.ragfairConfig.sell.expireSeconds)// expireSeconds Default is 71 seconds { - const newEndTime = 11 + this.timeUtil.getTimestamp(); + const newEndTime = this.ragfairConfig.sell.expireSeconds + this.timeUtil.getTimestamp(); offers[index].endTime = Math.round(newEndTime); } diff --git a/project/src/models/spt/config/IRagfairConfig.ts b/project/src/models/spt/config/IRagfairConfig.ts index b49d21e0..f62e0464 100644 --- a/project/src/models/spt/config/IRagfairConfig.ts +++ b/project/src/models/spt/config/IRagfairConfig.ts @@ -25,6 +25,8 @@ export interface Sell reputation: Reputation /** How many hours are simulated to figure out if player offer was sold */ simulatedSellHours: number + /**Seconds from clicking remove to remove offer from market */ + expireSeconds: number } export interface Chance diff --git a/project/src/services/RagfairOfferService.ts b/project/src/services/RagfairOfferService.ts index c18d11f8..2dfcc459 100644 --- a/project/src/services/RagfairOfferService.ts +++ b/project/src/services/RagfairOfferService.ts @@ -215,8 +215,8 @@ export class RagfairOfferService this.addOfferToExpired(staleOffer); } - // Handle player offer - items need returning/XP adjusting - if (isPlayer) + // Handle player offer - items need returning/XP adjusting. Checking if offer has actually expired or not. + if (isPlayer && staleOffer.endTime <= this.timeUtil.getTimestamp()) { // TODO: something feels wrong, func returns ItemEventRouterResponse but we dont pass it back to caller? this.returnPlayerOffer(staleOffer); @@ -254,8 +254,6 @@ export class RagfairOfferService this.ragfairServerHelper.returnItems(profile.aid, offer.items); profile.RagfairInfo.offers.splice(offerIndex, 1); - this.removeOfferById(offer._id); - return this.eventOutputHolder.getOutput(sessionID); } }