*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_SUM(a) (SCRIPT_CAST_TYPE<TempSummon*>(a))
|
||||||
#define CAST_PET(a) (SCRIPT_CAST_TYPE<Pet*>(a))
|
#define CAST_PET(a) (SCRIPT_CAST_TYPE<Pet*>(a))
|
||||||
#define CAST_AI(a,b) (SCRIPT_CAST_TYPE<a*>(b))
|
#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)))
|
#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);
|
uint64 guid = MAKE_NEW_GUID(guidlo, 0, HIGHGUID_PLAYER);
|
||||||
|
|
||||||
// kick if player currently
|
// kick if player currently
|
||||||
if (Player* p = ObjectAccessor::GetObjectInWorld(guid, (Player*)NULL))
|
if (Player* p = ObjectAccessor::FindPlayer(guid))
|
||||||
{
|
{
|
||||||
WorldSession* s = p->GetSession();
|
WorldSession* s = p->GetSession();
|
||||||
s->KickPlayer(); // mark session to remove at next session list update
|
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
|
// register single target aura
|
||||||
caster->GetSingleCastAuras().push_back(aura);
|
caster->GetSingleCastAuras().push_back(aura);
|
||||||
// remove other single target auras
|
// remove other single target auras
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
bool restart = false;
|
|
||||||
Unit::AuraList& scAuras = caster->GetSingleCastAuras();
|
Unit::AuraList& scAuras = caster->GetSingleCastAuras();
|
||||||
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end(); ++itr)
|
for (Unit::AuraList::iterator itr = scAuras.begin(); itr != scAuras.end();)
|
||||||
{
|
{
|
||||||
if ((*itr) != aura &&
|
if ((*itr) != aura &&
|
||||||
IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
|
IsSingleTargetSpells((*itr)->GetSpellProto(), aura->GetSpellProto()))
|
||||||
{
|
{
|
||||||
(*itr)->Remove();
|
(*itr)->Remove();
|
||||||
restart = true;
|
itr = scAuras.begin();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
|
++itr;
|
||||||
if (!restart)
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4266,7 +4260,7 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
|||||||
AuraApplication const * aurApp = iter->second;
|
AuraApplication const * aurApp = iter->second;
|
||||||
Aura const * aura = aurApp->GetBase();
|
Aura const * aura = aurApp->GetBase();
|
||||||
|
|
||||||
if (aura->GetCasterGUID() !=GetGUID() && IsSingleTargetSpell(aura->GetSpellProto()))
|
if (aura->GetCasterGUID() != GetGUID() && IsSingleTargetSpell(aura->GetSpellProto()))
|
||||||
{
|
{
|
||||||
if (!newPhase)
|
if (!newPhase)
|
||||||
RemoveAura(iter);
|
RemoveAura(iter);
|
||||||
@@ -4288,14 +4282,13 @@ void Unit::RemoveNotOwnSingleTargetAuras(uint32 newPhase)
|
|||||||
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
|
for (AuraList::iterator iter = scAuras.begin(); iter != scAuras.end();)
|
||||||
{
|
{
|
||||||
Aura * aura = *iter;
|
Aura * aura = *iter;
|
||||||
++iter;
|
|
||||||
if (aura->GetUnitOwner() != this && !aura->GetUnitOwner()->InSamePhase(newPhase))
|
if (aura->GetUnitOwner() != this && !aura->GetUnitOwner()->InSamePhase(newPhase))
|
||||||
{
|
{
|
||||||
uint32 removedAuras = m_removedAurasCount;
|
|
||||||
aura->Remove();
|
aura->Remove();
|
||||||
if (m_removedAurasCount > removedAuras + 1)
|
|
||||||
iter = scAuras.begin();
|
iter = scAuras.begin();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ struct ScriptInfo;
|
|||||||
struct ScriptAction;
|
struct ScriptAction;
|
||||||
struct Position;
|
struct Position;
|
||||||
class BattleGround;
|
class BattleGround;
|
||||||
|
class MapInstanced;
|
||||||
|
class InstanceMap;
|
||||||
|
|
||||||
//******************************************
|
//******************************************
|
||||||
// Map file format defines
|
// Map file format defines
|
||||||
@@ -446,6 +448,12 @@ class Map : public GridRefManager<NGridType>
|
|||||||
Creature* GetCreature(uint64 guid);
|
Creature* GetCreature(uint64 guid);
|
||||||
GameObject* GetGameObject(uint64 guid);
|
GameObject* GetGameObject(uint64 guid);
|
||||||
DynamicObject* GetDynamicObject(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:
|
private:
|
||||||
void LoadMapAndVMap(int gx, int gy);
|
void LoadMapAndVMap(int gx, int gy);
|
||||||
void LoadVMap(int gx, int gy);
|
void LoadVMap(int gx, int gy);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ struct boss_kalecgosAI : public ScriptedAI
|
|||||||
{
|
{
|
||||||
Player* pPlayer = itr->getSource();
|
Player* pPlayer = itr->getSource();
|
||||||
if (pPlayer)
|
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 192519: uiStatue = pInstance->GetData64(DATA_MOORABI_STATUE); break;
|
||||||
case 192520: uiStatue = pInstance->GetData64(DATA_DRAKKARI_COLOSSUS_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->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_UNK1);
|
||||||
pGO->SetGoState(GO_STATE_ACTIVE);
|
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));
|
Creature* Tenebron = pInstance->instance->GetCreature(pInstance->GetData64(DATA_TENEBRON));
|
||||||
if(Tenebron)
|
if(Tenebron)
|
||||||
((mob_tenebronAI*)Tenebron->AI())->m_bHasPortalOpen = false;
|
(CAST_AI(mob_tenebronAI,Tenebron->AI()))->m_bHasPortalOpen = false;
|
||||||
SpawnWhelps();
|
SpawnWhelps();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -446,8 +446,7 @@ struct boss_skadiAI : public ScriptedAI
|
|||||||
|
|
||||||
bool GOHello_go_harpoon_launcher(Player *pPlayer, GameObject *pGO)
|
bool GOHello_go_harpoon_launcher(Player *pPlayer, GameObject *pGO)
|
||||||
{
|
{
|
||||||
ScriptedInstance* m_pInstance;
|
ScriptedInstance* m_pInstance = pGO->GetInstanceData();
|
||||||
m_pInstance = (ScriptedInstance*)pGO->GetInstanceData();
|
|
||||||
if (!m_pInstance) return false;
|
if (!m_pInstance) return false;
|
||||||
|
|
||||||
if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS)))
|
if (Creature* pSkadi = Unit::GetCreature((*pGO),m_pInstance->GetData64(DATA_SKADI_THE_RUTHLESS)))
|
||||||
|
|||||||
Reference in New Issue
Block a user