*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())
{
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
_GO->SetLootState(GO_NOT_READY);
if (_GO->GetOwnerGUID())
if (Unit * owner = _GO->GetOwner())
owner->RemoveGameObject(_GO, false);
_GO->Delete();
_GO->DeleteObjectWithOwner();
}
return true;
}
@@ -161,7 +161,7 @@ struct TRINITY_DLL_DECL boss_sapphironAI : public BossAI
if(Player *player = Unit::GetPlayer(itr->first))
player->RemoveAura(SPELL_ICEBOLT);
if(GameObject *go = GameObject::GetGameObject(*me, itr->second))
go->Delete();
go->DeleteObjectWithOwner();
}
iceblocks.clear();
}
-3
View File
@@ -160,12 +160,9 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
std::string msg="";
recv_data >> msg;
if (ChatHandler(this).ParseCommands(msg.c_str()) == 0)
{
SendNotification(GetTrinityString(LANG_GM_SILENCE), GetPlayer()->GetName());
return;
}
}
switch(type)
{
+10 -1
View File
@@ -434,7 +434,7 @@ void GameObject::Update(uint32 /*p_time*/)
if(GetOwnerGUID())
{
if(Unit* owner = GetOwner())
if(Unit* owner = GetOwner(false))
{
owner->RemoveGameObject(this, false);
SetRespawnTime(0);
@@ -492,6 +492,15 @@ void GameObject::AddUniqueUse(Player* player)
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()
{
assert (!GetOwnerGUID());
+1
View File
@@ -640,6 +640,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
void Refresh();
void Delete();
void DeleteObjectWithOwner();
void SetSpellId(uint32 id) { m_spellId = id;}
uint32 GetSpellId() const { return m_spellId;}
void getFishLoot(Loot *loot, Player* loot_owner);
+30 -12
View File
@@ -943,20 +943,33 @@ void Aura::ApplyAllModifiers(bool apply, bool Real)
}
void Aura::HandleAuraSpecificMods(bool apply)
{
if (apply)
{
if (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE)
{
if (m_spellProto->SpellFamilyFlags[0] & 0x00000001 && m_spellProto->SpellFamilyFlags[2] & 0x00000008)
{
// Glyph of Fireball
if ((apply) && (GetCaster()->HasAura(56368)) && (m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && m_spellProto->SpellFamilyFlags[0] & 0x00000001 && m_spellProto->SpellFamilyFlags[2] & 0x00000008))
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 ((apply) && (GetCaster()->HasAura(56370)) && ((m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE) && (m_spellProto->SpellFamilyFlags[0] & 0x00000020) && (m_spellProto->SpellVisual[0] == 13)))
if (Unit * caster = GetCaster())
if (caster->HasAura(56370))
SetAuraDuration(0);
// Polymorph - Glyphs && Sound
if (apply && m_spellProto->SpellFamilyName == SPELLFAMILY_MAGE && m_spellProto->SpellFamilyFlags[0] & 0x01000000)
}
// Todo: This should be moved to similar function in spell::hit
else if (m_spellProto->SpellFamilyFlags[0] & 0x01000000)
{
// Glyph of Polymorph
if (GetCaster()->HasAura(56375))
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);
@@ -965,10 +978,13 @@ void Aura::HandleAuraSpecificMods(bool apply)
// Polymorph Sound - Sheep && Penguin
if (m_spellProto->SpellIconID == 82 && m_spellProto->SpellVisual[0] == 12978)
{
if (GetCaster()->HasAura(56375))
GetCaster()->CastSpell(m_target,61635,true);
// Glyph of the Penguin
if (caster->HasAura(52648))
caster->CastSpell(m_target,61635,true);
else
GetCaster()->CastSpell(m_target,61634,true);
caster->CastSpell(m_target,61634,true);
}
}
}
}
@@ -980,7 +996,6 @@ void Aura::HandleAuraSpecificMods(bool apply)
{
if (GetCasterGUID() != m_target->GetGUID())
return;
if (apply)
{
if ((m_spellProto->Id == 31821 && m_target->HasAura(19746, GetCasterGUID())) || (m_spellProto->Id == 19746 && m_target->HasAura(31821)))
@@ -3566,8 +3581,11 @@ 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())
m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314);
// Polymorph (sheep)
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)
if (Unit * caster = GetCaster())
// Glyph of the Penguin
if ((GetCaster()->HasAura(56375)) && (GetSpellProto()->SpellFamilyName == SPELLFAMILY_MAGE && GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978))
if (caster->HasAura(52648))
m_target->SetDisplayId(26452);
}
}