Skip to content

Commit

Permalink
chore(Core/Misc): rename spellInfo pointers (azerothcore#17914)
Browse files Browse the repository at this point in the history
* Rename all
  • Loading branch information
Kitzunu authored Dec 2, 2023
1 parent 123bf37 commit 5bfeabd
Show file tree
Hide file tree
Showing 18 changed files with 88 additions and 88 deletions.
6 changes: 3 additions & 3 deletions src/server/game/Achievements/AchievementMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA:
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA:
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellEntry)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(aura.spell_id);
if (!spellInfo)
{
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: {} Type: {}) for data type {} ({}) has wrong spell id in value1 ({}), ignored.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id);
Expand All @@ -153,7 +153,7 @@ bool AchievementCriteriaData::IsValid(AchievementCriteriaEntry const* criteria)
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.effect_idx);
return false;
}
if (!spellEntry->Effects[aura.effect_idx].ApplyAuraName)
if (!spellInfo->Effects[aura.effect_idx].ApplyAuraName)
{
LOG_ERROR("sql.sql", "Table `achievement_criteria_data` (Entry: {} Type: {}) for data type {} ({}) has non-aura spell effect (ID: {} Effect: {}), ignores.",
criteria->ID, criteria->requiredType, (dataType == ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA ? "ACHIEVEMENT_CRITERIA_DATA_TYPE_S_AURA" : "ACHIEVEMENT_CRITERIA_DATA_TYPE_T_AURA"), dataType, aura.spell_id, aura.effect_idx);
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/DataStores/DBCStores.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,8 +429,8 @@ void LoadDBCStores(const std::string& dataPath)

for (SkillLineAbilityEntry const* skillLine : sSkillLineAbilityStore)
{
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->Spell);
if (spellInfo && spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
SpellEntry const* spellEntry = sSpellStore.LookupEntry(skillLine->Spell);
if (spellEntry && spellEntry->Attributes & SPELL_ATTR0_PASSIVE)
{
for (CreatureFamilyEntry const* cFamily : sCreatureFamilyStore)
{
Expand All @@ -439,7 +439,7 @@ void LoadDBCStores(const std::string& dataPath)
continue;
}

if (spellInfo->SpellLevel)
if (spellEntry->SpellLevel)
{
continue;
}
Expand All @@ -449,7 +449,7 @@ void LoadDBCStores(const std::string& dataPath)
continue;
}

sPetFamilySpellsStore[cFamily->ID].insert(spellInfo->Id);
sPetFamilySpellsStore[cFamily->ID].insert(spellEntry->Id);
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/server/game/Entities/Pet/Pet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1941,16 +1941,16 @@ void Pet::InitLevelupSpellsForLevel()
{
for (uint32 spellId : defSpells->spellid)
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellId);
if (!spellEntry)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo)
continue;

// will called first if level down
if (spellEntry->SpellLevel > level && sScriptMgr->CanUnlearnSpellDefault(this, spellEntry))
unlearnSpell(spellEntry->Id, true);
if (spellInfo->SpellLevel > level && sScriptMgr->CanUnlearnSpellDefault(this, spellInfo))
unlearnSpell(spellInfo->Id, true);
// will called if level up
else
learnSpell(spellEntry->Id);
learnSpell(spellInfo->Id);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Player/PlayerUpdates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ bool Player::UpdateCraftSkill(uint32 spellid)
GetPureSkillValue(_spell_idx->second->SkillLine);

// Alchemy Discoveries here
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spellid);
if (spellEntry && spellEntry->Mechanic == MECHANIC_DISCOVERY)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (spellInfo && spellInfo->Mechanic == MECHANIC_DISCOVERY)
{
if (uint32 discoveredSpell = GetSkillDiscoverySpell(
_spell_idx->second->SkillLine, spellid, this))
Expand Down
14 changes: 7 additions & 7 deletions src/server/game/Entities/Unit/Unit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19835,10 +19835,10 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
Unit* target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_CLICKER) ? clicker : this;
ObjectGuid origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? GetOwnerGUID() : clicker->GetGUID();

SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->second.spellId);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->second.spellId);

