*Cleanup in single target auras (thanks to JuliuSZS some useable debug info)
*Add ToInstanceMap() and ToMapInstanced() typecast functions and CAST_INST macro to use in scripts. --HG-- branch : trunk
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#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))
|
||||
|
||||
#define GET_SPELL(a) (const_cast<SpellEntry*>(GetSpellStore()->LookupEntry(a)))
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accid)
|
||||
uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER);
|
||||
|
||||
// kick if player currently
|
||||
if (Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
|
||||
if (Player* p = ObjectAccessor::FindPlayer(guid))
|
||||
{
|
||||
WorldSession* s = p->GetSession();
|
||||
s->KickPlayer(); // mark session to remove at next session list update
|
||||
|
||||
@@ -3616,23 +3616,17 @@ void Unit::_AddAura(UnitAura * aura, Unit * caster)
|
||||
// register single target aura
|
||||
caster->GetSingleCastAuras().push_back(aura);
|
||||
// remove other single target auras
|
||||
for (;;)
|
||||
Unit::AuraList& scAuras = caster->GetSingleCastAuras();
|
||||
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
|
||||
{
|
||||
bool restart = false;
|
||||
Unit::AuraList& scAuras = caster->GetSingleCastAuras();
|
||||
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr)
|
||||
if ((*itr) != aura &&
|
||||
IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
|
||||
{
|
||||
if ((*itr) != aura &&
|
||||
IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
|
||||
{
|
||||
(*itr)->Remove();
|
||||
restart = true;
|
||||
break;
|
||||
}
|
||||
(*itr)->Remove();
|
||||
itr = scAuras.begin();
|
||||
}
|
||||
|
||||
if (!restart)
|
||||
break;
|
||||
else
|
||||
++itr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4266,7 +4260,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
||||
AuraApplication const * aurApp = iter->second;
|
||||
Aura const * aura = aurApp->GetBase();
|
||||
|
||||
if (aura->GetCasterGUID() !=GetGUID() && IsSingleTargetSpell(aura->GetSpellProto()))
|
||||
if (aura->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(aura->GetSpellProto()))
|
||||
{
|
||||
if (!newPhase)
|
||||
RemoveAura(iter);
|
||||
@@ -4288,14 +4282,13 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
||||
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
|
||||
{
|
||||
Aura * aura = *iter;
|
||||
++iter;
|
||||
if (aura->GetUnitOwner() != this && !aura->GetUnitOwner()->InSamePhase(newPhase))
|
||||
{
|
||||
uint32 removedAuras = m_removedAurasCount;
|
||||
aura->Remove();
|
||||
if (m_removedAurasCount > removedAuras + 1)
|
||||
iter = scAuras.begin();
|
||||
iter = scAuras.begin();
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ struct ScriptInfo;
|
||||
struct ScriptAction;
|
||||
struct Position;
|
||||
class BattleGround;
|
||||
class MapInstanced;
|
||||
class InstanceMap;
|
||||
|
||||
//******************************************
|
||||
// Map file format defines
|
||||
@@ -446,6 +448,12 @@ class Map : public GridRefManager<NGridType>
|
||||
Creature* GetCreature(uint64 guid);
|
||||
GameObject* GetGameObject(uint64 guid);
|
||||
DynamicObject* GetDynamicObject(uint64 guid);
|
||||
|
||||
MapInstanced* ToMapInstanced(){ if (Instanceable()) return reinterpret_cast<MapInstanced*>(this); else return NULL; }
|
||||
const MapInstanced* ToMapInstanced() const { if (Instanceable()) return (const MapInstanced*)((MapInstanced*)this); else return NULL; }
|
||||
|
||||
InstanceMap* ToInstanceMap(){ if (IsDungeon()) return reinterpret_cast<InstanceMap*>(this); else return NULL; }
|
||||
const InstanceMap* ToInstanceMap() const { if (IsDungeon()) return (const InstanceMap*)((InstanceMap*)this); else return NULL; }
|
||||
private:
|
||||
void LoadMapAndVMap(int gx, int gy);
|
||||
void LoadVMap(int gx, int gy);
|
||||
|
||||
@@ -369,7 +369,7 @@ struct boss_kalecgosAI : public ScriptedAI
|
||||
{
|
||||
Player* pPlayer = itr->getSource();
|
||||
if (pPlayer)
|
||||
((InstanceMap*)me->GetMap())->PermBindAllPlayers(pPlayer);
|
||||
me->GetMap()->ToInstanceMap()->PermBindAllPlayers(pPlayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -505,7 +505,7 @@ bool GOHello_altar(Player * /*pPlayer*/, GameObject *pGO)
|
||||
case 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break;
|
||||
case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_STATUE); break;
|
||||
}
|
||||
if (((instance_gundrak*)pInstance)->QueueActivation(uiStatue, 3500))
|
||||
if (CAST_INST(instance_gundrak, pInstance)->QueueActivation(uiStatue, 3500))
|
||||
{
|
||||
pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
|
||||
pGO->SetGoState(GO_STATE_ACTIVE);
|
||||
|
||||
@@ -1497,7 +1497,7 @@ struct mob_twilight_eggsAI : public Scripted_NoMovementAI
|
||||
{
|
||||
Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON));
|
||||
if(Tenebron)
|
||||
((mob_tenebronAI*)Tenebron->AI())->m_bHasPortalOpen = false;
|
||||
(CAST_AI(mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false;
|
||||
SpawnWhelps();
|
||||
}
|
||||
else
|
||||
|
||||
@@ -446,8 +446,7 @@ struct boss_skadiAI : public ScriptedAI
|
||||
|
||||
bool GOHello_go_harpoon_launcher(Player *pPlayer, GameObject *pGO)
|
||||
{
|
||||
ScriptedInstance* m_pInstance;
|
||||
m_pInstance = (ScriptedInstance*)pGO->GetInstanceData();
|
||||
ScriptedInstance* m_pInstance = pGO->GetInstanceData();
|
||||
if (!m_pInstance) return false;
|
||||
|
||||
if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS)))
|
||||
|
||||
Reference in New Issue
Block a user