mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[8381] Some refactoring work in Unit::m_currentSpells code.
* Restrict access, use enum args, move some repeated code parts to function. * Make m_selfContainer set only part of Unit::SetCurrentCastedSpell
This commit is contained in:
parent
1b1d013623
commit
74d27294aa
10 changed files with 70 additions and 69 deletions
|
|
@ -240,11 +240,7 @@ void GameObject::Update(uint32 /*p_time*/)
|
|||
Unit* caster = GetOwner();
|
||||
if(caster && caster->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
{
|
||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->SendChannelUpdate(0);
|
||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->finish(false);
|
||||
}
|
||||
caster->FinishSpell(CURRENT_CHANNELED_SPELL);
|
||||
|
||||
WorldPacket data(SMSG_FISH_NOT_HOOKED,0);
|
||||
((Player*)caster)->GetSession()->SendPacket(&data);
|
||||
|
|
@ -1065,11 +1061,7 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
}
|
||||
|
||||
if(player->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
{
|
||||
player->m_currentSpells[CURRENT_CHANNELED_SPELL]->SendChannelUpdate(0);
|
||||
player->m_currentSpells[CURRENT_CHANNELED_SPELL]->finish();
|
||||
}
|
||||
player->FinishSpell(CURRENT_CHANNELED_SPELL);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1100,7 +1092,7 @@ void GameObject::Use(Unit* user)
|
|||
// in case summoning ritual caster is GO creator
|
||||
spellCaster = caster;
|
||||
|
||||
if(!caster->m_currentSpells[CURRENT_CHANNELED_SPELL])
|
||||
if(!caster->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
return;
|
||||
|
||||
spellId = info->summoningRitual.spellId;
|
||||
|
|
@ -1113,8 +1105,7 @@ void GameObject::Use(Unit* user)
|
|||
}
|
||||
|
||||
// finish spell
|
||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->SendChannelUpdate(0);
|
||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->finish();
|
||||
player->FinishSpell(CURRENT_CHANNELED_SPELL);
|
||||
|
||||
// can be deleted now
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue