Scripts: Removed CAST_SUM define
This commit is contained in:
@@ -70,10 +70,10 @@ void SummonList::DespawnAll()
|
||||
else
|
||||
{
|
||||
erase(begin());
|
||||
if (summon->isSummon())
|
||||
if (TempSummon* summ = summon->ToTempSummon())
|
||||
{
|
||||
summon->DestroyForNearbyPlayers();
|
||||
CAST_SUM(summon)->UnSummon();
|
||||
summ->UnSummon();
|
||||
}
|
||||
else
|
||||
summon->DisappearAndDie();
|
||||
|
||||
@@ -1,12 +1,23 @@
|
||||
/* Copyright (C) 2008-2010 Trinity <http://www.trinitycore.org/>
|
||||
/*
|
||||
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
*
|
||||
* Thanks to the original authors: ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is free software licensed under GPL version 2
|
||||
* Please see the included DOCS/LICENSE.TXT for more information */
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef SC_CREATURE_H
|
||||
#define SC_CREATURE_H
|
||||
#ifndef SCRIPTEDCREATURE_H_
|
||||
#define SCRIPTEDCREATURE_H_
|
||||
|
||||
#include "Creature.h"
|
||||
#include "CreatureAI.h"
|
||||
@@ -17,7 +28,6 @@
|
||||
|
||||
#define CAST_PLR(a) (SCRIPT_CAST_TYPE<Player*>(a))
|
||||
#define CAST_CRE(a) (SCRIPT_CAST_TYPE<Creature*>(a))
|
||||
#define CAST_SUM(a) (SCRIPT_CAST_TYPE<TempSummon*>(a))
|
||||
#define CAST_PET(a) (SCRIPT_CAST_TYPE<Pet*>(a))
|
||||
#define CAST_AI(a, b) (SCRIPT_CAST_TYPE<a*>(b))
|
||||
#define CAST_INST(a, b) (SCRIPT_CAST_TYPE<a*>(b))
|
||||
@@ -299,4 +309,4 @@ GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, flo
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& list, WorldObject* source, uint32 entry, float maxSearchRange);
|
||||
|
||||
#endif
|
||||
#endif // SCRIPTEDCREATURE_H_
|
||||
|
||||
@@ -565,7 +565,7 @@ public:
|
||||
if (!me->isSummon())
|
||||
return;
|
||||
|
||||
if (Unit* pSummon = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummon = me->ToTempSummon()->GetSummoner())
|
||||
CAST_CRE(pSummon)->AI()->SetData(2, 1);
|
||||
}
|
||||
|
||||
@@ -582,8 +582,9 @@ public:
|
||||
if (!me->isSummon())
|
||||
return;
|
||||
|
||||
if (Unit* pSummon = CAST_SUM(me)->GetSummoner())
|
||||
CAST_CRE(pSummon)->AI()->SetData(2, 2);
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (Creature* summonerCre = summoner->ToCreature())
|
||||
summonerCre->AI()->SetData(2, 2);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
{
|
||||
Player *plr = NULL;
|
||||
if (me->isSummon())
|
||||
if (Unit *summoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit *summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
plr = CAST_PLR(summoner);
|
||||
|
||||
|
||||
@@ -478,10 +478,10 @@ public:
|
||||
|
||||
if (me->isSummon())
|
||||
{
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
if (pSummoner && pSummoner->isAlive() && !pSummoner->isInCombat())
|
||||
CAST_CRE(pSummoner)->AI()->AttackStart(pWho);
|
||||
if (pSummoner && pSummoner->GetTypeId() == TYPEID_UNIT && pSummoner->isAlive() && !pSummoner->isInCombat())
|
||||
pSummoner->ToCreature()->AI()->AttackStart(pWho);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,10 +492,10 @@ public:
|
||||
|
||||
if (me->isSummon())
|
||||
{
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
if (pSummoner && pSummoner->isAlive())
|
||||
CAST_CRE(pSummoner)->DisappearAndDie();
|
||||
if (pSummoner && pSummoner->GetTypeId() == TYPEID_UNIT && pSummoner->isAlive())
|
||||
pSummoner->ToCreature()->DisappearAndDie();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -507,10 +507,10 @@ public:
|
||||
|
||||
if (me->isSummon())
|
||||
{
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiTimer = 2000;
|
||||
CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, CAST_CRE(pSummoner)->AI())->uiPhase = 5;
|
||||
CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pSummoner->GetAI())->uiTimer = 2000;
|
||||
CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, pSummoner->GetAI())->uiPhase = 5;
|
||||
//me->ChangeOrient(0.0f, pSummoner);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1312,10 +1312,10 @@ public:
|
||||
|
||||
void JustDied(Unit* /*killer*/)
|
||||
{
|
||||
if (CAST_SUM(me))
|
||||
if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner()))
|
||||
if (pSummoner->AI())
|
||||
pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED);
|
||||
if (TempSummon* summon = me->ToTempSummon())
|
||||
if (Unit* summoner = summon->GetSummoner())
|
||||
if (summoner->IsAIEnabled)
|
||||
summoner->GetAI()->DoAction(ACTION_FLESH_TENTACLE_KILLED);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -190,7 +190,10 @@ class npc_tiger_matriarch_credit : public CreatureScript
|
||||
{
|
||||
for (std::list<Creature*>::iterator itr = tigers.begin(); itr != tigers.end(); ++itr)
|
||||
{
|
||||
if (Unit* summoner = CAST_SUM(*itr)->GetSummoner())
|
||||
if (!(*itr)->isSummon())
|
||||
continue;
|
||||
|
||||
if (Unit* summoner = (*itr)->ToTempSummon()->GetSummoner())
|
||||
if (!summoner->HasAura(SPELL_NO_SUMMON_AURA) && !summoner->HasAura(SPELL_SUMMON_ZENTABRA_TRIGGER)
|
||||
&& !summoner->isInCombat())
|
||||
{
|
||||
@@ -223,7 +226,10 @@ class npc_tiger_matriarch : public CreatureScript
|
||||
|
||||
struct npc_tiger_matriarchAI : public ScriptedAI
|
||||
{
|
||||
npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature) {}
|
||||
npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature),
|
||||
_tiger(NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void IsSummonedBy(Unit* summoner)
|
||||
{
|
||||
@@ -242,10 +248,10 @@ class npc_tiger_matriarch : public CreatureScript
|
||||
|
||||
void KilledUnit(Unit* victim)
|
||||
{
|
||||
if (victim->GetTypeId() != TYPEID_UNIT)
|
||||
if (victim->GetTypeId() != TYPEID_UNIT || !victim->isSummon())
|
||||
return;
|
||||
|
||||
if (Unit* vehSummoner = CAST_SUM(victim)->GetSummoner())
|
||||
if (Unit* vehSummoner = victim->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA);
|
||||
vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS);
|
||||
@@ -257,11 +263,14 @@ class npc_tiger_matriarch : public CreatureScript
|
||||
|
||||
void DamageTaken(Unit* attacker, uint32& damage)
|
||||
{
|
||||
if (HealthBelowPct(20))
|
||||
{
|
||||
if (!attacker->isSummon())
|
||||
return;
|
||||
|
||||
if (HealthBelowPct(20))
|
||||
{
|
||||
damage = 0;
|
||||
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||
if (Unit* vehSummoner = CAST_SUM(attacker)->GetSummoner())
|
||||
if (Unit* vehSummoner = attacker->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
vehSummoner->AddAura(SPELL_SUMMON_ZENTABRA_TRIGGER, vehSummoner);
|
||||
vehSummoner->CastSpell(vehSummoner, SPELL_SUMMON_ZENTABRA, true);
|
||||
@@ -271,6 +280,7 @@ class npc_tiger_matriarch : public CreatureScript
|
||||
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
|
||||
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
|
||||
}
|
||||
|
||||
me->ForcedDespawn();
|
||||
}
|
||||
}
|
||||
@@ -294,8 +304,9 @@ class npc_tiger_matriarch : public CreatureScript
|
||||
events.ScheduleEvent(EVENT_POUNCE, 30000);
|
||||
break;
|
||||
case EVENT_NOSUMMON: // Reapply SPELL_NO_SUMMON_AURA
|
||||
if (Unit* vehSummoner = CAST_SUM(_tiger)->GetSummoner())
|
||||
me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner);
|
||||
if (_tiger && _tiger->isSummon())
|
||||
if (Unit* vehSummoner = _tiger->ToTempSummon()->GetSummoner())
|
||||
me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner);
|
||||
events.ScheduleEvent(EVENT_NOSUMMON, 50000);
|
||||
break;
|
||||
default:
|
||||
|
||||
+3
-7
@@ -415,13 +415,9 @@ public:
|
||||
void JustDied(Unit* /*pKiller*/)
|
||||
{
|
||||
if (me->isSummon())
|
||||
{
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
{
|
||||
if (pSummoner && pSummoner->isAlive())
|
||||
CAST_CRE(pSummoner)->AI()->SetData(1, 0);
|
||||
}
|
||||
}
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (summoner->isAlive())
|
||||
summoner->GetAI()->SetData(1, 0);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -511,7 +511,7 @@ public:
|
||||
bool liveSide;
|
||||
bool gateClose;
|
||||
|
||||
bool isOnSameSide(const Unit *pWho)
|
||||
bool isOnSameSide(const Unit *pWho) const
|
||||
{
|
||||
return (liveSide == IN_LIVE_SIDE(pWho));
|
||||
}
|
||||
@@ -530,10 +530,8 @@ public:
|
||||
void JustDied(Unit * /*killer*/)
|
||||
{
|
||||
if (me->isSummon())
|
||||
{
|
||||
if (Unit *owner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* owner = me->ToTempSummon()->GetSummoner())
|
||||
CombatAI::JustDied(owner);
|
||||
}
|
||||
}
|
||||
|
||||
void EnterEvadeMode()
|
||||
|
||||
@@ -1299,7 +1299,7 @@ public:
|
||||
return;
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(pSummoner)->AI())->bArthasInPosition = true;
|
||||
}
|
||||
};
|
||||
@@ -1331,7 +1331,7 @@ public:
|
||||
me->AddUnitState(UNIT_STAT_STUNNED);
|
||||
me->CastSpell(me, SPELL_STUN, true);
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(pSummoner)->AI())->bArlosInPosition = true;
|
||||
}
|
||||
};
|
||||
@@ -1388,7 +1388,7 @@ public:
|
||||
return;
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(pSummoner)->AI())->bTalbotInPosition = true;
|
||||
}
|
||||
|
||||
@@ -1493,21 +1493,21 @@ public:
|
||||
if (!bDone)
|
||||
{
|
||||
if (Creature* pTalbot = me->FindNearestCreature(NPC_PRINCE_VALANAR, 50.0f, true))
|
||||
CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, pTalbot->AI())->bCheck = true;
|
||||
CAST_AI(npc_counselor_talbot::npc_counselor_talbotAI, pTalbot->GetAI())->bCheck = true;
|
||||
|
||||
me->AddUnitState(UNIT_STAT_STUNNED);
|
||||
me->CastSpell(me, SPELL_STUN, true);
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(pSummoner)->AI())->bLeryssaInPosition = true;
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, pSummoner->GetAI())->bLeryssaInPosition = true;
|
||||
bDone = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
me->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pSummoner = me->ToTempSummon()->GetSummoner())
|
||||
pSummoner->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
uiPhaseTimer = 1500;
|
||||
Phase = 1;
|
||||
@@ -1524,7 +1524,7 @@ public:
|
||||
{
|
||||
case 1:
|
||||
if (me->isSummon())
|
||||
if (Unit* pThassarian = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pThassarian = me->ToTempSummon()(me)->GetSummoner())
|
||||
DoScriptText(SAY_THASSARIAN_4, pThassarian);
|
||||
uiPhaseTimer = 5000;
|
||||
++Phase;
|
||||
@@ -1536,7 +1536,7 @@ public:
|
||||
break;
|
||||
case 3:
|
||||
if (me->isSummon())
|
||||
if (Unit* pThassarian = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
|
||||
DoScriptText(SAY_THASSARIAN_5, pThassarian);
|
||||
uiPhaseTimer = 5000;
|
||||
++Phase;
|
||||
@@ -1548,7 +1548,7 @@ public:
|
||||
break;
|
||||
case 5:
|
||||
if (me->isSummon())
|
||||
if (Unit* pThassarian = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
|
||||
DoScriptText(SAY_THASSARIAN_6, pThassarian);
|
||||
uiPhaseTimer = 5000;
|
||||
++Phase;
|
||||
@@ -1561,10 +1561,10 @@ public:
|
||||
break;
|
||||
case 7:
|
||||
if (me->isSummon())
|
||||
if (Unit* pThassarian = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pThassarian = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
DoScriptText(SAY_THASSARIAN_7, pThassarian);
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, CAST_CRE(pThassarian)->AI())->uiPhase = 16;
|
||||
CAST_AI(npc_thassarian::npc_thassarianAI, pThassarian->GetAI())->uiPhase = 16;
|
||||
}
|
||||
uiPhaseTimer = 5000;
|
||||
Phase = 0;
|
||||
|
||||
@@ -173,41 +173,26 @@ public:
|
||||
|
||||
void Reset()
|
||||
{
|
||||
InitScriptData();
|
||||
}
|
||||
|
||||
void InitScriptData()
|
||||
{
|
||||
Player* pPlayer = NULL;
|
||||
uint64 summonerGUID = 0;
|
||||
Player* player = NULL;
|
||||
if (me->isSummon())
|
||||
if (Unit* summoner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
pPlayer = CAST_PLR(summoner);
|
||||
summonerGUID = summoner->GetGUID();
|
||||
|
||||
if (!pPlayer)
|
||||
if (!summonerGUID)
|
||||
return;
|
||||
|
||||
me->SetUnitMovementFlags(MOVEMENTFLAG_WALKING);
|
||||
Start(false, false, pPlayer->GetGUID());
|
||||
Start(false, false, summonerGUID);
|
||||
}
|
||||
|
||||
void WaypointReached(uint32 i)
|
||||
void WaypointReached(uint32 waypointId)
|
||||
{
|
||||
Player* pPlayer = NULL;
|
||||
if (me->isSummon())
|
||||
if (Unit* summoner = CAST_SUM(me)->GetSummoner())
|
||||
if (summoner->GetTypeId() == TYPEID_PLAYER)
|
||||
pPlayer = CAST_PLR(summoner);
|
||||
|
||||
if (!pPlayer)
|
||||
if (waypointId != 26)
|
||||
return;
|
||||
|
||||
switch(i)
|
||||
{
|
||||
case 26:
|
||||
me->DespawnOrUnsummon();
|
||||
break;
|
||||
}
|
||||
me->DespawnOrUnsummon();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -299,15 +299,19 @@ public:
|
||||
{
|
||||
npc_bushwhackerAI(Creature* pCreature) : ScriptedAI(pCreature)
|
||||
{
|
||||
MoveToSummoner();
|
||||
}
|
||||
|
||||
void MoveToSummoner()
|
||||
void InitializeAI()
|
||||
{
|
||||
if (me->isDead())
|
||||
return;
|
||||
|
||||
if (me->isSummon())
|
||||
if (Unit* pSummoner = CAST_SUM(me)->GetSummoner())
|
||||
if (pSummoner)
|
||||
me->GetMotionMaster()->MovePoint(0, pSummoner->GetPositionX(), pSummoner->GetPositionY(), pSummoner->GetPositionZ());
|
||||
if (Unit* summoner = me->ToTempSummon()->GetSummoner())
|
||||
if (summoner)
|
||||
me->GetMotionMaster()->MovePoint(0, summoner->GetPositionX(), summoner->GetPositionY(), summoner->GetPositionZ());
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 /*uiDiff*/)
|
||||
|
||||
@@ -1689,7 +1689,7 @@ public:
|
||||
|
||||
// Start attacking attacker of owner on first ai update after spawn - move in line of sight may choose better target
|
||||
if (!me->getVictim() && me->isSummon())
|
||||
if (Unit * Owner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit * Owner = me->ToTempSummon()->GetSummoner())
|
||||
if (Owner->getAttackerForHelper())
|
||||
AttackStart(Owner->getAttackerForHelper());
|
||||
}
|
||||
@@ -2103,7 +2103,7 @@ public:
|
||||
void DamageTaken(Unit* /*pKiller*/, uint32 &damage)
|
||||
{
|
||||
if (me->isSummon())
|
||||
if (Unit* pOwner = CAST_SUM(me)->GetSummoner())
|
||||
if (Unit* pOwner = me->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
if (pOwner->HasAura(GLYPH_OF_SHADOWFIEND))
|
||||
if (damage >= me->GetHealth())
|
||||
@@ -2152,7 +2152,7 @@ public:
|
||||
{
|
||||
if (pCreature->isSummon())
|
||||
{
|
||||
if (pPlayer == CAST_SUM(pCreature)->GetSummoner())
|
||||
if (pPlayer == pCreature->ToTempSummon()->GetSummoner())
|
||||
{
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
|
||||
pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2);
|
||||
|
||||
Reference in New Issue
Block a user