Refactor processOffersOnProfile()
This commit is contained in:
parent
98e2af2ad4
commit
88a854c5ca
@ -4,7 +4,7 @@ import { IPmcData } from "../models/eft/common/IPmcData";
|
|||||||
import { Item } from "../models/eft/common/tables/IItem";
|
import { Item } from "../models/eft/common/tables/IItem";
|
||||||
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
|
import { ITraderAssort } from "../models/eft/common/tables/ITrader";
|
||||||
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
|
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
|
||||||
import { ISystemData } from "../models/eft/profile/IAkiProfile";
|
import { IAkiProfile, ISystemData } from "../models/eft/profile/IAkiProfile";
|
||||||
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
|
import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
|
||||||
import { ISearchRequestData, OfferOwnerType } from "../models/eft/ragfair/ISearchRequestData";
|
import { ISearchRequestData, OfferOwnerType } from "../models/eft/ragfair/ISearchRequestData";
|
||||||
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
import { ConfigTypes } from "../models/enums/ConfigTypes";
|
||||||
@ -246,10 +246,7 @@ export class RagfairOfferHelper
|
|||||||
boughtAmount = offer.sellResult[0].amount;
|
boughtAmount = offer.sellResult[0].amount;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase rating
|
this.increaseProfileRagfairRating(this.saveServer.getProfile(sessionID), offer.summaryCost / totalItemsCount * boughtAmount);
|
||||||
const profileRagfairInfo = this.saveServer.getProfile(sessionID).characters.pmc.RagfairInfo;
|
|
||||||
profileRagfairInfo.rating += this.ragfairConfig.sell.reputation.gain * offer.summaryCost / totalItemsCount * boughtAmount;
|
|
||||||
profileRagfairInfo.isRatingGrowing = true;
|
|
||||||
|
|
||||||
this.completeOffer(sessionID, offer, boughtAmount);
|
this.completeOffer(sessionID, offer, boughtAmount);
|
||||||
offer.sellResult.splice(0, 1);
|
offer.sellResult.splice(0, 1);
|
||||||
@ -261,6 +258,17 @@ export class RagfairOfferHelper
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add amount to players ragfair rating
|
||||||
|
* @param sessionId Profile to update
|
||||||
|
* @param amountToIncrementBy Raw amount to add to players ragfair rating (excluding the reputation gain multiplier)
|
||||||
|
*/
|
||||||
|
public increaseProfileRagfairRating(profile: IAkiProfile, amountToIncrementBy: number): void
|
||||||
|
{
|
||||||
|
profile.characters.pmc.RagfairInfo.rating += this.ragfairConfig.sell.reputation.gain * amountToIncrementBy;
|
||||||
|
profile.characters.pmc.RagfairInfo.isRatingGrowing = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected getProfileOffers(sessionID: string): IRagfairOffer[]
|
protected getProfileOffers(sessionID: string): IRagfairOffer[]
|
||||||
{
|
{
|
||||||
const profile = this.profileHelper.getPmcProfile(sessionID);
|
const profile = this.profileHelper.getPmcProfile(sessionID);
|
||||||
|
Loading…
Reference in New Issue
Block a user