*Temp fix for the crash bug of uldaman script. This script is bugged and needs big fix.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-18 10:12:24 -06:00
parent d97133571a
commit f4afde50e0
@@ -418,22 +418,27 @@ EndScriptData */
static uint64 altarOfTheKeeperCount[5]; static uint64 altarOfTheKeeperCount[5];
static uint32 altarOfTheKeeperCounter=0; static uint32 altarOfTheKeeperCounter=0;
bool GOHello_go_altar_of_the_keepers(Player *player, GameObject* go) bool GOHello_go_altar_of_the_keepers(Player *player, GameObject* go)
{ {
ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData());
if (!pInstance) return true;
bool alreadyUsed; bool alreadyUsed;
go->AddUse (); go->AddUse ();
alreadyUsed = false; alreadyUsed = false;
for (uint32 loop=0; loop<5; loop++) { for (uint32 loop=0; loop<5; ++loop)
if (altarOfTheKeeperCount[loop] == player->GetGUID()) alreadyUsed = true; {
if (altarOfTheKeeperCount[loop] == player->GetGUID())
alreadyUsed = true;
} }
if (!alreadyUsed) if (!alreadyUsed && altarOfTheKeeperCounter < 5)
altarOfTheKeeperCount[altarOfTheKeeperCounter++] = player->GetGUID(); altarOfTheKeeperCount[altarOfTheKeeperCounter++] = player->GetGUID();
player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false); player->CastSpell (player, SPELL_BOSS_OBJECT_VISUAL, false);
if (altarOfTheKeeperCounter < NUMBER_NEEDED_TO_ACTIVATE) { if (altarOfTheKeeperCounter < NUMBER_NEEDED_TO_ACTIVATE)
{
//error_log ("not enough people yet, altarOfTheKeeperCounter = %d", altarOfTheKeeperCounter); //error_log ("not enough people yet, altarOfTheKeeperCounter = %d", altarOfTheKeeperCounter);
return false; // not enough people yet return false; // not enough people yet
} }
@@ -441,7 +446,8 @@ bool GOHello_go_altar_of_the_keepers(Player *player, GameObject* go)
// Check to make sure at least three people are still casting // Check to make sure at least three people are still casting
uint32 count=0; uint32 count=0;
Unit *pTarget; Unit *pTarget;
for (uint32 x=0; x<=5; x++) { for (uint32 x = 0; x < 5; ++x)
{
pTarget = Unit::GetUnit(*player, altarOfTheKeeperCount[x]); pTarget = Unit::GetUnit(*player, altarOfTheKeeperCount[x]);
//error_log ("number of people currently activating it: %d", x+1); //error_log ("number of people currently activating it: %d", x+1);
if (!pTarget) continue; if (!pTarget) continue;
@@ -449,13 +455,12 @@ bool GOHello_go_altar_of_the_keepers(Player *player, GameObject* go)
if (count >= NUMBER_NEEDED_TO_ACTIVATE) break; if (count >= NUMBER_NEEDED_TO_ACTIVATE) break;
} }
if (count < NUMBER_NEEDED_TO_ACTIVATE) { if (count < NUMBER_NEEDED_TO_ACTIVATE)
{
// error_log ("still not enough people"); // error_log ("still not enough people");
return false; // not enough people return true; // not enough people
} }
ScriptedInstance* pInstance = ((ScriptedInstance*)player->GetInstanceData());
if (!pInstance) return false;
//error_log ("activating stone keepers"); //error_log ("activating stone keepers");
pInstance->SetData(NULL,1); // activate the Stone Keepers pInstance->SetData(NULL,1); // activate the Stone Keepers
return true; return true;