aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRat <none@none>2010-06-03 14:29:04 +0200
committerRat <none@none>2010-06-03 14:29:04 +0200
commit3c05d4d54454df50de16fb32e702ea09397675d4 (patch)
tree6c485b98ad8099ef96da030ae306a93b63f7c6e4
parent042971e7ffdfe8848b2aa837da6bc06d1e3e8776 (diff)
added script hook for gameobject's destroyed event
--HG-- branch : trunk
-rw-r--r--src/game/GameObject.cpp1
-rw-r--r--src/game/ScriptMgr.cpp7
-rw-r--r--src/game/ScriptMgr.h4
3 files changed, 11 insertions, 1 deletions
diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp
index 6eb0b482d80..d0591b7e9fa 100644
--- a/src/game/GameObject.cpp
+++ b/src/game/GameObject.cpp
@@ -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())
diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp
index 6912631a3e5..2dcfd258942 100644
--- a/src/game/ScriptMgr.cpp
+++ b/src/game/ScriptMgr.cpp
@@ -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)];
diff --git a/src/game/ScriptMgr.h b/src/game/ScriptMgr.h
index f1c56061a55..ed7200d5786 100644
--- a/src/game/ScriptMgr.h
+++ b/src/game/ScriptMgr.h
@@ -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);