Improved accuracy when creating flea offer - store single item price in `` property
Made `unlimited` property optional as its only used by traders Slightly reduced pack offer chance + made them have more items
This commit is contained in:
parent
e5a5bf2ee2
commit
727ba83273
@ -48,9 +48,9 @@
|
||||
]
|
||||
},
|
||||
"pack": {
|
||||
"chancePercent": 20,
|
||||
"chancePercent": 18,
|
||||
"itemCountMin": 4,
|
||||
"itemCountMax": 12,
|
||||
"itemCountMax": 18,
|
||||
"itemTypeWhitelist": [
|
||||
"5448eb774bdc2d0a728b4567",
|
||||
"5448e8d64bdc2dce718b4568",
|
||||
|
@ -123,6 +123,7 @@ export class RagfairOfferGenerator
|
||||
|
||||
// Clone to avoid modifying original array
|
||||
const itemsClone = this.cloner.clone(items);
|
||||
const itemStackCount = itemsClone[0].upd?.StackObjectsCount ?? 1;
|
||||
|
||||
// Hydrate ammo boxes with cartridges + ensure only 1 item is present (ammo box)
|
||||
// On offer refresh dont re-add cartridges to ammo box that already has cartridges
|
||||
@ -132,8 +133,8 @@ export class RagfairOfferGenerator
|
||||
this.itemHelper.addCartridgesToAmmoBox(itemsClone, this.itemHelper.getItem(items[0]._tpl)[1]);
|
||||
}
|
||||
|
||||
const itemRootCount = items.filter((item) => item.slotId === "hideout").length;
|
||||
const roublePrice = Math.round(this.convertOfferRequirementsIntoRoubles(offerRequirements));
|
||||
const roubleListingPrice = Math.round(this.convertOfferRequirementsIntoRoubles(offerRequirements));
|
||||
const singleItemListingPrice = isPackOffer ? roubleListingPrice / itemStackCount : roubleListingPrice;
|
||||
|
||||
const offer: IRagfairOffer = {
|
||||
_id: this.hashUtil.generate(),
|
||||
@ -143,14 +144,13 @@ export class RagfairOfferGenerator
|
||||
items: itemsClone,
|
||||
itemsCost: Math.round(this.handbookHelper.getTemplatePrice(items[0]._tpl)), // Handbook price
|
||||
requirements: offerRequirements,
|
||||
requirementsCost: roublePrice,
|
||||
summaryCost: roublePrice,
|
||||
requirementsCost: singleItemListingPrice,
|
||||
summaryCost: roubleListingPrice,
|
||||
startTime: time,
|
||||
endTime: this.getOfferEndTime(userID, time),
|
||||
loyaltyLevel: loyalLevel,
|
||||
sellInOnePiece: isPackOffer,
|
||||
locked: false,
|
||||
unlimitedCount: false,
|
||||
};
|
||||
|
||||
this.offerCounter++;
|
||||
|
@ -11,19 +11,21 @@ export interface IRagfairOffer
|
||||
intId: number
|
||||
/** Handbook price */
|
||||
itemsCost: number
|
||||
/** Rouble price */
|
||||
/** Rouble price per item */
|
||||
requirementsCost: number
|
||||
startTime: number
|
||||
endTime: number
|
||||
sellInOnePiece: boolean
|
||||
/** Rouble price - same as requirementsCost */
|
||||
summaryCost: number
|
||||
user: IRagfairOfferUser
|
||||
|
||||
/** Trader only */
|
||||
unlimitedCount?: boolean
|
||||
loyaltyLevel: number
|
||||
buyRestrictionMax?: number
|
||||
buyRestrictionCurrent?: number
|
||||
locked: boolean
|
||||
unlimitedCount: boolean
|
||||
/** Rouble price */
|
||||
summaryCost: number
|
||||
user: IRagfairOfferUser
|
||||
locked?: boolean
|
||||
}
|
||||
|
||||
export interface OfferRequirement
|
||||
|
Loading…
Reference in New Issue
Block a user