diff --git a/common/ruletypes.h b/common/ruletypes.h index 21fdb5f92..07e3f5713 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -219,6 +219,7 @@ RULE_BOOL(Character, UseForageCommonFood, true, "If enabled, use the common food RULE_INT(Character, ClearXTargetDelay, 10, "Seconds between uses of the #clearxtargets command (Set to 0 to disable)") RULE_BOOL(Character, PreventMountsFromZoning, false, "Enable to prevent mounts from zoning - Prior to December 15, 2004 this is enabled.") RULE_BOOL(Character, GroupInvitesRequireTarget, false, "Enable to require players to have invitee on target (Disables /invite name) - Classic Style") +RULE_BOOL(Character, PlayerTradingLoreFeedback, true, "If enabled, during a player to player trade, if lore items exist, it will output which items.") RULE_CATEGORY_END() RULE_CATEGORY(Mercs) diff --git a/zone/trading.cpp b/zone/trading.cpp index c0b34ef67..b7392a885 100644 --- a/zone/trading.cpp +++ b/zone/trading.cpp @@ -907,28 +907,53 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st bool Client::CheckTradeLoreConflict(Client* other) { - if (!other) + if (!other) { return true; + } + + bool has_lore_item = false; + std::vector lore_item_ids; for (int16 index = EQ::invslot::TRADE_BEGIN; index <= EQ::invslot::TRADE_END; ++index) { - const EQ::ItemInstance* inst = m_inv[index]; - if (!inst || !inst->GetItem()) + const auto inst = m_inv[index]; + if (!inst || !inst->GetItem()) { continue; + } - if (other->CheckLoreConflict(inst->GetItem())) - return true; + if (other->CheckLoreConflict(inst->GetItem())) { + lore_item_ids.emplace_back(inst->GetItem()->ID); + + has_lore_item = true; + } } for (int16 index = EQ::invbag::TRADE_BAGS_BEGIN; index <= EQ::invbag::TRADE_BAGS_END; ++index) { - const EQ::ItemInstance* inst = m_inv[index]; - if (!inst || !inst->GetItem()) + const auto inst = m_inv[index]; + if (!inst || !inst->GetItem()) { continue; + } - if (other->CheckLoreConflict(inst->GetItem())) - return true; + if (other->CheckLoreConflict(inst->GetItem())) { + lore_item_ids.emplace_back(inst->GetItem()->ID); + + has_lore_item = true; + } } - return false; + if (has_lore_item && RuleB(Character, PlayerTradingLoreFeedback)) { + for (const uint32 lore_item_id : lore_item_ids) { + Message( + Chat::Red, + fmt::format( + "{} already has a lore {} in their inventory.", + other->GetCleanName(), + database.CreateItemLink(lore_item_id) + ).c_str() + ); + } + } + + return has_lore_item; } bool Client::CheckTradeNonDroppable()