Tiered Flea: instead of not showing offers outside of players level, show offer but set to locked

This commit is contained in:
Dev 2024-10-02 11:06:25 +01:00
parent 93127ff16a
commit 61e90d7e9a

View File

@ -108,28 +108,26 @@ export class RagfairOfferHelper {
// Not trader offer + tiered flea enabled // Not trader offer + tiered flea enabled
if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) { if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) {
if ( this.checkAndLockOfferFromPlayerTieredFlea(tieredFlea, offer, tieredFleaLimitTypes, pmcData.Info.Level);
this.offerIsHiddenFromPlayerTieredFlea(tieredFlea, offer, tieredFleaLimitTypes, pmcData.Info.Level)
) {
return false;
}
} }
return true; return true;
}); });
} }
protected offerIsHiddenFromPlayerTieredFlea( protected checkAndLockOfferFromPlayerTieredFlea(
tieredFlea: ITieredFlea, tieredFlea: ITieredFlea,
offer: IRagfairOffer, offer: IRagfairOffer,
tieredFleaLimitTypes: string[], tieredFleaLimitTypes: string[],
playerLevel: number, playerLevel: number,
): boolean { ): void {
const offerItemTpl = offer.items[0]._tpl; const offerItemTpl = offer.items[0]._tpl;
if (tieredFlea.ammoTplUnlocks && this.itemHelper.isOfBaseclass(offerItemTpl, BaseClasses.AMMO)) { if (tieredFlea.ammoTplUnlocks && this.itemHelper.isOfBaseclass(offerItemTpl, BaseClasses.AMMO)) {
const unlockLevel = tieredFlea.ammoTplUnlocks[offerItemTpl]; const unlockLevel = tieredFlea.ammoTplUnlocks[offerItemTpl];
if (unlockLevel && playerLevel < unlockLevel) { if (unlockLevel && playerLevel < unlockLevel) {
return true; offer.locked = true;
return;
} }
} }
@ -137,7 +135,9 @@ export class RagfairOfferHelper {
const itemLevelRequirement = tieredFlea.unlocksTpl[offerItemTpl]; const itemLevelRequirement = tieredFlea.unlocksTpl[offerItemTpl];
if (itemLevelRequirement) { if (itemLevelRequirement) {
if (playerLevel < itemLevelRequirement) { if (playerLevel < itemLevelRequirement) {
return true; offer.locked = true;
return;
} }
} }
@ -147,15 +147,15 @@ export class RagfairOfferHelper {
for (const tieredItemType of tieredFleaLimitTypes) { for (const tieredItemType of tieredFleaLimitTypes) {
if (this.itemHelper.isOfBaseclass(offerItemTpl, tieredItemType)) { if (this.itemHelper.isOfBaseclass(offerItemTpl, tieredItemType)) {
if (playerLevel < tieredFlea.unlocksType[tieredItemType]) { if (playerLevel < tieredFlea.unlocksType[tieredItemType]) {
return true; offer.locked = true;
return;
} }
break; break;
} }
} }
} }
return false;
} }
/** /**
@ -176,11 +176,7 @@ export class RagfairOfferHelper {
} }
if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) { if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) {
if ( this.checkAndLockOfferFromPlayerTieredFlea(tieredFlea, offer, tieredFleaLimitTypes, pmcData.Info.Level);
this.offerIsHiddenFromPlayerTieredFlea(tieredFlea, offer, tieredFleaLimitTypes, pmcData.Info.Level)
) {
return false;
}
} }
return true; return true;
@ -232,16 +228,12 @@ export class RagfairOfferHelper {
} }
if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) { if (tieredFlea.enabled && offer.user.memberType !== MemberCategory.TRADER) {
if ( this.checkAndLockOfferFromPlayerTieredFlea(
this.offerIsHiddenFromPlayerTieredFlea(
tieredFlea, tieredFlea,
offer, offer,
tieredFleaLimitTypes, tieredFleaLimitTypes,
pmcData.Info.Level, pmcData.Info.Level,
) );
) {
continue;
}
} }
const key = offer.items[0]._tpl; const key = offer.items[0]._tpl;