mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-19 03:45:43 +00:00
feat(Scripting/Hooks): Add OnBeforeOpenItem Hook (#12576)
This commit is contained in:
@@ -233,16 +233,19 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
}
|
||||
|
||||
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))// wrapped?
|
||||
if (sScriptMgr->OnBeforeOpenItem(pUser, item))
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM);
|
||||
stmt->SetData(0, item->GetGUID().GetCounter());
|
||||
_queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt)
|
||||
.WithPreparedCallback(std::bind(&WorldSession::HandleOpenWrappedItemCallback, this, bagIndex, slot, item->GetGUID().GetCounter(), std::placeholders::_1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
pUser->SendLoot(item->GetGUID(), LOOT_CORPSE);
|
||||
if (item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))// wrapped?
|
||||
{
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM);
|
||||
stmt->SetData(0, item->GetGUID().GetCounter());
|
||||
_queryProcessor.AddCallback(CharacterDatabase.AsyncQuery(stmt)
|
||||
.WithPreparedCallback(std::bind(&WorldSession::HandleOpenWrappedItemCallback, this, bagIndex, slot, item->GetGUID().GetCounter(), std::placeholders::_1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
pUser->SendLoot(item->GetGUID(), LOOT_CORPSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user