From bec53e14c22295cfbe5e6e28ef16a734f919fbcc Mon Sep 17 00:00:00 2001 From: Antz Date: Mon, 17 Jul 2017 12:49:54 +0100 Subject: [PATCH] [FIX] full block {} expected in the control structure. Part 2 --- src/game/Object/ObjectMgr.cpp | 24 ++++++++++++++++++++---- src/game/WorldHandlers/Spell.cpp | 26 +++++++++++++++++++++++--- src/game/WorldHandlers/SpellAuras.cpp | 16 +++++++++++++--- 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/src/game/Object/ObjectMgr.cpp b/src/game/Object/ObjectMgr.cpp index 2a176bf3..6f7b3c67 100644 --- a/src/game/Object/ObjectMgr.cpp +++ b/src/game/Object/ObjectMgr.cpp @@ -186,8 +186,10 @@ ObjectMgr::~ObjectMgr() { delete[] playerClassInfo[class_].levelInfo; } for (int race = 0; race < MAX_RACES; ++race) - for (int class_ = 0; class_ < MAX_CLASSES; ++class_) - { delete[] playerInfo[race][class_].levelInfo; } + { + for (int class_ = 0; class_ < MAX_CLASSES; ++class_) + { delete[] playerInfo[race][class_].levelInfo; } + } // free objects for (GroupMap::iterator itr = mGroupMap.begin(); itr != mGroupMap.end(); ++itr) @@ -217,8 +219,9 @@ void ObjectMgr::AddLocaleString(std::string const& s, LocaleConstant locale, Str if (!s.empty()) { if (data.size() <= size_t(locale)) + { data.resize(locale + 1); - + } data[locale] = s; } } @@ -733,17 +736,25 @@ void ObjectMgr::LoadCreatureAddons() // check entry ids for (uint32 i = 1; i < sCreatureInfoAddonStorage.GetMaxEntry(); ++i) + { if (CreatureDataAddon const* addon = sCreatureInfoAddonStorage.LookupEntry(i)) + { if (!sCreatureStorage.LookupEntry(addon->guidOrEntry)) { sLog.outErrorDb("Creature (Entry: %u) does not exist but has a record in `%s`", addon->guidOrEntry, sCreatureInfoAddonStorage.GetTableName()); } + } + } LoadCreatureAddons(sCreatureDataAddonStorage, "GUID", "creature addons"); // check entry ids for (uint32 i = 1; i < sCreatureDataAddonStorage.GetMaxEntry(); ++i) + { if (CreatureDataAddon const* addon = sCreatureDataAddonStorage.LookupEntry(i)) + { if (mCreatureDataMap.find(addon->guidOrEntry) == mCreatureDataMap.end()) { sLog.outErrorDb("Creature (GUID: %u) does not exist but has a record in `creature_addon`", addon->guidOrEntry); } + } + } } void ObjectMgr::LoadCreatureItemTemplates() @@ -850,7 +861,9 @@ CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, u CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]]; if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.01f) + { return cCLS; + } return NULL; } @@ -905,10 +918,13 @@ void ObjectMgr::LoadEquipmentTemplates() sEquipmentStorageRaw.Load(false); for (uint32 i = 1; i < sEquipmentStorageRaw.GetMaxEntry(); ++i) + { if (sEquipmentStorageRaw.LookupEntry(i)) + { if (sEquipmentStorage.LookupEntry(i)) { sLog.outErrorDb("Table 'creature_equip_template_raw` have redundant data for ID %u ('creature_equip_template` already have data)", i); } - + } + } sLog.outString(">> Loaded %u equipment template (deprecated format)", sEquipmentStorageRaw.GetRecordCount()); sLog.outString(); } diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index 85c73269..dab488b0 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -153,7 +153,7 @@ void SpellCastTargets::Update(Unit* caster) m_itemTarget = NULL; if (caster->GetTypeId() == TYPEID_PLAYER) -{ + { Player* player = ((Player*)caster); if (m_targetMask & TARGET_FLAG_ITEM) @@ -161,8 +161,10 @@ void SpellCastTargets::Update(Unit* caster) else if (m_targetMask & TARGET_FLAG_TRADE_ITEM) { if (TradeData* pTrade = player->GetTradeData()) + { if (m_itemTargetGUID.GetRawValue() < TRADE_SLOT_COUNT) { m_itemTarget = pTrade->GetTraderData()->GetItem(TradeSlots(m_itemTargetGUID.GetRawValue())); } + } } if (m_itemTarget) @@ -447,9 +449,13 @@ void Spell::FillTargetMap() (m_spellInfo->Id == 13280)) { if (m_caster->GetTypeId() == TYPEID_PLAYER) + { if (Unit* target = ObjectAccessor::Instance().GetUnit(*m_caster, ((Player*)m_caster)->GetSelectionGuid())) + { if (!m_caster->IsFriendlyTo(target)) { tmpUnitLists[i /*==effToIndex[i]*/].push_back(target); } + } + } } else { SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetA[i], tmpUnitLists[i /*==effToIndex[i]*/]); } @@ -486,8 +492,10 @@ void Spell::FillTargetMap() case TARGET_AREAEFFECT_GO_AROUND_DEST: // triggered spells get dest point from default target set, ignore it if (!(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) || m_IsTriggeredSpell) + { if (WorldObject* castObject = GetCastingObject()) { m_targets.setDestination(castObject->GetPositionX(), castObject->GetPositionY(), castObject->GetPositionZ()); } + } SetTargetMap(SpellEffectIndex(i), m_spellInfo->EffectImplicitTargetB[i], tmpUnitLists[i /*==effToIndex[i]*/]); break; // target pre-selection required @@ -720,8 +728,10 @@ void Spell::prepareDataForTriggerSystem() // avoid triggering negative hit for only positive targets m_negativeEffectMask = 0x0; for (int i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (m_spellInfo->Effect[i] != SPELL_EFFECT_NONE && !IsPositiveEffect(m_spellInfo, SpellEffectIndex(i))) { m_negativeEffectMask |= (1 << i); } + } // Hunter traps spells (for Entrapment trigger) // Gives your Immolation Trap, Frost Trap, Explosive Trap, and Snake Trap .... @@ -945,8 +955,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) { // mark effects that were already handled in Spell::HandleDelayedSpellLaunch on spell launch as processed for (int32 i = 0; i < MAX_EFFECT_INDEX; ++i) + { if (IsEffectHandledOnDelayedSpellLaunch(m_spellInfo, SpellEffectIndex(i))) { mask &= ~(1 << i); } + } // maybe used in effects that are handled on hit m_damage += target->damage; @@ -962,7 +974,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) unitTarget = m_caster; if (m_caster->GetTypeId() == TYPEID_UNIT) - m_caster->ToCreature()->LowerPlayerDamageReq(target->damage); + { m_caster->ToCreature()->LowerPlayerDamageReq(target->damage); } } } else // in 1.12.1 we need explicit miss info @@ -1107,8 +1119,10 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore pets or autorepeat/melee casts for speed (not exist quest for spells (hm... ) if (real_caster && !((Creature*)unit)->IsPet() && !IsAutoRepeat() && !IsNextMeleeSwingSpell() && !IsChannelActive()) + { if (Player* p = real_caster->GetCharmerOrOwnerPlayerOrPlayerItself()) { p->RewardPlayerAndGroupAtCast(unit, m_spellInfo->Id); } + } if (((Creature*)unit)->AI()) { ((Creature*)unit)->AI()->SpellHit(m_caster, m_spellInfo); } @@ -1263,8 +1277,10 @@ void Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool isReflected) float multiplier = m_spellInfo->DmgMultiplier[effectNumber]; // Apply multiplier mods if (realCaster) + { if (Player* modOwner = realCaster->GetSpellModOwner()) { modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier, this); } + } m_damageMultipliers[effectNumber] *= multiplier; } } @@ -1319,8 +1335,10 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo* target) { return; } for (int effectNumber = 0; effectNumber < MAX_EFFECT_INDEX; ++effectNumber) + { if (effectMask & (1 << effectNumber)) { HandleEffects(NULL, NULL, go, SpellEffectIndex(effectNumber)); } + } // cast at creature (or GO) quest objectives update at successful cast finished (+channel finished) // ignore autorepeat/melee casts for speed (not exist quest for spells (hm... ) @@ -1382,8 +1400,10 @@ void Spell::HandleDelayedSpellLaunch(TargetInfo* target) float multiplier = m_spellInfo->DmgMultiplier[effectNumber]; // Apply multiplier mods if (real_caster) + { if (Player* modOwner = real_caster->GetSpellModOwner()) { modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier, this); } + } m_damageMultipliers[effectNumber] *= multiplier; } } @@ -1601,7 +1621,7 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList& while (t && next != tempTargetUnitMap.end()) { if (!prev->IsWithinDist(*next, CHAIN_SPELL_JUMP_RADIUS)) - break; + { break; } if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS) && !prev->IsWithinLOSInMap(*next)) { diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index d8d46f90..5b06430f 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -458,11 +458,11 @@ void AreaAura::Update(uint32 diff) SpellEntry const* actualSpellInfo; if (GetCasterGuid() == (*tIter)->GetObjectGuid()) // if caster is same as target then no need to change rank of the spell - actualSpellInfo = GetSpellProto(); + { actualSpellInfo = GetSpellProto(); } else actualSpellInfo = sSpellMgr.SelectAuraRankForLevel(GetSpellProto(), (*tIter)->getLevel()); // use spell id according level of the target if (!actualSpellInfo) - continue; + { continue; } Unit::SpellAuraHolderBounds spair = (*tIter)->GetSpellAuraHolderBounds(actualSpellInfo->Id); // we need ignore present caster self applied are auras sometime @@ -806,7 +806,9 @@ void Aura::TriggerSpell() // case 6965: break; case 9712: // Thaumaturgy Channel if (Unit* caster = GetCaster()) + { caster->CastSpell(caster, 21029, true); + } return; case 23170: // Brood Affliction: Bronze { @@ -1098,8 +1100,10 @@ void Aura::TriggerSpell() if (triggeredSpellInfo) { if (triggerTargetObject) + { triggerCaster->CastSpell(triggerTargetObject->GetPositionX(), triggerTargetObject->GetPositionY(), triggerTargetObject->GetPositionZ(), triggeredSpellInfo, true, NULL, this, casterGUID); + } else { triggerCaster->CastSpell(triggerTarget, triggeredSpellInfo, true, NULL, this, casterGUID); } } @@ -1733,9 +1737,13 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real) if (target->getRace() == RACE_TAUREN) { if (target->getGender() == GENDER_MALE) + { target->SetObjectScale(DEFAULT_TAUREN_MALE_SCALE * target->GetObjectScaleMod()); + } else + { target->SetObjectScale(DEFAULT_TAUREN_FEMALE_SCALE * target->GetObjectScaleMod()); + } } target->SetDisplayId(target->GetNativeDisplayId()); @@ -2345,7 +2353,7 @@ void Aura::HandleModConfuse(bool apply, bool Real) // Do not remove it yet if more effects are up, do it for the last effect if (!apply && GetTarget()->HasAuraType(SPELL_AURA_MOD_CONFUSE)) - return; + { return; } GetTarget()->SetConfused(apply, GetCasterGuid(), GetId()); } @@ -2520,7 +2528,9 @@ void Aura::HandleModStealth(bool apply, bool Real) // Remove vanish buff if user cancel stealth if (m_removeMode == AURA_REMOVE_BY_CANCEL) + { target->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); + } // only at real aura remove of _last_ SPELL_AURA_MOD_STEALTH if (Real && !target->HasAuraType(SPELL_AURA_MOD_STEALTH))