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
+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);