mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 22:58:34 +00:00
[Feature] Add Lore Item Trade Error (#3932)
* DRAFT: [Feature] Add Lore Item Trade Error I had lots of feedback from players to add feedback when doing player to player trades to include what items were causing the trade block. I quickly added this check, however if multiple lore items are being traded, this will only output the first. So far it has worked well, but not sure if we want to: - Expand this to list all lore items in the trade. - Enable this by default and do not provide a rule? * Credit to @KinglyKrab for the assist on making this output a list. Ruled this off but enabled by default.
This commit is contained in:
+35
-10
@@ -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<uint32> 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()
|
||||
|
||||
Reference in New Issue
Block a user