diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Collision/Management/MMapManager.cpp | 11 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 15 | ||||
-rw-r--r-- | src/server/game/Spells/SpellHistory.cpp | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellHistory.h | 1 | ||||
-rw-r--r-- | src/server/game/Spells/SpellInfo.cpp | 19 |
5 files changed, 27 insertions, 20 deletions
diff --git a/src/common/Collision/Management/MMapManager.cpp b/src/common/Collision/Management/MMapManager.cpp index 4f9ecdc8364..389e0f9629f 100644 --- a/src/common/Collision/Management/MMapManager.cpp +++ b/src/common/Collision/Management/MMapManager.cpp @@ -162,6 +162,17 @@ namespace MMAP return false; } + long pos = ftell(file); + fseek(file, 0, SEEK_END); + if (fileHeader.size > ftell(file) - pos) + { + TC_LOG_ERROR("maps", "MMAP:loadMap: %04u%02i%02i.mmtile has corrupted data size", mapId, x, y); + fclose(file); + return; + } + + fseek(file, pos, SEEK_SET); + unsigned char* data = (unsigned char*)dtAlloc(fileHeader.size, DT_ALLOC_PERM); ASSERT(data); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 1ac799d6b68..a538cbe8a0b 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -21242,9 +21242,6 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) WorldPackets::Spells::SetSpellModifier packet(opcode); - int i = 0; - flag128 _mask; - /// @todo Implement sending of bulk modifiers instead of single packet.Modifiers.resize(1); WorldPackets::Spells::SpellModifier& spellMod = packet.Modifiers[0]; @@ -21253,18 +21250,16 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) for (int eff = 0; eff < 128; ++eff) { - if (eff != 0 && (eff % 32) == 0) - _mask[i++] = 0; - - _mask[i] = uint32(1) << (eff - (32 * i)); - if (mod->mask & _mask) + flag128 mask; + mask[eff / 32] = 1u << (eff % 32); + if (mod->mask & mask) { WorldPackets::Spells::SpellModifierData modData; if (mod->type == SPELLMOD_FLAT) { for (SpellModList::iterator itr = m_spellMods[mod->op][SPELLMOD_FLAT].begin(); itr != m_spellMods[mod->op][SPELLMOD_FLAT].end(); ++itr) - if (*itr != mod && (*itr)->mask & _mask) + if (*itr != mod && (*itr)->mask & mask) modData.ModifierValue += (*itr)->value; if (apply) @@ -21274,7 +21269,7 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply) { modData.ModifierValue = 1.0f; for (SpellModList::iterator itr = m_spellMods[mod->op][SPELLMOD_PCT].begin(); itr != m_spellMods[mod->op][SPELLMOD_PCT].end(); ++itr) - if (*itr != mod && (*itr)->mask & _mask) + if (*itr != mod && (*itr)->mask & mask) modData.ModifierValue *= CalculatePct(1.0f, (*itr)->value); if (apply) diff --git a/src/server/game/Spells/SpellHistory.cpp b/src/server/game/Spells/SpellHistory.cpp index 39e0c29fda1..5cf6c6aecbd 100644 --- a/src/server/game/Spells/SpellHistory.cpp +++ b/src/server/game/Spells/SpellHistory.cpp @@ -204,7 +204,6 @@ void SpellHistory::SaveToDB(SQLTransaction& trans) void SpellHistory::Update() { - SQLTransaction t; Clock::time_point now = Clock::now(); for (auto itr = _categoryCooldowns.begin(); itr != _categoryCooldowns.end();) { diff --git a/src/server/game/Spells/SpellHistory.h b/src/server/game/Spells/SpellHistory.h index 29166c925e3..6e1c35b4f52 100644 --- a/src/server/game/Spells/SpellHistory.h +++ b/src/server/game/Spells/SpellHistory.h @@ -145,7 +145,6 @@ public: void AddGlobalCooldown(SpellInfo const* spellInfo, uint32 duration); void CancelGlobalCooldown(SpellInfo const* spellInfo); - uint16 GetArenaCooldownsSize(); void SaveCooldownStateBeforeDuel(); void RestoreCooldownStateAfterDuel(); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index b6aa0746376..ccc5d81d5c8 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2598,17 +2598,20 @@ std::vector<SpellInfo::CostData> SpellInfo::CalcPowerCost(Unit const* caster, Sp if (power->HealthCostPercentage) healthCost += int32(CalculatePct(caster->GetMaxHealth(), power->HealthCostPercentage)); - // Flat mod from caster auras by spell school and power type - Unit::AuraEffectList const& auras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL); - for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + if (power->PowerType != POWER_HEALTH) { - if (!((*i)->GetMiscValue() & schoolMask)) - continue; + // Flat mod from caster auras by spell school and power type + Unit::AuraEffectList const& auras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL); + for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i) + { + if (!((*i)->GetMiscValue() & schoolMask)) + continue; - if (!((*i)->GetMiscValueB() & (1 << power->PowerType))) - continue; + if (!((*i)->GetMiscValueB() & (1 << power->PowerType))) + continue; - powerCost += (*i)->GetAmount(); + powerCost += (*i)->GetAmount(); + } } // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost) |