#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 f46694a169)
This commit is contained in:
Dev 2024-08-15 09:42:07 +01:00
parent a4a3c8c89a
commit 093afe002c
2 changed files with 11 additions and 8 deletions

View File

@ -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 * @param {string} tpl the template id / tpl
* @returns boolean; true for items that may be in player possession and not quest items * @returns boolean; true for items that may be in player possession and not quest items
*/ */

View File

@ -62,8 +62,7 @@ export class RagfairServerHelper {
return false; return false;
} }
// Skip blacklisted items if (!this.itemHelper.isValidItem(itemDetails[1]._id)) {
if (this.itemFilterService.isItemBlacklisted(itemDetails[1]._id)) {
return false; return false;
} }
@ -72,8 +71,10 @@ export class RagfairServerHelper {
return false; return false;
} }
// Skip custom blacklisted items // Skip custom blacklisted items and flag as unsellable by players
if (this.isItemOnCustomFleaBlacklist(itemDetails[1]._id)) { if (this.isItemOnCustomFleaBlacklist(itemDetails[1]._id)) {
itemDetails[1]._props.CanSellOnRagfair = false;
return false; return false;
} }
@ -108,10 +109,6 @@ export class RagfairServerHelper {
* @returns True if its blacklsited * @returns True if its blacklsited
*/ */
protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean { protected isItemOnCustomFleaBlacklist(itemTemplateId: string): boolean {
if (!this.itemHelper.isValidItem(itemTemplateId)) {
return true;
}
return this.ragfairConfig.dynamic.blacklist.custom.includes(itemTemplateId); return this.ragfairConfig.dynamic.blacklist.custom.includes(itemTemplateId);
} }