// xinef: dont allow players to enter vehicles on arena
if (spellEntry->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->GetTypeId() == TYPEID_PLAYER && caster->FindMap() && caster->FindMap()->IsBattleArena())
if (spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE) && caster->GetTypeId() == TYPEID_PLAYER && caster->FindMap() && caster->FindMap()->IsBattleArena())
continue;

if (seatId > -1)
Expand All @@ -19847,7 +19847,7 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
bool valid = false;
while (i < MAX_SPELL_EFFECTS)
{
if (spellEntry->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
if (spellInfo->Effects[i].ApplyAuraName == SPELL_AURA_CONTROL_VEHICLE)
{
valid = true;
break;
Expand All @@ -19867,18 +19867,18 @@ bool Unit::HandleSpellClick(Unit* clicker, int8 seatId)
{
int32 bp0[MAX_SPELL_EFFECTS];
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
bp0[j] = spellEntry->Effects[j].BasePoints;
bp0[j] = spellInfo->Effects[j].BasePoints;

bp0[i] = seatId;
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, bp0, nullptr, origCasterGUID);
}
}
else
{
if (IsInMap(caster))
caster->CastSpell(target, spellEntry, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
caster->CastSpell(target, spellInfo, GetVehicleKit() ? TRIGGERED_IGNORE_CASTER_MOUNTED_OR_ON_VEHICLE : TRIGGERED_NONE, nullptr, nullptr, origCasterGUID);
else
Aura::TryRefreshStackOrCreate(spellEntry, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, this, clicker, nullptr, nullptr, origCasterGUID);
}

result = true;
Expand Down
10 changes: 5 additions & 5 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5671,7 +5671,7 @@ void ObjectMgr::ValidateSpellScripts()

for (SpellScriptsContainer::iterator itr = _spellScriptsStore.begin(); itr != _spellScriptsStore.end();)
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(itr->first);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
std::vector<std::pair<SpellScriptLoader*, SpellScriptsContainer::iterator> > SpellScriptLoaders;
sScriptMgr->CreateSpellScriptLoaders(itr->first, SpellScriptLoaders);
itr = _spellScriptsStore.upper_bound(itr->first);
Expand All @@ -5688,17 +5688,17 @@ void ObjectMgr::ValidateSpellScripts()
}
if (spellScript)
{
spellScript->_Init(&sitr->first->GetName(), spellEntry->Id);
spellScript->_Init(&sitr->first->GetName(), spellInfo->Id);
spellScript->_Register();
if (!spellScript->_Validate(spellEntry))
if (!spellScript->_Validate(spellInfo))
valid = false;
delete spellScript;
}
if (auraScript)
{
auraScript->_Init(&sitr->first->GetName(), spellEntry->Id);
auraScript->_Init(&sitr->first->GetName(), spellInfo->Id);
auraScript->_Register();
if (!auraScript->_Validate(spellEntry))
if (!auraScript->_Validate(spellInfo))
valid = false;
delete auraScript;
}
Expand Down
12 changes: 6 additions & 6 deletions src/server/game/Handlers/TradeHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 my_spell_id = my_trade->GetSpell())
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(my_spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(my_spell_id);
Item* castItem = my_trade->GetSpellCastItem();

if (!spellEntry || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
if (!spellInfo || !his_trade->GetItem(TRADE_SLOT_NONTRADED) ||
(my_trade->HasSpellCastItem() && !castItem))
{
clearAcceptTradeMode(my_trade, his_trade);
Expand All @@ -352,7 +352,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}

my_spell = new Spell(_player, spellEntry, TRIGGERED_FULL_MASK);
my_spell = new Spell(_player, spellInfo, TRIGGERED_FULL_MASK);
my_spell->m_CastItem = castItem;
my_targets.SetTradeItemTarget(_player);
my_spell->m_targets = my_targets;
Expand All @@ -374,10 +374,10 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
// not accept if spell can't be casted now (cheating)
if (uint32 his_spell_id = his_trade->GetSpell())
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(his_spell_id);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(his_spell_id);
Item* castItem = his_trade->GetSpellCastItem();

if (!spellEntry || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
if (!spellInfo || !my_trade->GetItem(TRADE_SLOT_NONTRADED) || (his_trade->HasSpellCastItem() && !castItem))
{
delete my_spell;
his_trade->SetSpell(0);
Expand All @@ -387,7 +387,7 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
return;
}

his_spell = new Spell(trader, spellEntry, TRIGGERED_FULL_MASK);
his_spell = new Spell(trader, spellInfo, TRIGGERED_FULL_MASK);
his_spell->m_CastItem = castItem;
his_targets.SetTradeItemTarget(trader);
his_spell->m_targets = his_targets;
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Scripting/ScriptDefines/PetScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ bool ScriptMgr::CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell)
return true;
}

bool ScriptMgr::CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry)
bool ScriptMgr::CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellInfo)
{
auto ret = IsValidBoolScript<PetScript>([&](PetScript* script)
{
return !script->CanUnlearnSpellDefault(pet, spellEntry);
return !script->CanUnlearnSpellDefault(pet, spellInfo);
});

if (ret && *ret)
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Scripting/ScriptMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1914,7 +1914,7 @@ class PetScript : public ScriptObject

[[nodiscard]] virtual bool CanUnlearnSpellSet(Pet* /*pet*/, uint32 /*level*/, uint32 /*spell*/) { return true; }

[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellEntry*/) { return true; }
[[nodiscard]] virtual bool CanUnlearnSpellDefault(Pet* /*pet*/, SpellInfo const* /*spellInfo*/) { return true; }

[[nodiscard]] virtual bool CanResetTalents(Pet* /*pet*/) { return true; }

Expand Down Expand Up @@ -2650,7 +2650,7 @@ class ScriptMgr
void OnInitStatsForLevel(Guardian* guardian, uint8 petlevel);
void OnCalculateMaxTalentPointsForLevel(Pet* pet, uint8 level, uint8& points);
bool CanUnlearnSpellSet(Pet* pet, uint32 level, uint32 spell);
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellEntry);
bool CanUnlearnSpellDefault(Pet* pet, SpellInfo const* spellInfo);
bool CanResetTalents(Pet* pet);

