*Add DeleteObjectWith owner function for gameobject deletion with updating owner object list

*Cleanups in Aura 1852 and recenlty added glyph code.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-08-03 14:52:30 +02:00
parent 8777efd03c
commit f93830e0ae
6 changed files with 61 additions and 40 deletions
@@ -200,11 +200,7 @@ bool GOHello_go_najentus_spine(Player *player, GameObject* _GO)
if(CAST_AI(boss_najentusAI, Najentus->AI())->RemoveImpalingSpine()) if(CAST_AI(boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
{ {
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true); player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
_GO->SetLootState(GO_NOT_READY); _GO->DeleteObjectWithOwner();
if (_GO->GetOwnerGUID())
if (Unit * owner = _GO->GetOwner())
owner->RemoveGameObject(_GO, false);
_GO->Delete();
} }
return true; return true;
} }
@@ -161,7 +161,7 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
if(Player *player = Unit::GetPlayer(itr->first)) if(Player *player = Unit::GetPlayer(itr->first))
player->RemoveAura(SPELL_ICEBOLT); player->RemoveAura(SPELL_ICEBOLT);
if(GameObject *go = GameObject::GetGameObject(*me, itr->second)) if(GameObject *go = GameObject::GetGameObject(*me, itr->second))
go->Delete(); go->DeleteObjectWithOwner();
} }
iceblocks.clear(); iceblocks.clear();
} }
+2 -5
View File
@@ -160,11 +160,8 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg=""; std::string msg="";
recv_data >> msg; recv_data >> msg;
if (ChatHandler(this).ParseCommands(msg.c_str()) == 0) SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName());
{ return;
SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName());
return;
}
} }
switch(type) switch(type)
+10 -1
View File
@@ -434,7 +434,7 @@ void GameObject::Update(uint32 /*p_time*/)
if(GetOwnerGUID()) if(GetOwnerGUID())
{ {
if(Unit* owner = GetOwner()) if(Unit* owner = GetOwner(false))
{ {
owner->RemoveGameObject(this, false); owner->RemoveGameObject(this, false);
SetRespawnTime(0); SetRespawnTime(0);
@@ -492,6 +492,15 @@ void GameObject::AddUniqueUse(Player* player)
m_unique_users.insert(player->GetGUIDLow()); m_unique_users.insert(player->GetGUIDLow());
} }
void GameObject::DeleteObjectWithOwner()
{
SetLootState(GO_NOT_READY);
if (GetOwnerGUID())
if (Unit * owner = GetOwner(false))
owner->RemoveGameObject(this, false);
Delete();
}
void GameObject::Delete() void GameObject::Delete()
{ {
assert (!GetOwnerGUID()); assert (!GetOwnerGUID());
+1
View File
@@ -640,6 +640,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
uint32 GetRespawnDelay() const { return m_respawnDelayTime; } uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
void Refresh(); void Refresh();
void Delete(); void Delete();
void DeleteObjectWithOwner();
void SetSpellId(uint32 id) { m_spellId = id;} void SetSpellId(uint32 id) { m_spellId = id;}
uint32 GetSpellId() const { return m_spellId;} uint32 GetSpellId() const { return m_spellId;}
void getFishLoot(Loot *loot, Player* loot_owner); void getFishLoot(Loot *loot, Player* loot_owner);
+44 -26
View File
@@ -944,31 +944,47 @@ void Aura::ApplyAllModifiers(bool apply, bool Real)
void Aura::HandleAuraSpecificMods(bool apply) void Aura::HandleAuraSpecificMods(bool apply)
{ {
// Glyph of Fireball if (apply)
if ((apply) && (GetCaster()->HasAura(56368)) && (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && m_spellProto->SpellFamilyFlags[0] & 0x00000001 && m_spellProto->SpellFamilyFlags[2] & 0x00000008))
SetAuraDuration(0);
// Glyph of Frostbolt
if ((apply) && (GetCaster()->HasAura(56370)) && ((m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE) && (m_spellProto->SpellFamilyFlags[0] & 0x00000020) && (m_spellProto->SpellVisual[0] == 13)))
SetAuraDuration(0);
// Polymorph - Glyphs && Sound
if (apply && m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && m_spellProto->SpellFamilyFlags[0] & 0x01000000)
{ {
// Glyph of Polymorph if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE)
if (GetCaster()->HasAura(56375))
{ {
m_target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE); if (m_spellProto->SpellFamilyFlags[0] & 0x00000001 && m_spellProto->SpellFamilyFlags[2] & 0x00000008)
m_target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT); {
} // Glyph of Fireball
if (Unit * caster = GetCaster())
if (caster->HasAura(56368))
SetAuraDuration(0);
}
else if (m_spellProto->SpellFamilyFlags[0] & 0x00000020 && m_spellProto->SpellVisual[0] == 13)
{
// Glyph of Frostbolt
if (Unit * caster = GetCaster())
if (caster->HasAura(56370))
SetAuraDuration(0);
}
// Todo: This should be moved to similar function in spell::hit
else if (m_spellProto->SpellFamilyFlags[0] & 0x01000000)
{
// Glyph of Polymorph
Unit * caster = GetCaster();
if (!caster)
return;
if (caster->HasAura(56375))
{
m_target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
m_target->RemoveAurasByType(SPELL_AURA_PERIODIC_DAMAGE_PERCENT);
}
// Polymorph Sound - Sheep && Penguin // Polymorph Sound - Sheep && Penguin
if (m_spellProto->SpellIconID == 82 && m_spellProto->SpellVisual[0] == 12978) if (m_spellProto->SpellIconID == 82 && m_spellProto->SpellVisual[0] == 12978)
{ {
if (GetCaster()->HasAura(56375)) // Glyph of the Penguin
GetCaster()->CastSpell(m_target,61635,true); if (caster->HasAura(52648))
else caster->CastSpell(m_target,61635,true);
GetCaster()->CastSpell(m_target,61634,true); else
caster->CastSpell(m_target,61634,true);
}
}
} }
} }
@@ -980,7 +996,6 @@ void Aura::HandleAuraSpecificMods(bool apply)
{ {
if (GetCasterGUID() != m_target->GetGUID()) if (GetCasterGUID() != m_target->GetGUID())
return; return;
if (apply) if (apply)
{ {
if ((m_spellProto->Id == 31821 && m_target->HasAura(19746, GetCasterGUID())) || (m_spellProto->Id == 19746 && m_target->HasAura(31821))) if ((m_spellProto->Id == 31821 && m_target->HasAura(19746, GetCasterGUID())) || (m_spellProto->Id == 19746 && m_target->HasAura(31821)))
@@ -3566,9 +3581,12 @@ void AuraEffect::HandleAuraTransform(bool apply, bool Real, bool /*changeAmount*
if(GetId()==42016 && m_target->GetMountID() && !m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty()) if(GetId()==42016 && m_target->GetMountID() && !m_target->GetAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED).empty())
m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314);
// Glyph of the Penguin // Polymorph (sheep)
if ((GetCaster()->HasAura(56375)) && (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)) if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)
m_target->SetDisplayId(26452); if (Unit * caster = GetCaster())
// Glyph of the Penguin
if (caster->HasAura(52648))
m_target->SetDisplayId(26452);
} }
} }