From 093afe002c51abff0a47dc343c9b415ae91a9731 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 15 Aug 2024 09:42:07 +0100 Subject: [PATCH] #747 Fixed items added to ragfair configs custom blacklist still be sellable on flea by player Moved confusing `isValidItem()` check out of `isItemOnCustomFleaBlacklist()` and into main function Removed redundant blacklist check from flea item generation as its already covered in `isValidItem()` (cherry picked from commit f46694a169b6df2c87e8b652c643f6e8791d9bd7) --- project/src/helpers/ItemHelper.ts | 8 +++++++- project/src/helpers/RagfairServerHelper.ts | 11 ++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index f4609d4f..fc01aa39 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -187,7 +187,13 @@ export class ItemHelper { } /** - * Checks if an id is a valid item. Valid meaning that it's an item that be stored in stash + * Checks if a tpl is a valid item. Valid meaning that it's an item that be stored in stash + * Valid means: + * Not quest item + * 'Item' type + * Not on the invalid base types array + * Price above 0 roubles + * Not on item config blacklist * @param {string} tpl the template id / tpl * @returns boolean; true for items that may be in player possession and not quest items */ diff --git a/project/src/helpers/RagfairServerHelper.ts b/project/src/helpers/RagfairServerHelper.ts index 376e7da2..aef98c90 100644 --- a/project/src/helpers/RagfairServerHelper.ts +++ b/project/src/helpers/RagfairServerHelper.ts @@ -62,8 +62,7 @@ export class RagfairServerHelper { return false; } - // Skip blacklisted items - if (this.itemFilterService.isItemBlacklisted(itemDetails[1]._id)) { + if (!this.itemHelper.isValidItem(itemDetails[1]._id)) { return false; } @@ -72,8 +71,10 @@ export class RagfairServerHelper { return false; } - // Skip custom blacklisted items + // Skip custom blacklisted items and flag as unsellable by players if (this.isItemOnCustomFleaBlacklist(itemDetails[1]._id)) { + itemDetails[1]._props.CanSellOnRagfair = false; + return false; } @@ -108,10 +109,6 @@ export class RagfairServerHelper { * @returns True if its blacklsited */ protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean { - if (!this.itemHelper.isValidItem(itemTemplateId)) { - return true; - } - return this.ragfairConfig.dynamic.blacklist.custom.includes(itemTemplateId); }