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:
@@ -170,92 +170,6 @@ Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m)
|
||||
}
|
||||
}
|
||||
|
||||
inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
|
||||
{
|
||||
if(!target->isAlive() || target->isInFlight() )
|
||||
return;
|
||||
|
||||
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
|
||||
return;
|
||||
|
||||
if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius()))
|
||||
return;
|
||||
|
||||
//Check targets for not_selectable unit flag and remove
|
||||
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||
return;
|
||||
|
||||
// Evade target
|
||||
if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode() )
|
||||
return;
|
||||
|
||||
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
|
||||
if( target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
|
||||
return;
|
||||
|
||||
if (i_dynobject.IsAffecting(target))
|
||||
return;
|
||||
|
||||
if(target->HasAura(i_dynobject.GetSpellId(), i_check->GetGUID()))
|
||||
return;
|
||||
|
||||
uint32 eff_index = 0;
|
||||
for (; eff_index < MAX_SPELL_EFFECTS; ++eff_index)
|
||||
if(i_dynobject.HasEffect(eff_index))
|
||||
break;
|
||||
|
||||
if(eff_index == MAX_SPELL_EFFECTS)
|
||||
return;
|
||||
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
|
||||
if(spellInfo->EffectImplicitTargetB[eff_index] == TARGET_DEST_DYNOBJ_ALLY
|
||||
|| spellInfo->EffectImplicitTargetB[eff_index] == TARGET_UNIT_AREA_ALLY_DST)
|
||||
{
|
||||
if(!i_check->IsFriendlyTo(target))
|
||||
return;
|
||||
}
|
||||
else if( i_check->GetTypeId() == TYPEID_PLAYER )
|
||||
{
|
||||
if (i_check->IsFriendlyTo( target ))
|
||||
return;
|
||||
|
||||
i_check->CombatStart(target);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!i_check->IsHostileTo( target ))
|
||||
return;
|
||||
|
||||
i_check->CombatStart(target);
|
||||
}
|
||||
|
||||
// Check target immune to spell or aura
|
||||
if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index))
|
||||
return;
|
||||
|
||||
// Apply PersistentAreaAura on target
|
||||
Aura *aur = new Aura(spellInfo, i_dynobject.GetEffectMask(), target, &i_dynobject, i_check);
|
||||
aur->SetAuraDuration(i_dynobject.GetDuration());
|
||||
if(target->AddAura(aur, true))
|
||||
i_dynobject.AddAffected(target);
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
Trinity::DynamicObjectUpdater::Visit(CreatureMapType &m)
|
||||
{
|
||||
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
VisitHelper(itr->getSource());
|
||||
}
|
||||
|
||||
template<>
|
||||
inline void
|
||||
Trinity::DynamicObjectUpdater::Visit(PlayerMapType &m)
|
||||
{
|
||||
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
|
||||
VisitHelper(itr->getSource());
|
||||
}
|
||||
|
||||
// SEARCHERS & LIST SEARCHERS & WORKERS
|
||||
|
||||
// WorldObject searchers & workers
|
||||
|
||||
Reference in New Issue
Block a user