Use ToTempSummon() in a case instead of a C style cast.
Use correct Unit::GetCreature() instead of Unit::GetUnit() with casting the object to Creature pointer. Remove some usless casts. Fix a possible crash in pyrewood_ambushAI. TODO: Remove ugly cast macros(like CAST_PLR(), CAST_CRE()) from scripts and use the correct ToX() functions(like ToPlayer(), ToCreature()). --HG-- branch : trunk
This commit is contained in:
@@ -254,6 +254,7 @@ struct pyrewood_ambushAI : public ScriptedAI
|
||||
if (PlayerGUID)
|
||||
{
|
||||
pPlayer = Unit::GetPlayer(PlayerGUID);
|
||||
if (pPlayer)
|
||||
pTarget = RAND((Unit*)m_creature, (Unit*)pPlayer);
|
||||
} else
|
||||
pTarget = m_creature;
|
||||
|
||||
@@ -672,7 +672,7 @@ struct npc_nesingwary_trapperAI : public ScriptedAI
|
||||
if (go_caribou && go_caribou->GetTypeId() == TYPEID_GAMEOBJECT)
|
||||
go_caribou->SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
||||
if (TempSummon *summon = (TempSummon*)m_creature)
|
||||
if (TempSummon *summon = m_creature->ToTempSummon())
|
||||
if (summon->isSummon())
|
||||
if (Unit *pTemp = summon->GetSummoner())
|
||||
if (pTemp->GetTypeId() == TYPEID_PLAYER)
|
||||
|
||||
@@ -1073,8 +1073,8 @@ struct mob_acolyte_of_shadronAI : public ScriptedAI
|
||||
{
|
||||
Unit *pTarget = SelectTarget(SELECT_TARGET_TOPAGGRO, 0, 999, true);
|
||||
Creature* pShadron = NULL;
|
||||
Creature* pSartharion = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SARTHARION)));
|
||||
if (Creature* pShadron = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SHADRON))))
|
||||
Creature* pSartharion = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SARTHARION));
|
||||
if (Creature* pShadron = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SHADRON)))
|
||||
//if not solo figth, buff main boss, else place debuff on mini-boss. both spells TARGET_SCRIPT
|
||||
if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
|
||||
pSartharion->CastSpell(m_creature, SPELL_GIFT_OF_TWILIGTH_SAR, true);
|
||||
@@ -1116,14 +1116,14 @@ struct mob_acolyte_of_shadronAI : public ScriptedAI
|
||||
if (pInstance->GetData(TYPE_SARTHARION_EVENT) == IN_PROGRESS)
|
||||
{
|
||||
//not solo fight, so main boss has deduff
|
||||
Creature* pDebuffTarget = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SARTHARION)));
|
||||
Creature* pDebuffTarget = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SARTHARION));
|
||||
if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SAR))
|
||||
pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SAR);
|
||||
}
|
||||
else
|
||||
{
|
||||
//event not in progress, then solo fight and must remove debuff mini-boss
|
||||
Creature* pDebuffTarget = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_SHADRON)));
|
||||
Creature* pDebuffTarget = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_SHADRON));
|
||||
if (pDebuffTarget && pDebuffTarget->isAlive() && pDebuffTarget->HasAura(SPELL_GIFT_OF_TWILIGTH_SHA))
|
||||
pDebuffTarget->RemoveAurasDueToSpell(SPELL_GIFT_OF_TWILIGTH_SHA);
|
||||
}
|
||||
@@ -1171,7 +1171,7 @@ struct mob_acolyte_of_vesperonAI : public ScriptedAI
|
||||
// remove twilight torment on Vesperon
|
||||
if (pInstance)
|
||||
{
|
||||
Creature* pVesperon = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_VESPERON)));
|
||||
Creature* pVesperon = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_VESPERON));
|
||||
|
||||
if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP))
|
||||
pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP);
|
||||
|
||||
@@ -333,7 +333,7 @@ struct mob_collapsing_starAI : public ScriptedAI
|
||||
{
|
||||
mob_collapsing_starAI(Creature *pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
pInstance = (ScriptedInstance*)pCreature->GetInstanceData();
|
||||
pInstance = pCreature->GetInstanceData();
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
|
||||
@@ -23,7 +23,7 @@ The teleporter appears to be active and stable.
|
||||
|
||||
bool GoHello_ulduar_teleporter( Player *pPlayer, GameObject *pGO )
|
||||
{
|
||||
ScriptedInstance *pInstance = (ScriptedInstance *) pGO->GetInstanceData();
|
||||
ScriptedInstance *pInstance = pGO->GetInstanceData();
|
||||
if(!pInstance) return true;
|
||||
|
||||
pPlayer->ADD_GOSSIP_ITEM(0, "Teleport to the Expedition Base Camp", GOSSIP_SENDER_MAIN, BASE_CAMP);
|
||||
|
||||
@@ -723,7 +723,7 @@ struct mob_palehoof_orbAI : public ScriptedAI
|
||||
{
|
||||
pNext->RemoveAurasDueToSpell(SPELL_FREEZE);
|
||||
pNext->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_ATTACKABLE_1|UNIT_FLAG_OOC_NOT_ATTACKABLE);
|
||||
((Unit*)pNext)->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
pNext->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
pNext->SetInCombatWithZone();
|
||||
pNext->Attack(pNext->SelectNearestTarget(100),true);
|
||||
|
||||
|
||||
@@ -344,7 +344,7 @@ struct boss_ymironAI : public ScriptedAI
|
||||
void DespawnBoatGhosts(uint64& m_uiCreatureGUID)
|
||||
{
|
||||
if (m_uiCreatureGUID)
|
||||
if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, m_uiCreatureGUID))
|
||||
if (Creature* pTemp = Unit::GetCreature(*m_creature, m_uiCreatureGUID))
|
||||
pTemp->DisappearAndDie();
|
||||
|
||||
m_uiCreatureGUID = 0;
|
||||
|
||||
@@ -349,7 +349,7 @@ struct mob_ichor_globuleAI : public ScriptedAI
|
||||
{
|
||||
if (pInstance)
|
||||
{
|
||||
if (Creature* pIchoron = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ICHORON))))
|
||||
if (Creature* pIchoron = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ICHORON)))
|
||||
{
|
||||
if (m_creature->IsWithinDist(pIchoron, 2.0f , false))
|
||||
{
|
||||
@@ -367,7 +367,7 @@ struct mob_ichor_globuleAI : public ScriptedAI
|
||||
void JustDied(Unit* pKiller)
|
||||
{
|
||||
DoCast(m_creature, SPELL_SPLASH);
|
||||
if (Creature* pIchoron = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_ICHORON))))
|
||||
if (Creature* pIchoron = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_ICHORON)))
|
||||
if (pIchoron->AI())
|
||||
pIchoron->AI()->DoAction(ACTION_WATER_ELEMENT_KILLED);
|
||||
}
|
||||
|
||||
@@ -252,7 +252,7 @@ struct mob_ethereal_sphereAI : public ScriptedAI
|
||||
{
|
||||
if (pInstance)
|
||||
{
|
||||
if (Creature* pXevozz = ((Creature*)Unit::GetUnit((*m_creature), pInstance->GetData64(DATA_XEVOZZ))))
|
||||
if (Creature* pXevozz = Unit::GetCreature(*m_creature, pInstance->GetData64(DATA_XEVOZZ)))
|
||||
{
|
||||
float fDistance = m_creature->GetDistance2d(pXevozz);
|
||||
if (fDistance <= 3)
|
||||
|
||||
@@ -277,7 +277,7 @@ struct npc_gurgthockAI : public ScriptedAI
|
||||
|
||||
for(std::list<uint64>::iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr)
|
||||
{
|
||||
if (Creature* pTemp = (Creature*)Unit::GetUnit(*m_creature, *itr))
|
||||
if (Creature* pTemp = Unit::GetCreature(*m_creature, *itr))
|
||||
if (pTemp)
|
||||
pTemp->RemoveFromWorld();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user