[Logs] Add NPC Trades to Player Events (#4505)

* [Logs] Add NPC Trades to Player Events

* Update player_event_discord_formatter.cpp

* Push

* Fix money and add NPC info

* [Logs] Add NPC Trades to Player Events

* Update player_event_discord_formatter.cpp

* Push

* Minor logic fix

* Push

* Update perl_client.cpp

---------

Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
Alex King
2024-10-13 18:26:10 -04:00
committed by GitHub
parent 9ac306fe67
commit 520943ebf1
7 changed files with 338 additions and 273 deletions
+18 -16
View File
@@ -664,6 +664,8 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
else if(tradingWith && tradingWith->IsNPC()) {
NPCHandinEventLog(trade, tradingWith->CastToNPC());
QSPlayerLogHandin_Struct* qs_audit = nullptr;
bool qs_log = false;
@@ -832,13 +834,13 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
);
}
auto loot_drop_entry = LootdropEntriesRepository::NewNpcEntity();
loot_drop_entry.equip_item = 1;
loot_drop_entry.item_charges = static_cast<int8>(baginst->GetCharges());
auto lde = LootdropEntriesRepository::NewNpcEntity();
lde.equip_item = 1;
lde.item_charges = static_cast<int8>(baginst->GetCharges());
tradingWith->CastToNPC()->AddLootDrop(
bagitem,
loot_drop_entry,
lde,
true
);
// Return quest items being traded to non-quest NPC when the rule is true
@@ -857,17 +859,17 @@ void Client::FinishTrade(Mob* tradingWith, bool finalizer, void* event_entry, st
}
}
}
} else {
auto lde = LootdropEntriesRepository::NewNpcEntity();
lde.equip_item = 1;
lde.item_charges = static_cast<int8>(inst->GetCharges());
tradingWith->CastToNPC()->AddLootDrop(
item,
lde,
true
);
}
auto new_loot_drop_entry = LootdropEntriesRepository::NewNpcEntity();
new_loot_drop_entry.equip_item = 1;
new_loot_drop_entry.item_charges = static_cast<int8>(inst->GetCharges());
tradingWith->CastToNPC()->AddLootDrop(
item,
new_loot_drop_entry,
true
);
}
// Return quest items being traded to non-quest NPC when the rule is true
else if (restrict_quest_items_to_quest_npc && (!is_quest_npc && item->IsQuestItem())) {
@@ -2382,7 +2384,7 @@ void Client::ShowBuyLines(const EQApplicationPacket *app)
ss.str("");
ss.clear();
}
return;
}
}
@@ -4257,4 +4259,4 @@ bool Client::DoBarterSellerChecks(BuyerLineSellItem_Struct &sell_line)
}
return true;
}
}