[Bots] Add Event_Trade Support for ^inventorygive Command (#2628)

This commit is contained in:
Aeadoin 2022-12-11 16:25:47 -05:00 committed by GitHub
parent f5126222c2
commit 13a3afbfac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5108,6 +5108,23 @@ void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client*
if (event_trade.size()) { if (event_trade.size()) {
// Get Traded Items // Get Traded Items
// Accept Items from Cursor to support bot command ^inventorygive
if (begin_slot_id == invslot::slotCursor && end_slot_id == invslot::slotCursor) {
EQ::ItemInstance* insts[1] = { 0 };
EQ::InventoryProfile& user_inv = client->GetInv();
insts[0] = user_inv.GetItem(invslot::slotCursor);
client->DeleteItemInInventory(invslot::slotCursor);
// copy to be filtered by task updates, null trade slots preserved for quest event arg
std::vector<EQ::ItemInstance*> items(insts, insts + std::size(insts));
// Check if EVENT_TRADE accepts any items
std::vector<std::any> item_list(items.begin(), items.end());
parse->EventBot(EVENT_TRADE, this, client, "", 0, &item_list);
CalcBotStats(false);
} else {
EQ::ItemInstance* insts[8] = { 0 }; EQ::ItemInstance* insts[8] = { 0 };
EQ::InventoryProfile& user_inv = client->GetInv(); EQ::InventoryProfile& user_inv = client->GetInv();
for (int i = EQ::invslot::TRADE_BEGIN; i <= EQ::invslot::TRADE_END; ++i) { for (int i = EQ::invslot::TRADE_BEGIN; i <= EQ::invslot::TRADE_END; ++i) {
@ -5124,6 +5141,7 @@ void Bot::PerformTradeWithClient(int16 begin_slot_id, int16 end_slot_id, Client*
CalcBotStats(false); CalcBotStats(false);
} }
} }
}
bool Bot::Death(Mob *killerMob, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill) { bool Bot::Death(Mob *killerMob, int64 damage, uint16 spell_id, EQ::skills::SkillType attack_skill) {
if(!NPC::Death(killerMob, damage, spell_id, attack_skill)) if(!NPC::Death(killerMob, damage, spell_id, attack_skill))