Fix: Fixed some ragfair issues (!86)

Fixed bug with removing offers from flee and item returning too quickly.
Fixed bug with error message that would show on removal of offers.
Expose property expireSeconds in ragfair.json.

Co-authored-by: Kaeno <>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/86
Co-authored-by: Kaeno <kaeno@noreply.dev.sp-tarkov.com>
Co-committed-by: Kaeno <kaeno@noreply.dev.sp-tarkov.com>
This commit is contained in:
Kaeno 2023-04-06 16:23:52 +00:00 committed by chomp
parent cd563a3642
commit ca931165b2
4 changed files with 9 additions and 8 deletions

View File

@ -16,7 +16,8 @@
"reputation": { "reputation": {
"gain": 0.0000002, "gain": 0.0000002,
"loss": 0.0000002 "loss": 0.0000002
} },
"expireSeconds": 71
}, },
"traders": { "traders": {
"54cb50c76803fa8b248b4571": true, "54cb50c76803fa8b248b4571": true,

View File

@ -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")); 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; const differenceInSeconds = (offers[index].endTime - this.timeUtil.getTimestamp());
if (differenceInMins > 1) 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); offers[index].endTime = Math.round(newEndTime);
} }

View File

@ -25,6 +25,8 @@ export interface Sell
reputation: Reputation reputation: Reputation
/** How many hours are simulated to figure out if player offer was sold */ /** How many hours are simulated to figure out if player offer was sold */
simulatedSellHours: number simulatedSellHours: number
/**Seconds from clicking remove to remove offer from market */
expireSeconds: number
} }
export interface Chance export interface Chance

View File

@ -215,8 +215,8 @@ export class RagfairOfferService
this.addOfferToExpired(staleOffer); this.addOfferToExpired(staleOffer);
} }
// Handle player offer - items need returning/XP adjusting // Handle player offer - items need returning/XP adjusting. Checking if offer has actually expired or not.
if (isPlayer) if (isPlayer && staleOffer.endTime <= this.timeUtil.getTimestamp())
{ {
// TODO: something feels wrong, func returns ItemEventRouterResponse but we dont pass it back to caller? // TODO: something feels wrong, func returns ItemEventRouterResponse but we dont pass it back to caller?
this.returnPlayerOffer(staleOffer); this.returnPlayerOffer(staleOffer);
@ -254,8 +254,6 @@ export class RagfairOfferService
this.ragfairServerHelper.returnItems(profile.aid, offer.items); this.ragfairServerHelper.returnItems(profile.aid, offer.items);
profile.RagfairInfo.offers.splice(offerIndex, 1); profile.RagfairInfo.offers.splice(offerIndex, 1);
this.removeOfferById(offer._id);
return this.eventOutputHolder.getOutput(sessionID); return this.eventOutputHolder.getOutput(sessionID);
} }
} }