[8056] Move SMSG_CLEAR_COOLDOWN into function and use it. Other cleanups. Author:XTZGZoReX
[8060] Store spell_pet_auras for auraeffects instead of by whole aura Author:hunuza. --HG-- branch : trunk
This commit is contained in:
@@ -291,7 +291,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
|
||||
pet->SendPetCastFail(spellid, result);
|
||||
|
||||
if(!((Creature*)pet)->HasSpellCooldown(spellid))
|
||||
pet->SendPetClearCooldown(spellid);
|
||||
GetPlayer()->SendClearCooldown(spellid, pet);
|
||||
|
||||
spell->finish(false);
|
||||
delete spell;
|
||||
@@ -669,12 +669,12 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
if(!((Player*)caster)->HasSpellCooldown(spellid))
|
||||
caster->SendPetClearCooldown(spellid);
|
||||
GetPlayer()->SendClearCooldown(spellid, caster);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!((Creature*)caster)->HasSpellCooldown(spellid))
|
||||
caster->SendPetClearCooldown(spellid);
|
||||
GetPlayer()->SendClearCooldown(spellid, caster);
|
||||
}
|
||||
|
||||
spell->finish(false);
|
||||
|
||||
+16
-37
@@ -3223,8 +3223,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_
|
||||
RemoveAurasDueToSpell(spell_id);
|
||||
|
||||
// remove pet auras
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id))
|
||||
RemovePetAura(petSpell);
|
||||
for(int i = 0; i < MAX_SPELL_EFFECTS; ++i)
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id, i))
|
||||
RemovePetAura(petSpell);
|
||||
|
||||
// free talent points
|
||||
uint32 talentCosts = GetTalentSpellCost(spell_id);
|
||||
@@ -3374,12 +3375,7 @@ void Player::RemoveSpellCooldown( uint32 spell_id, bool update /* = false */ )
|
||||
m_spellCooldowns.erase(spell_id);
|
||||
|
||||
if(update)
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spell_id);
|
||||
data << uint64(GetGUID());
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
SendClearCooldown(spell_id, this);
|
||||
}
|
||||
|
||||
void Player::RemoveCategoryCooldown( uint32 cat )
|
||||
@@ -3405,13 +3401,8 @@ void Player::RemoveArenaSpellCooldowns()
|
||||
entry->RecoveryTime <= 15 * MINUTE * IN_MILISECONDS &&
|
||||
entry->CategoryRecoveryTime <= 15 * MINUTE * IN_MILISECONDS )
|
||||
{
|
||||
// notify player
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(itr->first);
|
||||
data << uint64(GetGUID());
|
||||
GetSession()->SendPacket(&data);
|
||||
// remove cooldown
|
||||
m_spellCooldowns.erase(itr);
|
||||
// remove & notify
|
||||
RemoveSpellCooldown(itr->first, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3421,12 +3412,8 @@ void Player::RemoveAllSpellCooldown()
|
||||
if(!m_spellCooldowns.empty())
|
||||
{
|
||||
for(SpellCooldowns::const_iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end(); ++itr)
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(itr->first);
|
||||
data << uint64(GetGUID());
|
||||
GetSession()->SendPacket(&data);
|
||||
}
|
||||
SendClearCooldown(itr->first, this);
|
||||
|
||||
m_spellCooldowns.clear();
|
||||
}
|
||||
}
|
||||
@@ -6453,22 +6440,6 @@ void Player::DuelComplete(DuelCompleteType type)
|
||||
duel->opponent->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_DUEL, 1);
|
||||
}
|
||||
|
||||
// cool-down duel spell
|
||||
/*data.Initialize(SMSG_SPELL_COOLDOWN, 17);
|
||||
|
||||
data<<GetGUID();
|
||||
data<<uint8(0x0);
|
||||
|
||||
data<<(uint32)7266;
|
||||
data<<uint32(0x0);
|
||||
GetSession()->SendPacket(&data);
|
||||
data.Initialize(SMSG_SPELL_COOLDOWN, 17);
|
||||
data<<duel->opponent->GetGUID();
|
||||
data<<uint8(0x0);
|
||||
data<<(uint32)7266;
|
||||
data<<uint32(0x0);
|
||||
duel->opponent->GetSession()->SendPacket(&data);*/
|
||||
|
||||
//Remove Duel Flag object
|
||||
GameObject* obj = GetMap()->GetGameObject(GetUInt64Value(PLAYER_DUEL_ARBITER));
|
||||
if(obj)
|
||||
@@ -21132,3 +21103,11 @@ void Player::RemoveAtLoginFlag( AtLoginFlags f, bool in_db_also /*= false*/ )
|
||||
if(in_db_also)
|
||||
CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(f), GetGUIDLow());
|
||||
}
|
||||
|
||||
void Player::SendClearCooldown( uint32 spell_id, Unit* target )
|
||||
{
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spell_id);
|
||||
data << uint64(target->GetGUID());
|
||||
SendDirectMessage(&data);
|
||||
}
|
||||
|
||||
@@ -1422,6 +1422,8 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
void SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId = 0, Spell* spell = NULL);
|
||||
void ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs );
|
||||
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
|
||||
void SendClearCooldown( uint32 spell_id, Unit* target );
|
||||
|
||||
void RemoveCategoryCooldown(uint32 cat);
|
||||
void RemoveArenaSpellCooldowns();
|
||||
void RemoveAllSpellCooldown();
|
||||
|
||||
@@ -2895,7 +2895,7 @@ void AuraEffect::HandleAuraDummy(bool apply, bool Real, bool changeAmount)
|
||||
if (Real)
|
||||
{
|
||||
// pet auras
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(GetId()))
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex))
|
||||
{
|
||||
if(apply)
|
||||
m_target->AddPetAura(petSpell);
|
||||
|
||||
@@ -1994,7 +1994,7 @@ void Spell::EffectDummy(uint32 i)
|
||||
}
|
||||
|
||||
// pet auras
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id))
|
||||
if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id,i))
|
||||
{
|
||||
m_caster->AddPetAura(petSpell);
|
||||
return;
|
||||
|
||||
+11
-15
@@ -1892,8 +1892,8 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell, pet, aura FROM spell_pet_auras");
|
||||
// 0 1 2 3
|
||||
QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras");
|
||||
if( !result )
|
||||
{
|
||||
|
||||
@@ -1915,10 +1915,11 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
bar.step();
|
||||
|
||||
uint16 spell = fields[0].GetUInt16();
|
||||
uint16 pet = fields[1].GetUInt16();
|
||||
uint16 aura = fields[2].GetUInt16();
|
||||
uint8 eff = fields[1].GetUInt8();
|
||||
uint16 pet = fields[2].GetUInt16();
|
||||
uint16 aura = fields[3].GetUInt16();
|
||||
|
||||
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell);
|
||||
SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff);
|
||||
if(itr != mSpellPetAuraMap.end())
|
||||
{
|
||||
itr->second.AddAura(pet, aura);
|
||||
@@ -1931,14 +1932,9 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell);
|
||||
continue;
|
||||
}
|
||||
int i = 0;
|
||||
for(; i < 3; ++i)
|
||||
if((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA &&
|
||||
spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) ||
|
||||
spellInfo->Effect[i] == SPELL_EFFECT_DUMMY)
|
||||
break;
|
||||
|
||||
if(i == 3)
|
||||
if (spellInfo->Effect[eff] != SPELL_EFFECT_DUMMY &&
|
||||
(spellInfo->Effect[eff] != SPELL_EFFECT_APPLY_AURA ||
|
||||
spellInfo->EffectApplyAuraName[eff] != SPELL_AURA_DUMMY))
|
||||
{
|
||||
sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell);
|
||||
continue;
|
||||
@@ -1951,8 +1947,8 @@ void SpellMgr::LoadSpellPetAuras()
|
||||
continue;
|
||||
}
|
||||
|
||||
PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_PET, spellInfo->CalculateSimpleValue(i));
|
||||
mSpellPetAuraMap[spell] = pa;
|
||||
PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[eff] == TARGET_UNIT_PET, spellInfo->CalculateSimpleValue(eff));
|
||||
mSpellPetAuraMap[(spell<<8) + eff] = pa;
|
||||
}
|
||||
|
||||
++count;
|
||||
|
||||
+3
-3
@@ -593,7 +593,7 @@ class PetAura
|
||||
bool removeOnChangePet;
|
||||
int32 damage;
|
||||
};
|
||||
typedef std::map<uint16, PetAura> SpellPetAuraMap;
|
||||
typedef std::map<uint32, PetAura> SpellPetAuraMap;
|
||||
|
||||
struct SpellArea
|
||||
{
|
||||
@@ -965,9 +965,9 @@ class SpellMgr
|
||||
return mSkillLineAbilityMap.upper_bound(spell_id);
|
||||
}
|
||||
|
||||
PetAura const* GetPetAura(uint16 spell_id)
|
||||
PetAura const* GetPetAura(uint16 spell_id, uint8 eff)
|
||||
{
|
||||
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find(spell_id);
|
||||
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff);
|
||||
if(itr != mSpellPetAuraMap.end())
|
||||
return &itr->second;
|
||||
else
|
||||
|
||||
@@ -12845,33 +12845,6 @@ void Unit::SendPetTalk (uint32 pettalk)
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetSpellCooldown (uint32 spellid, time_t cooltime)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4);
|
||||
data << uint64(GetGUID());
|
||||
data << uint8(0x0); // flags (0x1, 0x2)
|
||||
data << uint32(spellid);
|
||||
data << uint32(cooltime);
|
||||
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetClearCooldown (uint32 spellid)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
if(!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_CLEAR_COOLDOWN, 4+8);
|
||||
data << uint32(spellid);
|
||||
data << uint64(GetGUID());
|
||||
((Player*)owner)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Unit::SendPetAIReaction(uint64 guid)
|
||||
{
|
||||
Unit* owner = GetOwner();
|
||||
@@ -13368,12 +13341,6 @@ void Unit::AddPetAura(PetAura const* petSpell)
|
||||
if(GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
// Aura already added - not need to add it twice
|
||||
// This check is to prevent existing pet having aura applied twice (passive auras can stack)
|
||||
// if aura has more than 1 dummy effect
|
||||
if (m_petAuras.find(petSpell)!= m_petAuras.end())
|
||||
return;
|
||||
|
||||
m_petAuras.insert(petSpell);
|
||||
if(Pet* pet = ((Player*)this)->GetPet())
|
||||
pet->CastPetAura(petSpell);
|
||||
|
||||
@@ -1705,8 +1705,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void SendPetCastFail(uint32 spellid, SpellCastResult msg);
|
||||
void SendPetActionFeedback (uint8 msg);
|
||||
void SendPetTalk (uint32 pettalk);
|
||||
void SendPetSpellCooldown (uint32 spellid, time_t cooltime);
|
||||
void SendPetClearCooldown (uint32 spellid);
|
||||
void SendPetAIReaction(uint64 guid);
|
||||
///----------End of Pet responses methods----------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user