mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Core/Scripts: New ItemScript trigger, OnItemRemove
This commit is contained in:
@@ -12654,7 +12654,8 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
|
||||
RemoveAurasDueToSpell(proto->Spells[i].SpellId);
|
||||
|
||||
ItemRemovedQuestCheck(pItem->GetEntry(), pItem->GetCount());
|
||||
|
||||
sScriptMgr->OnItemRemove(this, pItem);
|
||||
|
||||
if (bag == INVENTORY_SLOT_BAG_0)
|
||||
{
|
||||
SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0);
|
||||
|
||||
@@ -691,6 +691,15 @@ bool ScriptMgr::OnItemExpire(Player* player, ItemTemplate const* proto)
|
||||
return tmpscript->OnExpire(player, proto);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnItemRemove(Player* player, Item* item)
|
||||
{
|
||||
ASSERT(player);
|
||||
ASSERT(item);
|
||||
|
||||
GET_SCRIPT_RET(ItemScript, item->GetScriptId(), tmpscript, false);
|
||||
return tmpscript->OnRemove(player, item);
|
||||
}
|
||||
|
||||
bool ScriptMgr::OnDummyEffect(Unit* caster, uint32 spellId, SpellEffIndex effIndex, Creature* target)
|
||||
{
|
||||
ASSERT(caster);
|
||||
|
||||
@@ -388,6 +388,9 @@ class ItemScript : public ScriptObject
|
||||
|
||||
// Called when the item expires (is destroyed).
|
||||
virtual bool OnExpire(Player* /*player*/, ItemTemplate const* /*proto*/) { return false; }
|
||||
|
||||
// Called when the item is destroyed.
|
||||
virtual bool OnRemove(Player* /*player*/, Item* /*item*/) { return false; }
|
||||
};
|
||||
|
||||
class UnitScript : public ScriptObject
|
||||
@@ -918,6 +921,7 @@ class ScriptMgr
|
||||
bool OnQuestAccept(Player* player, Item* item, Quest const* quest);
|
||||
bool OnItemUse(Player* player, Item* item, SpellCastTargets const& targets);
|
||||
bool OnItemExpire(Player* player, ItemTemplate const* proto);
|
||||
bool OnItemRemove(Player* player, Item* item);
|
||||
|
||||
public: /* CreatureScript */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user