From fccdba38420a8818a4ffd8fde51dbc2a1dfb18a5 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 19 Jun 2014 15:30:07 +0200 Subject: Core/Players: Fixed trainers still displaying profession skills after learning Closes #8103 --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 8ceb6c00808..741eaba734a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6429,7 +6429,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) if (newVal < currVal) UpdateSkillEnchantments(id, currVal, newVal); // update step - SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_PAIR32(id, step)); + SetUInt32Value(PLAYER_SKILL_INDEX(itr->second.pos), MAKE_PAIR32(id, step)); // update value SetUInt32Value(PLAYER_SKILL_VALUE_INDEX(itr->second.pos), MAKE_SKILL_VALUE(newVal, maxVal)); if (itr->second.uState != SKILL_NEW) -- cgit v1.2.3 From 316d9a5ce89b1a21a22b4ef038d9c76e91e0e948 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 19 Jun 2014 15:58:06 +0200 Subject: Core/Misc: Fix coverity analysis issues --- src/server/game/Entities/Unit/Unit.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 8a3bc282d4a..36d8d25ba8f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3845,6 +3845,8 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura* except, { Aura* aura = (*iter)->GetBase(); AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID()); + if (!aurApp) + continue; ++iter; if (aura != except && (!casterGUID || aura->GetCasterGUID() == casterGUID) @@ -10504,17 +10506,21 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto { if (!((*i)->IsAffectedOnSpell(spellProto))) continue; - int32 modChance = 0; + switch ((*i)->GetMiscValue()) { - // Shatter - case 911: modChance+= 16; - case 910: modChance+= 17; - case 849: modChance+= 17; - if (!victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) - break; - crit_chance+=modChance; + case 911: // Shatter (Rank 1) + if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) + crit_chance += 17; break; + case 910: // Shatter (Rank 2) + if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) + crit_chance += 34; + break; + case 849: // Shatter (Rank 3) + if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) + crit_chance += 50; + break; case 7917: // Glyph of Shadowburn if (victim->HasAuraState(AURA_STATE_HEALTHLESS_35_PERCENT, spellProto, this)) crit_chance+=(*i)->GetAmount(); -- cgit v1.2.3 From dc96fb1cee4a91e9828d085717b50fc163393bc6 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Thu, 19 Jun 2014 18:51:47 +0200 Subject: Core: Fix typo in 316d9a5ce89b1a21a22b4ef038d9c76e91e0e948 --- src/server/game/Entities/Unit/Unit.cpp | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 36d8d25ba8f..492197db64e 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -3352,7 +3352,7 @@ void Unit::_ApplyAuraEffect(Aura* aura, uint8 effIndex) AuraApplication * aurApp = aura->GetApplicationOfTarget(GetGUID()); ASSERT(aurApp); if (!aurApp->GetEffectMask()) - _ApplyAura(aurApp, 1<_HandleEffect(effIndex, true); } @@ -3390,7 +3390,7 @@ void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask) // apply effects of the aura for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) { - if (effMask & 1<GetRemoveMode())) + if (effMask & 1 << i && (!aurApp->GetRemoveMode())) aurApp->_HandleEffect(i, true); } } @@ -10509,15 +10509,15 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto switch ((*i)->GetMiscValue()) { - case 911: // Shatter (Rank 1) + case 911: // Shatter (Rank 1) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 17; break; - case 910: // Shatter (Rank 2) + case 910: // Shatter (Rank 2) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 34; break; - case 849: // Shatter (Rank 3) + case 849: // Shatter (Rank 3) if (victim->HasAuraState(AURA_STATE_FROZEN, spellProto, this)) crit_chance += 50; break; @@ -10540,7 +10540,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto case SPELLFAMILY_MAGE: // Glyph of Fire Blast if (spellProto->SpellFamilyFlags[0] == 0x2 && spellProto->SpellIconID == 12) - if (victim->HasAuraWithMechanic((1<HasAuraWithMechanic((1 << MECHANIC_STUN) | (1 << MECHANIC_KNOCKOUT))) if (AuraEffect const* aurEff = GetAuraEffect(56369, EFFECT_0)) crit_chance += aurEff->GetAmount(); break; @@ -10561,7 +10561,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto crit_chance += aurEff->GetAmount(); break; } - break; + break; case SPELLFAMILY_ROGUE: // Shiv-applied poisons can't crit if (FindCurrentSpellBySpellId(5938)) @@ -10583,7 +10583,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto return 100.0f; break; } - break; + break; case SPELLFAMILY_SHAMAN: // Lava Burst if (spellProto->SpellFamilyFlags[1] & 0x00001000) @@ -10593,7 +10593,7 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto return 100.0f; break; } - break; + break; } } break; @@ -10614,17 +10614,17 @@ float Unit::GetUnitSpellCriticalChance(Unit* victim, SpellInfo const* spellProto crit_chance += rendAndTear->GetAmount(); break; } - break; + break; case SPELLFAMILY_WARRIOR: - // Victory Rush - if (spellProto->SpellFamilyFlags[1] & 0x100) - { - // Glyph of Victory Rush - if (AuraEffect const* aurEff = GetAuraEffect(58382, 0)) - crit_chance += aurEff->GetAmount(); - break; - } - break; + // Victory Rush + if (spellProto->SpellFamilyFlags[1] & 0x100) + { + // Glyph of Victory Rush + if (AuraEffect const* aurEff = GetAuraEffect(58382, 0)) + crit_chance += aurEff->GetAmount(); + break; + } + break; } } /// Intentional fallback. Calculate critical strike chance for both Ranged and Melee spells -- cgit v1.2.3