Core: Use new SpellInfo class in core. Sadly, this commit is not compatibile with some of the custom code. To make your code work again you may need to change:

*SpellEntry is now SpellInfo
*GetSpellProto is now GetSpellInfo
*SpellEntry::Effect*[effIndex] is now avalible under SpellInfo.Effects[effIndex].*
*sSpellStore.LookupEntry is no longer valid, use sSpellMgr->GetSpellInfo()
*SpellFunctions from SpellMgr.h like DoSpellStuff(spellId) are now: spellInfo->DoStuff()
*SpellMgr::CalculateEffectValue and similar functions are now avalible in SpellEffectInfo class.
*GET_SPELL macro is removed, code which used it is moved to SpellMgr::LoadDbcDataCorrections
*code which affected dbc data in SpellMgr::LoadSpellCustomAttr is now moved to LoadDbcDataCorrections
This commit is contained in:
QAston
2011-07-26 23:09:28 +02:00
parent 29c228a801
commit b0fe236265
195 changed files with 4630 additions and 6929 deletions
+9 -5
View File
@@ -18,6 +18,7 @@
#include "CombatAI.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "Vehicle.h"
#include "ObjectAccessor.h"
@@ -62,7 +63,7 @@ int VehicleAI::Permissible(const Creature* /*creature*/)
void CombatAI::InitializeAI()
{
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
if (me->m_spells[i] && GetSpellStore()->LookupEntry(me->m_spells[i]))
if (me->m_spells[i] && sSpellMgr->GetSpellInfo(me->m_spells[i]))
spells.push_back(me->m_spells[i]);
CreatureAI::InitializeAI();
@@ -177,10 +178,12 @@ ArcherAI::ArcherAI(Creature *c) : CreatureAI(c)
if (!me->m_spells[0])
sLog->outError("ArcherAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
m_minRange = GetSpellMinRange(me->m_spells[0], false);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
if (!m_minRange)
m_minRange = MELEE_RANGE;
me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
me->m_CombatDistance = spellInfo ? spellInfo->GetMaxRange(false) : 0;
me->m_SightDistance = me->m_CombatDistance;
}
@@ -224,8 +227,9 @@ TurretAI::TurretAI(Creature *c) : CreatureAI(c)
if (!me->m_spells[0])
sLog->outError("TurretAI set for creature (entry = %u) with spell1=0. AI will do nothing", me->GetEntry());
m_minRange = GetSpellMinRange(me->m_spells[0], false);
me->m_CombatDistance = GetSpellMaxRange(me->m_spells[0], false);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(me->m_spells[0]);
m_minRange = spellInfo ? spellInfo->GetMinRange(false) : 0;
me->m_CombatDistance = spellInfo ? spellInfo->GetMaxRange(false) : 0;
me->m_SightDistance = me->m_CombatDistance;
}
+8 -7
View File
@@ -28,6 +28,7 @@
#include "World.h"
#include "Util.h"
#include "Group.h"
#include "SpellInfo.h"
int PetAI::Permissible(const Creature *creature)
{
@@ -133,7 +134,7 @@ void PetAI::UpdateAI(const uint32 diff)
if (!spellID)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID);
if (!spellInfo)
continue;
@@ -144,21 +145,21 @@ void PetAI::UpdateAI(const uint32 diff)
if (!me->getVictim())
{
// ignore attacking spells, and allow only self/around spells
if (!IsPositiveSpell(spellInfo->Id))
if (!spellInfo->IsPositive())
continue;
// non combat spells allowed
// only pet spells have IsNonCombatSpell and not fit this reqs:
// Consume Shadows, Lesser Invisibility, so ignore checks for its
if (!IsNonCombatSpell(spellInfo))
if (spellInfo->CanBeUsedInCombat())
{
// allow only spell without spell cost or with spell cost but not duration limit
int32 duration = GetSpellDuration(spellInfo);
if ((spellInfo->manaCost || spellInfo->ManaCostPercentage || spellInfo->manaPerSecond) && duration > 0)
int32 duration = spellInfo->GetDuration();
if ((spellInfo->ManaCost || spellInfo->ManaCostPercentage || spellInfo->ManaPerSecond) && duration > 0)
continue;
// allow only spell without cooldown > duration
int32 cooldown = GetSpellRecoveryTime(spellInfo);
int32 cooldown = spellInfo->GetRecoveryTime();
if (cooldown >= 0 && duration >= 0 && cooldown > duration)
continue;
}
@@ -166,7 +167,7 @@ void PetAI::UpdateAI(const uint32 diff)
else
{
// just ignore non-combat spells
if (IsNonCombatSpell(spellInfo))
if (!spellInfo->CanBeUsedInCombat())
continue;
}
+2 -3
View File
@@ -61,13 +61,12 @@ TotemAI::UpdateAI(const uint32 /*diff*/)
return;
// Search spell
SpellEntry const *spellInfo = sSpellStore.LookupEntry(me->ToTotem()->GetSpell());
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(me->ToTotem()->GetSpell());
if (!spellInfo)
return;
// Get spell range
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
float max_range = GetSpellMaxRangeForHostile(srange);
float max_range = spellInfo->GetMaxRange(false);
// SPELLMOD_RANGE not applied in this place just because not existence range mods for attacking totems
+25 -20
View File
@@ -22,6 +22,7 @@
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "CreatureAIImpl.h"
void UnitAI::AttackStart(Unit* victim)
@@ -69,10 +70,15 @@ bool UnitAI::DoSpellAttackIfReady(uint32 spell)
if (me->isAttackReady())
{
if (me->IsWithinCombatRange(me->getVictim(), GetSpellMaxRange(spell, false)))
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell))
{
me->CastSpell(me->getVictim(), spell, false);
me->resetAttackTimer();
if (me->IsWithinCombatRange(me->getVictim(), spellInfo->GetMaxRange(false)))
{
me->CastSpell(me->getVictim(), spell, false);
me->resetAttackTimer();
}
else
return false;
}
else
return false;
@@ -92,7 +98,8 @@ void UnitAI::SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAg
float UnitAI::DoGetSpellMaxRange(uint32 spellId, bool positive)
{
return GetSpellMaxRange(spellId, positive);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
return spellInfo ? spellInfo->GetMaxRange(positive) : 0;
}
void UnitAI::DoAddAuraToAllHostilePlayers(uint32 spellid)
@@ -136,19 +143,19 @@ void UnitAI::DoCast(uint32 spellId)
case AITARGET_VICTIM: target = me->getVictim(); break;
case AITARGET_ENEMY:
{
const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId);
const SpellInfo * spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR3_PLAYERS_ONLY;
//float range = GetSpellMaxRange(spellInfo, false);
target = SelectTarget(SELECT_TARGET_RANDOM, 0, GetSpellMaxRange(spellInfo, false), playerOnly);
target = SelectTarget(SELECT_TARGET_RANDOM, 0, spellInfo->GetMaxRange(false), playerOnly);
break;
}
case AITARGET_ALLY: target = me; break;
case AITARGET_BUFF: target = me; break;
case AITARGET_DEBUFF:
{
const SpellEntry * spellInfo = GetSpellStore()->LookupEntry(spellId);
const SpellInfo * spellInfo = sSpellMgr->GetSpellInfo(spellId);
bool playerOnly = spellInfo->AttributesEx3 & SPELL_ATTR3_PLAYERS_ONLY;
float range = GetSpellMaxRange(spellInfo, false);
float range = spellInfo->GetMaxRange(false);
DefaultTargetSelector targetSelector(me, range, playerOnly, -(int32)spellId);
if (!(spellInfo->Attributes & SPELL_ATTR0_BREAKABLE_BY_DAMAGE)
@@ -169,20 +176,20 @@ void UnitAI::DoCast(uint32 spellId)
void UnitAI::FillAISpellInfo()
{
AISpellInfo = new AISpellInfoType[GetSpellStore()->GetNumRows()];
AISpellInfo = new AISpellInfoType[sSpellMgr->GetSpellInfoStoreSize()];
AISpellInfoType *AIInfo = AISpellInfo;
const SpellEntry * spellInfo;
const SpellInfo * spellInfo;
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i, ++AIInfo)
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i, ++AIInfo)
{
spellInfo = GetSpellStore()->LookupEntry(i);
spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo)
continue;
if (spellInfo->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD)
AIInfo->condition = AICOND_DIE;
else if (IsPassiveSpell(i) || GetSpellDuration(spellInfo) == -1)
else if (spellInfo->IsPassive() || spellInfo->GetDuration() == -1)
AIInfo->condition = AICOND_AGGRO;
else
AIInfo->condition = AICOND_COMBAT;
@@ -190,13 +197,13 @@ void UnitAI::FillAISpellInfo()
if (AIInfo->cooldown < spellInfo->RecoveryTime)
AIInfo->cooldown = spellInfo->RecoveryTime;
if (!GetSpellMaxRange(spellInfo, false))
if (!spellInfo->GetMaxRange(false))
UPDATE_TARGET(AITARGET_SELF)
else
{
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
uint32 targetType = spellInfo->EffectImplicitTargetA[j];
uint32 targetType = spellInfo->Effects[j].TargetA;
if (targetType == TARGET_UNIT_TARGET_ENEMY
|| targetType == TARGET_DST_TARGET_ENEMY)
@@ -204,19 +211,17 @@ void UnitAI::FillAISpellInfo()
else if (targetType == TARGET_UNIT_AREA_ENEMY_DST)
UPDATE_TARGET(AITARGET_ENEMY)
if (spellInfo->Effect[j] == SPELL_EFFECT_APPLY_AURA)
if (spellInfo->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
{
if (targetType == TARGET_UNIT_TARGET_ENEMY)
UPDATE_TARGET(AITARGET_DEBUFF)
else if (IsPositiveSpell(i))
else if (spellInfo->IsPositive())
UPDATE_TARGET(AITARGET_BUFF)
}
}
}
AIInfo->realCooldown = spellInfo->RecoveryTime + spellInfo->StartRecoveryTime;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
if (srange)
AIInfo->maxRange = srange->maxRangeHostile * 3 / 4;
AIInfo->maxRange = spellInfo->GetMaxRange(false) * 3 / 4;
}
}
+3 -3
View File
@@ -27,7 +27,7 @@ class WorldObject;
class Unit;
class Creature;
class Player;
struct SpellEntry;
class SpellInfo;
#define TIME_INTERVAL_LOOK 5000
#define VISIBILITY_RANGE 10000
@@ -111,10 +111,10 @@ class CreatureAI : public UnitAI
virtual void SummonedCreatureDies(Creature* /*summon*/, Unit* /*killer*/) {}
// Called when hit by a spell
virtual void SpellHit(Unit* /*caster*/, SpellEntry const* /*spell*/) {}
virtual void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
// Called when spell hits a target
virtual void SpellHitTarget(Unit* /*target*/, SpellEntry const* /*spell*/) {}
virtual void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
//virtual void AttackedBy(Unit* attacker);
+5 -11
View File
@@ -463,7 +463,7 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
if (canCast)
{
const SpellEntry* tSpell = GetSpellStore()->LookupEntry(action.cast.spellId);
const SpellInfo* tSpell = sSpellMgr->GetSpellInfo(action.cast.spellId);
//Verify that spell exists
if (tSpell)
@@ -1047,7 +1047,7 @@ void CreatureEventAI::MoveInLineOfSight(Unit *who)
CreatureAI::MoveInLineOfSight(who);
}
void CreatureEventAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
void CreatureEventAI::SpellHit(Unit* pUnit, const SpellInfo* pSpell)
{
if (m_bEmptyList)
@@ -1304,7 +1304,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* pSource, Unit*
}
}
bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered)
bool CreatureEventAI::CanCast(Unit* Target, SpellInfo const *Spell, bool Triggered)
{
//No target so we can't cast
if (!Target || !Spell)
@@ -1315,17 +1315,11 @@ bool CreatureEventAI::CanCast(Unit* Target, SpellEntry const *Spell, bool Trigge
return false;
//Check for power
if (!Triggered && me->GetPower((Powers)Spell->powerType) < CalculatePowerCost(Spell, me, GetSpellSchoolMask(Spell)))
return false;
SpellRangeEntry const* tempRange = sSpellRangeStore.LookupEntry(Spell->rangeIndex);
//Spell has invalid range store so we can't use it
if (!tempRange)
if (!Triggered && me->GetPower((Powers)Spell->PowerType) < Spell->CalcPowerCost(me, Spell->GetSchoolMask()))
return false;
//Unit is out of range of this spell
if (!me->IsInRange(Target, tempRange->minRangeHostile, tempRange->maxRangeHostile))
if (!me->IsInRange(Target, Spell->GetMinRange(false), Spell->GetMinRange(true)))
return false;
return true;
+2 -2
View File
@@ -606,7 +606,7 @@ class CreatureEventAI : public CreatureAI
void JustSummoned(Creature* pUnit);
void AttackStart(Unit *who);
void MoveInLineOfSight(Unit *who);
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
void SpellHit(Unit* pUnit, const SpellInfo* pSpell);
void DamageTaken(Unit* done_by, uint32& damage);
void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {}
void UpdateAI(const uint32 diff);
@@ -620,7 +620,7 @@ class CreatureEventAI : public CreatureAI
inline Unit* GetTargetByType(uint32 Target, Unit* pActionInvoker);
void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* target);
bool CanCast(Unit* Target, SpellEntry const *Spell, bool Triggered);
bool CanCast(Unit* Target, SpellInfo const *Spell, bool Triggered);
bool SpawnedEventConditionsCheck(CreatureEventAI_Event const& event);
@@ -24,6 +24,8 @@
#include "ObjectDefines.h"
#include "GridDefines.h"
#include "ConditionMgr.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
// -------------------
void CreatureEventAIMgr::LoadCreatureEventAI_Texts()
@@ -248,7 +250,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_SPELLHIT:
if (temp.spell_hit.spellId)
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -302,7 +304,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case EVENT_T_FRIENDLY_MISSING_BUFF:
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.spell_hit.spellId);
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.spell_hit.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -379,7 +381,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case EVENT_T_BUFFED:
case EVENT_T_TARGET_BUFFED:
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(temp.buffed.spellId);
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(temp.buffed.spellId);
if (!pSpell)
{
sLog->outErrorDb("CreatureEventAI: Creature %u has non-existant SpellID(%u) defined in event %u.", temp.creature_id, temp.spell_hit.spellId, i);
@@ -499,7 +501,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
break;
case ACTION_T_CAST:
{
const SpellEntry *spell = sSpellStore.LookupEntry(action.cast.spellId);
const SpellInfo *spell = sSpellMgr->GetSpellInfo(action.cast.spellId);
if (!spell)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast.spellId);
/* FIXME: temp.raw.param3 not have event tipes with recovery time in it....
@@ -555,7 +557,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_CAST_EVENT:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event.creatureId);
if (!sSpellStore.LookupEntry(action.cast_event.spellId))
if (!sSpellMgr->GetSpellInfo(action.cast_event.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event.spellId);
if (action.cast_event.target >= TARGET_T_END)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
@@ -593,11 +595,11 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
case ACTION_T_CAST_EVENT_ALL:
if (!sObjectMgr->GetCreatureTemplate(action.cast_event_all.creatureId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent creature entry %u.", i, j+1, action.cast_event_all.creatureId);
if (!sSpellStore.LookupEntry(action.cast_event_all.spellId))
if (!sSpellMgr->GetSpellInfo(action.cast_event_all.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.cast_event_all.spellId);
break;
case ACTION_T_REMOVEAURASFROMSPELL:
if (!sSpellStore.LookupEntry(action.remove_aura.spellId))
if (!sSpellMgr->GetSpellInfo(action.remove_aura.spellId))
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses non-existent SpellID %u.", i, j+1, action.remove_aura.spellId);
if (action.remove_aura.target >= TARGET_T_END)
sLog->outErrorDb("CreatureEventAI: Event %u Action %u uses incorrect Target type", i, j+1);
@@ -164,7 +164,7 @@ void ScriptedAI::DoStopAttack()
me->AttackStop();
}
void ScriptedAI::DoCastSpell(Unit* pTarget, SpellEntry const* pSpellInfo, bool bTriggered)
void ScriptedAI::DoCastSpell(Unit* pTarget, SpellInfo const* pSpellInfo, bool bTriggered)
{
if (!pTarget || me->IsNonMeleeSpellCasted(false))
return;
@@ -192,7 +192,7 @@ Creature* ScriptedAI::DoSpawnCreature(uint32 entry, float offsetX, float offsetY
return me->SummonCreature(entry, me->GetPositionX() + offsetX, me->GetPositionY() + offsetY, me->GetPositionZ() + offsetZ, angle, TempSummonType(type), despawntime);
}
SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects)
SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effects)
{
//No target so we can't cast
if (!target)
@@ -203,18 +203,18 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
return false;
//Using the extended script system we first create a list of viable spells
SpellEntry const* apSpell[CREATURE_MAX_SPELLS];
memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellEntry*));
SpellInfo const* apSpell[CREATURE_MAX_SPELLS];
memset(apSpell, 0, CREATURE_MAX_SPELLS * sizeof(SpellInfo*));
uint32 spellCount = 0;
SpellEntry const* tempSpell = NULL;
SpellInfo const* tempSpell = NULL;
SpellRangeEntry const* tempRange = NULL;
//Check if each spell is viable(set it to null if not)
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; i++)
{
tempSpell = sSpellStore.LookupEntry(me->m_spells[i]);
tempSpell = sSpellMgr->GetSpellInfo(me->m_spells[i]);
//This spell doesn't exist
if (!tempSpell)
@@ -238,31 +238,24 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
continue;
//Make sure that the spell uses the requested amount of power
if (powerCostMin && tempSpell->manaCost < powerCostMin)
if (powerCostMin && tempSpell->ManaCost < powerCostMin)
continue;
if (powerCostMax && tempSpell->manaCost > powerCostMax)
if (powerCostMax && tempSpell->ManaCost > powerCostMax)
continue;
//Continue if we don't have the mana to actually cast this spell
if (tempSpell->manaCost > me->GetPower(Powers(tempSpell->powerType)))
continue;
//Get the Range
tempRange = GetSpellRangeStore()->LookupEntry(tempSpell->rangeIndex);
//Spell has invalid range store so we can't use it
if (!tempRange)
if (tempSpell->ManaCost > me->GetPower(Powers(tempSpell->PowerType)))
continue;
//Check if the spell meets our range requirements
if (rangeMin && me->GetSpellMinRangeForTarget(target, tempRange) < rangeMin)
if (rangeMin && me->GetSpellMinRangeForTarget(target, tempSpell) < rangeMin)
continue;
if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempRange) > rangeMax)
if (rangeMax && me->GetSpellMaxRangeForTarget(target, tempSpell) > rangeMax)
continue;
//Check if our target is in range
if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempRange))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempRange))))
if (me->IsWithinDistInMap(target, float(me->GetSpellMinRangeForTarget(target, tempSpell))) || !me->IsWithinDistInMap(target, float(me->GetSpellMaxRangeForTarget(target, tempSpell))))
continue;
//All good so lets add it to the spell list
@@ -277,7 +270,7 @@ SpellEntry const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 me
return apSpell[urand(0, spellCount - 1)];
}
bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spell, bool triggered /*= false*/)
bool ScriptedAI::CanCast(Unit* target, SpellInfo const* spell, bool triggered /*= false*/)
{
//No target so we can't cast
if (!target || !spell)
@@ -288,17 +281,11 @@ bool ScriptedAI::CanCast(Unit* target, SpellEntry const* spell, bool triggered /
return false;
//Check for power
if (!triggered && me->GetPower(Powers(spell->powerType)) < spell->manaCost)
return false;
SpellRangeEntry const* tempRange = GetSpellRangeStore()->LookupEntry(spell->rangeIndex);
//Spell has invalid range store so we can't use it
if (!tempRange)
if (!triggered && me->GetPower(Powers(spell->PowerType)) < spell->ManaCost)
return false;
//Unit is out of range of this spell
if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, tempRange)), float(me->GetSpellMaxRangeForTarget(target, tempRange))))
if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, spell)), float(me->GetSpellMaxRangeForTarget(target, spell))))
return false;
return true;
@@ -28,8 +28,6 @@
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
#define CAST_AI(a, b) (dynamic_cast<a*>(b))
#define GET_SPELL(a) (const_cast<SpellEntry*>(GetSpellStore()->LookupEntry(a)))
class InstanceScript;
class SummonList : public std::list<uint64>
@@ -78,10 +76,10 @@ struct ScriptedAI : public CreatureAI
void SummonedCreatureDespawn(Creature* /*summon*/) {}
// Called when hit by a spell
void SpellHit(Unit* /*caster*/, SpellEntry const* /*spell*/) {}
void SpellHit(Unit* /*caster*/, SpellInfo const* /*spell*/) {}
// Called when spell hits a target
void SpellHitTarget(Unit* /*target*/, SpellEntry const* /*spell*/) {}
void SpellHitTarget(Unit* /*target*/, SpellInfo const* /*spell*/) {}
//Called at waypoint reached or PointMovement end
void MovementInform(uint32 /*type*/, uint32 /*id*/) {}
@@ -123,7 +121,7 @@ struct ScriptedAI : public CreatureAI
void DoStopAttack();
//Cast spell by spell info
void DoCastSpell(Unit* target, SpellEntry const* spellInfo, bool triggered = false);
void DoCastSpell(Unit* target, SpellInfo const* spellInfo, bool triggered = false);
//Plays a sound to all nearby players
void DoPlaySoundToSet(WorldObject* source, uint32 soundId);
@@ -160,10 +158,10 @@ struct ScriptedAI : public CreatureAI
bool HealthAbovePct(uint32 pct) const { return me->HealthAbovePct(pct); }
//Returns spells that meet the specified criteria from the creatures spell list
SpellEntry const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect);
SpellInfo const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect);
//Checks if you can cast the specified spell
bool CanCast(Unit* target, SpellEntry const* spell, bool triggered = false);
bool CanCast(Unit* target, SpellInfo const* spell, bool triggered = false);
void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE);
+2 -2
View File
@@ -606,12 +606,12 @@ void SmartAI::AttackStart(Unit* who)
}
}
void SmartAI::SpellHit(Unit* pUnit, const SpellEntry* pSpell)
void SmartAI::SpellHit(Unit* pUnit, const SpellInfo* pSpell)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT, pUnit, 0, 0, false, pSpell);
}
void SmartAI::SpellHitTarget(Unit* target, const SpellEntry* pSpell)
void SmartAI::SpellHitTarget(Unit* target, const SpellInfo* pSpell)
{
GetScript()->ProcessEventsFor(SMART_EVENT_SPELLHIT_TARGET, target, 0, 0, false, pSpell);
}
+2 -2
View File
@@ -100,10 +100,10 @@ class SmartAI : public CreatureAI
void MoveInLineOfSight(Unit *who);
// Called when hit by a spell
void SpellHit(Unit* pUnit, const SpellEntry* pSpell);
void SpellHit(Unit* pUnit, const SpellInfo* pSpell);
// Called when spell hits a target
void SpellHitTarget(Unit* target, const SpellEntry* pSpell);
void SpellHitTarget(Unit* target, const SpellInfo* pSpell);
// Called at any Damage from any attacker (before damage apply)
void DamageTaken(Unit* done_by, uint32& damage);
@@ -74,7 +74,7 @@ void SmartScript::OnReset()
mLastInvoker = 0;
}
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
if (e == SMART_EVENT_AGGRO)
{
@@ -103,7 +103,7 @@ void SmartScript::ProcessEventsFor(SMART_EVENT e, Unit* unit, uint32 var0, uint3
}
}
void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
//calc random
if (e.GetEventType() != SMART_EVENT_LINK && e.event.event_chance < 100 && e.event.event_chance)
@@ -2164,7 +2164,7 @@ ObjectList* SmartScript::GetWorldObjectsInDist(float dist)
return targets;
}
void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellEntry* spell, GameObject* gob)
void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, uint32 var1, bool bvar, const SpellInfo* spell, GameObject* gob)
{
if (!e.active && e.GetEventType() != SMART_EVENT_LINK)
return;
@@ -40,13 +40,13 @@ class SmartScript
void GetScript();
void FillScript(SmartAIEventList e, WorldObject* obj, AreaTriggerEntry const* at);
void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
void ProcessEventsFor(SMART_EVENT e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
void ProcessEvent(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
bool CheckTimer(SmartScriptHolder const& e) const;
void RecalcTimer(SmartScriptHolder& e, uint32 min, uint32 max);
void UpdateTimer(SmartScriptHolder& e, uint32 const diff);
void InitTimer(SmartScriptHolder& e);
void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellEntry* spell = NULL, GameObject* gob = NULL);
void ProcessAction(SmartScriptHolder& e, Unit* unit = NULL, uint32 var0 = 0, uint32 var1 = 0, bool bvar = false, const SpellInfo* spell = NULL, GameObject* gob = NULL);
ObjectList* GetTargets(SmartScriptHolder const& e, Unit* invoker = NULL);
ObjectList* GetWorldObjectsInDist(float dist);
void InstallTemplate(SmartScriptHolder const& e);
@@ -334,7 +334,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder &e)
case SMART_EVENT_SPELLHIT_TARGET:
if (e.event.spellHit.spell)
{
SpellEntry const* pSpell = sSpellStore.LookupEntry(e.event.spellHit.spell);
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(e.event.spellHit.spell);
if (!pSpell)
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell);
@@ -1311,7 +1311,7 @@ class SmartAIMgr
bool IsSpellValid(SmartScriptHolder const& e, uint32 entry)
{
if (!sSpellStore.LookupEntry(entry))
if (!sSpellMgr->GetSpellInfo(entry))
{
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry);
return false;
@@ -165,7 +165,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(aura.spell_id);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has wrong spell id in value1 (%u), ignored.",
@@ -178,7 +178,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
if (!spellEntry->EffectApplyAuraName[aura.effect_idx])
if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
{
sLog->outErrorDb("Table `achievement_criteria_data` (Entry: %u Type: %u) for data type %s (%u) has non-aura spell effect (ID: %u Effect: %u), ignores.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA?"ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA":"ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
@@ -465,7 +465,7 @@ inline void Battleground::_ProcessJoin(uint32 diff)
if (!aura->IsPermanent()
&& aura->GetDuration() <= 30*IN_MILLISECONDS
&& aurApp->IsPositive()
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
&& (!(aura->GetSpellInfo()->Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
plr->RemoveAura(iter);
else
+6 -5
View File
@@ -18,6 +18,7 @@
#include "ChatLink.h"
#include "SpellMgr.h"
#include "ObjectMgr.h"
#include "SpellInfo.h"
// Supported shift-links (client generated and server side)
// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r
@@ -268,7 +269,7 @@ bool SpellChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |spell command", iss.str().c_str(), spellId);
@@ -405,7 +406,7 @@ bool TradeChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), spellId);
@@ -463,7 +464,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate talent's spell
_spell = sSpellStore.LookupEntry(talentInfo->RankID[0]);
_spell = sSpellMgr->GetSpellInfo(talentInfo->RankID[0]);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |trade command", iss.str().c_str(), talentInfo->RankID[0]);
@@ -495,7 +496,7 @@ bool EnchantmentChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate spell
_spell = sSpellStore.LookupEntry(spellId);
_spell = sSpellMgr->GetSpellInfo(spellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |enchant command", iss.str().c_str(), spellId);
@@ -534,7 +535,7 @@ bool GlyphChatLink::Initialize(std::istringstream& iss)
return false;
}
// Validate glyph's spell
_spell = sSpellStore.LookupEntry(_glyph->SpellId);
_spell = sSpellMgr->GetSpellInfo(_glyph->SpellId);
if (!_spell)
{
sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid spell id %u in |glyph command", iss.str().c_str(), _glyph->SpellId);
+2 -2
View File
@@ -26,7 +26,7 @@ struct ItemLocale;
struct ItemTemplate;
struct ItemRandomSuffixEntry;
struct ItemRandomPropertiesEntry;
struct SpellEntry;
class SpellInfo;
struct AchievementEntry;
struct GlyphPropertiesEntry;
class Quest;
@@ -91,7 +91,7 @@ public:
virtual bool ValidateName(char* buffer, const char* context);
protected:
SpellEntry const* _spell;
SpellInfo const* _spell;
};
// AchievementChatLink - link to quest
+2 -2
View File
@@ -862,7 +862,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
uint32 spellId = extractSpellIdFromLink((char*)args);
if (!spellId || !sSpellStore.LookupEntry(spellId))
if (!spellId || !sSpellMgr->GetSpellInfo(spellId))
return false;
// Check if pet already has it
@@ -874,7 +874,7 @@ bool ChatHandler::HandlePetLearnCommand(const char* args)
}
// Check if spell is valid
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo))
{
PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spellId);
+17 -15
View File
@@ -198,7 +198,7 @@ bool ChatHandler::HandleCooldownCommand(const char *args)
if (!spell_id)
return false;
if (!sSpellStore.LookupEntry(spell_id))
if (!sSpellMgr->GetSpellInfo(spell_id))
{
PSendSysMessage(LANG_UNKNOWN_SPELL, target == m_session->GetPlayer() ? GetTrinityString(LANG_YOU) : tNameLink.c_str());
SetSentErrorMessage(true);
@@ -1000,9 +1000,9 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
uint32 maxResults = sWorld->getIntConfig(CONFIG_MAX_RESULTS_LOOKUP_COMMANDS);
// Search in Spell.dbc
for (uint32 id = 0; id < sSpellStore.GetNumRows(); id++)
for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(id);
if (spellInfo)
{
int loc = GetSessionDbcLocale();
@@ -1036,17 +1036,19 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args)
}
bool known = target && target->HasSpell(id);
bool learn = (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL);
bool learn = (spellInfo->Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL);
SpellInfo const* learnSpellInfo = sSpellMgr->GetSpellInfo(spellInfo->Effects[0].TriggerSpell);
uint32 talentCost = GetTalentSpellCost(id);
bool talent = (talentCost > 0);
bool passive = IsPassiveSpell(id);
bool passive = spellInfo->IsPassive();
bool active = target && target->HasAura(id);
// unit32 used to prevent interpreting uint8 as char at output
// find rank of learned spell for learning spell, or talent rank
uint32 rank = talentCost ? talentCost : sSpellMgr->GetSpellRank(learn ? spellInfo->EffectTriggerSpell[0] : id);
uint32 rank = talentCost ? talentCost : learn ? learnSpellInfo->GetRank() : spellInfo->GetRank();
// send spell in "id - [name, rank N] [talent] [passive] [learn] [known]" format
std::ostringstream ss;
@@ -1915,7 +1917,7 @@ bool ChatHandler::HandleDamageCommand(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);
if (!spellid || !sSpellStore.LookupEntry(spellid))
if (!spellid || !sSpellMgr->GetSpellInfo(spellid))
return false;
m_session->GetPlayer()->SpellNonMeleeDamageLog(target, spellid, damage);
@@ -1955,7 +1957,7 @@ 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);
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID))
if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target);
return true;
@@ -2407,7 +2409,7 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
AuraApplication const* aurApp = itr->second;
Aura const* aura = aurApp->GetBase();
char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()];
char const* name = aura->GetSpellInfo()->SpellName[GetSessionDbcLocale()];
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
@@ -3794,7 +3796,7 @@ bool ChatHandler::HandleCastCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3838,7 +3840,7 @@ bool ChatHandler::HandleCastBackCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
if (!spell || !sSpellStore.LookupEntry(spell))
if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -3872,7 +3874,7 @@ bool ChatHandler::HandleCastDistCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
@@ -3931,7 +3933,7 @@ bool ChatHandler::HandleCastTargetCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = extractSpellIdFromLink((char*)args);
if (!spell || !sSpellStore.LookupEntry(spell))
if (!spell || !sSpellMgr->GetSpellInfo(spell))
{
PSendSysMessage(LANG_COMMAND_NOSPELLFOUND);
SetSentErrorMessage(true);
@@ -4005,7 +4007,7 @@ bool ChatHandler::HandleCastSelfCommand(const char *args)
if (!spell)
return false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo)
return false;
@@ -4502,7 +4504,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
}
//m_session->GetPlayer()->CastSpell(player, spellID, false);
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454))
if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(9454))
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player);
//save player
+3 -2
View File
@@ -21,6 +21,7 @@
#include "Unit.h"
#include "DBCStructure.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
HostileRefManager::~HostileRefManager()
{
@@ -32,7 +33,7 @@ HostileRefManager::~HostileRefManager()
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry const *pThreatSpell, bool pSingleTarget)
void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellInfo const *pThreatSpell, bool pSingleTarget)
{
HostileReference* ref;
@@ -40,7 +41,7 @@ void HostileRefManager::threatAssist(Unit *pVictim, float fThreat, SpellEntry co
ref = getFirst();
while (ref != NULL)
{
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? GetSpellSchoolMask(pThreatSpell) : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
float threat = ThreatCalcHelper::calcThreat(pVictim, iOwner, fThreat, (pThreatSpell ? pThreatSpell->GetSchoolMask() : SPELL_SCHOOL_MASK_NORMAL), pThreatSpell);
if (pVictim == getOwner())
ref->addThreat(threat / size); // It is faster to modify the threat durectly if possible
else
+2 -2
View File
@@ -25,7 +25,7 @@
class Unit;
class ThreatManager;
class HostileReference;
struct SpellEntry;
class SpellInfo;
//=================================================
@@ -42,7 +42,7 @@ class HostileRefManager : public RefManager<Unit, ThreatManager>
// send threat to all my hateres for the pVictim
// The pVictim is hated than by them as well
// use for buffs and healing threat functionality
void threatAssist(Unit *pVictim, float fThreat, SpellEntry const *threatSpell = 0, bool pSingleTarget = false);
void threatAssist(Unit *pVictim, float fThreat, SpellInfo const *threatSpell = 0, bool pSingleTarget = false);
void addTempThreat(float fThreat, bool apply);
+3 -3
View File
@@ -32,7 +32,7 @@
//==============================================================
// The pHatingUnit is not used yet
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
float ThreatCalcHelper::calcThreat(Unit* pHatedUnit, Unit* /*pHatingUnit*/, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
{
if (pThreatSpell)
{
@@ -355,7 +355,7 @@ void ThreatManager::clearReferences()
//============================================================
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellEntry const *pThreatSpell)
void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask, SpellInfo const *pThreatSpell)
{
//function deals with adding threat and adding players and pets into ThreatList
//mobs, NPCs, guards have ThreatList and HateOfflineList
@@ -386,7 +386,7 @@ void ThreatManager::addThreat(Unit* pVictim, float fThreat, SpellSchoolMask scho
Unit *unit = pVictim->GetMisdirectionTarget();
if (unit)
if (Aura* pAura = unit->GetAura(63326)) // Glyph of Vigilance
reducedThreadPercent += SpellMgr::CalculateSpellEffectAmount(pAura->GetSpellProto(), 0);
reducedThreadPercent += pAura->GetSpellInfo()->Effects[0].CalcValue();
float reducedThreat = threat * reducedThreadPercent / 100;
threat -= reducedThreat;
+3 -3
View File
@@ -32,7 +32,7 @@
class Unit;
class Creature;
class ThreatManager;
struct SpellEntry;
class SpellInfo;
#define THREAT_UPDATE_INTERVAL 1 * IN_MILLISECONDS // Server should send threat update to client periodically each second
@@ -42,7 +42,7 @@ struct SpellEntry;
class ThreatCalcHelper
{
public:
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
static float calcThreat(Unit* pHatedUnit, Unit* pHatingUnit, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
};
//==============================================================
@@ -195,7 +195,7 @@ class ThreatManager
void clearReferences();
void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
void addThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
void modifyThreatPercent(Unit *pVictim, int32 iPercent);
float getThreat(Unit *pVictim, bool pAlsoSearchOfflineList = false);
+28 -28
View File
@@ -854,7 +854,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
return false;
}
SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -864,22 +864,22 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
bool targetfound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENTRY_DST ||
spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_AREA_ENTRY_DST ||
spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_AREA_SRC ||
spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_AREA_SRC ||
spellProto->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_AREA_DST ||
spellProto->EffectImplicitTargetB[i] == TARGET_GAMEOBJECT_AREA_DST ||
spellProto->EffectImplicitTargetA[i] == TARGET_DST_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetB[i] == TARGET_DST_NEARBY_ENTRY ||
spellProto->EffectImplicitTargetA[i] == TARGET_UNIT_CONE_ENTRY ||
spellProto->EffectImplicitTargetB[i] == TARGET_UNIT_CONE_ENTRY)
if (spellProto->Effects[i].TargetA == TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->Effects[i].TargetB == TARGET_UNIT_AREA_ENTRY_SRC ||
spellProto->Effects[i].TargetA == TARGET_UNIT_AREA_ENTRY_DST ||
spellProto->Effects[i].TargetB == TARGET_UNIT_AREA_ENTRY_DST ||
spellProto->Effects[i].TargetA == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_AREA_SRC ||
spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_AREA_SRC ||
spellProto->Effects[i].TargetA == TARGET_GAMEOBJECT_AREA_DST ||
spellProto->Effects[i].TargetB == TARGET_GAMEOBJECT_AREA_DST ||
spellProto->Effects[i].TargetA == TARGET_DST_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB == TARGET_DST_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA == TARGET_UNIT_CONE_ENTRY ||
spellProto->Effects[i].TargetB == TARGET_UNIT_CONE_ENTRY)
{
targetfound = true;
//break;
@@ -899,7 +899,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
"TARGET_GAMEOBJECT_AREA_SRC(51), TARGET_GAMEOBJECT_AREA_DST(52)", cond->mSourceEntry);
return false;
}
if ((cond->mConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !IsAllowingDeadTargetSpell(spellProto))
if ((cond->mConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget())
{
sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_ALLOW_DEAD_TARGET", cond->mSourceEntry);
return false;
@@ -917,7 +917,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
}
case CONDITION_SOURCE_TYPE_SPELL:
{
SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -943,7 +943,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
bool bIsItemSpellValid = false;
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
if (SpellEntry const* pSpellInfo = sSpellStore.LookupEntry(pItemProto->Spells[i].SpellId))
if (SpellInfo const* pSpellInfo = sSpellMgr->GetSpellInfo(pItemProto->Spells[i].SpellId))
{
if (pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
pItemProto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)
@@ -954,10 +954,10 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
for (int j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (pSpellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
pSpellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_TARGET_ENEMY ||
pSpellInfo->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ANY ||
pSpellInfo->EffectImplicitTargetB[j] == TARGET_UNIT_TARGET_ANY)
if (pSpellInfo->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
pSpellInfo->Effects[j].TargetB == TARGET_UNIT_TARGET_ENEMY ||
pSpellInfo->Effects[j].TargetA == TARGET_UNIT_TARGET_ANY ||
pSpellInfo->Effects[j].TargetB == TARGET_UNIT_TARGET_ANY)
{
bIsItemSpellValid = true;
break;
@@ -1005,7 +1005,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `creature_template`, ignoring.", cond->mSourceGroup);
return false;
}
SpellEntry const* spellProto = sSpellStore.LookupEntry(cond->mSourceEntry);
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->mSourceEntry);
if (!spellProto)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->mSourceEntry);
@@ -1034,7 +1034,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
{
case CONDITION_AURA:
{
if (!sSpellStore.LookupEntry(cond->mConditionValue1))
if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
@@ -1151,7 +1151,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_NO_AURA:
{
if (!sSpellStore.LookupEntry(cond->mConditionValue1))
if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Aura condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
@@ -1320,7 +1320,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
}
case CONDITION_SPELL:
{
if (!sSpellStore.LookupEntry(cond->mConditionValue1))
if (!sSpellMgr->GetSpellInfo(cond->mConditionValue1))
{
sLog->outErrorDb("Spell condition has non existing spell (Id: %d), skipped", cond->mConditionValue1);
return false;
+1 -1
View File
@@ -78,7 +78,7 @@ void DisableMgr::LoadDisables()
{
case DISABLE_TYPE_SPELL:
{
if (!(sSpellStore.LookupEntry(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
if (!(sSpellMgr->GetSpellInfo(entry) || flags & SPELL_DISABLE_DEPRECATED_SPELL))
{
sLog->outErrorDb("Spell entry %u from `disables` doesn't exist in dbc, skipped.", entry);
continue;
+1 -2
View File
@@ -400,7 +400,7 @@ void LoadDBCStores(const std::string& dataPath)
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
if (spellInfo && IsPassiveSpell(spellInfo->Id))
if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
@@ -860,7 +860,6 @@ uint32 const* GetTalentTabPages(uint8 cls)
// script support functions
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore() { return &sSoundEntriesStore; }
DBCStorage <SpellEntry> const* GetSpellStore() { return &sSpellStore; }
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore() { return &sSpellRangeStore; }
DBCStorage <FactionEntry> const* GetFactionStore() { return &sFactionStore; }
DBCStorage <ItemEntry> const* GetItemDisplayStore() { return &sItemStore; }
-1
View File
@@ -173,7 +173,6 @@ void LoadDBCStores(const std::string& dataPath);
// script support functions
DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
DBCStorage <SpellEntry> const* GetSpellStore();
DBCStorage <SpellRangeEntry> const* GetSpellRangeStore();
DBCStorage <FactionEntry> const* GetFactionStore();
DBCStorage <ItemEntry> const* GetItemDisplayStore();
+4 -8
View File
@@ -1491,7 +1491,7 @@ struct SpellEntry
uint32 AttributesEx4; // 8 m_attributesExD
uint32 AttributesEx5; // 9 m_attributesExE
uint32 AttributesEx6; // 10 m_attributesExF
uint32 AttributesEx7; // 11 3.2.0 (0x20 - totems, 0x4 - paladin auras, etc...)
uint32 AttributesEx7; // 11 m_attributesExG
uint32 Stances; // 12 m_shapeshiftMask
// uint32 unk_320_2; // 13 3.2.0
uint32 StancesNot; // 14 m_shapeshiftExclude
@@ -1589,10 +1589,6 @@ struct SpellEntry
float EffectBonusMultiplier[MAX_SPELL_EFFECTS]; // 229-231 3.2.0
//uint32 spellDescriptionVariableID; // 232 3.2.0
//uint32 SpellDifficultyId; // 233 3.3.0
private:
// prevent creating custom entries (copy data from original in fact)
SpellEntry(SpellEntry const&); // DON'T must have implementation
};
typedef std::set<uint32> SpellCategorySet;
@@ -1624,9 +1620,9 @@ struct SpellFocusObjectEntry
struct SpellRadiusEntry
{
uint32 ID;
float radiusHostile;
float radiusMin;
//uint32 Unk //always 0
float radiusFriend;
float radiusMax;
};
struct SpellRangeEntry
@@ -1635,7 +1631,7 @@ struct SpellRangeEntry
float minRangeHostile;
float minRangeFriend;
float maxRangeHostile;
float maxRangeFriend; //friend means unattackable unit here
float maxRangeFriend;
uint32 type;
//char* Name[16]; // 7-23 unused
// 24 string flags, unused
+24 -27
View File
@@ -1641,7 +1641,7 @@ void Creature::DespawnOrUnsummon(uint32 msTimeToDespawn /*= 0*/)
ForcedDespawn(msTimeToDespawn);
}
bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
{
if (!spellInfo)
return false;
@@ -1652,18 +1652,18 @@ bool Creature::IsImmunedToSpell(SpellEntry const* spellInfo)
return Unit::IsImmunedToSpell(spellInfo);
}
bool Creature::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->EffectMechanic[index] - 1)))
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1)))
return true;
if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effect[index] == SPELL_EFFECT_HEAL)
if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
return true;
return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
SpellInfo const *Creature::reachWithSpellAttack(Unit *pVictim)
{
if (!pVictim)
return NULL;
@@ -1672,7 +1672,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
{
if (!m_spells[i])
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
@@ -1682,10 +1682,10 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
bool bcontinue = true;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
if ((spellInfo->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE) ||
(spellInfo->Effect[j] == SPELL_EFFECT_INSTAKILL) ||
(spellInfo->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
(spellInfo->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) ||
(spellInfo->Effects[j].Effect == SPELL_EFFECT_INSTAKILL) ||
(spellInfo->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) ||
(spellInfo->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
)
{
bcontinue = false;
@@ -1694,14 +1694,11 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
}
if (bcontinue) continue;
if (spellInfo->manaCost > GetPower(POWER_MANA))
if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
float range = GetSpellMaxRangeForHostile(srange);
float minrange = GetSpellMinRangeForHostile(srange);
float range = spellInfo->GetMaxRange(false);
float minrange = spellInfo->GetMinRange(false);
float dist = GetDistance(pVictim);
//if (!isInFront(pVictim, range) && spellInfo->AttributesEx)
// continue;
if (dist > range || dist < minrange)
continue;
if (spellInfo->PreventionType == SPELL_PREVENTION_TYPE_SILENCE && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED))
@@ -1713,7 +1710,7 @@ SpellEntry const *Creature::reachWithSpellAttack(Unit *pVictim)
return NULL;
}
SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
SpellInfo const *Creature::reachWithSpellCure(Unit *pVictim)
{
if (!pVictim)
return NULL;
@@ -1722,7 +1719,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
{
if (!m_spells[i])
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_spells[i]);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %i", m_spells[i]);
@@ -1732,7 +1729,7 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
bool bcontinue = true;
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; j++)
{
if ((spellInfo->Effect[j] == SPELL_EFFECT_HEAL))
if ((spellInfo->Effects[j].Effect == SPELL_EFFECT_HEAL))
{
bcontinue = false;
break;
@@ -1740,11 +1737,11 @@ SpellEntry const *Creature::reachWithSpellCure(Unit *pVictim)
}
if (bcontinue) continue;
if (spellInfo->manaCost > GetPower(POWER_MANA))
if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue;
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);
float range = GetSpellMaxRangeForFriend(srange);
float minrange = GetSpellMinRangeForFriend(srange);
float range = spellInfo->GetMaxRange(true);
float minrange = spellInfo->GetMinRange(true);
float dist = GetDistance(pVictim);
//if (!isInFront(pVictim, range) && spellInfo->AttributesEx)
// continue;
@@ -2075,7 +2072,7 @@ bool Creature::LoadCreaturesAddon(bool reload)
{
for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr)
{
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(*itr);
SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr);
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr);
@@ -2158,11 +2155,11 @@ void Creature::_AddCreatureCategoryCooldown(uint32 category, time_t apply_time)
void Creature::AddCreatureSpellCooldown(uint32 spellid)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
return;
uint32 cooldown = GetSpellRecoveryTime(spellInfo);
uint32 cooldown = spellInfo->GetRecoveryTime();
if (Player *modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown);
@@ -2175,7 +2172,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid)
bool Creature::HasCategoryCooldown(uint32 spell_id) const
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
return false;
+5 -5
View File
@@ -29,7 +29,7 @@
#include <list>
struct SpellEntry;
class SpellInfo;
class CreatureAI;
class Quest;
@@ -458,9 +458,9 @@ class Creature : public Unit, public GridObject<Creature>
bool isCanInteractWithBattleMaster(Player* player, bool msg) const;
bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const;
bool canCreatureAttack(Unit const *pVictim, bool force = true) const;
bool IsImmunedToSpell(SpellEntry const* spellInfo);
bool IsImmunedToSpell(SpellInfo const* spellInfo);
// redefine Unit::IsImmunedToSpell
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
// redefine Unit::IsImmunedToSpellEffect
bool isElite() const
{
@@ -570,8 +570,8 @@ class Creature : public Unit, public GridObject<Creature>
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
SpellEntry const *reachWithSpellAttack(Unit *pVictim);
SpellEntry const *reachWithSpellCure(Unit *pVictim);
SpellInfo const *reachWithSpellAttack(Unit *pVictim);
SpellInfo const *reachWithSpellCure(Unit *pVictim);
uint32 m_spells[CREATURE_MAX_SPELLS];
CreatureSpellCooldowns m_CreatureSpellCooldowns;
@@ -23,7 +23,7 @@
class Unit;
class Aura;
struct SpellEntry;
class SpellInfo;
enum DynamicObjectType
{
@@ -928,21 +928,11 @@ void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
return;
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
SpellInfo const* trapSpell = sSpellMgr->GetSpellInfo(trapInfo->trap.spellId);
if (!trapSpell) // checked at load already
return;
float range;
SpellRangeEntry const* srentry = sSpellRangeStore.LookupEntry(trapSpell->rangeIndex);
if (GetSpellMaxRangeForHostile(srentry) == GetSpellMaxRangeForFriend(srentry))
range = GetSpellMaxRangeForHostile(srentry);
else
// get owner to check hostility of GameObject
if (Unit *owner = GetOwner())
range = (float)owner->GetSpellMaxRangeForTarget(target, srentry);
else
// if no owner assume that object is hostile to target
range = GetSpellMaxRangeForHostile(srentry);
float range = float(target->GetSpellMaxRangeForTarget(GetOwner(), trapSpell));
// search nearest linked GO
GameObject* trapGO = NULL;
@@ -1593,7 +1583,7 @@ void GameObject::Use(Unit* user)
if (!spellId)
return;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
if (user->GetTypeId() != TYPEID_PLAYER || !sOutdoorPvPMgr->HandleCustomSpell(user->ToPlayer(), spellId, this))
@@ -1611,14 +1601,14 @@ void GameObject::Use(Unit* user)
void GameObject::CastSpell(Unit* target, uint32 spellId)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return;
bool self = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_CASTER)
if (spellInfo->Effects[i].TargetA == TARGET_UNIT_CASTER)
{
self = true;
break;
@@ -1633,7 +1623,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
}
//summon world trigger
Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, GetSpellCastTime(spellInfo) + 100);
Creature* trigger = SummonTrigger(GetPositionX(), GetPositionY(), GetPositionZ(), 0, spellInfo->CalcCastTime() + 100);
if (!trigger)
return;
+4 -3
View File
@@ -23,6 +23,7 @@
#include "DatabaseEnv.h"
#include "ItemEnchantmentMgr.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "ScriptMgr.h"
#include "ConditionMgr.h"
@@ -93,7 +94,7 @@ void AddItemsSetItem(Player* player, Item* item)
{
if (!eff->spells[y]) // free slot
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(set->spells[x]);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(set->spells[x]);
if (!spellInfo)
{
sLog->outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x], setid);
@@ -833,7 +834,7 @@ InventoryResult Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const
return EQUIP_ERR_OK;
}
bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
{
ItemTemplate const* proto = GetTemplate();
@@ -842,7 +843,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
// Special case - accept vellum for armor/weapon requirements
if ((spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && proto->IsArmorVellum())
||(spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && proto->IsWeaponVellum()))
if (sSpellMgr->IsSkillTypeSpell(spellInfo->Id, SKILL_ENCHANTING)) // only for enchanting spells
if (spellInfo->IsAbilityOfSkillType(SKILL_ENCHANTING)) // only for enchanting spells
return true;
if (spellInfo->EquippedItemClass != int32(proto->Class))
+3 -3
View File
@@ -25,7 +25,7 @@
#include "ItemPrototype.h"
#include "DatabaseEnv.h"
struct SpellEntry;
class SpellInfo;
class Bag;
class Unit;
@@ -33,7 +33,7 @@ struct ItemSetEffect
{
uint32 setid;
uint32 item_count;
SpellEntry const *spells[8];
SpellInfo const *spells[8];
};
enum InventoryResult
@@ -267,7 +267,7 @@ class Item : public Object
bool HasEnchantRequiredSkill(const Player *pPlayer) const;
uint32 GetEnchantRequiredLevel() const;
bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const;
bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const;
bool IsTargetValidForItemUse(Unit* pUnitTarget);
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
bool GemsFitSockets() const;
+38 -67
View File
@@ -138,9 +138,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
return false;
uint32 summon_spell_id = fields[15].GetUInt32();
SpellEntry const* spellInfo = sSpellStore.LookupEntry(summon_spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id);
bool is_temporary_summoned = spellInfo && GetSpellDuration(spellInfo) > 0;
bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0;
// check temporary summoned pets like mage water elemental
if (current && is_temporary_summoned)
@@ -632,45 +632,6 @@ HappinessState Pet::GetHappinessState()
return CONTENT;
}
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
{
uint8 activecount = 1;
uint32 chainstartstore[ACTIVE_SPELLS_MAX];
if (IsPassiveSpell(spellid))
return true;
chainstartstore[0] = sSpellMgr->GetFirstSpellInChain(spellid);
for (PetSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
if (itr->second.state == PETSPELL_REMOVED)
continue;
if (IsPassiveSpell(itr->first))
continue;
uint32 chainstart = sSpellMgr->GetFirstSpellInChain(itr->first);
uint8 x;
for (x = 0; x < activecount; x++)
{
if (chainstart == chainstartstore[x])
break;
}
if (x == activecount) //spellchain not yet saved -> add active count
{
++activecount;
if (activecount > ACTIVE_SPELLS_MAX)
return false;
chainstartstore[x] = chainstart;
}
}
return true;
}
void Pet::Remove(PetSaveMode mode, bool returnreagent)
{
m_owner->RemovePet(this, mode, returnreagent);
@@ -1088,7 +1049,7 @@ void Pet::_LoadSpellCooldowns()
uint32 spell_id = fields[0].GetUInt32();
time_t db_time = time_t(fields[1].GetUInt32());
if (!sSpellStore.LookupEntry(spell_id))
if (!sSpellMgr->GetSpellInfo(spell_id))
{
sLog->outError("Pet %u have unknown spell %u in `pet_spell_cooldown`, skipping.", m_charmInfo->GetPetNumber(), spell_id);
continue;
@@ -1205,15 +1166,15 @@ void Pet::_LoadAuras(uint32 timediff)
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if (!spellproto)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
continue;
}
// negative effects should continue counting down after logout
if (remaintime != -1 && !IsPositiveSpell(spellid))
if (remaintime != -1 && !spellInfo->IsPositive())
{
if (remaintime/IN_MILLISECONDS <= int32(timediff))
continue;
@@ -1222,15 +1183,15 @@ void Pet::_LoadAuras(uint32 timediff)
}
// prevent wrong values of remaincharges
if (spellproto->procCharges)
if (spellInfo->ProcCharges)
{
if (remaincharges <= 0 || remaincharges > spellproto->procCharges)
remaincharges = spellproto->procCharges;
if (remaincharges <= 0 || remaincharges > spellInfo->ProcCharges)
remaincharges = spellInfo->ProcCharges;
}
else
remaincharges = 0;
if (Aura* aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
if (!aura->CanBeSaved())
{
@@ -1239,7 +1200,7 @@ void Pet::_LoadAuras(uint32 timediff)
}
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
sLog->outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -1289,7 +1250,7 @@ void Pet::_SaveAuras(SQLTransaction& trans)
bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do pet spell book cleanup
@@ -1318,9 +1279,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
itr->second.state = PETSPELL_UNCHANGED;
if (active == ACT_ENABLED)
ToggleAutocast(spell_id, true);
ToggleAutocast(spellInfo, true);
else if (active == ACT_DISABLED)
ToggleAutocast(spell_id, false);
ToggleAutocast(spellInfo, false);
return false;
}
@@ -1334,7 +1295,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
if (active == ACT_DECIDE) // active was not used before, so we save it's autocast/passive state here
{
if (IsAutocastableSpell(spell_id))
if (spellInfo->IsAutocastable())
newspell.active = ACT_DISABLED;
else
newspell.active = ACT_PASSIVE;
@@ -1361,27 +1322,32 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
}
}
}
else if (sSpellMgr->GetSpellRank(spell_id) != 0)
else if (spellInfo->IsRanked())
{
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second.state == PETSPELL_REMOVED) continue;
if (sSpellMgr->IsRankSpellDueToSpell(spellInfo, itr2->first))
SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first);
if (!oldRankSpellInfo)
continue;
if (spellInfo->IsDifferentRankOf(oldRankSpellInfo))
{
// replace by new high rank
if (sSpellMgr->IsHighRankOfSpell(spell_id, itr2->first))
if (spellInfo->IsHighRankOf(oldRankSpellInfo))
{
newspell.active = itr2->second.active;
if (newspell.active == ACT_ENABLED)
ToggleAutocast(itr2->first, false);
ToggleAutocast(oldRankSpellInfo, false);
unlearnSpell(itr2->first, false, false);
break;
}
// ignore new lesser rank
else if (sSpellMgr->IsHighRankOfSpell(itr2->first, spell_id))
else
return false;
}
}
@@ -1389,13 +1355,13 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
m_spells[spell_id] = newspell;
if (IsPassiveSpell(spell_id) && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))))
if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
CastSpell(this, spell_id, true);
else
m_charmInfo->AddSpellToActionBar(spell_id);
m_charmInfo->AddSpellToActionBar(spellInfo);
if (newspell.active == ACT_ENABLED)
ToggleAutocast(spell_id, true);
ToggleAutocast(spellInfo, true);
uint32 talentCost = GetTalentSpellCost(spell_id);
if (talentCost)
@@ -1450,12 +1416,12 @@ void Pet::InitLevelupSpellsForLevel()
{
for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i)
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(defSpells->spellid[i]);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(defSpells->spellid[i]);
if (!spellEntry)
continue;
// will called first if level down
if (spellEntry->spellLevel > level)
if (spellEntry->SpellLevel > level)
unlearnSpell(spellEntry->Id, true);
// will called if level up
else
@@ -1539,7 +1505,10 @@ void Pet::CleanupActionBar()
if (!HasSpell(ab->GetAction()))
m_charmInfo->SetActionBar(i, 0, ACT_PASSIVE);
else if (ab->GetType() == ACT_ENABLED)
ToggleAutocast(ab->GetAction(), true);
{
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(ab->GetAction()))
ToggleAutocast(spellInfo, true);
}
}
}
@@ -1735,11 +1704,13 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint8 level)
return points;
}
void Pet::ToggleAutocast(uint32 spellid, bool apply)
void Pet::ToggleAutocast(SpellInfo const* spellInfo, bool apply)
{
if (!IsAutocastableSpell(spellid))
if (!spellInfo->IsAutocastable())
return;
uint32 spellid = spellInfo->Id;
PetSpellMap::iterator itr = m_spells.find(spellid);
if (itr == m_spells.end())
return;
+1 -2
View File
@@ -176,8 +176,7 @@ class Pet : public Guardian
void UpdateDamagePhysical(WeaponAttackType attType);
*/
bool CanTakeMoreActiveSpells(uint32 SpellIconID);
void ToggleAutocast(uint32 spellid, bool apply);
void ToggleAutocast(SpellInfo const* spellInfo, bool apply);
bool HasSpell(uint32 spell) const;
+112 -110
View File
@@ -3298,7 +3298,7 @@ void Player::SendInitialSpells()
data << uint16(spellCooldowns);
for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr)
{
SpellEntry const *sEntry = sSpellStore.LookupEntry(itr->first);
SpellInfo const *sEntry = sSpellMgr->GetSpellInfo(itr->first);
if (!sEntry)
continue;
@@ -3406,7 +3406,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time)
bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
@@ -3469,7 +3469,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning)
bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled, bool loading /*=false*/)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
{
// do character spell book cleanup (all characters)
@@ -3513,7 +3513,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
{
uint32 next_active_spell_id = 0;
// fix activate state for non-stackable low rank (and find next spell for !active case)
if (!SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
if (!spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
if (uint32 next = sSpellMgr->GetNextSpellInChain(spell_id))
{
@@ -3557,7 +3557,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (active)
{
if (IsPassiveSpell(spell_id) && IsNeedCastPassiveSpellAtLearn(spellInfo))
if (spellInfo->IsPassive() && IsNeedCastPassiveSpellAtLearn(spellInfo))
CastSpell (this, spell_id, true);
}
else if (IsInWorld())
@@ -3648,19 +3648,19 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
newspell->disabled = disabled;
// replace spells in action bars and spellbook to bigger rank if only one spell rank must be accessible
if (newspell->active && !newspell->disabled && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
if (newspell->active && !newspell->disabled && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked() != 0)
{
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{
if (itr2->second->state == PLAYERSPELL_REMOVED) continue;
SpellEntry const *i_spellInfo = sSpellStore.LookupEntry(itr2->first);
SpellInfo const *i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first);
if (!i_spellInfo) continue;
if (sSpellMgr->IsRankSpellDueToSpell(spellInfo, itr2->first))
if (spellInfo->IsDifferentRankOf(i_spellInfo))
{
if (itr2->second->active)
{
if (sSpellMgr->IsHighRankOfSpell(spell_id, itr2->first))
if (spellInfo->IsHighRankOf(i_spellInfo))
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@@ -3676,7 +3676,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
itr2->second->state = PLAYERSPELL_CHANGED;
superceded_old = true; // new spell replace old in action bars and spell book.
}
else if (sSpellMgr->IsHighRankOfSpell(itr2->first, spell_id))
else
{
if (IsInWorld()) // not send spell (re-/over-)learn packets at loading
{
@@ -3707,18 +3707,18 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// cast talents with SPELL_EFFECT_LEARN_SPELL (other dependent spells will learned later as not auto-learned)
// note: all spells with SPELL_EFFECT_LEARN_SPELL isn't passive
if (!loading && talentCost > 0 && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_LEARN_SPELL))
if (!loading && talentCost > 0 && spellInfo->HasEffect(SPELL_EFFECT_LEARN_SPELL))
{
// ignore stance requirement for talent learn spell (stance set for spell only for client spell description show)
CastSpell(this, spell_id, true);
}
// also cast passive spells (including all talents without SPELL_EFFECT_LEARN_SPELL) with additional checks
else if (IsPassiveSpell(spell_id))
else if (spellInfo->IsPassive())
{
if (IsNeedCastPassiveSpellAtLearn(spellInfo))
CastSpell(this, spell_id, true);
}
else if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_SKILL_STEP))
else if (spellInfo->HasEffect(SPELL_EFFECT_SKILL_STEP))
{
CastSpell(this, spell_id, true);
return false;
@@ -3730,7 +3730,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
// update free primary prof.points (if any, can be none in case GM .learn prof. learning)
if (uint32 freeProfs = GetFreePrimaryProfessionPoints())
{
if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(spell_id))
if (spellInfo->IsPrimaryProfessionFirstRank())
SetFreePrimaryProfessions(freeProfs-1);
}
@@ -3767,8 +3767,8 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
if (!Has310Flyer(false) && pSkill->id == SKILL_MOUNTS)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
SpellMgr::CalculateSpellEffectAmount(spellInfo, i) == 310)
if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
spellInfo->Effects[i].CalcValue() == 310)
SetHas310Flyer(true);
if (HasSkill(pSkill->id))
@@ -3854,7 +3854,7 @@ void Player::RemoveTemporarySpell(uint32 spellId)
m_spells.erase(itr);
}
bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
bool Player::IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const
{
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
@@ -3863,7 +3863,7 @@ bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
(!form && (spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT)));
//Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState)));
}
void Player::learnSpell(uint32 spell_id, bool dependent)
@@ -3887,12 +3887,11 @@ void Player::learnSpell(uint32 spell_id, bool dependent)
// learn all disabled higher ranks and required spells (recursive)
if (disabled)
{
SpellChainNode const* node = sSpellMgr->GetSpellChainNode(spell_id);
if (node)
if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
{
PlayerSpellMap::iterator iter = m_spells.find(node->next);
PlayerSpellMap::iterator iter = m_spells.find(nextSpell);
if (iter != m_spells.end() && iter->second->disabled)
learnSpell(node->next, false);
learnSpell(nextSpell, false);
}
SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spell_id);
@@ -3915,10 +3914,10 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
return;
// unlearn non talent higher ranks (recursive)
if (SpellChainNode const* node = sSpellMgr->GetSpellChainNode(spell_id))
if (uint32 nextSpell = sSpellMgr->GetNextSpellInChain(spell_id))
{
if (HasSpell(node->next) && !GetTalentSpellPos(node->next))
removeSpell(node->next, disabled, false);
if (HasSpell(nextSpell) && !GetTalentSpellPos(nextSpell))
removeSpell(nextSpell, disabled, false);
}
//unlearn spells dependent from recently removed spells
SpellsRequiringSpellMapBounds spellsRequiringSpell = sSpellMgr->GetSpellsRequiringSpellBounds(spell_id);
@@ -3970,7 +3969,8 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
}
// update free primary prof.points (if not overflow setting, can be in case GM use before .learn prof. learning)
if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(spell_id))
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (spellInfo && spellInfo->IsPrimaryProfessionFirstRank())
{
uint32 freeProfs = GetFreePrimaryProfessionPoints()+1;
if (freeProfs <= sWorld->getIntConfig(CONFIG_MAX_PRIMARY_TRADE_SKILL))
@@ -4041,10 +4041,10 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// most likely will never be used, haven't heard of cases where players unlearn a mount
if (Has310Flyer(false) && _spell_idx->second->skillId == SKILL_MOUNTS)
{
SpellEntry const *pSpellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *pSpellInfo = sSpellMgr->GetSpellInfo(spell_id);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
SpellMgr::CalculateSpellEffectAmount(pSpellInfo, i) == 310)
if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
pSpellInfo->Effects[i].CalcValue() == 310)
Has310Flyer(true, spell_id); // with true as first argument its also used to set/remove the flag
}
}
@@ -4059,9 +4059,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// activate lesser rank in spellbook/action bar, and cast it if need
bool prev_activate = false;
if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain (spell_id))
if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain(spell_id))
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
// if talent then lesser rank also talent and need learn
if (talentCosts)
@@ -4071,7 +4071,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank)
// learnSpell(prev_id, false);
}
// if ranked non-stackable spell: need activate lesser rank and update dendence state
else if (cur_active && !SpellMgr::canStackSpellRanks(spellInfo) && sSpellMgr->GetSpellRank(spellInfo->Id) != 0)
else if (cur_active && !spellInfo->IsStackableWithRanks() && spellInfo->IsRanked())
{
// need manually update dependence state (learn spell ignore like attempts)
PlayerSpellMap::iterator prev_itr = m_spells.find(prev_id);
@@ -4125,7 +4125,7 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
else
{
SetHas310Flyer(false);
SpellEntry const *pSpellInfo;
SpellInfo const *pSpellInfo;
for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
{
if (itr->first == excludeSpellId)
@@ -4137,10 +4137,10 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId)
if (_spell_idx->second->skillId != SKILL_MOUNTS)
break; // We can break because mount spells belong only to one skillline (at least 310 flyers do)
pSpellInfo = sSpellStore.LookupEntry(itr->first);
pSpellInfo = sSpellMgr->GetSpellInfo(itr->first);
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (pSpellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
SpellMgr::CalculateSpellEffectAmount(pSpellInfo, i) == 310)
if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED &&
pSpellInfo->Effects[i].CalcValue() == 310)
{
SetHas310Flyer(true);
return true;
@@ -4194,7 +4194,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns)
{
next = itr;
++next;
SpellEntry const* entry = sSpellStore.LookupEntry(itr->first);
SpellInfo const* entry = sSpellMgr->GetSpellInfo(itr->first);
// check if spellentry is present and if the cooldown is less or equal to 10 min
if (entry &&
entry->RecoveryTime <= 10 * MINUTE * IN_MILLISECONDS &&
@@ -4246,7 +4246,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result)
uint32 item_id = fields[1].GetUInt32();
time_t db_time = time_t(fields[2].GetUInt32());
if (!sSpellStore.LookupEntry(spell_id))
if (!sSpellMgr->GetSpellInfo(spell_id))
{
sLog->outError("Player %u has unknown spell %u in `character_spell_cooldown`, skipping.", GetGUIDLow(), spell_id);
continue;
@@ -4389,10 +4389,10 @@ bool Player::resetTalents(bool no_cost)
if (talentInfo->RankID[rank] == 0)
continue;
removeSpell(talentInfo->RankID[rank], true);
if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells
if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
if (plrTalent != m_talents[m_activeSpec]->end())
@@ -4676,10 +4676,10 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
if (!IsSpellFitByClassAndRace(trainer_spell->learnedSpell[i]))
return TRAINER_SPELL_RED;
if (SpellChainNode const* spell_chain = sSpellMgr->GetSpellChainNode(trainer_spell->learnedSpell[i]))
if (uint32 prevSpell = sSpellMgr->GetPrevSpellInChain(trainer_spell->learnedSpell[i]))
{
// check prev.rank requirement
if (spell_chain->prev && !HasSpell(spell_chain->prev))
if (prevSpell && !HasSpell(prevSpell))
return TRAINER_SPELL_RED;
}
@@ -4698,7 +4698,8 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell
{
if (!trainer_spell->learnedSpell[i])
continue;
if ((sSpellMgr->IsPrimaryProfessionFirstRankSpell(trainer_spell->learnedSpell[i])) && (GetFreePrimaryProfessionPoints() == 0))
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainer_spell->learnedSpell[i]);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank() && (GetFreePrimaryProfessionPoints() == 0))
return TRAINER_SPELL_GREEN_DISABLED;
}
@@ -6074,7 +6075,7 @@ bool Player::UpdateCraftSkill(uint32 spellid)
uint32 SkillValue = GetPureSkillValue(_spell_idx->second->skillId);
// Alchemy Discoveries here
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellid);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellid);
if (spellEntry && spellEntry->Mechanic == MECHANIC_DISCOVERY)
{
if (uint32 discoveredSpell = GetSkillDiscoverySpell(_spell_idx->second->skillId, spellid, this))
@@ -6628,7 +6629,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
switch (type)
{
case ACTION_BUTTON_SPELL:
if (!sSpellStore.LookupEntry(action))
if (!sSpellMgr->GetSpellInfo(action))
{
sLog->outError("Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName());
return false;
@@ -8011,7 +8012,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
float mod = 100.0f;
AuraEffectList const& auraDamagePctList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator itr = auraDamagePctList.begin(); itr != auraDamagePctList.end(); ++itr)
if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellProto())) || HasItemFitToSpellRequirements((*itr)->GetSpellProto(), item))
if ((apply && item->IsFitToSpellRequirements((*itr)->GetSpellInfo())) || HasItemFitToSpellRequirements((*itr)->GetSpellInfo(), item))
mod += (*itr)->GetAmount();
SetFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, mod/100.0f);
@@ -8020,7 +8021,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
{
// generic not weapon specific case processes in aura code
if (aura->GetSpellProto()->EquippedItemClass == -1)
if (aura->GetSpellInfo()->EquippedItemClass == -1)
return;
BaseModGroup mod = BASEMOD_END;
@@ -8032,7 +8033,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac
default: return;
}
if (!item->IsBroken()&&item->IsFitToSpellRequirements(aura->GetSpellProto()))
if (!item->IsBroken()&&item->IsFitToSpellRequirements(aura->GetSpellInfo()))
HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
}
@@ -8047,7 +8048,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
return;
// generic not weapon specific case processes in aura code
if (aura->GetSpellProto()->EquippedItemClass == -1)
if (aura->GetSpellInfo()->EquippedItemClass == -1)
return;
UnitMods unitMod = UNIT_MOD_END;
@@ -8066,7 +8067,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
default: return;
}
if (item->IsFitToSpellRequirements(aura->GetSpellProto()))
if (item->IsFitToSpellRequirements(aura->GetSpellInfo()))
{
HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply);
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply);
@@ -8095,7 +8096,7 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
continue;
// check if it is valid spell
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellData.SpellId);
SpellInfo const* spellproto = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellproto)
continue;
@@ -8103,12 +8104,12 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
}
}
void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change)
void Player::ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change)
{
if (apply)
{
// Cannot be used in this stance/form
if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) != SPELL_CAST_OK)
if (spellInfo->CheckShapeshift(GetShapeshiftForm()) != SPELL_CAST_OK)
return;
if (form_change) // check aura active state from other form
@@ -8128,7 +8129,7 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if (form_change) // check aura compatibility
{
// Cannot be used in this stance/form
if (GetErrorAtShapeshiftedCast(spellInfo, GetShapeshiftForm()) == SPELL_CAST_OK)
if (spellInfo->CheckShapeshift(GetShapeshiftForm()) == SPELL_CAST_OK)
return; // and remove only not compatible at form change
}
@@ -8159,7 +8160,7 @@ void Player::UpdateEquipSpellsAtFormChange()
for (uint32 y = 0; y < MAX_ITEM_SET_SPELLS; ++y)
{
SpellEntry const* spellInfo = eff->spells[y];
SpellInfo const* spellInfo = eff->spells[y];
if (!spellInfo)
continue;
@@ -8222,7 +8223,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId);
@@ -8230,10 +8231,10 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
}
// not allow proc extra attack spell at extra attack
if (m_extraAttacks && IsSpellHaveEffect(spellInfo, SPELL_EFFECT_ADD_EXTRA_ATTACKS))
if (m_extraAttacks && spellInfo->HasEffect(SPELL_EFFECT_ADD_EXTRA_ATTACKS))
return;
float chance = (float)spellInfo->procChance;
float chance = (float)spellInfo->ProcChance;
if (spellData.SpellPPMRate)
{
@@ -8289,7 +8290,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
continue;
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...",
@@ -8316,10 +8317,10 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
if (roll_chance_f(chance))
{
if (IsPositiveSpell(pEnchant->spellid[s]))
CastSpell(this, pEnchant->spellid[s], true, item);
if (spellInfo->IsPositive())
CastSpell(this, spellInfo, true, item);
else
CastSpell(target, pEnchant->spellid[s], true, item);
CastSpell(target, spellInfo, true, item);
}
}
}
@@ -8334,7 +8335,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
uint32 learn_spell_id = proto->Spells[0].SpellId;
uint32 learning_spell_id = proto->Spells[1].SpellId;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(learn_spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id);
@@ -8366,7 +8367,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellData.SpellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId);
@@ -8394,7 +8395,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(pEnchant->spellid[s]);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]);
@@ -12073,7 +12074,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update)
if (getClass() == CLASS_ROGUE)
cooldownSpell = 6123;
SpellEntry const* spellProto = sSpellStore.LookupEntry(cooldownSpell);
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
if (!spellProto)
sLog->outError("Weapon switch cooldown spell %u couldn't be found in Spell.dbc", cooldownSpell);
@@ -17112,15 +17113,15 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if (!spellproto)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
sLog->outError("Unknown aura (spellid %u), ignore.", spellid);
continue;
}
// negative effects should continue counting down after logout
if (remaintime != -1 && !IsPositiveSpell(spellid))
if (remaintime != -1 && !spellInfo->IsPositive())
{
if (remaintime/IN_MILLISECONDS <= int32(timediff))
continue;
@@ -17129,17 +17130,17 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
}
// prevent wrong values of remaincharges
if (spellproto->procCharges)
if (spellInfo->ProcCharges)
{
// we have no control over the order of applying auras and modifiers allow auras
// to have more charges than value in SpellEntry
// to have more charges than value in SpellInfo
if (remaincharges <= 0/* || remaincharges > spellproto->procCharges*/)
remaincharges = spellproto->procCharges;
remaincharges = spellInfo->ProcCharges;
}
else
remaincharges = 0;
if (Aura* aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
if (!aura->CanBeSaved())
{
@@ -17149,7 +17150,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
aura->SetLoadedState(maxduration, remaintime, remaincharges, stackcount, recalculatemask, &damage[0]);
aura->ApplyForTargets();
sLog->outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
sLog->outDetail("Added aura spellid %u, effectmask %u", spellInfo->Id, effmask);
}
}
while (result->NextRow());
@@ -19133,7 +19134,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
{
//returning of reagents only for players, so best done here
uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (spellInfo)
{
@@ -19434,7 +19435,8 @@ void Player::VehicleSpellInitialize()
for (uint32 i = 0; i < CREATURE_MAX_SPELLS; ++i)
{
uint32 spellId = veh->m_spells[i];
if (!sSpellStore.LookupEntry(spellId))
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
data << uint16(0) << uint8(0) << uint8(i+8);
continue;
@@ -19448,7 +19450,7 @@ void Player::VehicleSpellInitialize()
continue;
}
if (IsPassiveSpell(spellId))
if (spellInfo->IsPassive())
{
veh->CastSpell(veh, spellId, true);
data << uint16(0) << uint8(0) << uint8(i+8);
@@ -19536,7 +19538,7 @@ void Player::CharmSpellInitialize()
{
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
{
CharmSpellEntry *cspell = charmInfo->GetCharmSpell(i);
CharmSpellInfo *cspell = charmInfo->GetCharmSpell(i);
if (cspell->GetAction())
data << uint32(cspell->packedData);
}
@@ -19554,7 +19556,7 @@ void Player::SendRemoveControlBar()
GetSession()->SendPacket(&data);
}
bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell)
bool Player::IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell)
{
if (!mod || !spellInfo)
return false;
@@ -19564,10 +19566,10 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo
return false;
// +duration to infinite duration spells making them limited
if (mod->op == SPELLMOD_DURATION && GetSpellDuration(spellInfo) == -1)
if (mod->op == SPELLMOD_DURATION && spellInfo->GetDuration() == -1)
return false;
return sSpellMgr->IsAffectedByMod(spellInfo, mod);
return spellInfo->IsAffectedBySpellMod(mod);
}
void Player::AddSpellMod(SpellModifier* mod, bool apply)
@@ -19628,7 +19630,7 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura)
continue;
// Restore only specific owner aura mods
if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellProto()->Id))
if (ownerAuraId && (ownerAuraId != mod->ownerAura->GetSpellInfo()->Id))
continue;
if (aura && mod->ownerAura != aura)
@@ -20121,7 +20123,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
if (itr->second->state == PLAYERSPELL_REMOVED)
continue;
uint32 unSpellId = itr->first;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(unSpellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(unSpellId);
if (!spellInfo)
{
ASSERT(spellInfo);
@@ -20135,7 +20137,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs)
if (spellInfo->PreventionType != SPELL_PREVENTION_TYPE_SILENCE)
continue;
if ((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
if ((idSchoolMask & spellInfo->GetSchoolMask()) && GetSpellCooldownDelay(unSpellId) < unTimeMs)
{
data << uint32(unSpellId);
data << uint32(unTimeMs); // in m.secs
@@ -20531,7 +20533,7 @@ void Player::UpdatePvP(bool state, bool override)
}
}
void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell, bool infinityCooldown)
void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell, bool infinityCooldown)
{
// init cooldown values
uint32 cat = 0;
@@ -20584,7 +20586,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
{
// shoot spells used equipped item cooldown values already assigned in GetAttackTime(RANGED_ATTACK)
// prevent 0 cooldowns set by another way
if (rec <= 0 && catrec <= 0 && (cat == 76 || (IsAutoRepeatRangedSpell(spellInfo) && spellInfo->Id != 75)))
if (rec <= 0 && catrec <= 0 && (cat == 76 || (spellInfo->IsAutoRepeatRangedSpell() && spellInfo->Id != 75)))
rec = GetAttackTime(RANGED_ATTACK);
// Now we have cooldown data (if found any), time to apply mods
@@ -20635,7 +20637,7 @@ void Player::AddSpellCooldown(uint32 spellid, uint32 itemid, time_t end_time)
m_spellCooldowns[spellid] = sc;
}
void Player::SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/)
void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/)
{
// start cooldowns at server side, if any
if (setCooldown)
@@ -20661,7 +20663,7 @@ void Player::UpdatePotionCooldown(Spell* spell)
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(m_lastPotionId))
for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId))
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[idx].SpellId))
SendCooldownEvent(spellInfo, m_lastPotionId);
}
// from spell cases (m_lastPotionId set in Spell::SendSpellCooldown)
@@ -21549,12 +21551,12 @@ void Player::resetSpells(bool myClassOnly)
for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(iter->first);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(iter->first);
if (!spellInfo)
continue;
// skip server-side/triggered spells
if (spellInfo->spellLevel == 0)
if (spellInfo->SpellLevel == 0)
continue;
// skip wrong class/race skills
@@ -21614,7 +21616,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
return;
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
return;
@@ -21622,7 +21624,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
bool found = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->Effect[i] == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->EffectTriggerSpell[i]))
if (spellInfo->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL && !HasSpell(spellInfo->Effects[i].TriggerSpell))
{
found = true;
break;
@@ -21634,7 +21636,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
return;
// prevent learn non first rank unknown profession and second specialization for same profession)
uint32 learned_0 = spellInfo->EffectTriggerSpell[0];
uint32 learned_0 = spellInfo->Effects[0].TriggerSpell;
if (sSpellMgr->GetSpellRank(learned_0) > 1 && !HasSpell(learned_0))
{
// not have first rank learned (unlearned prof?)
@@ -21642,7 +21644,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
if (!HasSpell(first_spell))
return;
SpellEntry const *learnedInfo = sSpellStore.LookupEntry(learned_0);
SpellInfo const *learnedInfo = sSpellMgr->GetSpellInfo(learned_0);
if (!learnedInfo)
return;
@@ -21652,7 +21654,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
uint32 profSpell = itr2->second;
// specialization
if (learnedInfo->Effect[0] == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effect[1] == 0 && profSpell)
if (learnedInfo->Effects[0].Effect == SPELL_EFFECT_TRADE_SKILL && learnedInfo->Effects[1].Effect == 0 && profSpell)
{
// search other specialization for same prof
for (PlayerSpellMap::const_iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr)
@@ -21660,12 +21662,12 @@ void Player::learnQuestRewardedSpells(Quest const* quest)
if (itr->second->state == PLAYERSPELL_REMOVED || itr->first == learned_0)
continue;
SpellEntry const *itrInfo = sSpellStore.LookupEntry(itr->first);
SpellInfo const *itrInfo = sSpellMgr->GetSpellInfo(itr->first);
if (!itrInfo)
return;
// compare only specializations
if (itrInfo->Effect[0] != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effect[1] != 0)
if (itrInfo->Effects[0].Effect != SPELL_EFFECT_TRADE_SKILL || itrInfo->Effects[1].Effect != 0)
continue;
// compare same chain spells
@@ -21708,7 +21710,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value)
if (pAbility->classmask && !(pAbility->classmask & classMask))
continue;
if (sSpellStore.LookupEntry(pAbility->spellId))
if (sSpellMgr->GetSpellInfo(pAbility->spellId))
{
// need unlearn spell
if (skill_value < pAbility->req_skill_value)
@@ -22032,7 +22034,7 @@ OutdoorPvP * Player::GetOutdoorPvP() const
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
}
bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem)
bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem)
{
if (spellInfo->EquippedItemClass < 0)
return true;
@@ -22077,7 +22079,7 @@ bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item con
return false;
}
bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const
bool Player::CanNoReagentCast(SpellInfo const* spellInfo) const
{
// don't take reagents for spells with SPELL_ATTR5_NO_REAGENT_WHILE_PREP
if (spellInfo->AttributesEx5 & SPELL_ATTR5_NO_REAGENT_WHILE_PREP &&
@@ -22102,7 +22104,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item* pItem)
Aura * aura = itr->second;
// skip passive (passive item dependent spells work in another way) and not self applied auras
SpellEntry const* spellInfo = aura->GetSpellProto();
SpellInfo const* spellInfo = aura->GetSpellInfo();
if (aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
{
++itr;
@@ -22136,7 +22138,7 @@ uint32 Player::GetResurrectionSpellId()
for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
// Soulstone Resurrection // prio: 3 (max, non death persistent)
if (prio < 2 && (*itr)->GetSpellProto()->SpellVisual[0] == 99 && (*itr)->GetSpellProto()->SpellIconID == 92)
if (prio < 2 && (*itr)->GetSpellInfo()->SpellVisual[0] == 99 && (*itr)->GetSpellInfo()->SpellIconID == 92)
{
switch ((*itr)->GetId())
{
@@ -22362,7 +22364,7 @@ void Player::UpdateAreaDependentAuras(uint32 newArea)
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
if (sSpellMgr->GetSpellAllowedInLocationError(iter->second->GetSpellProto(), GetMapId(), m_zoneUpdateId, newArea, this) != SPELL_CAST_OK)
if (iter->second->GetSpellInfo()->CheckLocation(GetMapId(), m_zoneUpdateId, newArea, this) != SPELL_CAST_OK)
RemoveOwnedAura(iter);
else
++iter;
@@ -23142,7 +23144,7 @@ uint32 Player::CalculateTalentsPoints() const
bool Player::IsKnowHowFlyIn(uint32 mapid, uint32 zone) const
{
// continent checked in SpellMgr::GetSpellAllowedInLocationError at cast and area update
// continent checked in SpellInfo::CheckLocation at cast and area update
uint32 v_map = GetVirtualMapForMapAndZone(mapid, zone);
return v_map != 571 || HasSpell(54197); // Cold Weather Flying
}
@@ -24252,10 +24254,10 @@ void Player::ActivateSpec(uint8 spec)
if (talentInfo->RankID[rank] == 0)
continue;
removeSpell(talentInfo->RankID[rank], true); // removes the talent, and all dependant, learned, and chained spells..
if (const SpellEntry *_spellEntry = sSpellStore.LookupEntry(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellEntry for valid trigger spells
if (_spellEntry->EffectTriggerSpell[i] > 0 && _spellEntry->Effect[i] == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->EffectTriggerSpell[i], true); // and remove any spells that the talent teaches
if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank]))
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells
if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL)
removeSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches
// if this talent rank can be found in the PlayerTalentMap, mark the talent as removed so it gets deleted
//PlayerTalentMap::iterator plrTalent = m_talents[m_activeSpec]->find(talentInfo->RankID[rank]);
//if (plrTalent != m_talents[m_activeSpec]->end())
+11 -8
View File
@@ -37,6 +37,9 @@
#include "Util.h" // for Tokens typedef
#include "WorldSession.h"
// for template
#include "SpellMgr.h"
#include<string>
#include<vector>
@@ -1202,8 +1205,8 @@ class Player : public Unit, public GridObject<Player>
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
bool HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellEntry const* spellInfo) const;
bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
@@ -1600,7 +1603,7 @@ class Player : public Unit, public GridObject<Player>
bool HasActiveSpell(uint32 spell) const; // show in spellbook
TrainerSpellState GetTrainerSpellState(TrainerSpell const* trainer_spell) const;
bool IsSpellFitByClassAndRace(uint32 spell_id) const;
bool IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const;
bool IsNeedCastPassiveSpellAtLearn(SpellInfo const* spellInfo) const;
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask);
void SendInitialSpells();
@@ -1661,7 +1664,7 @@ class Player : public Unit, public GridObject<Player>
SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; }
void AddSpellMod(SpellModifier* mod, bool apply);
bool IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
bool IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell = NULL);
template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL);
void RemoveSpellMods(Spell* spell);
void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL);
@@ -1682,9 +1685,9 @@ class Player : public Unit, public GridObject<Player>
time_t t = time(NULL);
return uint32(itr != m_spellCooldowns.end() && itr->second.end > t ? itr->second.end - t : 0);
}
void AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
void AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 itemId, Spell* spell = NULL, bool infinityCooldown = false);
void AddSpellCooldown(uint32 spell_id, uint32 itemid, time_t end_time);
void SendCooldownEvent(SpellEntry const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true);
void SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId = 0, Spell* spell = NULL, bool setCooldown = true);
void ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs);
void RemoveSpellCooldown(uint32 spell_id, bool update = false);
void RemoveSpellCategoryCooldown(uint32 cat, bool update = false);
@@ -2061,7 +2064,7 @@ class Player : public Unit, public GridObject<Player>
void InitDataForForm(bool reapplyMods = false);
void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false);
void ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply, bool form_change = false);
void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change = false);
void UpdateEquipSpellsAtFormChange();
void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
void CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex);
@@ -2768,7 +2771,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const *proto);
// "the bodies of template functions must be made available in a header file"
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return 0;
float totalmul = 1.0f;
+6 -5
View File
@@ -23,6 +23,7 @@
#include "Player.h"
#include "ObjectMgr.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
Totem::Totem(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner)
{
@@ -71,8 +72,8 @@ void Totem::InitStats(uint32 duration)
Minion::InitStats(duration);
// Get spell cast by totem
if (SpellEntry const* totemSpell = sSpellStore.LookupEntry(GetSpell()))
if (GetSpellCastTime(totemSpell)) // If spell has cast time -> its an active totem
if (SpellInfo const* totemSpell = sSpellMgr->GetSpellInfo(GetSpell()))
if (totemSpell->CalcCastTime()) // If spell has cast time -> its an active totem
m_type = TOTEM_ACTIVE;
if (GetEntry() == SENTRY_TOTEM_ENTRY)
@@ -115,7 +116,7 @@ void Totem::UnSummon()
{
owner->SendAutoRepeatCancel(this);
if (SpellEntry const* spell = sSpellStore.LookupEntry(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(GetUInt32Value(UNIT_CREATED_BY_SPELL)))
owner->SendCooldownEvent(spell, 0, NULL, false);
if (Group* group = owner->GetGroup())
@@ -132,13 +133,13 @@ void Totem::UnSummon()
AddObjectToRemoveList();
}
bool Totem::IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const
bool Totem::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
// TODO: possibly all negative auras immune?
if (GetEntry() == 5925)
return false;
switch (spellInfo->EffectApplyAuraName[index])
switch (spellInfo->Effects[index].ApplyAuraName)
{
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_LEECH:
+1 -1
View File
@@ -53,7 +53,7 @@ class Totem : public Minion
void UpdateAttackPowerAndDamage(bool /*ranged*/) {}
void UpdateDamagePhysical(WeaponAttackType /*attType*/) {}
bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
protected:
TotemType m_type;
+10 -10
View File
@@ -354,7 +354,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged)
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
AuraEffect* aurEff = *itr;
if (aurEff->GetSpellProto()->SpellIconID == 1563)
if (aurEff->GetSpellInfo()->SpellIconID == 1563)
{
switch (aurEff->GetEffIndex())
{
@@ -725,10 +725,10 @@ void Player::UpdateExpertise(WeaponAttackType attack)
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
{
// item neutral spell
if ((*itr)->GetSpellProto()->EquippedItemClass == -1)
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
expertise += (*itr)->GetAmount();
// item dependent spell
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellProto()))
else if (weapon && weapon->IsFitToSpellRequirements((*itr)->GetSpellInfo()))
expertise += (*itr)->GetAmount();
}
@@ -1016,8 +1016,8 @@ bool Guardian::UpdateStats(Stats stat)
aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0);
if (aurEff)
{
SpellEntry const* sProto = aurEff->GetSpellProto(); // Then get the SpellProto and add the dummy effect value
AddPctN(mod, SpellMgr::CalculateSpellEffectAmount(sProto, 1)); // Ravenous Dead edits the original scale
SpellInfo const* spellInfo = aurEff->GetSpellInfo(); // Then get the SpellProto and add the dummy effect value
AddPctN(mod, spellInfo->Effects[EFFECT_1].CalcValue()); // Ravenous Dead edits the original scale
}
// Glyph of the Ghoul
aurEff = owner->GetAuraEffect(58686, 0);
@@ -1044,8 +1044,8 @@ bool Guardian::UpdateStats(Stats stat)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value
AddPctN(mod, SpellMgr::CalculateSpellEffectAmount(sProto, 0));
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
AddPctN(mod, spellInfo->Effects[EFFECT_0].CalcValue());
}
}
ownersBonus = float(owner->GetStat(stat)) * mod;
@@ -1213,8 +1213,8 @@ void Guardian::UpdateAttackPowerAndDamage(bool ranged)
if (itr != ToPet()->m_spells.end()) // If pet has Wild Hunt
{
SpellEntry const* sProto = sSpellStore.LookupEntry(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePctN(1.0f, SpellMgr::CalculateSpellEffectAmount(sProto, 1));
SpellInfo const* sProto = sSpellMgr->GetSpellInfo(itr->first); // Then get the SpellProto and add the dummy effect value
mod += CalculatePctN(1.0f, sProto->Effects[1].CalcValue());
}
}
@@ -1328,7 +1328,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACKSPEED);
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
switch ((*itr)->GetSpellProto()->Id)
switch ((*itr)->GetSpellInfo()->Id)
{
case 61682:
case 61683:
File diff suppressed because it is too large Load Diff
+76 -77
View File
@@ -317,7 +317,6 @@ enum InventorySlot
};
struct FactionTemplateEntry;
struct SpellEntry;
struct SpellValue;
class AuraApplication;
@@ -326,6 +325,7 @@ class UnitAura;
class AuraEffect;
class Creature;
class Spell;
class SpellInfo;
class DynamicObject;
class GameObject;
class Item;
@@ -811,7 +811,7 @@ private:
Unit* const m_attacker;
Unit* const m_victim;
uint32 m_damage;
SpellEntry const* const m_spellInfo;
SpellInfo const* const m_spellInfo;
SpellSchoolMask const m_schoolMask;
DamageEffectType const m_damageType;
WeaponAttackType m_attackType;
@@ -819,7 +819,7 @@ private:
uint32 m_resist;
uint32 m_block;
public:
explicit DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellEntry const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType);
explicit DamageInfo(Unit* _attacker, Unit* _victim, uint32 _damage, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask, DamageEffectType _damageType);
explicit DamageInfo(CalcDamageInfo& dmgInfo);
void ModifyDamage(int32 amount);
@@ -829,7 +829,7 @@ public:
Unit* GetAttacker() const { return m_attacker; };
Unit* GetVictim() const { return m_victim; };
SpellEntry const* GetSpellInfo() const { return m_spellInfo; };
SpellInfo const* GetSpellInfo() const { return m_spellInfo; };
SpellSchoolMask GetSchoolMask() const { return m_schoolMask; };
DamageEffectType GetDamageType() const { return m_damageType; };
WeaponAttackType GetAttackType() const { return m_attackType; };
@@ -846,10 +846,10 @@ private:
Unit* const m_target;
uint32 m_heal;
uint32 m_absorb;
SpellEntry const* const m_spellInfo;
SpellInfo const* const m_spellInfo;
SpellSchoolMask const m_schoolMask;
public:
explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellEntry const* _spellInfo, SpellSchoolMask _schoolMask)
explicit HealInfo(Unit* _healer, Unit* _target, uint32 _heal, SpellInfo const* _spellInfo, SpellSchoolMask _schoolMask)
: m_healer(_healer), m_target(_target), m_heal(_heal), m_spellInfo(_spellInfo), m_schoolMask(_schoolMask)
{
m_absorb = 0;
@@ -886,7 +886,7 @@ public:
uint32 GetSpellTypeMask() const { return _spellTypeMask; }
uint32 GetSpellPhaseMask() const { return _spellPhaseMask; }
uint32 GetHitMask() const { return _hitMask; }
SpellEntry const* GetSpellInfo() const { return NULL; }
SpellInfo const* GetSpellInfo() const { return NULL; }
SpellSchoolMask GetSchoolMask() const { return SPELL_SCHOOL_MASK_NONE; }
DamageInfo* GetDamageInfo() const { return _damageInfo; }
HealInfo* GetHealInfo() const { return _healInfo; }
@@ -987,9 +987,9 @@ public:
GlobalCooldownMgr() {}
public:
bool HasGlobalCooldown(SpellEntry const* spellInfo) const;
void AddGlobalCooldown(SpellEntry const* spellInfo, uint32 gcd);
void CancelGlobalCooldown(SpellEntry const* spellInfo);
bool HasGlobalCooldown(SpellInfo const* spellInfo) const;
void AddGlobalCooldown(SpellInfo const* spellInfo, uint32 gcd);
void CancelGlobalCooldown(SpellInfo const* spellInfo);
private:
GlobalCooldownList m_GlobalCooldowns;
@@ -1065,7 +1065,7 @@ enum CharmType
CHARM_TYPE_CONVERT,
};
typedef UnitActionBarEntry CharmSpellEntry;
typedef UnitActionBarEntry CharmSpellInfo;
enum ActionBarIndex
{
@@ -1096,20 +1096,20 @@ struct CharmInfo
void InitEmptyActionBar(bool withAttack = true);
//return true if successful
bool AddSpellToActionBar(uint32 spellid, ActiveStates newstate = ACT_DECIDE);
bool AddSpellToActionBar(SpellInfo const* spellInfo, ActiveStates newstate = ACT_DECIDE);
bool RemoveSpellFromActionBar(uint32 spell_id);
void LoadPetActionBar(const std::string& data);
void BuildActionBar(WorldPacket* data);
void SetSpellAutocast(uint32 spell_id, bool state);
void SetSpellAutocast(SpellInfo const* spellInfo, bool state);
void SetActionBar(uint8 index, uint32 spellOrAction, ActiveStates type)
{
PetActionBar[index].SetActionAndType(spellOrAction, type);
}
UnitActionBarEntry const* GetActionBarEntry(uint8 index) const { return &(PetActionBar[index]); }
void ToggleCreatureAutocast(uint32 spellid, bool apply);
void ToggleCreatureAutocast(SpellInfo const* spellInfo, bool apply);
CharmSpellEntry* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
CharmSpellInfo* GetCharmSpell(uint8 index) { return &(m_charmspells[index]); }
GlobalCooldownMgr& GetGlobalCooldownMgr() { return m_GlobalCooldownMgr; }
@@ -1128,7 +1128,7 @@ struct CharmInfo
Unit* m_unit;
UnitActionBarEntry PetActionBar[MAX_UNIT_ACTION_BAR_INDEX];
CharmSpellEntry m_charmspells[4];
CharmSpellInfo m_charmspells[4];
CommandStates m_CommandState;
uint32 m_petnumber;
bool m_barInit;
@@ -1187,7 +1187,7 @@ class Unit : public WorldObject
typedef std::pair<uint32, uint8> spellEffectPair;
typedef std::multimap<uint32, Aura*> AuraMap;
typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap;
typedef std::multimap<AuraState, AuraApplication*> AuraStateAurasMap;
typedef std::multimap<AuraStateType, AuraApplication*> AuraStateAurasMap;
typedef std::list<AuraEffect *> AuraEffectList;
typedef std::list<Aura *> AuraList;
typedef std::list<AuraApplication *> AuraApplicationList;
@@ -1212,10 +1212,9 @@ class Unit : public WorldObject
void ApplyDiminishingAura(DiminishingGroup group, bool apply);
void ClearDiminishings() { m_Diminishing.clear(); }
//target dependent range checks
uint32 GetSpellMaxRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry);
uint32 GetSpellMinRangeForTarget(Unit* target, const SpellRangeEntry * rangeEntry);
uint32 GetSpellRadiusForTarget(Unit* target, const SpellRadiusEntry * radiusEntry);
// target dependent range checks
float GetSpellMaxRangeForTarget(Unit* target, SpellInfo const* spellInfo);
float GetSpellMinRangeForTarget(Unit* target, SpellInfo const* spellInfo);
virtual void Update(uint32 time);
@@ -1392,12 +1391,12 @@ class Unit : public WorldObject
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb);
uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *spellProto = NULL, bool durabilityLoss = true);
uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto = NULL, bool durabilityLoss = true);
void Kill(Unit *pVictim, bool durabilityLoss = true);
int32 DealHeal(Unit *pVictim, uint32 addhealth);
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellEntry const *procSpell = NULL, SpellEntry const* procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellEntry const* procSpell, uint32 damage , SpellEntry const* procAura = NULL);
void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const *procSpell = NULL, SpellInfo const* procAura = NULL);
void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage , SpellInfo const* procAura = NULL);
void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo);
void TriggerAurasProcOnEvent(CalcDamageInfo& damageInfo);
@@ -1410,7 +1409,7 @@ class Unit : public WorldObject
void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK);
void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss);
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);
// player or player's pet resilience (-1%)
@@ -1431,15 +1430,15 @@ class Unit : public WorldObject
void ApplyResilience(const Unit* pVictim, float * crit, int32 * damage, bool isCrit, CombatRating type) const;
float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const;
SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellEntry const *spell);
SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellEntry const *spell);
SpellMissInfo SpellHitResult(Unit *pVictim, SpellEntry const *spell, bool canReflect = false);
SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellInfo const *spell);
SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellInfo const *spell);
SpellMissInfo SpellHitResult(Unit *pVictim, SpellInfo const *spell, bool canReflect = false);
float GetUnitDodgeChance() const;
float GetUnitParryChance() const;
float GetUnitBlockChance() const;
float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const;
int32 GetMechanicResistChance(const SpellEntry *spell);
int32 GetMechanicResistChance(const SpellInfo *spell);
bool CanUseAttackType(uint8 attacktype) const
{
switch(attacktype)
@@ -1456,7 +1455,7 @@ class Unit : public WorldObject
uint32 GetDefenseSkillValue(Unit const* target = NULL) const;
uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const;
float GetWeaponProcChance() const;
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * spellProto) const;
float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo * spellProto) const;
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const;
MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const;
@@ -1506,31 +1505,31 @@ class Unit : public WorldObject
bool isFrozen() const;
bool isTargetableForAttack() const;
bool isAttackableByAOE(SpellEntry const* spellProto = NULL) const;
bool isAttackableByAOE(SpellInfo const* spellProto = NULL) const;
bool canAttack(Unit const* target, bool force = true) const;
virtual bool IsInWater() const;
virtual bool IsUnderWater() const;
bool isInAccessiblePlaceFor(Creature const* c) const;
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false);
int32 HealBySpell(Unit* pVictim, SpellEntry const* spellInfo, uint32 addHealth, bool critical = false);
int32 HealBySpell(Unit* pVictim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, SpellInfo const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0, Unit* originalVictim = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
Aura * AddAura(uint32 spellId, Unit* target);
Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit* target);
Aura * AddAura(SpellInfo const *spellInfo, uint8 effMask, Unit* target);
void SetAuraStack(uint32 spellId, Unit* target, uint32 stack);
void SendPlaySpellVisual(uint32 id);
void SendPlaySpellImpact(uint64 guid, uint32 id);
bool IsDamageToThreatSpell(SpellEntry const* spellInfo) const;
bool IsDamageToThreatSpell(SpellInfo const* spellInfo) const;
void DeMorph();
@@ -1664,7 +1663,7 @@ class Unit : public WorldObject
bool InitTamedPet(Pet * pet, uint8 level, uint32 spell_id);
// aura apply/remove helpers - you should better not use these
Aura* _TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
void _AddAura(UnitAura* aura, Unit* caster);
AuraApplication * _CreateAuraApplication(Aura * aura, uint8 effMask);
void _ApplyAuraEffect(Aura * aura, uint8 effIndex);
@@ -1741,13 +1740,13 @@ class Unit : public WorldObject
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithCaster(AuraType auratype, uint64 caster) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const;
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
bool HasAuraTypeWithValue(AuraType auratype, int32 value) const;
bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0);
bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0);
bool HasAuraWithMechanic(uint32 mechanicMask);
AuraEffect * IsScriptOverriden(SpellEntry const* spell, int32 script) const;
AuraEffect * IsScriptOverriden(SpellInfo const* spell, int32 script) const;
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
uint32 GetDoTsByCaster(uint64 casterGUID) const;
@@ -1766,10 +1765,10 @@ class Unit : public WorldObject
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetTotalAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
float GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellEntry const* affectedSpell) const;
int32 GetTotalAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
float GetTotalAuraMultiplierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
int32 GetMaxPositiveAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
int32 GetMaxNegativeAuraModifierByAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const;
float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school); }
void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school, val); }
@@ -1902,7 +1901,7 @@ class Unit : public WorldObject
// Threat related methods
bool CanHaveThreatList() const;
void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL);
void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL);
float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL);
void DeleteThreatList();
void TauntApply(Unit* pVictim);
@@ -1950,45 +1949,45 @@ class Unit : public WorldObject
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct);
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
void ModifyAuraState(AuraState flag, bool apply);
void ModifyAuraState(AuraStateType flag, bool apply);
uint32 BuildAuraStateUpdateForTarget(Unit* target) const;
bool HasAuraState(AuraState flag, SpellEntry const *spellProto = NULL, Unit const* Caster = NULL) const ;
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto = NULL, Unit const* Caster = NULL) const ;
void UnsummonAllTotems();
Unit* SelectMagnetTarget(Unit* victim, SpellEntry const *spellInfo = NULL);
Unit* SelectMagnetTarget(Unit* victim, SpellInfo const *spellInfo = NULL);
int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask);
int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask);
int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim);
uint32 SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
uint32 SpellHealingBonus(Unit *pVictim, SpellEntry const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
bool isSpellBlocked(Unit *pVictim, SpellEntry const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
uint32 SpellDamageBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1);
uint32 SpellHealingBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1);
bool isSpellBlocked(Unit *pVictim, SpellInfo const *spellProto, WeaponAttackType attackType = BASE_ATTACK);
bool isBlockCritical();
bool isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
uint32 SpellCriticalDamageBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
uint32 SpellCriticalHealingBonus(SpellEntry const *spellProto, uint32 damage, Unit *pVictim);
bool isSpellCrit(Unit *pVictim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const;
uint32 SpellCriticalDamageBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim);
uint32 SpellCriticalHealingBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim);
void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; }
bool IsUnderLastManaUseEffect() const;
void SetContestedPvP(Player *attackedPlayer = NULL);
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellEntry const *spellProto = NULL);
uint32 GetCastingTimeForBonus(SpellEntry const *spellProto, DamageEffectType damagetype, uint32 CastingTime);
void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL);
uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime);
uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const;
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);
void ApplySpellDispelImmunity(const SpellEntry * spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellEntry const* spellInfo);
void ApplySpellDispelImmunity(const SpellInfo * spellProto, DispelType type, bool apply);
virtual bool IsImmunedToSpell(SpellInfo const* spellInfo);
// redefined in Creature
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask);
bool IsImmunedToDamage(SpellEntry const* spellInfo);
virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
bool IsImmunedToDamage(SpellInfo const* spellInfo);
virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const;
// redefined in Creature
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellEntry const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL);
void CalcHealAbsorb(Unit *pVictim, const SpellEntry *spellProto, uint32 &healAmount, uint32 &absorb);
static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS);
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo = NULL);
void CalcHealAbsorb(Unit *pVictim, const SpellInfo *spellProto, uint32 &healAmount, uint32 &absorb);
void UpdateSpeed(UnitMoveType mtype, bool forced);
float GetSpeed(UnitMoveType mtype) const;
@@ -1999,12 +1998,12 @@ class Unit : public WorldObject
void SetHover(bool on);
bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
float ApplyEffectModifiers(SpellEntry const* spellProto, uint8 effect_index, float value) const;
int32 CalculateSpellDamage(Unit const* target, SpellEntry const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
int32 CalcSpellDuration(SpellEntry const* spellProto);
int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
void ModSpellCastTime(SpellEntry const* spellProto, int32 & castTime, Spell* spell=NULL);
float CalculateLevelPenalty(SpellEntry const* spellProto) const;
float ApplyEffectModifiers(SpellInfo const* spellProto, uint8 effect_index, float value) const;
int32 CalculateSpellDamage(Unit const* target, SpellInfo const* spellProto, uint8 effect_index, int32 const* basePoints = NULL) const;
int32 CalcSpellDuration(SpellInfo const* spellProto);
int32 ModSpellDuration(SpellInfo const* spellProto, Unit const* target, int32 duration, bool positive);
void ModSpellCastTime(SpellInfo const* spellProto, int32 & castTime, Spell* spell=NULL);
float CalculateLevelPenalty(SpellInfo const* spellProto) const;
void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
void removeFollower(FollowerReference* /*pRef*/) { /* nothing to do yet */ }
@@ -2237,15 +2236,15 @@ class Unit : public WorldObject
bool isAlwaysDetectableFor(WorldObject const* seer) const;
private:
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent);
bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellEntry const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled);
bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 cooldown);
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent);
bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled);
bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 cooldown);
bool HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura);
bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura);
+4 -2
View File
@@ -26,6 +26,8 @@
#include "ScriptMgr.h"
#include "CreatureAI.h"
#include "ZoneScript.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) : _me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry)
{
@@ -73,11 +75,11 @@ void Vehicle::Install()
if (!creature->m_spells[i])
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(creature->m_spells[i]);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(creature->m_spells[i]);
if (!spellInfo)
continue;
if (spellInfo->powerType == POWER_ENERGY)
if (spellInfo->PowerType == POWER_ENERGY)
{
_me->setPowerType(POWER_ENERGY);
_me->SetMaxPower(POWER_ENERGY, 100);
+51 -47
View File
@@ -587,7 +587,7 @@ void ObjectMgr::LoadCreatureTemplateAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(uint32(atol(*itr)));
SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", entry, uint32(atol(*itr)));
@@ -869,7 +869,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
for (uint8 j = 0; j < CREATURE_MAX_SPELLS; ++j)
{
if (cInfo->spells[j] && !sSpellStore.LookupEntry(cInfo->spells[j]))
if (cInfo->spells[j] && !sSpellMgr->GetSpellInfo(cInfo->spells[j]))
{
sLog->outErrorDb("Creature (Entry: %u) has non-existing Spell%d (%u), set to 0.", cInfo->Entry, j+1, cInfo->spells[j]);
const_cast<CreatureTemplate*>(cInfo)->spells[j] = 0;
@@ -955,7 +955,7 @@ void ObjectMgr::LoadCreatureAddons()
creatureAddon.auras.resize(tokens.size());
for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr)
{
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(uint32(atol(*itr)));
SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr)));
if (!AdditionalSpellInfo)
{
sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr)));
@@ -2401,7 +2401,7 @@ void ObjectMgr::LoadItemTemplates()
}
}
if (itemTemplate.RequiredSpell && !sSpellStore.LookupEntry(itemTemplate.RequiredSpell))
if (itemTemplate.RequiredSpell && !sSpellMgr->GetSpellInfo(itemTemplate.RequiredSpell))
{
sLog->outErrorDb("Item (Entry: %u) has a wrong (non-existing) spell in RequiredSpell (%u)", entry, itemTemplate.RequiredSpell);
itemTemplate.RequiredSpell = 0;
@@ -2509,7 +2509,7 @@ void ObjectMgr::LoadItemTemplates()
}
else if (itemTemplate.Spells[1].SpellId != -1)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itemTemplate.Spells[1].SpellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId);
if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL))
{
sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId);
@@ -2557,7 +2557,7 @@ void ObjectMgr::LoadItemTemplates()
if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(itemTemplate.Spells[j].SpellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId);
if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL))
{
sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId);
@@ -4018,7 +4018,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->SrcSpell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->SrcSpell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->SrcSpell);
if (!spellInfo)
{
sLog->outErrorDb("Quest %u has `SrcSpell` = %u but spell %u doesn't exist, quest can't be done.",
@@ -4090,7 +4090,7 @@ void ObjectMgr::LoadQuests()
uint32 id = qinfo->ReqSpell[j];
if (id)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id);
if (!spellInfo)
{
sLog->outErrorDb("Quest %u has `ReqSpellCast%d` = %u but spell %u does not exist, quest can't be done.",
@@ -4103,8 +4103,8 @@ void ObjectMgr::LoadQuests()
bool found = false;
for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
{
if ((spellInfo->Effect[k] == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->EffectMiscValue[k]) == qinfo->QuestId) ||
spellInfo->Effect[k] == SPELL_EFFECT_SEND_EVENT)
if ((spellInfo->Effects[k].Effect == SPELL_EFFECT_QUEST_COMPLETE && uint32(spellInfo->Effects[k].MiscValue) == qinfo->QuestId) ||
spellInfo->Effects[k].Effect == SPELL_EFFECT_SEND_EVENT)
{
found = true;
break;
@@ -4248,7 +4248,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->RewSpell)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpell);
if (!spellInfo)
{
@@ -4274,7 +4274,7 @@ void ObjectMgr::LoadQuests()
if (qinfo->RewSpellCast > 0)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(qinfo->RewSpellCast);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(qinfo->RewSpellCast);
if (!spellInfo)
{
@@ -4366,18 +4366,18 @@ void ObjectMgr::LoadQuests()
}
// check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE
for (uint32 i = 0; i < sSpellStore.GetNumRows(); ++i)
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo)
continue;
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (spellInfo->Effect[j] != SPELL_EFFECT_QUEST_COMPLETE)
if (spellInfo->Effects[j].Effect != SPELL_EFFECT_QUEST_COMPLETE)
continue;
uint32 quest_id = spellInfo->EffectMiscValue[j];
uint32 quest_id = spellInfo->Effects[j].MiscValue;
Quest const* quest = GetQuestTemplate(quest_id);
@@ -4707,7 +4707,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_REMOVE_AURA:
{
if (!sSpellStore.LookupEntry(tmp.RemoveAura.SpellID))
if (!sSpellMgr->GetSpellInfo(tmp.RemoveAura.SpellID))
{
sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_REMOVE_AURA for script id %u",
tableName.c_str(), tmp.RemoveAura.SpellID, tmp.id);
@@ -4724,7 +4724,7 @@ void ObjectMgr::LoadScripts(ScriptsType type)
case SCRIPT_COMMAND_CAST_SPELL:
{
if (!sSpellStore.LookupEntry(tmp.CastSpell.SpellID))
if (!sSpellMgr->GetSpellInfo(tmp.CastSpell.SpellID))
{
sLog->outErrorDb("Table `%s` using non-existent spell (id: %u) in SCRIPT_COMMAND_CAST_SPELL for script id %u",
tableName.c_str(), tmp.CastSpell.SpellID, tmp.id);
@@ -4830,7 +4830,7 @@ void ObjectMgr::LoadSpellScripts()
for (ScriptMapMap::const_iterator itr = sSpellScripts.begin(); itr != sSpellScripts.end(); ++itr)
{
uint32 spellId = uint32(itr->first) & 0x00FFFFFF;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -4840,7 +4840,7 @@ void ObjectMgr::LoadSpellScripts()
uint8 i = (uint8)((uint32(itr->first) >> 24) & 0x000000FF);
//check for correct spellEffect
if (!spellInfo->Effect[i] || (spellInfo->Effect[i] != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effect[i] != SPELL_EFFECT_DUMMY))
if (!spellInfo->Effects[i].Effect || (spellInfo->Effects[i].Effect != SPELL_EFFECT_SCRIPT_EFFECT && spellInfo->Effects[i].Effect != SPELL_EFFECT_DUMMY))
sLog->outErrorDb("Table `spell_scripts` - spell %u effect %u is not SPELL_EFFECT_SCRIPT_EFFECT or SPELL_EFFECT_DUMMY", spellId, i);
}
}
@@ -4857,17 +4857,17 @@ void ObjectMgr::LoadEventScripts()
evt_scripts.insert(eventId);
// Load all possible script entries from spells
for (uint32 i = 1; i < sSpellStore.GetNumRows(); ++i)
for (uint32 i = 1; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
SpellEntry const* spell = sSpellStore.LookupEntry(i);
SpellInfo const* spell = sSpellMgr->GetSpellInfo(i);
if (spell)
{
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (spell->Effect[j] == SPELL_EFFECT_SEND_EVENT)
if (spell->Effects[j].Effect == SPELL_EFFECT_SEND_EVENT)
{
if (spell->EffectMiscValue[j])
evt_scripts.insert(spell->EffectMiscValue[j]);
if (spell->Effects[j].MiscValue)
evt_scripts.insert(spell->Effects[j].MiscValue);
}
}
}
@@ -4956,8 +4956,8 @@ void ObjectMgr::LoadSpellScriptNames()
spellId = -spellId;
}
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId);
if (!spellEntry)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) does not exist in `Spell.dbc`.", scriptName, fields[0].GetInt32());
continue;
@@ -4970,14 +4970,14 @@ void ObjectMgr::LoadSpellScriptNames()
sLog->outErrorDb("Scriptname:`%s` spell (spell_id:%d) is not first rank of spell.", scriptName, fields[0].GetInt32());
continue;
}
while(spellId)
while(spellInfo)
{
mSpellScripts.insert(SpellScriptsMap::value_type(spellId, GetScriptId(scriptName)));
spellId = sSpellMgr->GetNextSpellInChain(spellId);
mSpellScripts.insert(SpellScriptsMap::value_type(spellInfo->Id, GetScriptId(scriptName)));
spellInfo = sSpellMgr->GetSpellInfo(spellInfo->Id)->GetNextRankSpell();
}
}
else
mSpellScripts.insert(SpellScriptsMap::value_type(spellId, GetScriptId(scriptName)));
mSpellScripts.insert(SpellScriptsMap::value_type(spellInfo->Id, GetScriptId(scriptName)));
++count;
}
while (result->NextRow());
@@ -5001,7 +5001,7 @@ void ObjectMgr::ValidateSpellScripts()
for (SpellScriptsMap::iterator itr = mSpellScripts.begin(); itr != mSpellScripts.end();)
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(itr->first);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first);
std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> > SpellScriptLoaders;
sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
itr = mSpellScripts.upper_bound(itr->first);
@@ -5237,7 +5237,7 @@ void ObjectMgr::LoadInstanceEncounters()
break;
}
case ENCOUNTER_CREDIT_CAST_SPELL:
if (!sSpellStore.LookupEntry(creditEntry))
if (!sSpellMgr->GetSpellInfo(creditEntry))
{
sLog->outErrorDb("Table `instance_encounters` has an invalid spell (entry %u) linked to the encounter %u (%s), skipped!", creditEntry, entry, dungeonEncounter->encounterName[0]);
continue;
@@ -6430,7 +6430,7 @@ inline void CheckGOLinkedTrapId(GameObjectTemplate const* goInfo, uint32 dataN,
inline void CheckGOSpellId(GameObjectTemplate const* goInfo, uint32 dataN, uint32 N)
{
if (sSpellStore.LookupEntry(dataN))
if (sSpellMgr->GetSpellInfo(dataN))
return;
sLog->outErrorDb("Gameobject (Entry: %u GoType: %u) have data%d=%u but Spell (Entry %u) not exist.",
@@ -7208,7 +7208,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
}
uint32 spellid = fields[1].GetUInt32();
SpellEntry const *spellinfo = sSpellStore.LookupEntry(spellid);
SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellinfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid);
@@ -7218,7 +7218,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
uint32 auraRequired = fields[6].GetUInt32();
if (auraRequired)
{
SpellEntry const *aurReqInfo = sSpellStore.LookupEntry(auraRequired);
SpellInfo const *aurReqInfo = sSpellMgr->GetSpellInfo(auraRequired);
if (!aurReqInfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura required %u. Skipping entry.", auraRequired);
@@ -7229,7 +7229,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
uint32 auraForbidden = fields[7].GetUInt32();
if (auraForbidden)
{
SpellEntry const *aurForInfo = sSpellStore.LookupEntry(auraForbidden);
SpellInfo const *aurForInfo = sSpellMgr->GetSpellInfo(auraForbidden);
if (!aurForInfo)
{
sLog->outErrorDb("Table npc_spellclick_spells references unknown aura forbidden %u. Skipping entry.", auraForbidden);
@@ -8219,7 +8219,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
return;
}
SpellEntry const *spellinfo = sSpellStore.LookupEntry(spell);
SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spell);
if (!spellinfo)
{
sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell);
@@ -8248,28 +8248,32 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost,
trainerSpell.reqLevel = reqLevel;
if (!trainerSpell.reqLevel)
trainerSpell.reqLevel = spellinfo->spellLevel;
trainerSpell.reqLevel = spellinfo->SpellLevel;
// calculate learned spell for profession case when stored cast-spell
trainerSpell.learnedSpell[0] = spell;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellinfo->Effect[i] != SPELL_EFFECT_LEARN_SPELL)
if (spellinfo->Effects[i].Effect != SPELL_EFFECT_LEARN_SPELL)
continue;
if (trainerSpell.learnedSpell[0] == spell)
trainerSpell.learnedSpell[0] = 0;
// player must be able to cast spell on himself
if (spellinfo->EffectImplicitTargetA[i] != 0 && spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_TARGET_ALLY
&& spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_TARGET_ANY && spellinfo->EffectImplicitTargetA[i] != TARGET_UNIT_CASTER)
if (spellinfo->Effects[i].TargetA != 0 && spellinfo->Effects[i].TargetA != TARGET_UNIT_TARGET_ALLY
&& spellinfo->Effects[i].TargetA != TARGET_UNIT_TARGET_ANY && spellinfo->Effects[i].TargetA != TARGET_UNIT_CASTER)
{
sLog->outErrorDb("Table `npc_trainer` has spell %u for trainer entry %u with learn effect which has incorrect target type, ignoring learn effect!", spell, entry);
continue;
}
trainerSpell.learnedSpell[i] = spellinfo->EffectTriggerSpell[i];
trainerSpell.learnedSpell[i] = spellinfo->Effects[i].TriggerSpell;
if (trainerSpell.learnedSpell[i] && SpellMgr::IsProfessionSpell(trainerSpell.learnedSpell[i]))
data.trainerType = 2;
if (trainerSpell.learnedSpell[i])
{
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(trainerSpell.learnedSpell[i]);
if (learnedSpellInfo && learnedSpellInfo->IsProfession())
data.trainerType = 2;
}
}
return;
@@ -8925,9 +8929,9 @@ void ObjectMgr::LoadFactionChangeSpells()
uint32 alliance = fields[0].GetUInt32();
uint32 horde = fields[1].GetUInt32();
if (!sSpellStore.LookupEntry(alliance))
if (!sSpellMgr->GetSpellInfo(alliance))
sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", alliance);
else if (!sSpellStore.LookupEntry(horde))
else if (!sSpellMgr->GetSpellInfo(horde))
sLog->outErrorDb("Spell %u referenced in `player_factionchange_spells` does not exist, pair skipped!", horde);
else
factionchange_spells[alliance] = horde;
+4 -3
View File
@@ -23,6 +23,7 @@
#include "Util.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "Group.h"
static Rates const qualityToRate[MAX_ITEM_QUALITY] = {
@@ -1743,14 +1744,14 @@ void LoadLootTemplates_Spell()
uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
// remove real entries and check existence loot
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry (spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
continue;
// possible cases
if (!IsLootCraftingSpell(spellInfo))
if (!spellInfo->IsLootCrafting())
continue;
if (ids_set.find(spell_id) == ids_set.end())
@@ -1162,7 +1162,7 @@ enum GhostVisibilityType
};
// Spell aura states
enum AuraState
enum AuraStateType
{ // (C) used in caster aura state (T) used in target aura state
// (c) used in caster aura state-not (t) used in target aura state-not
AURA_STATE_NONE = 0, // C |
@@ -2806,7 +2806,7 @@ enum DiminishingGroup
DIMINISHING_SILENCE = 16,
DIMINISHING_SLEEP = 17,
DIMINISHING_TAUNT = 18,
DIMINISHING_LIMITONLY = 19 // No diminishing return, but duration limited to 10 seconds
DIMINISHING_LIMITONLY = 19
};
enum SummonCategory
+38 -38
View File
@@ -210,16 +210,16 @@ struct TSpellSummary
void ScriptMgr::FillSpellSummary()
{
SpellSummary = new TSpellSummary[GetSpellStore()->GetNumRows()];
SpellSummary = new TSpellSummary[sSpellMgr->GetSpellInfoStoreSize()];
SpellEntry const* pTempSpell;
SpellInfo const* pTempSpell;
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
SpellSummary[i].Effects = 0;
SpellSummary[i].Targets = 0;
pTempSpell = GetSpellStore()->LookupEntry(i);
pTempSpell = sSpellMgr->GetSpellInfo(i);
//This spell doesn't exist
if (!pTempSpell)
continue;
@@ -227,67 +227,67 @@ void ScriptMgr::FillSpellSummary()
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
//Spell targets self
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SELF-1);
//Spell targets a single enemy
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
pTempSpell->Effects[j].TargetA == TARGET_DST_TARGET_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_ENEMY-1);
//Spell targets AoE at enemy
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_SRC ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_DST ||
pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_ENEMY-1);
//Spell targets an enemy
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ENEMY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DST_TARGET_ENEMY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_SRC ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_AREA_ENEMY_DST ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_DEST_DYNOBJ_ENEMY)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ENEMY ||
pTempSpell->Effects[j].TargetA == TARGET_DST_TARGET_ENEMY ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_SRC ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_AREA_ENEMY_DST ||
pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_ENEMY-1);
//Spell targets a single friend(or self)
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_PARTY)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_SINGLE_FRIEND-1);
//Spell targets aoe friends
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY_PARTY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_PARTY_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY_PARTY ||
pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_AOE_FRIEND-1);
//Spell targets any friend(or self)
if (pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_PARTY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_PARTY_CASTER ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_UNIT_TARGET_ALLY_PARTY ||
pTempSpell->EffectImplicitTargetA[j] == TARGET_SRC_CASTER)
if (pTempSpell->Effects[j].TargetA == TARGET_UNIT_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_PARTY ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_PARTY_CASTER ||
pTempSpell->Effects[j].TargetA == TARGET_UNIT_TARGET_ALLY_PARTY ||
pTempSpell->Effects[j].TargetA == TARGET_SRC_CASTER)
SpellSummary[i].Targets |= 1 << (SELECT_TARGET_ANY_FRIEND-1);
//Make sure that this spell includes a damage effect
if (pTempSpell->Effect[j] == SPELL_EFFECT_SCHOOL_DAMAGE ||
pTempSpell->Effect[j] == SPELL_EFFECT_INSTAKILL ||
pTempSpell->Effect[j] == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
pTempSpell->Effect[j] == SPELL_EFFECT_HEALTH_LEECH)
if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_SCHOOL_DAMAGE ||
pTempSpell->Effects[j].Effect == SPELL_EFFECT_INSTAKILL ||
pTempSpell->Effects[j].Effect == SPELL_EFFECT_ENVIRONMENTAL_DAMAGE ||
pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEALTH_LEECH)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_DAMAGE-1);
//Make sure that this spell includes a healing effect (or an apply aura with a periodic heal)
if (pTempSpell->Effect[j] == SPELL_EFFECT_HEAL ||
pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MAX_HEALTH ||
pTempSpell->Effect[j] == SPELL_EFFECT_HEAL_MECHANICAL ||
(pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA && pTempSpell->EffectApplyAuraName[j] == 8))
if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL ||
pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MAX_HEALTH ||
pTempSpell->Effects[j].Effect == SPELL_EFFECT_HEAL_MECHANICAL ||
(pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA && pTempSpell->Effects[j].ApplyAuraName == 8))
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_HEALING-1);
//Make sure that this spell applies an aura
if (pTempSpell->Effect[j] == SPELL_EFFECT_APPLY_AURA)
if (pTempSpell->Effects[j].Effect == SPELL_EFFECT_APPLY_AURA)
SpellSummary[i].Effects |= 1 << (SELECT_EFFECT_AURA-1);
}
}
@@ -26,6 +26,7 @@
#include "Item.h"
#include "UpdateData.h"
#include "ObjectAccessor.h"
#include "SpellInfo.h"
void WorldSession::HandleSplitItemOpcode(WorldPacket & recv_data)
{
@@ -363,7 +364,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data)
{
// send DBC data for cooldowns in same way as it used in Spell::SendSpellCooldown
// use `item_template` or if not set then only use spell cooldowns
SpellEntry const* spell = sSpellStore.LookupEntry(pProto->Spells[s].SpellId);
SpellInfo const* spell = sSpellMgr->GetSpellInfo(pProto->Spells[s].SpellId);
if (spell)
{
bool db_data = pProto->Spells[s].SpellCooldown >= 0 || pProto->Spells[s].SpellCategoryCooldown >= 0;
@@ -35,6 +35,7 @@
#include "Battleground.h"
#include "ScriptMgr.h"
#include "CreatureAI.h"
#include "SpellInfo.h"
enum StableResultCode
{
@@ -177,7 +178,8 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
valid = false;
break;
}
if (sSpellMgr->IsPrimaryProfessionFirstRankSpell(tSpell->learnedSpell[i]))
SpellInfo const* learnedSpellInfo = sSpellMgr->GetSpellInfo(tSpell->learnedSpell[i]);
if (learnedSpellInfo && learnedSpellInfo->IsPrimaryProfessionFirstRank())
primary_prof_first_rank = true;
}
if (!valid)
@@ -201,13 +203,10 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
{
if (!tSpell->learnedSpell[i])
continue;
if (SpellChainNode const* chain_node = sSpellMgr->GetSpellChainNode(tSpell->learnedSpell[i]))
if (uint32 prevSpellId = sSpellMgr->GetPrevSpellInChain(tSpell->learnedSpell[i]))
{
if (chain_node->prev)
{
data << uint32(chain_node->prev);
++maxReq;
}
data << uint32(prevSpellId);
++maxReq;
}
if (maxReq == 3)
break;
@@ -30,6 +30,7 @@
#include "Pet.h"
#include "World.h"
#include "Group.h"
#include "SpellInfo.h"
void WorldSession::HandleDismissCritter(WorldPacket &recv_data)
{
@@ -84,7 +85,7 @@ void WorldSession::HandlePetAction(WorldPacket & recv_data)
if (!pet->isAlive())
{
SpellEntry const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellStore.LookupEntry(spellid) : NULL;
SpellInfo const* spell = (flag == ACT_ENABLED || flag == ACT_PASSIVE) ? sSpellMgr->GetSpellInfo(spellid) : NULL;
if (!spell)
return;
if (!(spell->Attributes & SPELL_ATTR0_CASTABLE_WHILE_DEAD))
@@ -288,7 +289,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
unit_target = ObjectAccessor::GetUnit(*_player, guid2);
// do not cast unknown spells
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellid);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %i", spellid);
@@ -301,12 +302,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->EffectImplicitTargetA[i] == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->EffectImplicitTargetA[i] == TARGET_DEST_DYNOBJ_ENEMY)
if (spellInfo->Effects[i].TargetA == TARGET_UNIT_AREA_ENEMY_SRC || spellInfo->Effects[i].TargetA == TARGET_UNIT_AREA_ENEMY_DST || spellInfo->Effects[i].TargetA == TARGET_DEST_DYNOBJ_ENEMY)
return;
}
// do not cast not learned spells
if (!pet->HasSpell(spellid) || IsPassiveSpell(spellid))
if (!pet->HasSpell(spellid) || spellInfo->IsPassive())
return;
// Clear the flags as if owner clicked 'attack'. AI will reset them
@@ -554,26 +555,29 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data)
//if it's act for spell (en/disable/cast) and there is a spell given (0 = remove spell) which pet doesn't know, don't add
if (!((act_state == ACT_ENABLED || act_state == ACT_DISABLED || act_state == ACT_PASSIVE) && spell_id && !pet->HasSpell(spell_id)))
{
//sign for autocast
if (act_state == ACT_ENABLED && spell_id)
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id))
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spell_id, true);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spell_id, true);
}
//sign for no/turn off autocast
else if (act_state == ACT_DISABLED && spell_id)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spell_id, false);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spell_id, false);
//sign for autocast
if (act_state == ACT_ENABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spellInfo, true);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, true);
}
//sign for no/turn off autocast
else if (act_state == ACT_DISABLED)
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->ToCreature()->isPet())
((Pet*)pet)->ToggleAutocast(spellInfo, false);
else
for (Unit::ControlList::iterator itr = GetPlayer()->m_Controlled.begin(); itr != GetPlayer()->m_Controlled.end(); ++itr)
if ((*itr)->GetEntry() == pet->GetEntry())
(*itr)->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, false);
}
}
charmInfo->SetActionBar(position[i], spell_id, ActiveStates(act_state));
@@ -706,8 +710,9 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
// do not add not learned spells/ passive spells
if (!pet->HasSpell(spellid) || IsAutocastableSpell(spellid))
if (!pet->HasSpell(spellid) || spellInfo->IsAutocastable())
return;
CharmInfo *charmInfo = pet->GetCharmInfo();
@@ -718,11 +723,11 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
}
if (pet->isPet())
((Pet*)pet)->ToggleAutocast(spellid, state);
((Pet*)pet)->ToggleAutocast(spellInfo, state);
else
pet->GetCharmInfo()->ToggleCreatureAutocast(spellid, state);
pet->GetCharmInfo()->ToggleCreatureAutocast(spellInfo, state);
charmInfo->SetSpellAutocast(spellid, state);
charmInfo->SetSpellAutocast(spellInfo, state);
}
void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
@@ -750,7 +755,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
return;
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %i", spellId);
@@ -765,7 +770,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
}
// do not cast not learned spells
if (!caster->HasSpell(spellId) || IsPassiveSpell(spellId))
if (!caster->HasSpell(spellId) || spellInfo->IsPassive())
return;
SpellCastTargets targets;
@@ -139,9 +139,9 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
{
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(proto->Spells[i].SpellId))
if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId))
{
if (IsNonCombatSpell(spellInfo))
if (spellInfo->CanBeUsedInCombat())
{
pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, NULL);
return;
@@ -170,7 +170,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
// send spell error
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId))
if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId))
{
// for implicit area/coord target spells
if (!targets.GetUnitTarget())
@@ -341,7 +341,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
return;
}
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
@@ -353,7 +353,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
if (mover->GetTypeId() == TYPEID_PLAYER)
{
// not have spell in spellbook or spell passive and not casted by client
if (!mover->ToPlayer()->HasActiveSpell (spellId) || IsPassiveSpell(spellId))
if (!mover->ToPlayer()->HasActiveSpell (spellId) || spellInfo->IsPassive())
{
//cheater? kick? ban?
recvPacket.rfinish(); // prevent spam at ignore packet
@@ -363,7 +363,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
else
{
// not have spell in spellbook or spell passive and not casted by client
if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || IsPassiveSpell(spellId))
if ((mover->GetTypeId() == TYPEID_UNIT && !mover->ToCreature()->HasSpell(spellId)) || spellInfo->IsPassive())
{
//cheater? kick? ban?
recvPacket.rfinish(); // prevent spam at ignore packet
@@ -373,7 +373,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// Client is resending autoshot cast opcode when other spell is casted during shoot rotation
// Skip it to prevent "interrupt" message
if (IsAutoRepeatRangedSpell(spellInfo) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
if (spellInfo->IsAutoRepeatRangedSpell() && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)
&& _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo == spellInfo)
{
recvPacket.rfinish();
@@ -395,7 +395,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
// auto-selection buff level base at target level (in spellInfo)
if (targets.GetUnitTarget())
{
SpellEntry const *actualSpellInfo = sSpellMgr->SelectAuraRankForPlayerLevel(spellInfo, targets.GetUnitTarget()->getLevel());
SpellInfo const *actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel());
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if (actualSpellInfo)
@@ -423,20 +423,20 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
uint32 spellId;
recvPacket >> spellId;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
return;
// not allow remove non positive spells and spells with attr SPELL_ATTR0_CANT_CANCEL
if (!IsPositiveSpell(spellId) || (spellInfo->Attributes & SPELL_ATTR0_CANT_CANCEL))
if (!spellInfo->IsPositive() || (spellInfo->Attributes & SPELL_ATTR0_CANT_CANCEL))
return;
// don't allow cancelling passive auras (some of them are visible)
if (IsPassiveSpell(spellInfo))
if (spellInfo->IsPassive())
return;
// channeled spell case (it currently casted then)
if (IsChanneledSpell(spellInfo))
if (spellInfo->IsChanneled())
{
if (Spell* curSpell = _player->GetCurrentSpell(CURRENT_CHANNELED_SPELL))
if (curSpell->m_spellInfo->Id == spellId)
@@ -457,7 +457,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
recvPacket >> guid;
recvPacket >> spellId;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
{
sLog->outError("WORLD: unknown PET spell id %u", spellId);
@@ -541,7 +541,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/)
if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL))
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL));
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL));
if (spellInfo)
_player->CastSpell(_player, spellInfo, false, 0);
@@ -338,7 +338,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 my_spell_id = my_trade->GetSpell())
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(my_spell_id);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(my_spell_id);
Item* castItem = my_trade->GetSpellCastItem();
if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
@@ -373,7 +373,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 his_spell_id = his_trade->GetSpell())
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(his_spell_id);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(his_spell_id);
Item* castItem = his_trade->GetSpellCastItem();
if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
+8 -7
View File
@@ -23,6 +23,7 @@
#include "SkillDiscovery.h"
#include "SpellMgr.h"
#include "Player.h"
#include "SpellInfo.h"
#include <map>
struct SkillDiscoveryEntry
@@ -83,8 +84,8 @@ void LoadSkillDiscoveryTable()
if (reqSkillOrSpell > 0) // spell case
{
uint32 absReqSkillOrSpell = uint32(reqSkillOrSpell);
SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(absReqSkillOrSpell);
if (!reqSpellEntry)
SpellInfo const* reqSpellInfo = sSpellMgr->GetSpellInfo(absReqSkillOrSpell);
if (!reqSpellInfo)
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
@@ -95,9 +96,9 @@ void LoadSkillDiscoveryTable()
}
// mechanic discovery
if (reqSpellEntry->Mechanic != MECHANIC_DISCOVERY &&
if (reqSpellInfo->Mechanic != MECHANIC_DISCOVERY &&
// explicit discovery ability
!IsExplicitDiscoverySpell(reqSpellEntry))
!reqSpellInfo->IsExplicitDiscovery())
{
if (reportedReqSpells.find(absReqSkillOrSpell) == reportedReqSpells.end())
{
@@ -137,14 +138,14 @@ void LoadSkillDiscoveryTable()
sLog->outErrorDb("Some items can't be successfully discovered: have in chance field value < 0.000001 in `skill_discovery_template` DB table . List:\n%s", ssNonDiscoverableEntries.str().c_str());
// report about empty data for explicit discovery spells
for (uint32 spell_id = 1; spell_id < sSpellStore.GetNumRows(); ++spell_id)
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
SpellEntry const* spellEntry = sSpellStore.LookupEntry(spell_id);
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell_id);
if (!spellEntry)
continue;
// skip not explicit discovery spells
if (!IsExplicitDiscoverySpell(spellEntry))
if (!spellEntry->IsExplicitDiscovery())
continue;
if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
+2 -2
View File
@@ -73,14 +73,14 @@ void LoadSkillExtraItemTable()
uint32 spellId = fields[0].GetUInt32();
if (!sSpellStore.LookupEntry(spellId))
if (!sSpellMgr->GetSpellInfo(spellId))
{
sLog->outError("Skill specialization %u has non-existent spell id in `skill_extra_item_template`!", spellId);
continue;
}
uint32 requiredSpecialization = fields[1].GetUInt32();
if (!sSpellStore.LookupEntry(requiredSpecialization))
if (!sSpellMgr->GetSpellInfo(requiredSpecialization))
{
sLog->outError("Skill specialization %u have not existed required specialization spell id %u in `skill_extra_item_template`!", spellId, requiredSpecialization);
continue;
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -30,7 +30,7 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin
class AuraEffect
{
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
friend Aura::~Aura();
private:
~AuraEffect();
@@ -43,15 +43,15 @@ class AuraEffect
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
SpellModifier* GetSpellModifier() const { return m_spellmod; }
SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const { return m_spellProto->Id; }
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
uint32 GetId() const { return m_spellInfo->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBaseAmount() const { return m_baseAmount; }
int32 GetAmplitude() const { return m_amplitude; }
int32 GetMiscValueB() const { return m_spellProto->EffectMiscValueB[m_effIndex]; }
int32 GetMiscValue() const { return m_spellProto->EffectMiscValue[m_effIndex]; }
AuraType GetAuraType() const { return (AuraType)m_spellProto->EffectApplyAuraName[m_effIndex]; }
int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; }
int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; }
AuraType GetAuraType() const { return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; }
int32 GetAmount() const { return m_amount; }
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;}
@@ -79,7 +79,7 @@ class AuraEffect
bool IsPeriodic() const { return m_isPeriodic; }
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
bool IsAffectedOnSpell(SpellEntry const *spell) const;
bool IsAffectedOnSpell(SpellInfo const *spell) const;
void SendTickImmune(Unit* target, Unit *caster) const;
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
@@ -93,7 +93,7 @@ class AuraEffect
private:
Aura * const m_base;
SpellEntry const* const m_spellProto;
SpellInfo const* const m_spellInfo;
uint8 const m_effIndex;
int32 const m_baseAmount;
@@ -308,8 +308,8 @@ namespace Trinity
AbsorbAuraOrderPred() { }
bool operator() (AuraEffect * aurEffA, AuraEffect * aurEffB) const
{
SpellEntry const* spellProtoA = aurEffA->GetSpellProto();
SpellEntry const* spellProtoB = aurEffB->GetSpellProto();
SpellInfo const* spellProtoA = aurEffA->GetSpellInfo();
SpellInfo const* spellProtoB = aurEffB->GetSpellInfo();
// Wards
if ((spellProtoA->SpellFamilyName == SPELLFAMILY_MAGE) ||
+239 -111
View File
@@ -123,7 +123,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
bool negativeFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (((1<<i) & effMask) && !IsPositiveEffect(GetBase()->GetId(), i))
if (((1<<i) & effMask) && !GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
negativeFound = true;
break;
@@ -138,7 +138,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask)
bool positiveFound = false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (((1<<i) & effMask) && IsPositiveEffect(GetBase()->GetId(), i))
if (((1<<i) & effMask) && GetBase()->GetSpellInfo()->IsPositiveEffect(i))
{
positiveFound = true;
break;
@@ -189,13 +189,13 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
Aura const* aura = GetBase();
data << uint32(aura->GetId());
uint32 flags = m_flags;
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
flags |= AFLAG_DURATION;
data << uint8(flags);
data << uint8(aura->GetCasterLevel());
// send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges
// stack amount has priority over charges (checked on retail with spell 50262)
data << uint8(aura->GetSpellProto()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
data << uint8(aura->GetSpellInfo()->StackAmount ? aura->GetStackAmount() : aura->GetCharges());
if (!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
@@ -218,7 +218,7 @@ void AuraApplication::ClientUpdate(bool remove)
m_target->SendMessageToSet(&data, true);
}
uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
uint8 Aura::BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner)
{
ASSERT(spellProto);
ASSERT(owner);
@@ -229,14 +229,14 @@ uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalible
case TYPEID_PLAYER:
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
if (IsUnitOwnedAuraEffect(spellProto->Effect[i]))
if (spellProto->Effects[i].IsUnitOwnedAuraEffect())
effMask |= 1 << i;
}
break;
case TYPEID_DYNAMICOBJECT:
for (uint8 i = 0; i< MAX_SPELL_EFFECTS; ++i)
{
if (spellProto->Effect[i] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
if (spellProto->Effects[i].Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
effMask |= 1 << i;
}
break;
@@ -246,7 +246,7 @@ uint8 Aura::BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalible
return effMask & avalibleEffectMask;
}
Aura* Aura::TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/)
Aura* Aura::TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/, bool* refresh /*= NULL*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -272,7 +272,7 @@ Aura* Aura::TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMa
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
Aura* Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
Aura* Aura::TryCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount /*= NULL*/, Item* castItem /*= NULL*/, uint64 casterGUID /*= 0*/)
{
ASSERT(spellproto);
ASSERT(owner);
@@ -284,7 +284,7 @@ Aura* Aura::TryCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObjec
return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID);
}
Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID)
{
ASSERT(effMask);
ASSERT(spellproto);
@@ -306,7 +306,7 @@ Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* own
if (owner->isType(TYPEMASK_UNIT))
if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
// owner not in world so don't allow to own not self casted single target auras
if (casterGUID != owner->GetGUID() && IsSingleTargetSpell(spellproto))
if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
return NULL;
Aura* aura = NULL;
@@ -329,14 +329,14 @@ Aura* Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* own
return aura;
}
Aura::Aura(SpellEntry const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID) :
m_spellProto(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
Aura::Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID) :
m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()),
m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_applyTime(time(NULL)),
m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0),
m_casterLevel(caster ? caster->getLevel() : m_spellProto->spellLevel), m_procCharges(0), m_stackAmount(1),
m_casterLevel(caster ? caster->getLevel() : m_spellInfo->SpellLevel), m_procCharges(0), m_stackAmount(1),
m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false)
{
if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
m_maxDuration = CalcMaxDuration(caster);
@@ -404,10 +404,10 @@ void Aura::_ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp
// set infinity cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if (m_spellProto->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
if (m_spellInfo->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
{
Item* castItem = m_castItemGuid ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellProto, castItem ? castItem->GetEntry() : 0, NULL, true);
caster->ToPlayer()->AddSpellAndCategoryCooldowns(m_spellInfo, castItem ? castItem->GetEntry() : 0, NULL, true);
}
}
}
@@ -424,7 +424,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
if (itr == m_applications.end())
{
sLog->outError("Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!",
target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellProto()->Id);
target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id);
ASSERT(false);
}
@@ -437,9 +437,9 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA
// reset cooldown state for spells
if (caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if (GetSpellProto()->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
if (GetSpellInfo()->Attributes & SPELL_ATTR0_DISABLED_WHILE_ACTIVE)
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
caster->ToPlayer()->SendCooldownEvent(GetSpellProto());
caster->ToPlayer()->SendCooldownEvent(GetSpellInfo());
}
}
@@ -519,7 +519,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
bool addUnit = true;
// check target immunities
if (itr->first->IsImmunedToSpell(GetSpellProto())
if (itr->first->IsImmunedToSpell(GetSpellInfo())
|| !CanBeAppliedOn(itr->first))
addUnit = false;
@@ -542,7 +542,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply)
for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
{
Aura const* aura = iter->second->GetBase();
if (!sSpellMgr->CanAurasStack(this, aura, aura->GetCasterGUID() == GetCasterGUID()))
if (!CanStackWith(aura))
{
addUnit = false;
break;
@@ -658,11 +658,11 @@ void Aura::Update(uint32 diff, Unit* caster)
m_timeCla -= diff;
else if (caster)
{
if (int32 manaPerSecond = m_spellProto->manaPerSecond + m_spellProto->manaPerSecondPerLevel * caster->getLevel())
if (int32 manaPerSecond = m_spellInfo->ManaPerSecond + m_spellInfo->ManaPerSecondPerLevel * caster->getLevel())
{
m_timeCla += 1000 - diff;
Powers powertype = Powers(m_spellProto->powerType);
Powers powertype = Powers(m_spellInfo->PowerType);
if (powertype == POWER_HEALTH)
{
if (int32(caster->GetHealth()) > manaPerSecond)
@@ -697,12 +697,12 @@ int32 Aura::CalcMaxDuration(Unit* caster) const
if (caster)
{
modOwner = caster->GetSpellModOwner();
maxDuration = caster->CalcSpellDuration(m_spellProto);
maxDuration = caster->CalcSpellDuration(m_spellInfo);
}
else
maxDuration = GetSpellDuration(m_spellProto);
maxDuration = m_spellInfo->GetDuration();
if (IsPassive() && m_spellProto->DurationIndex == 0)
if (IsPassive() && !m_spellInfo->DurationEntry)
maxDuration = -1;
if (!IsPermanent() && modOwner)
@@ -726,7 +726,7 @@ void Aura::RefreshDuration()
{
SetDuration(GetMaxDuration());
if (m_spellProto->manaPerSecond || m_spellProto->manaPerSecondPerLevel)
if (m_spellInfo->ManaPerSecond || m_spellInfo->ManaPerSecondPerLevel)
m_timeCla = 1 * IN_MILLISECONDS;
}
@@ -751,7 +751,7 @@ void Aura::SetCharges(uint8 charges)
uint8 Aura::CalcMaxCharges(Unit* caster) const
{
uint8 maxProcCharges = m_spellProto->procCharges;
uint8 maxProcCharges = m_spellInfo->ProcCharges;
if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
maxProcCharges = procEntry->charges;
@@ -811,13 +811,13 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode)
int32 stackAmount = m_stackAmount + num;
// limit the stack amount (only on stack increase, stack amount may be changed manually)
if ((num > 0) && (stackAmount > int32(m_spellProto->StackAmount)))
if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
{
// not stackable aura - set stack amount to 1
if (!m_spellProto->StackAmount)
if (!m_spellInfo->StackAmount)
stackAmount = 1;
else
stackAmount = m_spellProto->StackAmount;
stackAmount = m_spellInfo->StackAmount;
}
// we're out of stacks, remove
else if (stackAmount <= 0)
@@ -858,12 +858,12 @@ void Aura::RefreshSpellMods()
bool Aura::IsPassive() const
{
return IsPassiveSpell(GetSpellProto());
return GetSpellInfo()->IsPassive();
}
bool Aura::IsDeathPersistent() const
{
return IsDeathPersistentSpell(GetSpellProto());
return GetSpellInfo()->IsDeathPersistent();
}
bool Aura::CanBeSaved() const
@@ -872,7 +872,7 @@ bool Aura::CanBeSaved() const
return false;
if (GetCasterGUID() != GetOwner()->GetGUID())
if (IsSingleTargetSpell(GetSpellProto()))
if (GetSpellInfo()->IsSingleTarget())
return false;
// Can't be saved - aura handler relies on calculated amount and changes it
@@ -897,7 +897,7 @@ bool Aura::CanBeSaved() const
bool Aura::CanBeSentToClient() const
{
return !IsPassive() || HasAreaAuraEffect(GetSpellProto()) || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
return !IsPassive() || GetSpellInfo()->HasAreaAuraEffect() || HasEffectType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
}
void Aura::UnregisterSingleTarget()
@@ -912,6 +912,27 @@ void Aura::UnregisterSingleTarget()
SetIsSingleTarget(false);
}
int32 Aura::CalcDispelChance(Unit* auraTarget, bool offensive) const
{
// we assume that aura dispel chance is 100% on start
// need formula for level difference based chance
int32 resistChance = 0;
// Apply dispel mod from aura caster
if (Unit* caster = GetCaster())
if (Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
// Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
// Only affects offensive dispels
if (offensive && auraTarget)
resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
resistChance = resistChance < 0 ? 0 : resistChance;
resistChance = resistChance > 100 ? 100 : resistChance;
return 100 - resistChance;
}
void Aura::SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount)
{
m_maxDuration = maxduration;
@@ -1000,15 +1021,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
// handle spell_linked_spell table
uint32 customAttr = sSpellMgr->GetSpellCustomAttr(GetId());
if (!onReapply)
{
// apply linked auras
if (apply)
{
if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1021,9 +1040,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else
{
// remove linked auras
if (customAttr & SPELL_ATTR0_CU_LINK_REMOVE)
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId()))
{
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId());
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1032,9 +1050,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID());
}
}
if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
{
if (*itr < 0)
@@ -1048,9 +1065,8 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
else if (apply)
{
// modify stack amount of linked auras
if (customAttr & SPELL_ATTR0_CU_LINK_AURA)
if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
{
std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA);
for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
if (*itr > 0)
if (Aura* triggeredAura = target->GetAura(*itr, GetCasterGUID()))
@@ -1061,7 +1077,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// mods at aura apply
if (apply)
{
switch (GetSpellProto()->SpellFamilyName)
switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -1088,7 +1104,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Rejuvenation
if (GetSpellProto()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
{
// Druid T8 Restoration 4P Bonus
if (caster->HasAura(64760))
@@ -1101,23 +1117,23 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
case SPELLFAMILY_MAGE:
if (!caster)
break;
if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000001 && GetSpellProto()->SpellFamilyFlags[2] & 0x00000008)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001 && GetSpellInfo()->SpellFamilyFlags[2] & 0x00000008)
{
// Glyph of Fireball
if (caster->HasAura(56368))
SetDuration(0);
}
else if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000020 && GetSpellProto()->SpellVisual[0] == 13)
else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000020 && GetSpellInfo()->SpellVisual[0] == 13)
{
// Glyph of Frostbolt
if (caster->HasAura(56370))
SetDuration(0);
}
// Todo: This should be moved to similar function in spell::hit
else if (GetSpellProto()->SpellFamilyFlags[0] & 0x01000000)
else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x01000000)
{
// Polymorph Sound - Sheep && Penguin
if (GetSpellProto()->SpellIconID == 82 && GetSpellProto()->SpellVisual[0] == 12978)
if (GetSpellInfo()->SpellIconID == 82 && GetSpellInfo()->SpellVisual[0] == 12978)
{
// Glyph of the Penguin
if (caster->HasAura(52648))
@@ -1179,29 +1195,29 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Devouring Plague
if (GetSpellProto()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
{
// Improved Devouring Plague
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 1))
{
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellProto(), GetEffect(0)->GetAmount(), DOT) / 100;
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellDamageBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT) / 100;
int32 heal = int32(CalculatePctN(basepoints0, 15));
caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
}
}
// Renew
else if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0))
else if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000040 && GetEffect(0))
{
// Empowered Renew
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3021, 1))
{
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellProto(), GetEffect(0)->GetAmount(), HEAL) / 100;
int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * caster->SpellHealingBonus(target, GetSpellInfo(), GetEffect(0)->GetAmount(), HEAL) / 100;
caster->CastCustomSpell(target, 63544, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
}
}
// Power Word: Shield
else if (m_spellProto->SpellFamilyFlags[0] & 0x1 && m_spellProto->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
{
// Glyph of Power Word: Shield
if (AuraEffect* glyph = caster->GetAuraEffect(55672, 0))
@@ -1214,7 +1230,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_ROGUE:
// Sprint (skip non player casted spells by category)
if (GetSpellProto()->SpellFamilyFlags[0] & 0x40 && GetSpellProto()->Category == 44)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->Category == 44)
// in official maybe there is only one icon?
if (target->HasAura(58039)) // Glyph of Blurred Speed
target->CastSpell(target, 61922, true); // Sprint (waterwalk)
@@ -1223,7 +1239,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Frost Fever and Blood Plague
if (GetSpellProto()->SpellFamilyFlags[2] & 0x2)
if (GetSpellInfo()->SpellFamilyFlags[2] & 0x2)
{
// Can't proc on self
if (GetCasterGUID() == target->GetGUID())
@@ -1238,7 +1254,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
{
aurEff = *itr;
// Ebon Plaguebringer - end search if found
if ((*itr)->GetSpellProto()->SpellIconID == 1766)
if ((*itr)->GetSpellInfo()->SpellIconID == 1766)
break;
}
}
@@ -1267,7 +1283,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// mods at aura remove
else
{
switch(GetSpellProto()->SpellFamilyName)
switch(GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch(GetId())
@@ -1317,7 +1333,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Ice barrier - dispel/absorb remove
if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellProto()->SpellFamilyFlags[1] & 0x1)
if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[1] & 0x1)
{
// Shattered Barrier
if (caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0))
@@ -1328,7 +1344,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Spell Reflection
if (GetSpellProto()->SpellFamilyFlags[1] & 0x2)
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x2)
{
if (removeMode != AURA_REMOVE_BY_DEFAULT)
{
@@ -1351,7 +1367,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Curse of Doom
if (GetSpellProto()->SpellFamilyFlags[1] & 0x02)
if (GetSpellInfo()->SpellFamilyFlags[1] & 0x02)
{
if (removeMode == AURA_REMOVE_BY_DEATH)
{
@@ -1360,7 +1376,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
// Improved Fear
else if (GetSpellProto()->SpellFamilyFlags[1] & 0x00000400)
else if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
{
if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
{
@@ -1392,7 +1408,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!caster)
break;
// Shadow word: Pain // Vampiric Touch
if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && (GetSpellProto()->SpellFamilyFlags[0] & 0x00008000 || GetSpellProto()->SpellFamilyFlags[1] & 0x00000400))
if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && (GetSpellInfo()->SpellFamilyFlags[0] & 0x00008000 || GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400))
{
// Shadow Affinity
if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 178, 1))
@@ -1402,7 +1418,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
// Power word: shield
else if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellProto()->SpellFamilyFlags[0] & 0x00000001)
else if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
{
// Rapture
if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
@@ -1468,13 +1484,13 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (!player->HasSpellCooldown(47788))
break;
player->RemoveSpellCooldown(GetSpellProto()->Id, true);
player->AddSpellCooldown(GetSpellProto()->Id, 0, uint32(time(NULL) + aurEff->GetAmount()));
player->RemoveSpellCooldown(GetSpellInfo()->Id, true);
player->AddSpellCooldown(GetSpellInfo()->Id, 0, uint32(time(NULL) + aurEff->GetAmount()));
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4+4);
data << uint64(player->GetGUID());
data << uint8(0x0); // flags (0x1, 0x2)
data << uint32(GetSpellProto()->Id);
data << uint32(GetSpellInfo()->Id);
data << uint32(aurEff->GetAmount()*IN_MILLISECONDS);
player->SendDirectMessage(&data);
}
@@ -1495,7 +1511,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Blood of the North
// Reaping
// Death Rune Mastery
if (GetSpellProto()->SpellIconID == 3041 || GetSpellProto()->SpellIconID == 22 || GetSpellProto()->SpellIconID == 2622)
if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
{
if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
break;
@@ -1510,7 +1526,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_HUNTER:
// Glyph of Freezing Trap
if (GetSpellProto()->SpellFamilyFlags[0] & 0x00000008)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000008)
if (caster && caster->HasAura(56845))
target->CastSpell(target, 61394, true);
break;
@@ -1518,7 +1534,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
// mods at aura apply or remove
switch (GetSpellProto()->SpellFamilyName)
switch (GetSpellInfo()->SpellFamilyName)
{
case SPELLFAMILY_GENERIC:
switch (GetId())
@@ -1533,7 +1549,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_ROGUE:
// Stealth
if (GetSpellProto()->SpellFamilyFlags[0] & 0x00400000)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00400000)
{
// Master of subtlety
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(31221, 0))
@@ -1590,7 +1606,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
if (apply)
{
if ((GetSpellProto()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellProto()->Id == 19746 && target->HasAura(31821)))
if ((GetSpellInfo()->Id == 31821 && target->HasAura(19746, GetCasterGUID())) || (GetSpellInfo()->Id == 19746 && target->HasAura(31821)))
target->CastSpell(target, 64364, true);
}
else
@@ -1609,7 +1625,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
break;
case SPELLFAMILY_DEATHKNIGHT:
if (GetSpellSpecific(GetSpellProto()) == SPELL_SPECIFIC_PRESENCE)
if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE)
{
AuraEffect *bloodPresenceAura=0; // healing by damage done
AuraEffect *frostPresenceAura=0; // increased health
@@ -1670,7 +1686,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (unholyPresenceAura)
{
// Not listed as any effect, only base points set
int32 basePoints0 = SpellMgr::CalculateSpellEffectAmount(unholyPresenceAura->GetSpellProto(), 1);
int32 basePoints0 = unholyPresenceAura->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, 63622, &basePoints0 , &basePoints0, &basePoints0, true, 0, unholyPresenceAura);
}
target->CastSpell(target, 49772, true);
@@ -1699,7 +1715,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
break;
case SPELLFAMILY_WARLOCK:
// Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
if (GetSpellProto()->SpellFamilyFlags[0] & 0x00004000)
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)
{
if (!caster)
break;
@@ -1729,7 +1745,7 @@ bool Aura::CanBeAppliedOn(Unit* target)
if (GetOwner() != target)
return false;
// not selfcasted single target auras mustn't be applied
if (GetCasterGUID() != GetOwner()->GetGUID() && IsSingleTargetSpell(GetSpellProto()))
if (GetCasterGUID() != GetOwner()->GetGUID() && GetSpellInfo()->IsSingleTarget())
return false;
return true;
}
@@ -1742,6 +1758,125 @@ bool Aura::CheckAreaTarget(Unit* target)
return CallScriptCheckAreaTargetHandlers(target);
}
bool Aura::CanStackWith(Aura const* existingAura) const
{
// Can stack with self
if (this == existingAura)
return true;
// Dynobj auras always stack
if (existingAura->GetType() == DYNOBJ_AURA_TYPE)
return true;
SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
// passive auras don't stack when cast by different casters, or with another rank of the spell
if (IsPassive() && (!sameCaster || !m_spellInfo->IsDifferentRankOf(existingSpellInfo)))
return false;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// prevent remove triggering aura by triggered aura
if (existingSpellInfo->Effects[i].TriggerSpell == GetId()
// prevent remove triggered aura by triggering aura refresh
|| m_spellInfo->Effects[i].TriggerSpell == existingAura->GetId())
return true;
}
// check spell specific stack rules
if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
|| (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
return false;
// check spell group stack rules
SpellGroupStackRule stackRule = sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo);
if (stackRule)
{
if (stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE)
return false;
if (sameCaster && stackRule == SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER)
return false;
}
if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
return true;
if (!sameCaster)
{
if (m_spellInfo->AttributesEx3 & SPELL_ATTR3_STACK_FOR_DIFF_CASTERS)
return true;
// check same periodic auras
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
switch (m_spellInfo->Effects[i].ApplyAuraName)
{
// DOT or HOT from different casters will stack
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_DUMMY:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_LEECH:
case SPELL_AURA_POWER_BURN_MANA:
case SPELL_AURA_OBS_MOD_POWER:
case SPELL_AURA_OBS_MOD_HEALTH:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
// periodic auras which target areas are not allowed to stack this way (replenishment for example)
if (m_spellInfo->Effects[i].IsArea() || existingSpellInfo->Effects[i].IsArea())
break;
return true;
default:
break;
}
}
}
bool isVehicleAura1 = false;
bool isVehicleAura2 = false;
uint8 i = 0;
while (i < MAX_SPELL_EFFECTS && !(isVehicleAura1 && isVehicleAura2))
{
if (m_spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
isVehicleAura1 = true;
if (existingSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
isVehicleAura2 = true;
++i;
}
if (isVehicleAura1 && isVehicleAura2)
{
Vehicle* veh = NULL;
if (GetOwner()->ToUnit())
veh = GetOwner()->ToUnit()->GetVehicleKit();
if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
return true;
if (!veh->GetAvailableSeatCount())
return false; // No empty seat available
return true; // Empty seat available (skip rest)
}
// spell of same spell rank chain
if (m_spellInfo->IsRankOf(existingSpellInfo))
{
if (m_spellInfo->IsMultiSlotAura())
return true;
if (GetCastItemGUID() && existingAura->GetCastItemGUID())
if (GetCastItemGUID() != existingAura->GetCastItemGUID() && (m_spellInfo->AttributesCu & SPELL_ATTR0_CU_ENCHANT_PROC))
return true;
// same spell with same caster should not stack
return false;
}
return true;
}
bool Aura::IsProcOnCooldown() const
{
/*if (m_procCooldown)
@@ -1803,7 +1938,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
Unit* target = aurApp->GetTarget();
if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER)
{
if (GetSpellProto()->EquippedItemClass == ITEM_CLASS_WEAPON)
if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_WEAPON)
{
if (target->ToPlayer()->IsInFeralForm())
return false;
@@ -1819,15 +1954,15 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI
else
item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED);
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & GetSpellProto()->EquippedItemSubClassMask))
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
else if (GetSpellProto()->EquippedItemClass == ITEM_CLASS_ARMOR)
else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item *item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellProto()->EquippedItemSubClassMask))
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask))
return false;
}
}
@@ -1846,7 +1981,7 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event
if (eventInfo.GetDamageInfo() && procEntry.ratePerMinute != 0)
{
uint32 WeaponSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
chance = caster->GetPPMProcChance(WeaponSpeed, procEntry.ratePerMinute, GetSpellProto());
chance = caster->GetPPMProcChance(WeaponSpeed, procEntry.ratePerMinute, GetSpellInfo());
}
// apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
if (Player* modOwner = caster->GetSpellModOwner())
@@ -1880,7 +2015,7 @@ void Aura::_DeleteRemovedApplications()
void Aura::LoadScripts()
{
sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura::LoadScripts");
sScriptMgr->CreateAuraScripts(m_spellProto->Id, m_loadedScripts);
sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
for (std::list<AuraScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;)
{
if (!(*itr)->_Load(this))
@@ -1918,7 +2053,7 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
if (!preventDefault)
@@ -1937,7 +2072,7 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
if (!preventDefault)
@@ -1955,7 +2090,7 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
(*scritr)->_FinishScriptCall();
@@ -1970,7 +2105,7 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp
std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, mode);
}
(*scritr)->_FinishScriptCall();
@@ -1986,7 +2121,7 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic
std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
}
if (!preventDefault)
@@ -2004,7 +2139,7 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff)
std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff);
}
(*scritr)->_FinishScriptCall();
@@ -2019,7 +2154,7 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 &
std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, amount, canBeRecalculated);
}
(*scritr)->_FinishScriptCall();
@@ -2034,7 +2169,7 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool &
std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, isPeriodic, amplitude);
}
(*scritr)->_FinishScriptCall();
@@ -2049,7 +2184,7 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM
std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, spellMod);
}
(*scritr)->_FinishScriptCall();
@@ -2064,7 +2199,7 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect * aurEff, AuraApplication c
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2079,7 +2214,7 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect * aurEff, AuraApplicat
std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2094,7 +2229,7 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect * aurEff, AuraApplicati
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
@@ -2109,14 +2244,14 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect * aurEff, AuraAppl
std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
for (; effItr != effEndItr ; ++effItr)
{
if ((*effItr).IsEffectAffected(m_spellProto, aurEff->GetEffIndex()))
if ((*effItr).IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
(*effItr).Call(*scritr, aurEff, dmgInfo, absorbAmount);
}
(*scritr)->_FinishScriptCall();
}
}
UnitAura::UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
m_AuraDRGroup = DIMINISHING_NONE;
@@ -2162,24 +2297,17 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
continue;
UnitList targetList;
// non-area aura
if (GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AURA)
if (GetSpellInfo()->Effects[effIndex].Effect == SPELL_EFFECT_APPLY_AURA)
{
targetList.push_back(GetUnitOwner());
}
else
{
float radius;
if (GetSpellProto()->Effect[effIndex] == SPELL_EFFECT_APPLY_AREA_AURA_ENEMY)
radius = GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[effIndex]));
else
radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[effIndex]));
if (modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_RADIUS, radius);
float radius = GetSpellInfo()->Effects[effIndex].CalcRadius(caster);
if (!GetUnitOwner()->HasUnitState(UNIT_STAT_ISOLATED))
{
switch(GetSpellProto()->Effect[effIndex])
switch(GetSpellInfo()->Effects[effIndex].Effect)
{
case SPELL_EFFECT_APPLY_AREA_AURA_PARTY:
targetList.push_back(GetUnitOwner());
@@ -2228,7 +2356,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster)
}
}
DynObjAura::DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID)
: Aura(spellproto, owner, caster, castItem, casterGUID)
{
LoadScripts();
@@ -2256,8 +2384,8 @@ void DynObjAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* /*caster
if (!HasEffect(effIndex))
continue;
UnitList targetList;
if (GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_DEST_DYNOBJ_ALLY
|| GetSpellProto()->EffectImplicitTargetB[effIndex] == TARGET_UNIT_AREA_ALLY_DST)
if (GetSpellInfo()->Effects[effIndex].TargetB == TARGET_DEST_DYNOBJ_ALLY
|| GetSpellInfo()->Effects[effIndex].TargetB == TARGET_UNIT_AREA_ALLY_DST)
{
Trinity::AnyFriendlyUnitInObjectRangeCheck u_check(GetDynobjOwner(), dynObjOwnerCaster, radius);
Trinity::UnitListSearcher<Trinity::AnyFriendlyUnitInObjectRangeCheck> searcher(GetDynobjOwner(), targetList, u_check);
+18 -16
View File
@@ -20,9 +20,10 @@
#define TRINITY_SPELLAURAS_H
#include "SpellAuraDefines.h"
#include "SpellInfo.h"
class Unit;
struct SpellEntry;
class SpellInfo;
struct SpellModifier;
struct ProcTriggerSpell;
struct SpellProcEntry;
@@ -82,20 +83,20 @@ class AuraApplication
class Aura
{
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellEntry const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
typedef std::map<uint64, AuraApplication *> ApplicationMap;
static uint8 BuildEffectMaskForOwner(SpellEntry const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
static Aura* TryRefreshStackOrCreate(SpellEntry const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL);
static Aura* TryCreate(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
static Aura* Create(SpellEntry const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
explicit Aura(SpellEntry const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID);
static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL);
static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
explicit Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID);
void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
virtual ~Aura();
SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const{ return GetSpellProto()->Id; }
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
uint32 GetId() const{ return GetSpellInfo()->Id; }
uint64 GetCastItemGUID() const { return m_castItemGuid; }
uint64 const& GetCasterGUID() const { return m_casterGuid; }
@@ -150,7 +151,7 @@ class Aura
bool IsPassive() const;
bool IsDeathPersistent() const;
bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !(m_spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !(m_spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT)); }
bool CanBeSaved() const;
bool IsRemoved() const { return m_isRemoved; }
bool CanBeSentToClient() const;
@@ -158,6 +159,7 @@ class Aura
bool IsSingleTarget() const {return m_isSingleTarget;}
void SetIsSingleTarget(bool val) { m_isSingleTarget = val;}
void UnregisterSingleTarget();
int32 CalcDispelChance(Unit* auraTarget, bool offensive) const;
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount);
@@ -180,6 +182,7 @@ class Aura
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
bool CanBeAppliedOn(Unit* target);
bool CheckAreaTarget(Unit* target);
bool CanStackWith(Aura const* existingAura) const;
// Proc system
bool IsProcOnCooldown() const;
@@ -191,7 +194,6 @@ class Aura
float CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const;
void TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo);
// AuraScript
void LoadScripts();
bool CallScriptCheckAreaTargetHandlers(Unit* target);
@@ -212,7 +214,7 @@ class Aura
private:
void _DeleteRemovedApplications();
protected:
SpellEntry const* const m_spellProto;
SpellInfo const* const m_spellInfo;
uint64 const m_casterGuid;
uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
time_t const m_applyTime;
@@ -240,9 +242,9 @@ class Aura
class UnitAura : public Aura
{
friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
protected:
explicit UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
@@ -261,9 +263,9 @@ class UnitAura : public Aura
class DynObjAura : public Aura
{
friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
protected:
explicit DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
public:
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
File diff suppressed because it is too large Load Diff
+16 -27
View File
@@ -31,8 +31,8 @@ class WorldObject;
class Aura;
class SpellScript;
class ByteBuffer;
struct SpellEntry;
class SpellInfo;
class SpellImplicitTargetInfo;
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
@@ -211,14 +211,7 @@ class SpellCastTargets
struct SpellValue
{
explicit SpellValue(SpellEntry const* proto)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
EffectBasePoints[i] = proto->EffectBasePoints[i];
MaxAffectedTargets = proto->MaxAffectedTargets;
RadiusMod = 1.0f;
AuraStackAmount = 1;
}
explicit SpellValue(SpellInfo const* proto);
int32 EffectBasePoints[MAX_SPELL_EFFECTS];
uint32 MaxAffectedTargets;
float RadiusMod;
@@ -387,7 +380,7 @@ class Spell
typedef std::set<Aura*> UsedSpellMods;
Spell(Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false, bool castedClientside = false);
Spell(Unit* Caster, SpellInfo const *info, bool triggered, uint64 originalCasterGUID = 0, bool skipCheck = false, bool castedClientside = false);
~Spell();
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
@@ -431,7 +424,7 @@ class Spell
void WriteAmmoToPacket(WorldPacket * data);
void SelectSpellTargets();
void SelectEffectTargets(uint32 i, uint32 cur);
void SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur);
void SelectTrajTargets();
template<typename T> WorldObject* FindCorpseUsing();
@@ -441,7 +434,7 @@ class Spell
void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
static void SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE);
static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cast_count, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE);
void SendCastResult(SpellCastResult result);
void SendSpellStart();
void SendSpellGo();
@@ -463,9 +456,9 @@ class Spell
void SendResurrectRequest(Player* target);
void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i);
void HandleThreatSpells(uint32 spellId);
void HandleThreatSpells();
const SpellEntry * const m_spellInfo;
SpellInfo const* const m_spellInfo;
Item* m_CastItem;
uint64 m_castItemGUID;
uint8 m_cast_count;
@@ -477,17 +470,14 @@ class Spell
UsedSpellMods m_appliedMods;
int32 GetCastTime() const { return m_casttime; }
int32 CalcCastTime() const { return m_casttime; }
bool IsAutoRepeat() const { return m_autoRepeat; }
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const
{
return m_spellInfo->Attributes & SPELL_ATTR0_ON_NEXT_SWING;
}
bool IsNextMeleeSwingSpell() const;
bool IsTriggered() const {return m_IsTriggeredSpell;};
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
bool IsAutoActionResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); }
bool IsAutoActionResetSpell() const;
bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }
@@ -503,7 +493,7 @@ class Spell
Unit* GetCaster() const { return m_caster; }
Unit* GetOriginalCaster() const { return m_originalCaster; }
SpellEntry const* GetSpellInfo() const { return m_spellInfo; }
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
int32 GetPowerCost() const { return m_powerCost; }
void UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
@@ -669,7 +659,7 @@ class Spell
bool CanExecuteTriggersOnHit(uint8 effMask) const;
void PrepareTriggersExecutedOnHit();
typedef std::list< std::pair<SpellEntry const*, int32> > HitTriggerSpells;
typedef std::list< std::pair<SpellInfo const*, int32> > HitTriggerSpells;
HitTriggerSpells m_hitTriggerSpells;
// effect helpers
@@ -689,9 +679,8 @@ class Spell
// if need this can be replaced by Aura copy
// we can't store original aura link to prevent access to deleted auras
// and in same time need aura data and after aura deleting.
SpellEntry const* m_triggeredByAuraSpell;
SpellInfo const* m_triggeredByAuraSpell;
uint32 m_customAttr;
bool m_skipCheck;
uint32 m_effectMask;
uint8 m_auraScaleMask;
@@ -719,10 +708,10 @@ namespace Trinity
uint32 i_entry;
const Position * const i_pos;
bool i_requireDeadTarget;
SpellEntry const* i_spellProto;
SpellInfo const* i_spellProto;
SpellNotifierCreatureAndPlayer(Unit *source, std::list<Unit*> &data, float radius, SpellNotifyPushType type,
SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position *pos = NULL, uint32 entry = 0, SpellEntry const* spellProto = NULL)
SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position *pos = NULL, uint32 entry = 0, SpellInfo const* spellProto = NULL)
: i_data(&data), i_push_type(type), i_radius(radius), i_TargetType(TargetType),
i_source(source), i_entry(entry), i_pos(pos), i_spellProto(spellProto)
{
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -21,7 +21,7 @@
#include "SpellScript.h"
#include "SpellMgr.h"
bool _SpellScript::_Validate(SpellEntry const* entry)
bool _SpellScript::_Validate(SpellInfo const* entry)
{
if (!Validate(entry))
{
@@ -59,7 +59,7 @@ _SpellScript::EffectHook::EffectHook(uint8 _effIndex)
effIndex = _effIndex;
}
uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEntry)
uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEntry)
{
uint8 mask = 0;
if ((effIndex == EFFECT_ALL) || (effIndex == EFFECT_FIRST_FOUND))
@@ -80,7 +80,7 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellEntry const* spellEn
return mask;
}
bool _SpellScript::EffectHook::IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
{
return GetAffectedEffectsMask(spellEntry) & 1<<effIndex;
}
@@ -103,13 +103,13 @@ std::string _SpellScript::EffectHook::EffIndexToString()
return "Invalid Value";
}
bool _SpellScript::EffectNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!spellEntry->Effect[effIndex] && !effName)
if (!spellEntry->Effects[effIndex].Effect && !effName)
return true;
if (!spellEntry->Effect[effIndex])
if (!spellEntry->Effects[effIndex].Effect)
return false;
return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effect[effIndex] == effName);
return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName);
}
std::string _SpellScript::EffectNameCheck::ToString()
@@ -125,13 +125,13 @@ std::string _SpellScript::EffectNameCheck::ToString()
}
}
bool _SpellScript::EffectAuraNameCheck::Check(SpellEntry const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!spellEntry->EffectApplyAuraName[effIndex] && !effAurName)
if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName)
return true;
if (!spellEntry->EffectApplyAuraName[effIndex])
if (!spellEntry->Effects[effIndex].ApplyAuraName)
return false;
return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->EffectApplyAuraName[effIndex] == effAurName);
return (effAurName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName);
}
std::string _SpellScript::EffectAuraNameCheck::ToString()
@@ -168,7 +168,7 @@ std::string SpellScript::EffectHandler::ToString()
return "Index: " + EffIndexToString() + " Name: " +_SpellScript::EffectNameCheck::ToString();
}
bool SpellScript::EffectHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
}
@@ -201,11 +201,11 @@ std::string SpellScript::UnitTargetHandler::ToString()
return oss.str();
}
bool SpellScript::UnitTargetHandler::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
bool SpellScript::UnitTargetHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
if (!targetType)
return false;
return (effIndex == EFFECT_ALL) || (spellEntry->EffectImplicitTargetA[effIndex] == targetType || spellEntry->EffectImplicitTargetB[effIndex] == targetType);
return (effIndex == EFFECT_ALL) || (spellEntry->Effects[effIndex].TargetA == targetType || spellEntry->Effects[effIndex].TargetB == targetType);
}
void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Unit*>& unitTargets)
@@ -213,7 +213,7 @@ void SpellScript::UnitTargetHandler::Call(SpellScript* spellScript, std::list<Un
(spellScript->*pUnitTargetHandlerScript)(unitTargets);
}
bool SpellScript::_Validate(SpellEntry const* entry)
bool SpellScript::_Validate(SpellInfo const* entry)
{
for (std::list<EffectHandler>::iterator itr = OnEffect.begin(); itr != OnEffect.end(); ++itr)
if (!(*itr).GetAffectedEffectsMask(entry))
@@ -261,7 +261,7 @@ Unit* SpellScript::GetOriginalCaster()
return m_spell->GetOriginalCaster();
}
SpellEntry const* SpellScript::GetSpellInfo()
SpellInfo const* SpellScript::GetSpellInfo()
{
return m_spell->GetSpellInfo();
}
@@ -472,10 +472,10 @@ void SpellScript::SetCustomCastResultMessage(SpellCustomErrors result)
m_spell->m_customError = result;
}
bool AuraScript::_Validate(SpellEntry const* entry)
bool AuraScript::_Validate(SpellInfo const* entry)
{
for (std::list<CheckAreaTargetHandler>::iterator itr = DoCheckAreaTarget.begin(); itr != DoCheckAreaTarget.end(); ++itr)
if (!HasAreaAuraEffect(entry))
if (!entry->HasAreaAuraEffect())
sLog->outError("TSCR: Spell `%u` of script `%s` does not have area aura effect - handler bound to hook `DoCheckAreaTarget` of AuraScript won't be executed", entry->Id, m_scriptName->c_str());
for (std::list<EffectApplyHandler>::iterator itr = OnEffectApply.begin(); itr != OnEffectApply.end(); ++itr)
@@ -548,7 +548,7 @@ AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
{
}
bool AuraScript::EffectBase::CheckEffect(SpellEntry const* spellEntry, uint8 effIndex)
bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
{
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
}
@@ -703,9 +703,9 @@ void AuraScript::PreventDefaultAction()
}
}
SpellEntry const* AuraScript::GetSpellProto() const
SpellInfo const* AuraScript::GetSpellInfo() const
{
return m_aura->GetSpellProto();
return m_aura->GetSpellInfo();
}
uint32 AuraScript::GetId() const
+15 -15
View File
@@ -24,7 +24,7 @@
#include <stack>
class Unit;
struct SpellEntry;
class SpellInfo;
class SpellScript;
class Spell;
class Aura;
@@ -56,7 +56,7 @@ class _SpellScript
// internal use classes & functions
// DO NOT OVERRIDE THESE IN SCRIPTS
protected:
virtual bool _Validate(SpellEntry const* entry);
virtual bool _Validate(SpellInfo const* entry);
public:
_SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE) {}
@@ -70,9 +70,9 @@ class _SpellScript
{
public:
EffectHook(uint8 _effIndex);
uint8 GetAffectedEffectsMask(SpellEntry const* spellEntry);
bool IsEffectAffected(SpellEntry const* spellEntry, uint8 effIndex);
virtual bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex) = 0;
uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
std::string EffIndexToString();
protected:
uint8 effIndex;
@@ -82,7 +82,7 @@ class _SpellScript
{
public:
EffectNameCheck(uint16 _effName) {effName = _effName;};
bool Check(SpellEntry const* spellEntry, uint8 effIndex);
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
uint16 effName;
@@ -92,7 +92,7 @@ class _SpellScript
{
public:
EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
bool Check(SpellEntry const* spellEntry, uint8 effIndex);
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
std::string ToString();
private:
uint16 effAurName;
@@ -110,7 +110,7 @@ class _SpellScript
virtual void Register() = 0;
// Function called on server startup, if returns false script won't be used in core
// use for: dbc/template data presence/correctness checks
virtual bool Validate(SpellEntry const* /*spellEntry*/) { return true; }
virtual bool Validate(SpellInfo const* /*spellEntry*/) { return true; }
// Function called when script is created, if returns false script will be unloaded afterwards
// use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
virtual bool Load() { return true; }
@@ -163,7 +163,7 @@ class SpellScript : public _SpellScript
public:
EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
std::string ToString();
bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex);
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
void Call(SpellScript* spellScript, SpellEffIndex effIndex);
private:
SpellEffectFnType pEffectHandlerScript;
@@ -183,7 +183,7 @@ class SpellScript : public _SpellScript
public:
UnitTargetHandler(SpellUnitTargetFnType _pUnitTargetHandlerScript, uint8 _effIndex, uint16 _targetType);
std::string ToString();
bool CheckEffect(SpellEntry const* spellEntry, uint8 targetType);
bool CheckEffect(SpellInfo const* spellEntry, uint8 targetType);
void Call(SpellScript* spellScript, std::list<Unit*>& unitTargets);
private:
SpellUnitTargetFnType pUnitTargetHandlerScript;
@@ -198,7 +198,7 @@ class SpellScript : public _SpellScript
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
public:
bool _Validate(SpellEntry const* entry);
bool _Validate(SpellInfo const* entry);
bool _Load(Spell* spell);
void _InitHit();
bool _IsEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventEffectMask & (1<<effIndex); }
@@ -255,7 +255,7 @@ class SpellScript : public _SpellScript
// methods useable during all spell handling phases
Unit* GetCaster();
Unit* GetOriginalCaster();
SpellEntry const* GetSpellInfo();
SpellInfo const* GetSpellInfo();
// methods useable after spell targets are set
// accessors to the "focus" targets of the spell
@@ -381,7 +381,7 @@ class AuraScript : public _SpellScript
public:
EffectBase(uint8 _effIndex, uint16 _effName);
std::string ToString();
bool CheckEffect(SpellEntry const* spellEntry, uint8 effIndex);
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
};
class EffectPeriodicHandler : public EffectBase
{
@@ -465,7 +465,7 @@ class AuraScript : public _SpellScript
public:
AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false)
{}
bool _Validate(SpellEntry const* entry);
bool _Validate(SpellInfo const* entry);
bool _Load(Aura * aura);
void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL);
void _FinishScriptCall();
@@ -580,7 +580,7 @@ class AuraScript : public _SpellScript
// AuraScript interface - functions which are redirecting to Aura class
// returns proto of the spell
SpellEntry const* GetSpellProto() const;
SpellInfo const* GetSpellInfo() const;
// returns spellid of the spell
uint32 GetId() const;
@@ -128,7 +128,7 @@ void CharacterDatabaseCleaner::CleanCharacterSkills()
bool CharacterDatabaseCleaner::SpellCheck(uint32 spell_id)
{
return sSpellStore.LookupEntry(spell_id) && !GetTalentSpellPos(spell_id);
return sSpellMgr->GetSpellInfo(spell_id) && !GetTalentSpellPos(spell_id);
}
void CharacterDatabaseCleaner::CleanCharacterSpell()
+12 -3
View File
@@ -1253,6 +1253,18 @@ void World::SetInitialWorldSettings()
LoadDBCStores(m_dataPath);
DetectDBCLang();
sLog->outString("Loading spell dbc data corrections...");
sSpellMgr->LoadDbcDataCorrections();
sLog->outString("Loading SpellInfo store...");
sSpellMgr->LoadSpellInfoStore();
sLog->outString("Loading spell custom attributes...");
sSpellMgr->LoadSpellCustomAttr();
// unload data which is copied to SpellMgr::mSpellInfoMap
sSpellStore.Clear();
sLog->outString("Loading Script Names...");
sObjectMgr->LoadScriptNames();
@@ -1447,9 +1459,6 @@ void World::SetInitialWorldSettings()
sLog->outString("Loading spell pet auras...");
sSpellMgr->LoadSpellPetAuras();
sLog->outString("Loading spell extra attributes...");
sSpellMgr->LoadSpellCustomAttr();
sLog->outString("Loading Spell target coordinates...");
sSpellMgr->LoadSpellTargetPositions();
+2 -2
View File
@@ -976,11 +976,11 @@ public:
{
// reset all states
for (int i = 1; i <= 32; ++i)
unit->ModifyAuraState(AuraState(i), false);
unit->ModifyAuraState(AuraStateType(i), false);
return true;
}
unit->ModifyAuraState(AuraState(abs(state)), state > 0);
unit->ModifyAuraState(AuraStateType(abs(state)), state > 0);
return true;
}
+10 -10
View File
@@ -80,13 +80,13 @@ public:
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spell = handler->extractSpellIdFromLink((char*)args);
if (!spell || !sSpellStore.LookupEntry(spell))
if (!spell || !sSpellMgr->GetSpellInfo(spell))
return false;
char const* allStr = strtok(NULL, " ");
bool allRanks = allStr ? (strncmp(allStr, "all", strlen(allStr)) == 0) : false;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer()))
{
handler->PSendSysMessage(LANG_COMMAND_SPELL_BROKEN, spell);
@@ -118,13 +118,13 @@ public:
static bool HandleLearnAllGMCommand(ChatHandler* handler, const char* /*args*/)
{
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(i);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
if (!sSpellMgr->IsSkillTypeSpell(i, SKILL_INTERNAL))
if (!spellInfo->IsAbilityOfSkillType(SKILL_INTERNAL))
continue;
handler->GetSession()->GetPlayer()->learnSpell(i, false);
@@ -154,12 +154,12 @@ public:
if (!entry)
continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(entry->spellId);
SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(entry->spellId);
if (!spellInfo)
continue;
// skip server-side/triggered spells
if (spellInfo->spellLevel == 0)
if (spellInfo->SpellLevel == 0)
continue;
// skip wrong class/race skills
@@ -218,7 +218,7 @@ public:
if (!spellId) // ??? none spells in talent
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
@@ -297,7 +297,7 @@ public:
if (!spellid) // ??? none spells in talent
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, handler->GetSession()->GetPlayer(), false))
continue;
@@ -456,7 +456,7 @@ public:
if (skillLine->classmask && (skillLine->classmask & classmask) == 0)
continue;
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(skillLine->spellId);
if (!spellInfo || !SpellMgr::IsSpellValid(spellInfo, player, false))
continue;
@@ -98,7 +98,7 @@ public:
void UpdateAI(const uint32 diff);
void SpellHit(Unit* /*source*/, const SpellEntry *spell)
void SpellHit(Unit* /*source*/, const SpellInfo *spell)
{
if (spell->Mechanic == MECHANIC_DISARM)
DoScriptText(SAY_DISARMED, me);
@@ -149,7 +149,7 @@ public:
CAST_CRE(pMalchezaar)->AI()->KilledUnit(who);
}
void SpellHit(Unit* /*who*/, const SpellEntry *spell)
void SpellHit(Unit* /*who*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_INFERNAL_RELAY)
{
@@ -305,7 +305,7 @@ public:
void EnfeebleHealthEffect()
{
const SpellEntry *info = GetSpellStore()->LookupEntry(SPELL_ENFEEBLE_EFFECT);
const SpellInfo *info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT);
if (!info)
return;
@@ -486,12 +486,12 @@ public:
DrinkInturrupted = true;
}
void SpellHit(Unit* /*pAttacker*/, const SpellEntry* Spell)
void SpellHit(Unit* /*pAttacker*/, const SpellInfo* Spell)
{
//We only care about interrupt effects and only if they are durring a spell currently being casted
if ((Spell->Effect[0] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[1] != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effect[2] != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
if ((Spell->Effects[0].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effects[1].Effect != SPELL_EFFECT_INTERRUPT_CAST &&
Spell->Effects[2].Effect != SPELL_EFFECT_INTERRUPT_CAST) || !me->IsNonMeleeSpellCasted(false))
return;
//Interrupt effect
@@ -340,7 +340,7 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, const SpellEntry *Spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *Spell)
{
if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10)))
{
@@ -1080,7 +1080,7 @@ public:
me->DespawnOrUnsummon();
}
void SpellHit(Unit* /*caster*/, const SpellEntry *Spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *Spell)
{
if (Spell->Id == SPELL_DRINK_POISON)
{
@@ -138,14 +138,14 @@ public:
if (lList.isEmpty())
return;
SpellEntry const* pSpell = GetSpellStore()->LookupEntry(SPELL_ORB_KILL_CREDIT);
SpellInfo const* pSpell = sSpellMgr->GetSpellInfo(SPELL_ORB_KILL_CREDIT);
for (Map::PlayerList::const_iterator i = lList.begin(); i != lList.end(); ++i)
{
if (Player* player = i->getSource())
{
if (pSpell && pSpell->EffectMiscValue[0])
player->KilledMonsterCredit(pSpell->EffectMiscValue[0], 0);
if (pSpell && pSpell->Effects[0].MiscValue)
player->KilledMonsterCredit(pSpell->Effects[0].MiscValue, 0);
}
}
}
@@ -436,7 +436,7 @@ public:
m_bIsDuelInProgress = false;
}
void SpellHit(Unit* pCaster, const SpellEntry* pSpell)
void SpellHit(Unit* pCaster, const SpellInfo* pSpell)
{
if (!m_bIsDuelInProgress && pSpell->Id == SPELL_DUEL)
{
@@ -625,7 +625,7 @@ public:
{
npc_salanar_the_horsemanAI(Creature* c) : ScriptedAI(c) {}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == DELIVER_STOLEN_HORSE)
{
@@ -71,7 +71,7 @@ public:
me->RestoreFaction();
}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter)
{
@@ -143,13 +143,6 @@ public:
mob_wisp_invisAI(Creature* c) : ScriptedAI(c)
{
Creaturetype = delay = spell = spell2 = 0;
//that's hack but there are no info about range of this spells in dbc
SpellEntry *wisp = GET_SPELL(SPELL_WISP_BLUE);
if (wisp)
wisp->rangeIndex = 6; //100 yards
SpellEntry *port = GET_SPELL(SPELL_WISP_FLIGHT_PORT);
if (port)
port->rangeIndex = 6;
}
uint32 Creaturetype;
@@ -183,7 +176,7 @@ public:
DoCast(me, spell);
}
void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4)
me->SetDisplayId(2027);
@@ -290,7 +283,7 @@ public:
}
}
void SpellHit(Unit* caster, const SpellEntry* spell)
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!withbody)
return;
@@ -534,7 +527,7 @@ public:
return NULL;
}
void SpellHitTarget(Unit* unit, const SpellEntry* spell)
void SpellHitTarget(Unit* unit, const SpellInfo* spell)
{
if (spell->Id == SPELL_CONFLAGRATION && unit->HasAura(SPELL_CONFLAGRATION))
SaySound(SAY_CONFLAGRATION, unit);
@@ -553,7 +546,7 @@ public:
pInstance->SetData(DATA_HORSEMAN_EVENT, DONE);
}
void SpellHit(Unit* caster, const SpellEntry* spell)
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (withhead)
return;
@@ -781,7 +774,7 @@ public:
void EnterCombat(Unit* /*who*/){}
void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_SPROUTING)
{
@@ -157,7 +157,7 @@ public:
}
}
void SpellHit(Unit* /*who*/, const SpellEntry* pSpell)
void SpellHit(Unit* /*who*/, const SpellInfo* pSpell)
{
//When hit with ressurection say text
if (pSpell->Id == SPELL_SCARLETRESURRECTION)
@@ -148,7 +148,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -224,7 +224,7 @@ public:
void EnterCombat(Unit* /*who*/) {}
void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (!Tagged && spell->Id == SPELL_EGAN_BLASTER)
Tagged = true;
@@ -181,7 +181,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, const SpellEntry* spell)
void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
@@ -476,7 +476,7 @@ public:
me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
void SpellHitTarget(Unit* target, const SpellEntry* spell)
void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
@@ -701,7 +701,7 @@ public:
void EnterCombat(Unit* /*who*/){}
void SpellHitTarget(Unit* target, const SpellEntry* spell)
void SpellHitTarget(Unit* target, const SpellInfo* spell)
{
switch(spell->Id)
{
@@ -118,17 +118,6 @@ public:
boss_felmystAI(Creature* c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
// wait for core patch be accepted
/*SpellEntry *TempSpell = GET_SPELL(SPELL_ENCAPSULATE_EFFECT);
if (TempSpell->SpellIconID == 2294)
TempSpell->SpellIconID = 2295;
TempSpell = GET_SPELL(SPELL_VAPOR_TRIGGER);
if ((TempSpell->Attributes & SPELL_ATTR0_PASSIVE) == 0)
TempSpell->Attributes |= SPELL_ATTR0_PASSIVE;
TempSpell = GET_SPELL(SPELL_FOG_CHARM2);
if ((TempSpell->Attributes & SPELL_ATTR0_PASSIVE) == 0)
TempSpell->Attributes |= SPELL_ATTR0_PASSIVE;*/
}
InstanceScript *pInstance;
@@ -203,7 +192,7 @@ public:
pInstance->SetData(DATA_FELMYST_EVENT, DONE);
}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
// workaround for linked aura
/*if (spell->Id == SPELL_VAPOR_FORCE)
@@ -122,9 +122,6 @@ public:
DoorGUID = 0;
bJustReset = false;
me->setActive(true);
SpellEntry *TempSpell = GET_SPELL(SPELL_SPECTRAL_BLAST);
if (TempSpell)
TempSpell->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ENEMY;
}
InstanceScript *pInstance;
@@ -413,7 +413,7 @@ public:
Summons.Summon(summoned);
}
void SpellHit(Unit* /*caster*/, const SpellEntry* Spell)
void SpellHit(Unit* /*caster*/, const SpellInfo* Spell)
{
float x, y, z, o;
me->GetHomePosition(x, y, z, o);
@@ -475,10 +475,10 @@ public:
me->AddUnitState(UNIT_STAT_STUNNED);
}
void SpellHit(Unit* /*caster*/, const SpellEntry* Spell)
void SpellHit(Unit* /*caster*/, const SpellInfo* Spell)
{
for (uint8 i = 0; i < 3; ++i)
if (Spell->Effect[i] == 38)
if (Spell->Effects[i].Effect == 38)
me->DisappearAndDie();
}
@@ -112,10 +112,10 @@ class boss_archaedas : public CreatureScript
me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
}
void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
// Being woken up from the altar, start the awaken sequence
if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
{
me->MonsterYell(SAY_AGGRO, LANG_UNIVERSAL, 0);
DoPlaySoundToSet(me, SOUND_AGGRO);
@@ -267,9 +267,9 @@ class mob_archaedas_minions : public CreatureScript
bAmIAwake = true;
}
void SpellHit (Unit* /*caster*/, const SpellEntry *spell) {
void SpellHit (Unit* /*caster*/, const SpellInfo *spell) {
// time to wake up, start animation
if (spell == GetSpellStore()->LookupEntry(SPELL_ARCHAEDAS_AWAKEN))
if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN))
{
iAwakenTimer = 5000;
bWakingUp = true;
@@ -37,7 +37,6 @@ enum Spells
SPELL_GUST_OF_WIND = 43621,
SPELL_ELECTRICAL_STORM = 43648,
SPELL_BERSERK = 45078,
SPELL_ELECTRICAL_DAMAGE = 43657,
SPELL_ELECTRICAL_OVERLOAD = 43658,
SPELL_EAGLE_SWOOP = 44732
};
@@ -75,9 +74,6 @@ class boss_akilzon : public CreatureScript
{
boss_akilzonAI(Creature* c) : ScriptedAI(c)
{
SpellEntry *TempSpell = GET_SPELL(SPELL_ELECTRICAL_DAMAGE);
if (TempSpell)
TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core
pInstance = c->GetInstanceScript();
}
InstanceScript *pInstance;
@@ -61,7 +61,6 @@ EndScriptData */
#define SPELL_SHRED_ARMOR 43243
#define MOB_TOTEM 24224
#define SPELL_LIGHTNING 43301
enum PhaseHalazzi
{
@@ -87,10 +86,6 @@ class boss_halazzi : public CreatureScript
boss_halazziAI(Creature* c) : ScriptedAI(c)
{
pInstance = c->GetInstanceScript();
// need to find out what controls totem's spell cooldown
SpellEntry *TempSpell = GET_SPELL(SPELL_LIGHTNING);
if (TempSpell && TempSpell->CastingTimeIndex != 5)
TempSpell->CastingTimeIndex = 5; // 2000 ms casting time
}
InstanceScript *pInstance;
@@ -147,7 +142,7 @@ class boss_halazzi : public CreatureScript
damage = 0;
}
void SpellHit(Unit*, const SpellEntry *spell)
void SpellHit(Unit*, const SpellInfo *spell)
{
if (spell->Id == SPELL_TRANSFORM_SPLIT2)
EnterPhase(PHASE_HUMAN);
@@ -454,7 +454,7 @@ class mob_janalai_firebomb : public CreatureScript
void Reset() {}
void SpellHit(Unit* /*caster*/, const SpellEntry *spell)
void SpellHit(Unit* /*caster*/, const SpellInfo *spell)
{
if (spell->Id == SPELL_FIRE_BOMB_THROW)
DoCast(me, SPELL_FIRE_BOMB_DUMMY, true);
@@ -685,7 +685,7 @@ public:
void UpdateAI(uint32 const /*diff*/) {}
void SpellHit(Unit* /*caster*/, const SpellEntry* spell)
void SpellHit(Unit* /*caster*/, const SpellInfo* spell)
{
if (spell->Id == SPELL_HATCH_EGG)
{
@@ -610,7 +610,7 @@ class mob_zuljin_vortex : public CreatureScript
void EnterCombat(Unit* /*pTarget*/) {}
void SpellHit(Unit* caster, const SpellEntry* spell)
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (spell->Id == SPELL_ZAP_INFORM)
DoCast(caster, SPELL_ZAP_DAMAGE, true);
@@ -91,7 +91,7 @@ class npc_forest_frog : public CreatureScript
}
}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == ENTRY_FOREST_FROG)
{
@@ -120,7 +120,7 @@ public:
PlayerGUID = 0;
}
void SpellHit(Unit* caster, const SpellEntry* spell)
void SpellHit(Unit* caster, const SpellInfo* spell)
{
if (!caster)
return;
@@ -85,7 +85,7 @@ public:
}
}
void SpellHit(Unit* Hitter, const SpellEntry *Spellkind)
void SpellHit(Unit* Hitter, const SpellInfo *Spellkind)
{
if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit &&
(Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD)))
@@ -59,7 +59,7 @@ public:
me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE);
}
void SpellHit(Unit* caster, const SpellEntry *spell)
void SpellHit(Unit* caster, const SpellInfo *spell)
{
if (caster->GetTypeId() == TYPEID_PLAYER)
{
@@ -48,10 +48,10 @@ class spell_ex_5581 : public SpellScriptLoader
// function called on server startup
// checks if script has data required for it to work
bool Validate(SpellEntry const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellEntry*/)
{
// check if spellid 70522 exists in dbc, we will trigger it later
if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
return false;
return true;
}
@@ -147,10 +147,10 @@ class spell_ex_66244 : public SpellScriptLoader
PrepareAuraScript(spell_ex_66244AuraScript);
// function called on server startup
// checks if script has data required for it to work
bool Validate(SpellEntry const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellEntry*/)
{
// check if spellid exists in dbc, we will trigger it later
if (!sSpellStore.LookupEntry(SPELL_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_TRIGGERED))
return false;
return true;
}
@@ -379,7 +379,7 @@ class spell_ex : public SpellScriptLoader
{
PrepareSpellScript(spell_ex_SpellScript);
//bool Validate(SpellEntry const* spellEntry){return true;}
//bool Validate(SpellInfo const* spellEntry){return true;}
//bool Load(){return true;}
//void Unload(){}
@@ -406,7 +406,7 @@ class spell_ex : public SpellScriptLoader
class spell_ex_AuraScript : public AuraScript
{
PrepareAuraScript(spell_ex)
//bool Validate(SpellEntry const* spellEntry){return true;}
//bool Validate(SpellInfo const* spellEntry){return true;}
//bool Load(){return true;}
//void Unload(){}
@@ -69,12 +69,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
SpellEntry *TempSpell = GET_SPELL(SPELL_SLEEP);
if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
{
TempSpell->EffectImplicitTargetA[0] = 1;
TempSpell->EffectImplicitTargetB[0] = 0;
}
}
uint32 SwarmTimer;
@@ -60,9 +60,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
SpellEntry *TempSpell = GET_SPELL(SPELL_HOWL_OF_AZGALOR);
if (TempSpell)
TempSpell->EffectRadiusIndex[0] = 12;//100yards instead of 50000?!
}
uint32 RainTimer;
@@ -57,12 +57,6 @@ public:
pInstance = c->GetInstanceScript();
pGo = false;
pos = 0;
SpellEntry *TempSpell = GET_SPELL(SPELL_MARK);
if (TempSpell && TempSpell->EffectImplicitTargetA[0] != 1)
{
TempSpell->EffectImplicitTargetA[0] = 1;
TempSpell->EffectImplicitTargetB[0] = 0;
}
}
uint32 CleaveTimer;

Some files were not shown because too many files have changed in this diff Show More