Core/Misc: Minor cleanup and code style fixes
This commit is contained in:
@@ -271,7 +271,7 @@ int32 GetSpellDuration(SpellEntry const *spellInfo)
|
||||
{
|
||||
if (!spellInfo)
|
||||
return 0;
|
||||
SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
|
||||
SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
|
||||
if (!du)
|
||||
return 0;
|
||||
return (du->Duration[0] == -1) ? -1 : abs(du->Duration[0]);
|
||||
@@ -281,7 +281,7 @@ int32 GetSpellMaxDuration(SpellEntry const *spellInfo)
|
||||
{
|
||||
if (!spellInfo)
|
||||
return 0;
|
||||
SpellDurationEntry const *du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
|
||||
SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
|
||||
if (!du)
|
||||
return 0;
|
||||
return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]);
|
||||
@@ -314,7 +314,7 @@ uint32 GetDispelChance(Unit* auraCaster, Unit* target, uint32 spellId, bool offe
|
||||
|
||||
uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell* spell)
|
||||
{
|
||||
SpellCastTimesEntry const *spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
|
||||
SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
|
||||
|
||||
// not all spells have cast time index and this is all is pasiive abilities
|
||||
if (!spellCastTimeEntry)
|
||||
@@ -333,7 +333,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell* spell)
|
||||
|
||||
bool IsPassiveSpell(uint32 spellId)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
return IsPassiveSpell(spellInfo);
|
||||
@@ -348,7 +348,7 @@ bool IsPassiveSpell(SpellEntry const* spellInfo)
|
||||
|
||||
bool IsAutocastableSpell(uint32 spellId)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
if (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
|
||||
@@ -412,16 +412,16 @@ uint32 CalculatePowerCost(SpellEntry const* spellInfo, Unit const* caster, Spell
|
||||
powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
|
||||
// Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
|
||||
if (spellInfo->AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST)
|
||||
powerCost += caster->GetAttackTime(OFF_ATTACK)/100;
|
||||
powerCost += caster->GetAttackTime(OFF_ATTACK) / 100;
|
||||
// Apply cost mod by spell
|
||||
if (Player* modOwner = caster->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost);
|
||||
|
||||
if (spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)
|
||||
powerCost = int32(powerCost/ (1.117f* spellInfo->spellLevel / caster->getLevel() -0.1327f));
|
||||
powerCost = int32(powerCost / (1.117f * spellInfo->spellLevel / caster->getLevel() -0.1327f));
|
||||
|
||||
// PCT mod from user auras by school
|
||||
powerCost = int32(powerCost * (1.0f+caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER+school)));
|
||||
powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school)));
|
||||
if (powerCost < 0)
|
||||
powerCost = 0;
|
||||
return powerCost;
|
||||
@@ -1261,7 +1261,7 @@ bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod)
|
||||
if (!spellInfo || !mod)
|
||||
return false;
|
||||
|
||||
SpellEntry const *affect_spell = sSpellStore.LookupEntry(mod->spellId);
|
||||
SpellEntry const* affect_spell = sSpellStore.LookupEntry(mod->spellId);
|
||||
// False if affect_spell == NULL or spellFamily not equal
|
||||
if (!affect_spell || affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
|
||||
return false;
|
||||
@@ -1297,7 +1297,7 @@ void SpellMgr::LoadSpellProcEvents()
|
||||
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
const SpellEntry *spell = sSpellStore.LookupEntry(entry);
|
||||
SpellEntry const* spell = sSpellStore.LookupEntry(entry);
|
||||
if (!spell)
|
||||
{
|
||||
sLog->outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
|
||||
@@ -1628,7 +1628,7 @@ void SpellMgr::LoadSpellBonusess()
|
||||
Field *fields = result->Fetch();
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
|
||||
const SpellEntry *spell = sSpellStore.LookupEntry(entry);
|
||||
SpellEntry const* spell = sSpellStore.LookupEntry(entry);
|
||||
if (!spell)
|
||||
{
|
||||
sLog->outErrorDb("Spell %u listed in `spell_bonus_data` does not exist", entry);
|
||||
@@ -1819,7 +1819,7 @@ void SpellMgr::LoadSpellThreats()
|
||||
|
||||
bool SpellMgr::IsRankSpellDueToSpell(SpellEntry const *spellInfo_1, uint32 spellId_2) const
|
||||
{
|
||||
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
|
||||
SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
|
||||
if (!spellInfo_1 || !spellInfo_2) return false;
|
||||
if (spellInfo_1->Id == spellId_2) return false;
|
||||
|
||||
@@ -1866,7 +1866,7 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
|
||||
|
||||
bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
@@ -1886,7 +1886,7 @@ bool SpellMgr::IsProfessionOrRidingSpell(uint32 spellId)
|
||||
|
||||
bool SpellMgr::IsProfessionSpell(uint32 spellId)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
@@ -1906,7 +1906,7 @@ bool SpellMgr::IsProfessionSpell(uint32 spellId)
|
||||
|
||||
bool SpellMgr::IsPrimaryProfessionSpell(uint32 spellId)
|
||||
{
|
||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
|
||||
if (!spellInfo)
|
||||
return false;
|
||||
|
||||
@@ -1935,7 +1935,7 @@ bool SpellMgr::IsSkillBonusSpell(uint32 spellId) const
|
||||
|
||||
for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx)
|
||||
{
|
||||
SkillLineAbilityEntry const *pAbility = _spell_idx->second;
|
||||
SkillLineAbilityEntry const* pAbility = _spell_idx->second;
|
||||
if (!pAbility || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL)
|
||||
continue;
|
||||
|
||||
@@ -2070,7 +2070,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForPlayerLevel(SpellEntry const* spell
|
||||
|
||||
for (uint32 nextSpellId = spellInfo->Id; nextSpellId != 0; nextSpellId = GetPrevSpellInChain(nextSpellId))
|
||||
{
|
||||
SpellEntry const *nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
|
||||
SpellEntry const* nextSpellInfo = sSpellStore.LookupEntry(nextSpellId);
|
||||
if (!nextSpellInfo)
|
||||
break;
|
||||
|
||||
@@ -2302,7 +2302,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
|
||||
|
||||
for (uint32 i = 0; i < sCreatureFamilyStore.GetNumRows(); ++i)
|
||||
{
|
||||
CreatureFamilyEntry const *creatureFamily = sCreatureFamilyStore.LookupEntry(i);
|
||||
CreatureFamilyEntry const* creatureFamily = sCreatureFamilyStore.LookupEntry(i);
|
||||
if (!creatureFamily) // not exist
|
||||
continue;
|
||||
|
||||
@@ -2313,7 +2313,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
|
||||
|
||||
for (uint32 k = 0; k < sSkillLineAbilityStore.GetNumRows(); ++k)
|
||||
{
|
||||
SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(k);
|
||||
SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(k);
|
||||
if (!skillLine)
|
||||
continue;
|
||||
|
||||
@@ -2327,7 +2327,7 @@ void SpellMgr::LoadPetLevelupSpellMap()
|
||||
if (skillLine->learnOnGetSkill != ABILITY_LEARNED_ON_GET_RACE_OR_CLASS_SKILL)
|
||||
continue;
|
||||
|
||||
SpellEntry const *spell = sSpellStore.LookupEntry(skillLine->spellId);
|
||||
SpellEntry const* spell = sSpellStore.LookupEntry(skillLine->spellId);
|
||||
if (!spell) // not exist or triggered or talent
|
||||
continue;
|
||||
|
||||
@@ -2364,7 +2364,7 @@ bool LoadPetDefaultSpells_helper(CreatureTemplate const* cInfo, PetDefaultSpells
|
||||
return false;
|
||||
|
||||
// remove duplicates with levelupSpells if any
|
||||
if (PetLevelupSpellSet const *levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : NULL)
|
||||
if (PetLevelupSpellSet const* levelupSpells = cInfo->family ? sSpellMgr->GetPetLevelupSpellList(cInfo->family) : NULL)
|
||||
{
|
||||
for (uint8 j = 0; j < MAX_CREATURE_SPELL_DATA_SLOT; ++j)
|
||||
{
|
||||
@@ -2448,7 +2448,7 @@ void SpellMgr::LoadPetDefaultSpells()
|
||||
if (spellEntry->Effect[k] == SPELL_EFFECT_SUMMON || spellEntry->Effect[k] == SPELL_EFFECT_SUMMON_PET)
|
||||
{
|
||||
uint32 creature_id = spellEntry->EffectMiscValue[k];
|
||||
CreatureTemplate const *cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
|
||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(creature_id);
|
||||
if (!cInfo)
|
||||
continue;
|
||||
|
||||
@@ -2533,7 +2533,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const *spellInfo, Player *pl, bool msg)
|
||||
}
|
||||
case SPELL_EFFECT_LEARN_SPELL:
|
||||
{
|
||||
SpellEntry const *spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]);
|
||||
SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(spellInfo->EffectTriggerSpell[i]);
|
||||
if (!IsSpellValid(spellInfo2, pl, msg))
|
||||
{
|
||||
if (msg)
|
||||
@@ -2609,7 +2609,7 @@ void SpellMgr::LoadSpellAreas()
|
||||
spellArea.gender = Gender(fields[7].GetUInt8());
|
||||
spellArea.autocast = fields[8].GetBool();
|
||||
|
||||
if (const SpellEntry* spellInfo = sSpellStore.LookupEntry(spell))
|
||||
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell))
|
||||
{
|
||||
if (spellArea.autocast)
|
||||
const_cast<SpellEntry*>(spellInfo)->Attributes |= SPELL_ATTR0_CANT_CANCEL;
|
||||
@@ -2798,7 +2798,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
||||
if (spellInfo->AttributesEx4 & SPELL_ATTR4_CAST_ONLY_IN_OUTLAND)
|
||||
{
|
||||
uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(v_map);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
|
||||
if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent())
|
||||
return SPELL_FAILED_INCORRECT_AREA;
|
||||
}
|
||||
@@ -2806,7 +2806,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
||||
// raid instance limitation
|
||||
if (spellInfo->AttributesEx6 & SPELL_ATTR6_NOT_IN_RAID_INSTANCE)
|
||||
{
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(map_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry || mapEntry->IsRaid())
|
||||
return SPELL_FAILED_NOT_IN_RAID_INSTANCE;
|
||||
}
|
||||
@@ -2850,7 +2850,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
||||
if (!player)
|
||||
return SPELL_FAILED_REQUIRES_AREA;
|
||||
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(map_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry)
|
||||
return SPELL_FAILED_INCORRECT_AREA;
|
||||
|
||||
@@ -2865,7 +2865,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
||||
case 35774: // Gold Team (Horde)
|
||||
case 35775: // Green Team (Horde)
|
||||
{
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(map_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry)
|
||||
return SPELL_FAILED_INCORRECT_AREA;
|
||||
|
||||
@@ -2876,14 +2876,14 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
||||
if (!player)
|
||||
return SPELL_FAILED_REQUIRES_AREA;
|
||||
|
||||
MapEntry const *mapEntry = sMapStore.LookupEntry(map_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry)
|
||||
return SPELL_FAILED_INCORRECT_AREA;
|
||||
|
||||
if (!mapEntry->IsBattleArena())
|
||||
return SPELL_FAILED_REQUIRES_AREA;
|
||||
|
||||
Battleground *bg = player->GetBattleground();
|
||||
Battleground* bg = player->GetBattleground();
|
||||
return bg && bg->GetStatus() == STATUS_WAIT_JOIN ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
|
||||
}
|
||||
}
|
||||
@@ -2915,7 +2915,7 @@ void SpellMgr::LoadSkillLineAbilityMap()
|
||||
|
||||
for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i)
|
||||
{
|
||||
SkillLineAbilityEntry const *SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
|
||||
SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i);
|
||||
if (!SkillInfo)
|
||||
continue;
|
||||
|
||||
@@ -3300,8 +3300,8 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32
|
||||
|
||||
bool SpellMgr::CanAurasStack(Aura const *aura1, Aura const *aura2, bool sameCaster) const
|
||||
{
|
||||
SpellEntry const *spellInfo_1 = aura1->GetSpellProto();
|
||||
SpellEntry const *spellInfo_2 = aura2->GetSpellProto();
|
||||
SpellEntry const* spellInfo_1 = aura1->GetSpellProto();
|
||||
SpellEntry const* spellInfo_2 = aura2->GetSpellProto();
|
||||
SpellSpecific spellSpec_1 = GetSpellSpecific(spellInfo_1);
|
||||
SpellSpecific spellSpec_2 = GetSpellSpecific(spellInfo_2);
|
||||
if (spellSpec_1 && spellSpec_2)
|
||||
@@ -3460,7 +3460,7 @@ void SpellMgr::LoadSpellEnchantProcData()
|
||||
|
||||
uint32 enchantId = fields[0].GetUInt32();
|
||||
|
||||
SpellItemEnchantmentEntry const *ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
|
||||
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchantId);
|
||||
if (!ench)
|
||||
{
|
||||
sLog->outErrorDb("Enchancment %u listed in `spell_enchant_proc_data` does not exist", enchantId);
|
||||
@@ -3706,13 +3706,13 @@ void SpellMgr::LoadSpellCustomAttr()
|
||||
if (IsPartOfSkillLine(SKILL_ENCHANTING, i))
|
||||
{
|
||||
uint32 enchantId = spellInfo->EffectMiscValue[j];
|
||||
SpellItemEnchantmentEntry const *enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
|
||||
SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
|
||||
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
|
||||
{
|
||||
if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
|
||||
continue;
|
||||
|
||||
SpellEntry const *procInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
|
||||
SpellEntry const* procInfo = sSpellStore.LookupEntry(enchant->spellid[s]);
|
||||
if (!procInfo)
|
||||
continue;
|
||||
|
||||
@@ -4021,7 +4021,7 @@ void SpellMgr::LoadSpellCustomAttr()
|
||||
spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER;
|
||||
++count;
|
||||
break;
|
||||
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
|
||||
case 29809: // Desecration Arm - 36 instead of 37 - typo? :/
|
||||
spellInfo->EffectRadiusIndex[0] = 37;
|
||||
++count;
|
||||
break;
|
||||
@@ -4374,7 +4374,7 @@ void SpellMgr::LoadSpellCustomAttr()
|
||||
}
|
||||
}
|
||||
|
||||
SummonPropertiesEntry *properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121));
|
||||
SummonPropertiesEntry* properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(121));
|
||||
properties->Type = SUMMON_TYPE_TOTEM;
|
||||
properties = const_cast<SummonPropertiesEntry*>(sSummonPropertiesStore.LookupEntry(647)); // 52893
|
||||
properties->Type = SUMMON_TYPE_TOTEM;
|
||||
@@ -4400,7 +4400,7 @@ void SpellMgr::LoadEnchantCustomAttr()
|
||||
|
||||
for (uint32 i = 0; i < GetSpellStore()->GetNumRows(); ++i)
|
||||
{
|
||||
SpellEntry * spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
|
||||
SpellEntry* spellInfo = (SpellEntry*)GetSpellStore()->LookupEntry(i);
|
||||
if (!spellInfo)
|
||||
continue;
|
||||
|
||||
@@ -4413,7 +4413,7 @@ void SpellMgr::LoadEnchantCustomAttr()
|
||||
if (spellInfo->Effect[j] == SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY)
|
||||
{
|
||||
uint32 enchId = spellInfo->EffectMiscValue[j];
|
||||
SpellItemEnchantmentEntry const *ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
|
||||
SpellItemEnchantmentEntry const* ench = sSpellItemEnchantmentStore.LookupEntry(enchId);
|
||||
if (!ench)
|
||||
continue;
|
||||
mEnchantCustomAttr[enchId] = true;
|
||||
|
||||
Reference in New Issue
Block a user