added script hook for gameobject's destroyed event

--HG--
branch : trunk
This commit is contained in:
Rat
2010-06-03 14:29:04 +02:00
parent 042971e7ff
commit 3c05d4d544
3 changed files with 11 additions and 1 deletions

View File

@@ -1610,6 +1610,7 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
if (BattleGround* bg = pwho->GetBattleGround())
bg->DestroyGate(pwho, this, m_goInfo->building.destroyedEvent);
hitType = BG_OBJECT_DMG_HIT_TYPE_JUST_DESTROYED;
sScriptMgr.GODestroyed(pwho, this, m_goInfo->building.destroyedEvent);
}
if (pwho)
if (BattleGround* bg = pwho->GetBattleGround())

View File

@@ -471,6 +471,13 @@ bool ScriptMgr::GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQ
return tmpscript->pGOChooseReward(pPlayer, pGO, pQuest, opt);
}
void ScriptMgr::GODestroyed(Player* pPlayer, GameObject* pGO, uint32 destroyedEvent)
{
Script *tmpscript = m_scripts[pGO->GetGOInfo()->ScriptId];
if (!tmpscript) return;
tmpscript->pGODestroyed(pPlayer, pGO, destroyedEvent);
}
bool ScriptMgr::AreaTrigger(Player* pPlayer, AreaTriggerEntry const* atEntry)
{
Script *tmpscript = m_scripts[GetAreaTriggerScriptId(atEntry->id)];

View File

@@ -39,7 +39,7 @@ struct Script
pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL),
pGOSelect(NULL), pGOSelectWithCode(NULL),
pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL),
pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
pChooseReward(NULL), pGODestroyed(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL),
pGOQuestAccept(NULL), pGOChooseReward(NULL),pItemUse(NULL), pItemExpire(NULL),
pEffectDummyCreature(NULL), pEffectDummyGameObj(NULL), pEffectDummyItem(NULL),
GetAI(NULL), GetInstanceData(NULL)
@@ -79,6 +79,7 @@ struct Script
bool (*pItemQuestAccept)(Player*, Item *, Quest const*);
bool (*pGOQuestAccept)(Player*, GameObject*, Quest const*);
bool (*pGOChooseReward)(Player*, GameObject*, Quest const*, uint32);
void (*pGODestroyed)(Player*, GameObject*, uint32);
bool (*pItemUse)(Player*, Item*, SpellCastTargets const&);
bool (*pItemExpire)(Player*, ItemPrototype const *);
bool (*pEffectDummyCreature)(Unit*, uint32, uint32, Creature*);
@@ -132,6 +133,7 @@ class ScriptMgr
bool GOHello(Player* pPlayer, GameObject* pGO);
bool GOQuestAccept(Player* pPlayer, GameObject* pGO, Quest const* pQuest);
bool GOChooseReward(Player* pPlayer, GameObject* pGO, Quest const* pQuest, uint32 opt);
void GODestroyed(Player* pPlayer, GameObject* pGO, uint32 destroyedEvent);
bool AreaTrigger(Player* pPlayer,AreaTriggerEntry const* atEntry);
CreatureAI* GetAI(Creature* pCreature);
bool ItemUse(Player* pPlayer, Item* pItem, SpellCastTargets const& targets);