Improvements in the scripts for quest chain The Amphitheater of Anguish, this should fix some crashes.
--HG-- branch : trunk
This commit is contained in:
@@ -229,12 +229,12 @@ struct TRINITY_DLL_DECL npc_gurgthockAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature)
|
npc_gurgthockAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||||
{
|
{
|
||||||
pOrinoko = NULL;
|
pSummon = NULL;
|
||||||
pKorrak = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature* pKorrak;
|
Unit* pSummon;
|
||||||
Creature* pOrinoko;
|
|
||||||
|
std::list<uint64> SummonList;
|
||||||
|
|
||||||
uint32 uiTimer;
|
uint32 uiTimer;
|
||||||
uint32 uiPhase;
|
uint32 uiPhase;
|
||||||
@@ -256,22 +256,21 @@ struct TRINITY_DLL_DECL npc_gurgthockAI : public ScriptedAI
|
|||||||
|
|
||||||
void RemoveSummons()
|
void RemoveSummons()
|
||||||
{
|
{
|
||||||
if (bEventInProgress)
|
if (SummonList.empty())
|
||||||
bEventInProgress = false;
|
return;
|
||||||
|
|
||||||
|
bEventInProgress = false;
|
||||||
|
|
||||||
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
|
||||||
|
|
||||||
if (pOrinoko)
|
for(std::list<uint64>::iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
|
||||||
{
|
{
|
||||||
pOrinoko->RemoveFromWorld();
|
if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, *itr))
|
||||||
pOrinoko = NULL;
|
if (pTemp)
|
||||||
|
pTemp->RemoveFromWorld();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pKorrak)
|
SummonList.clear();
|
||||||
{
|
|
||||||
pKorrak->RemoveFromWorld();
|
|
||||||
pKorrak = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAI(const uint32 uiDiff)
|
void UpdateAI(const uint32 uiDiff)
|
||||||
@@ -321,14 +320,15 @@ struct TRINITY_DLL_DECL npc_gurgthockAI : public ScriptedAI
|
|||||||
switch(uiPhase)
|
switch(uiPhase)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
pOrinoko = m_creature->SummonCreature(NPC_ORINOKO_TUSKBREAKER, 5757.765137, -2945.161133, 286.276672, 5.156380, TEMPSUMMON_CORPSE_DESPAWN, 1000);
|
pSummon = m_creature->SummonCreature(NPC_ORINOKO_TUSKBREAKER, 5757.765137, -2945.161133, 286.276672, 5.156380, TEMPSUMMON_CORPSE_DESPAWN, 1000);
|
||||||
uiPhase = 2;
|
uiPhase = 2;
|
||||||
uiTimer = 4000;
|
uiTimer = 4000;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (pOrinoko)
|
if (pSummon)
|
||||||
pOrinoko->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f);
|
pSummon->GetMotionMaster()->MoveJump(5776.319824, -2981.005371, 273.100037, 10.0f, 20.0f);
|
||||||
uiPhase = 0;
|
uiPhase = 0;
|
||||||
|
pSummon = NULL;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, m_creature);
|
DoScriptText(SAY_QUEST_ACCEPT_KORRAK_2, m_creature);
|
||||||
@@ -336,21 +336,27 @@ struct TRINITY_DLL_DECL npc_gurgthockAI : public ScriptedAI
|
|||||||
uiPhase = 4;
|
uiPhase = 4;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
pKorrak = m_creature->SummonCreature(NPC_KORRAK_BLOODRAGER, 5757.765137, -2945.161133, 286.276672, 5.156380, TEMPSUMMON_CORPSE_DESPAWN, 1000);
|
pSummon = m_creature->SummonCreature(NPC_KORRAK_BLOODRAGER, 5757.765137, -2945.161133, 286.276672, 5.156380, TEMPSUMMON_CORPSE_DESPAWN, 1000);
|
||||||
uiTimer = 3000;
|
uiTimer = 3000;
|
||||||
uiPhase = 5;
|
uiPhase = 5;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
if (pKorrak)
|
if (pSummon)
|
||||||
pKorrak->GetMotionMaster()->MovePoint(0, 5722.558594, -2960.685059, 286.276367);
|
pSummon->GetMotionMaster()->MovePoint(0, 5722.558594, -2960.685059, 286.276367);
|
||||||
uiTimer = 0;
|
uiTimer = 0;
|
||||||
uiPhase = 0;
|
uiPhase = 0;
|
||||||
|
pSummon = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else uiTimer -= uiDiff;
|
} else uiTimer -= uiDiff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JustSummoned(Creature* pSummon)
|
||||||
|
{
|
||||||
|
SummonList.push_back(pSummon->GetGUID());
|
||||||
|
}
|
||||||
|
|
||||||
void SummonedCreatureDespawn(Creature* pSummon)
|
void SummonedCreatureDespawn(Creature* pSummon)
|
||||||
{
|
{
|
||||||
if (bEventInProgress)
|
if (bEventInProgress)
|
||||||
@@ -430,11 +436,9 @@ struct TRINITY_DLL_DECL npc_orinoko_tuskbreakerAI : public ScriptedAI
|
|||||||
if (pWhisker)
|
if (pWhisker)
|
||||||
pWhisker->RemoveFromWorld();
|
pWhisker->RemoveFromWorld();
|
||||||
|
|
||||||
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
if (m_creature->isSummon())
|
||||||
{
|
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->RemoveSummons();
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->RemoveSummons();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovementInform(uint32 uiType, uint32 uiId)
|
void MovementInform(uint32 uiType, uint32 uiId)
|
||||||
@@ -504,8 +508,9 @@ struct TRINITY_DLL_DECL npc_orinoko_tuskbreakerAI : public ScriptedAI
|
|||||||
if (pKiller->GetTypeId() == TYPEID_PLAYER)
|
if (pKiller->GetTypeId() == TYPEID_PLAYER)
|
||||||
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, CAST_PLR(pKiller));
|
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_TUSKARRMAGEDDON, CAST_PLR(pKiller));
|
||||||
|
|
||||||
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
if (m_creature->isSummon())
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
||||||
|
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -548,11 +553,9 @@ struct TRINITY_DLL_DECL npc_korrak_bloodragerAI : public ScriptedAI
|
|||||||
|
|
||||||
void EnterEvadeMode() //If you lose the combat, then the npc go away
|
void EnterEvadeMode() //If you lose the combat, then the npc go away
|
||||||
{
|
{
|
||||||
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
if (m_creature->isSummon())
|
||||||
{
|
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->RemoveSummons();
|
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->RemoveSummons();
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovementInform(uint32 uiType, uint32 uiId)
|
void MovementInform(uint32 uiType, uint32 uiId)
|
||||||
@@ -636,8 +639,9 @@ struct TRINITY_DLL_DECL npc_korrak_bloodragerAI : public ScriptedAI
|
|||||||
if (pKiller->GetTypeId() == TYPEID_PLAYER)
|
if (pKiller->GetTypeId() == TYPEID_PLAYER)
|
||||||
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, CAST_PLR(pKiller));
|
CAST_PLR(pKiller)->GroupEventHappens(QUEST_AMPHITHEATER_ANGUISH_KORRAK_BLOODRAGER, CAST_PLR(pKiller));
|
||||||
|
|
||||||
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
if (m_creature->isSummon())
|
||||||
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
if (Unit* pSummoner = CAST_SUM(m_creature)->GetSummoner())
|
||||||
|
CAST_AI(npc_gurgthockAI,CAST_CRE(pSummoner)->AI())->bEventInProgress = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user