public: /* ArenaScript */
Expand Down
6 changes: 3 additions & 3 deletions src/server/game/Skills/SkillDiscovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ void LoadSkillDiscoveryTable()
// report about empty data for explicit discovery spells
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
{
SpellInfo const* spellEntry = sSpellMgr->GetSpellInfo(spell_id);
if (!spellEntry)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
if (!spellInfo)
continue;

// skip not explicit discovery spells
if (!spellEntry->IsExplicitDiscovery())
if (!spellInfo->IsExplicitDiscovery())
continue;

if (SkillDiscoveryStore.find(int32(spell_id)) == SkillDiscoveryStore.end())
Expand Down
8 changes: 4 additions & 4 deletions src/server/game/Spells/SpellMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2449,15 +2449,15 @@ void SpellMgr::LoadPetDefaultSpells()
// different summon spells
for (uint32 i = 0; i < GetSpellInfoStoreSize(); ++i)
{
SpellInfo const* spellEntry = GetSpellInfo(i);
if (!spellEntry)
SpellInfo const* spellInfo = GetSpellInfo(i);
if (!spellInfo)
continue;

for (uint8 k = 0; k < MAX_SPELL_EFFECTS; ++k)
{
if (spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON || spellEntry->Effects[k].Effect == SPELL_EFFECT_SUMMON_PET)
if (spellInfo->Effects[k].Effect == SPELL_EFFECT_SUMMON || spellInfo->Effects[k].Effect == SPELL_EFFECT_SUMMON_PET)
{
uint32 creature_id = spellEntry->Effects[k].MiscValue;
uint32 creature_id = spellInfo->Effects[k].MiscValue;
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
if (!cInfo)
continue;
Expand Down
40 changes: 20 additions & 20 deletions src/server/game/Spells/SpellScript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ _SpellScript::EffectHook::EffectHook(uint8 _effIndex)
effIndex = _effIndex;
}

uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEntry)
uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellInfo)
{
uint8 mask = 0;
if ((effIndex == EFFECT_ALL) || (effIndex == EFFECT_FIRST_FOUND))
Expand All @@ -84,21 +84,21 @@ uint8 _SpellScript::EffectHook::GetAffectedEffectsMask(SpellInfo const* spellEnt
{
if ((effIndex == EFFECT_FIRST_FOUND) && mask)
return mask;
if (CheckEffect(spellEntry, i))
if (CheckEffect(spellInfo, i))
mask |= (uint8)1 << i;
}
}
else
{
if (CheckEffect(spellEntry, effIndex))
if (CheckEffect(spellInfo, effIndex))
mask |= (uint8)1 << effIndex;
}
return mask;
}

bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectHook::IsEffectAffected(SpellInfo const* spellInfo, uint8 effIndex)
{
return GetAffectedEffectsMask(spellEntry) & 1 << effIndex;
return GetAffectedEffectsMask(spellInfo) & 1 << effIndex;
}

std::string _SpellScript::EffectHook::EffIndexToString()
Expand All @@ -119,13 +119,13 @@ std::string _SpellScript::EffectHook::EffIndexToString()
return "Invalid Value";
}

bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectNameCheck::Check(SpellInfo const* spellInfo, uint8 effIndex)
{
if (!spellEntry->Effects[effIndex].Effect && !effName)
if (!spellInfo->Effects[effIndex].Effect && !effName)
return true;
if (!spellEntry->Effects[effIndex].Effect)
if (!spellInfo->Effects[effIndex].Effect)
return false;
return (effName == SPELL_EFFECT_ANY) || (spellEntry->Effects[effIndex].Effect == effName);
return (effName == SPELL_EFFECT_ANY) || (spellInfo->Effects[effIndex].Effect == effName);
}

std::string _SpellScript::EffectNameCheck::ToString()
Expand All @@ -141,13 +141,13 @@ std::string _SpellScript::EffectNameCheck::ToString()
}
}

bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellEntry, uint8 effIndex)
bool _SpellScript::EffectAuraNameCheck::Check(SpellInfo const* spellInfo, uint8 effIndex)
{
if (!spellEntry->Effects[effIndex].ApplyAuraName && !effAurName)
if (!spellInfo->Effects[effIndex].ApplyAuraName && !effAurName)
return true;
if (!spellEntry->Effects[effIndex].ApplyAuraName)
if (!spellInfo->Effects[effIndex].ApplyAuraName)
return false;
return (effAurName == SPELL_AURA_ANY) || (spellEntry->Effects[effIndex].ApplyAuraName == effAurName);
return (effAurName == SPELL_AURA_ANY) || (spellInfo->Effects[effIndex].ApplyAuraName == effAurName);
}

std::string _SpellScript::EffectAuraNameCheck::ToString()
Expand Down Expand Up @@ -194,9 +194,9 @@ std::string SpellScript::EffectHandler::ToString()
return "Index: " + EffIndexToString() + " Name: " + _SpellScript::EffectNameCheck::ToString();
}

bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool SpellScript::EffectHandler::CheckEffect(SpellInfo const* spellInfo, uint8 effIndex)
{
return _SpellScript::EffectNameCheck::Check(spellEntry, effIndex);
return _SpellScript::EffectNameCheck::Check(spellInfo, effIndex);
}

void SpellScript::EffectHandler::Call(SpellScript* spellScript, SpellEffIndex effIndex)
Expand Down Expand Up @@ -234,13 +234,13 @@ std::string SpellScript::TargetHook::ToString()
return oss.str();
}

bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellInfo, uint8 effIndex)
{
if (!targetType)
return false;

if (spellEntry->Effects[effIndex].TargetA.GetTarget() != targetType &&
spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType)
if (spellInfo->Effects[effIndex].TargetA.GetTarget() != targetType &&
spellInfo->Effects[effIndex].TargetB.GetTarget() != targetType)
return false;

SpellImplicitTargetInfo targetInfo(targetType);
Expand Down Expand Up @@ -785,9 +785,9 @@ AuraScript::EffectBase::EffectBase(uint8 _effIndex, uint16 _effName)
{
}

bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellEntry, uint8 effIndex)
bool AuraScript::EffectBase::CheckEffect(SpellInfo const* spellInfo, uint8 effIndex)
{
return _SpellScript::EffectAuraNameCheck::Check(spellEntry, effIndex);
return _SpellScript::EffectAuraNameCheck::Check(spellInfo, effIndex);
}

std::string AuraScript::EffectBase::ToString()
Expand Down
Loading

0 comments on commit 5bfeabd

Please sign in to comment.