mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Update aura system:
* Change system logic - unify Auras, AreaAuras and PersistentAreaAuras: * Aura has now its owner - which is the WorldObject, which applies aura (creates AuraApplication object) dependant on aura radius, and effect type * Owner can be Dynobj (DynObjAura class) for PersistentAreaAuras, or Unit (UnitAura class) for Area and nonArea auras * Aura data is shared for all units which have AuraApplication of the Aura * Because of that AuraEffect handlers , and periodic tick functions can't modify AuraEffect object (they are const now) * Remove spell source and AreaAuraEffect classes * Add AuraEffect::UpdatePeriodic function, to allow periodic aura object modification (target independant) * Add AuraEffect::CalculateAmount and AuraEffect::CalculateSpellMod function, to allow non-default amount calculation * AreaAura updates are done in owner _UpdateSpells cycle * Since now you don't need to wait an aura update cycle to get area aura applied on it's correct target list * And you can access area aura target list * Add basic support for aura amount recalculation * Save recalculation state and base amount of auras to db * Add AuraEffect::CalculatePeriodic function to determine if aura is periodic, and to set correct tick number after aura is loaded from db * Add ChangeAmount function in addition to SetAmount function, to allow easy reapplication of AuraEffect handlers on all targets * Sort aura effect handlers in SpellAuras.cpp and .h by their use * Add check for already existing aura of that type to some AuraEffect handlers, to prevent incorrect effect removal * SPELL_AURA_CONVERT_RUNE and MOD_POWER_REGEN and MOD_REGEN hacky handlers are now implemented correctly * Send aura application client update only once per unit update - prevent unnecesary packet spam * Fix ByteBuffer::appendPackGUID function - it added additionall 0s at the end of the packet * Fix memory leak at player creation (not deleted auras) * Updated some naming conventions (too many to mention) * Added Unit::GetAuraOfRankedSpell() function * Remove procflags on aura remove, use Aura::HandleAuraSpecificMods instead * Added functions to maintain owned auras (GetOwnedAuras, GetOwnedAura, RemoveOwnedAura, etc) * Implement AURA_INTERRUPT_FLAG_LANDING * Implement EffectPlayerNotification (thanks to Spp) * Remove wrong aura 304 handler * Add better handler for death runes * Remove unnecesary variables from DynamicObject class, and cleanup related code, link dynobj duration with aura * Add GetAuraEffectTriggerTarget function in CreatureAi for special target selection for periodic trigger auras used in a script * Add many assert() procection from idiots using some functions in wrong way * I am to lazy to write here anything more Thanks to Visagalis for testing this patch PS: Do not make patches like this, please --HG-- branch : trunk
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
#include "InstanceData.h"
|
||||
#include "AuctionHouseBot.h"
|
||||
#include "CreatureEventAIMgr.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "DBCEnums.h"
|
||||
|
||||
bool ChatHandler::HandleAHBotOptionsCommand(const char *args)
|
||||
@@ -4387,25 +4388,8 @@ bool ChatHandler::HandleAuraCommand(const char *args)
|
||||
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
|
||||
uint32 spellID = extractSpellIdFromLink((char*)args);
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
|
||||
uint8 eff_mask=0;
|
||||
if(spellInfo)
|
||||
{
|
||||
for (uint32 i = 0; i<3; ++i)
|
||||
{
|
||||
uint8 eff = spellInfo->Effect[i];
|
||||
if (eff>=TOTAL_SPELL_EFFECTS)
|
||||
continue;
|
||||
if( IsAreaAuraEffect(eff) ||
|
||||
eff == SPELL_EFFECT_APPLY_AURA ||
|
||||
eff == SPELL_EFFECT_PERSISTENT_AREA_AURA )
|
||||
{
|
||||
eff_mask|=1<<i;
|
||||
}
|
||||
}
|
||||
Aura *Aur = new Aura(spellInfo, eff_mask, target, target, target);
|
||||
target->AddAura(Aur);
|
||||
}
|
||||
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID ))
|
||||
Aura::TryCreate(spellInfo, target, target);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -5117,39 +5101,41 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
|
||||
char const* talentStr = GetTrinityString(LANG_TALENT);
|
||||
char const* passiveStr = GetTrinityString(LANG_PASSIVE);
|
||||
|
||||
Unit::AuraMap const& uAuras = unit->GetAuras();
|
||||
Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras();
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size());
|
||||
for (Unit::AuraMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
|
||||
for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
|
||||
{
|
||||
bool talent = GetTalentSpellCost(itr->second->GetId()) > 0;
|
||||
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
|
||||
|
||||
char const* name = itr->second->GetSpellProto()->SpellName[GetSessionDbcLocale()];
|
||||
AuraApplication const * aurApp = itr->second;
|
||||
Aura const * aura = aurApp->GetBase();
|
||||
char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()];
|
||||
|
||||
if (m_session)
|
||||
{
|
||||
std::ostringstream ss_name;
|
||||
ss_name << "|cffffffff|Hspell:" << itr->second->GetId() << "|h[" << name << "]|h|r";
|
||||
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
|
||||
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
|
||||
itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
|
||||
itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(),
|
||||
aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
|
||||
aura->GetDuration(), aura->GetMaxDuration(),
|
||||
ss_name.str().c_str(),
|
||||
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
|
||||
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
|
||||
(aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
|
||||
IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID()));
|
||||
}
|
||||
else
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
|
||||
itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
|
||||
itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(),
|
||||
aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
|
||||
aura->GetDuration(), aura->GetMaxDuration(),
|
||||
name,
|
||||
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
|
||||
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
|
||||
(aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
|
||||
IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID()));
|
||||
}
|
||||
}
|
||||
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
|
||||
{
|
||||
Unit::AuraEffectList const& uAuraList = unit->GetAurasByType(AuraType(i));
|
||||
Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
|
||||
if (uAuraList.empty()) continue;
|
||||
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
|
||||
for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
|
||||
@@ -7376,9 +7362,8 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
|
||||
}
|
||||
|
||||
//m_session->GetPlayer()->CastSpell(player,spellID,false);
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry( 9454 );
|
||||
Aura *Aur = new Aura(spellInfo, 1, player, player, player);
|
||||
player->AddAura(Aur);
|
||||
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454))
|
||||
Aura::TryCreate(spellInfo, player, player);
|
||||
|
||||
//save player
|
||||
player->SaveToDB();
|
||||
|
||||
Reference in New Issue
Block a user