Core/Auras: Simplified SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS handling
This commit is contained in:
1 parent
3ad20d6bbd
commit
8819f30a12
4 files changed
+23
-63
No files matched your search
@@ -2606,19 +2606,6 @@ class Player : public Unit, public GridObject<Player>
|
||||
VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
|
||||
VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
|
||||
|
||||
// SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS handling
|
||||
void AddSpellSwap(uint32 oldSpell, uint32 newSpell) { _spellSwaps[oldSpell] = newSpell; }
|
||||
void RemoveSpellSwap(uint32 originalSpell) { _spellSwaps.erase(originalSpell); }
|
||||
|
||||
uint32 GetSpellForCast(uint32 spellId) const
|
||||
{
|
||||
std::map<uint32, uint32>::const_iterator itr = _spellSwaps.find(spellId);
|
||||
if (itr != _spellSwaps.end())
|
||||
return itr->second;
|
||||
|
||||
return spellId;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Gamemaster whisper whitelist
|
||||
WhisperListContainer WhisperList;
|
||||
@@ -2947,8 +2934,6 @@ class Player : public Unit, public GridObject<Player>
|
||||
InstanceTimeMap _instanceResetTimes;
|
||||
uint32 _pendingBindId;
|
||||
uint32 _pendingBindTimer;
|
||||
|
||||
std::map<uint32, uint32> _spellSwaps;
|
||||
};
|
||||
|
||||
void AddItemsSetItem(Player*player, Item* item);
|
||||
|
||||
@@ -350,8 +350,6 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (Player* plrMover = mover->ToPlayer())
|
||||
spellId = plrMover->GetSpellForCast(spellId);
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||
if (!spellInfo)
|
||||
@@ -382,6 +380,27 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
}
|
||||
|
||||
Unit::AuraEffectList swaps = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS);
|
||||
Unit::AuraEffectList const& swaps2 = mover->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2);
|
||||
if (!swaps2.empty())
|
||||
swaps.insert(swaps.end(), swaps2.begin(), swaps2.end());
|
||||
|
||||
if (!swaps.empty())
|
||||
{
|
||||
for (Unit::AuraEffectList::const_iterator itr = swaps.begin(); itr != swaps.end(); ++itr)
|
||||
{
|
||||
if ((*itr)->IsAffectingSpell(spellInfo))
|
||||
{
|
||||
if (SpellInfo const* newInfo = sSpellMgr->GetSpellInfo((*itr)->GetAmount()))
|
||||
{
|
||||
spellInfo = newInfo;
|
||||
spellId = newInfo->Id;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
|
||||
// Skip it to prevent "interrupt" message
|
||||
if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
|
||||
|
||||
@@ -385,8 +385,8 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]=
|
||||
&AuraEffect::HandleNULL, //329 SPELL_AURA_MOD_RUNE_REGEN_SPEED
|
||||
&AuraEffect::HandleNULL, //330 SPELL_AURA_CAST_WHILE_WALKING
|
||||
&AuraEffect::HandleNULL, //331 SPELL_AURA_331
|
||||
&AuraEffect::HandleOverrideActionbar, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS
|
||||
&AuraEffect::HandleOverrideActionbar, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2
|
||||
&AuraEffect::HandleNoImmediateEffect, //332 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS implemented in WorldSession::HandleCastSpellOpcode
|
||||
&AuraEffect::HandleNoImmediateEffect, //333 SPELL_AURA_OVERRIDE_ACTIONBAR_SPELLS_2 implemented in WorldSession::HandleCastSpellOpcode
|
||||
&AuraEffect::HandleNULL, //334 SPELL_AURA_334
|
||||
&AuraEffect::HandleNULL, //335 SPELL_AURA_335
|
||||
&AuraEffect::HandleNULL, //336 SPELL_AURA_MOD_FLYING_RESTRICTIONS
|
||||
@@ -5679,49 +5679,6 @@ void AuraEffect::HandlePreventResurrection(AuraApplication const* aurApp, uint8
|
||||
aurApp->GetTarget()->SetByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER);
|
||||
}
|
||||
|
||||
void AuraEffect::HandleOverrideActionbar(AuraApplication const* aurApp, uint8 mode, bool apply) const
|
||||
{
|
||||
if (!(mode & AURA_EFFECT_HANDLE_REAL))
|
||||
return;
|
||||
|
||||
Player* target = aurApp->GetTarget()->ToPlayer();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
uint32 newSpellId = uint32(GetAmount());
|
||||
if (!sSpellMgr->GetSpellInfo(newSpellId))
|
||||
return;
|
||||
|
||||
bool foundAny = false;
|
||||
PlayerSpellMap const& spells = target->GetSpellMap();
|
||||
for (PlayerSpellMap::const_iterator itr = spells.begin(); itr != spells.end(); ++itr)
|
||||
{
|
||||
if (itr->second->state == PLAYERSPELL_REMOVED)
|
||||
continue;
|
||||
|
||||
if (!itr->second->active || itr->second->disabled)
|
||||
continue;
|
||||
|
||||
SpellInfo const* info = sSpellMgr->GetSpellInfo(itr->first);
|
||||
if (!IsAffectingSpell(info))
|
||||
continue;
|
||||
|
||||
foundAny = true;
|
||||
if (apply)
|
||||
target->AddSpellSwap(itr->first, newSpellId);
|
||||
else
|
||||
target->RemoveSpellSwap(itr->first);
|
||||
}
|
||||
|
||||
if (foundAny)
|
||||
{
|
||||
if (apply)
|
||||
target->AddTemporarySpell(newSpellId);
|
||||
else
|
||||
target->RemoveTemporarySpell(newSpellId);
|
||||
}
|
||||
}
|
||||
|
||||
void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const
|
||||
{
|
||||
switch (GetSpellInfo()->SpellFamilyName)
|
||||
|
||||
@@ -280,7 +280,6 @@ class AuraEffect
|
||||
void HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleOverrideActionbar(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
// aura effect periodic tick handlers
|
||||
void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const;
|
||||
|
||||
Reference in new issue
Block a user