Core/Scripts: Split OnCreatureCreate() and OnGameObjectCreate() into two virtual functions each.

Note to scripters: be aware that you will need to hook into the Remove functions if you want to do stuff at GO/creature removal.
Closes issue 5011.

--HG--
branch : trunk
This commit is contained in:
leak
2010-12-05 18:04:10 +01:00
parent dfa1e9532b
commit 6fe19b5a86
65 changed files with 1139 additions and 1132 deletions
@@ -90,53 +90,48 @@ class instance_blood_furnace : public InstanceMapScript
PrisonCell8GUID = 0;
}
void OnCreatureCreate(Creature* pCreature, bool add)
void OnCreatureCreate(Creature* creature)
{
if (!add)
return;
switch(pCreature->GetEntry())
switch(creature->GetEntry())
{
case 17381: The_MakerGUID = pCreature->GetGUID(); break;
case 17380: BroggokGUID = pCreature->GetGUID(); break;
case 17377: Kelidan_The_BreakerGUID = pCreature->GetGUID(); break;
case 17381: The_MakerGUID = creature->GetGUID(); break;
case 17380: BroggokGUID = creature->GetGUID(); break;
case 17377: Kelidan_The_BreakerGUID = creature->GetGUID(); break;
}
}
void OnGameObjectCreate(GameObject* pGo, bool add)
void OnGameObjectCreate(GameObject* go)
{
if (!add)
return;
if (pGo->GetEntry() == 181766) //Final exit door
Door1GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181811) //The Maker Front door
Door2GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181812) //The Maker Rear door
Door3GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181822) //Broggok Front door
Door4GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181819) //Broggok Rear door
Door5GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181823) //Kelidan exit door
Door6GUID = pGo->GetGUID();
if (go->GetEntry() == 181766) //Final exit door
Door1GUID = go->GetGUID();
if (go->GetEntry() == 181811) //The Maker Front door
Door2GUID = go->GetGUID();
if (go->GetEntry() == 181812) //The Maker Rear door
Door3GUID = go->GetGUID();
if (go->GetEntry() == 181822) //Broggok Front door
Door4GUID = go->GetGUID();
if (go->GetEntry() == 181819) //Broggok Rear door
Door5GUID = go->GetGUID();
if (go->GetEntry() == 181823) //Kelidan exit door
Door6GUID = go->GetGUID();
if (pGo->GetEntry() == 181813) //The Maker prison cell front right
PrisonCell1GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181814) //The Maker prison cell back right
PrisonCell2GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181816) //The Maker prison cell front left
PrisonCell3GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181815) //The Maker prison cell back left
PrisonCell4GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181821) //Broggok prison cell front right
PrisonCell5GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181818) //Broggok prison cell back right
PrisonCell6GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181820) //Broggok prison cell front left
PrisonCell7GUID = pGo->GetGUID();
if (pGo->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = pGo->GetGUID();
if (go->GetEntry() == 181813) //The Maker prison cell front right
PrisonCell1GUID = go->GetGUID();
if (go->GetEntry() == 181814) //The Maker prison cell back right
PrisonCell2GUID = go->GetGUID();
if (go->GetEntry() == 181816) //The Maker prison cell front left
PrisonCell3GUID = go->GetGUID();
if (go->GetEntry() == 181815) //The Maker prison cell back left
PrisonCell4GUID = go->GetGUID();
if (go->GetEntry() == 181821) //Broggok prison cell front right
PrisonCell5GUID = go->GetGUID();
if (go->GetEntry() == 181818) //Broggok prison cell back right
PrisonCell6GUID = go->GetGUID();
if (go->GetEntry() == 181820) //Broggok prison cell front left
PrisonCell7GUID = go->GetGUID();
if (go->GetEntry() == 181817) //Broggok prison cell back left
PrisonCell8GUID = go->GetGUID();
}
uint64 GetData64(uint32 data)
@@ -51,15 +51,15 @@ class instance_ramparts : public InstanceMapScript
m_uiChestHGUID = 0;
}
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
void OnGameObjectCreate(GameObject* go)
{
switch(pGo->GetEntry())
switch(go->GetEntry())
{
case 185168:
m_uiChestNGUID = pGo->GetGUID();
m_uiChestNGUID = go->GetGUID();
break;
case 185169:
m_uiChestHGUID = pGo->GetGUID();
m_uiChestHGUID = go->GetGUID();
break;
}
}
@@ -85,28 +85,28 @@ class instance_magtheridons_lair : public InstanceMapScript
return false;
}
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
void OnCreatureCreate(Creature* creature)
{
switch(pCreature->GetEntry())
switch(creature->GetEntry())
{
case 17257:
MagtheridonGUID = pCreature->GetGUID();
MagtheridonGUID = creature->GetGUID();
break;
case 17256:
ChannelerGUID.insert(pCreature->GetGUID());
ChannelerGUID.insert(creature->GetGUID());
break;
}
}
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
void OnGameObjectCreate(GameObject* go)
{
switch(pGo->GetEntry())
switch(go->GetEntry())
{
case 181713:
pGo->SetUInt32Value(GAMEOBJECT_FLAGS, 0);
go->SetUInt32Value(GAMEOBJECT_FLAGS, 0);
break;
case 183847:
DoorGUID = pGo->GetGUID();
DoorGUID = go->GetGUID();
break;
case 184653: // hall
case 184634: // six columns
@@ -115,7 +115,7 @@ class instance_magtheridons_lair : public InstanceMapScript
case 184637:
case 184638:
case 184639:
ColumnGUID.insert(pGo->GetGUID());
ColumnGUID.insert(go->GetGUID());
break;
}
}
@@ -150,7 +150,7 @@ class instance_magtheridons_lair : public InstanceMapScript
m_auiEncounter[1] = NOT_STARTED;
for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature *Channeler = instance->GetCreature(*i))
if (Creature* Channeler = instance->GetCreature(*i))
{
if (Channeler->isAlive())
Channeler->AI()->EnterEvadeMode();
@@ -169,12 +169,12 @@ class instance_magtheridons_lair : public InstanceMapScript
// Let all five channelers aggro.
for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature *Channeler = instance->GetCreature(*i);
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->isAlive())
Channeler->AI()->AttackStart(Channeler->SelectNearestTarget(999));
}
// Release Magtheridon after two minutes.
Creature *Magtheridon = instance->GetCreature(MagtheridonGUID);
Creature* Magtheridon = instance->GetCreature(MagtheridonGUID);
if (Magtheridon && Magtheridon->isAlive())
{
Magtheridon->MonsterTextEmote(EMOTE_BONDS_WEAKEN, 0);
@@ -186,7 +186,7 @@ class instance_magtheridons_lair : public InstanceMapScript
case DONE: // Add buff and check if all channelers are dead.
for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
Creature *Channeler = instance->GetCreature(*i);
Creature* Channeler = instance->GetCreature(*i);
if (Channeler && Channeler->isAlive())
{
//Channeler->CastSpell(Channeler, SPELL_SOUL_TRANSFER, true);
@@ -221,7 +221,7 @@ class instance_magtheridons_lair : public InstanceMapScript
{
if (CageTimer <= diff)
{
Creature *Magtheridon = instance->GetCreature(MagtheridonGUID);
Creature* Magtheridon = instance->GetCreature(MagtheridonGUID);
if (Magtheridon && Magtheridon->isAlive())
{
Magtheridon->clearUnitState(UNIT_STAT_STUNNED);
@@ -237,7 +237,7 @@ class instance_magtheridons_lair : public InstanceMapScript
{
for (std::set<uint64>::const_iterator i = ChannelerGUID.begin(); i != ChannelerGUID.end(); ++i)
{
if (Creature *Channeler = instance->GetCreature(*i))
if (Creature* Channeler = instance->GetCreature(*i))
{
if (Channeler->isAlive())
Channeler->AI()->EnterEvadeMode();
@@ -53,22 +53,22 @@ class instance_shattered_halls : public InstanceMapScript
nethekurseDoorGUID = 0;
}
void OnGameObjectCreate(GameObject* pGo, bool /*add*/)
void OnGameObjectCreate(GameObject* go)
{
switch(pGo->GetEntry())
switch(go->GetEntry())
{
case DOOR_NETHEKURSE:
nethekurseDoorGUID = pGo->GetGUID();
nethekurseDoorGUID = go->GetGUID();
break;
}
}
void OnCreatureCreate(Creature* pCreature, bool /*add*/)
void OnCreatureCreate(Creature* creature)
{
switch(pCreature->GetEntry())
switch(creature->GetEntry())
{
case 16807:
nethekurseGUID = pCreature->GetGUID();
nethekurseGUID = creature->GetGUID();
break;
}
}