aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Scripting
diff options
context:
space:
mode:
authortreeston <treeston.mmoc@gmail.com>2016-09-09 19:34:58 +0200
committertreeston <treeston.mmoc@gmail.com>2016-09-09 19:37:04 +0200
commit91c2b3162d350ab1a09053574ad67f45f089175b (patch)
tree6ea5b549bd8845421edcf673d707397cc242fffd /src/server/game/Scripting
parent3c32086b81ea85ddbb5920c11d9f30fbd0953ef6 (diff)
Game/Scripting: Follow-up to b3d44d6. Fix script selection for creatures on difficulty > 0.
Diffstat (limited to 'src/server/game/Scripting')
-rw-r--r--src/server/game/Scripting/ScriptMgr.cpp7
-rw-r--r--src/server/game/Scripting/ScriptMgr.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp
index 85e7fdb212f..2539774b4fa 100644
--- a/src/server/game/Scripting/ScriptMgr.cpp
+++ b/src/server/game/Scripting/ScriptMgr.cpp
@@ -1602,12 +1602,13 @@ uint32 ScriptMgr::GetDialogStatus(Player* player, Creature* creature)
return tmpscript->GetDialogStatus(player, creature);
}
-bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, CreatureTemplate const* cTemplate, CreatureData const* cData, Map const* map)
+bool ScriptMgr::CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemplate const* actTemplate, CreatureData const* cData, Map const* map)
{
ASSERT(cTemplate);
- GET_SCRIPT_RET(CreatureScript, cTemplate->ScriptID, tmpscript, true);
- return tmpscript->CanSpawn(spawnId, cTemplate, cData, map);
+ CreatureTemplate const* baseTemplate = sObjectMgr->GetCreatureTemplate(entry);
+ GET_SCRIPT_RET(CreatureScript, baseTemplate->ScriptID, tmpscript, true);
+ return tmpscript->CanSpawn(spawnId, entry, baseTemplate, actTemplate, cData, map);
}
CreatureAI* ScriptMgr::GetCreatureAI(Creature* creature)
diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h
index 5101e2d8967..c218f273277 100644
--- a/src/server/game/Scripting/ScriptMgr.h
+++ b/src/server/game/Scripting/ScriptMgr.h
@@ -435,7 +435,7 @@ class TC_GAME_API CreatureScript : public UnitScript, public UpdatableScript<Cre
virtual uint32 GetDialogStatus(Player* /*player*/, Creature* /*creature*/) { return DIALOG_STATUS_SCRIPTED_NO_STATUS; }
// Called when the creature tries to spawn. Return false to block spawn and re-evaluate on next tick.
- virtual bool CanSpawn(ObjectGuid::LowType /*spawnId*/, CreatureTemplate const* /*cTemplate*/, CreatureData const* /*cData*/, Map const* /*map*/) const { return true; }
+ virtual bool CanSpawn(ObjectGuid::LowType /*spawnId*/, uint32 /*entry*/, CreatureTemplate const* /*baseTemplate*/, CreatureTemplate const* /*actTemplate*/, CreatureData const* /*cData*/, Map const* /*map*/) const { return true; }
// Called when a CreatureAI object is needed for the creature.
virtual CreatureAI* GetAI(Creature* /*creature*/) const { return NULL; }
@@ -962,7 +962,7 @@ class TC_GAME_API ScriptMgr
bool OnQuestSelect(Player* player, Creature* creature, Quest const* quest);
bool OnQuestReward(Player* player, Creature* creature, Quest const* quest, uint32 opt);
uint32 GetDialogStatus(Player* player, Creature* creature);
- bool CanSpawn(ObjectGuid::LowType spawnId, CreatureTemplate const* cTemplate, CreatureData const* cData, Map const* map);
+ bool CanSpawn(ObjectGuid::LowType spawnId, uint32 entry, CreatureTemplate const* baseTemplate, CreatureTemplate const* actTemplate, CreatureData const* cData, Map const* map);
CreatureAI* GetCreatureAI(Creature* creature);
void OnCreatureUpdate(Creature* creature, uint32 diff);