aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorAlιAѕѕaѕѕιN <AilSynthax@gmail.com>2019-08-28 10:33:41 +0430
committerGiacomo Pozzoni <giacomopoz@gmail.com>2019-08-28 08:03:41 +0200
commit92d83c3c2eaba3f5b58dc98472318872f3a54706 (patch)
treecb635a573647b94046a9a073ab83f9d3b6f7e932 /src/server/game/Entities
parent07e2264964ef728050e55e5ec5217c4fb4fe1af2 (diff)
[3.3.5] Fix spell_area not checking for zoneID for quests (#23719)
* Fix spell_area not checking for zoneID for quests * Addendum to bdffe0a4a641414fe26c9b75b00f8e70ff0f1cb8 * Fix spell_area handle same spell with the same quests Also fix not checking for quest_end at all. * Addendum to 2d6b0545e3762b3a25005726d4093cf4a7945a8d * Better commenting for 7a50189de3104f000d8b31fa6c415bb69cf1a3e7 * Addendum to 2d6b0545e3762b3a25005726d4093cf4a7945a8d
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Player/Player.cpp45
1 files changed, 37 insertions, 8 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 336d2fa5917..8015eabf6ef 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -15952,21 +15952,50 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
void Player::SendQuestUpdate(uint32 questId)
{
- uint32 zone = 0, area = 0;
- GetZoneAndAreaId(zone, area);
-
- SpellAreaForQuestAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestAreaMapBounds(area, questId);
+ SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(questId);
if (saBounds.first != saBounds.second)
{
- for (SpellAreaForQuestAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ std::set<uint32> aurasToRemove, aurasToCast;
+ uint32 zone = 0, area = 0;
+ GetZoneAndAreaId(zone, area);
+
+ for (SpellAreaForQuestMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
{
if (!itr->second->IsFitToRequirements(this, zone, area))
- RemoveAurasDueToSpell(itr->second->spellId);
+ aurasToRemove.insert(itr->second->spellId);
else if (itr->second->autocast)
- if (!HasAura(itr->second->spellId))
- CastSpell(this, itr->second->spellId, true);
+ aurasToCast.insert(itr->second->spellId);
+ }
+
+ // Auras matching the requirements will be inside the aurasToCast container.
+ // Auras not matching the requirements may prevent using auras matching the requirements.
+ // aurasToCast will erase conflicting auras in aurasToRemove container to handle spells used by multiple quests.
+
+ for (auto itr = aurasToRemove.begin(); itr != aurasToRemove.end();)
+ {
+ bool auraRemoved = false;
+
+ for (const auto i : aurasToCast)
+ {
+ if (*itr == i)
+ {
+ itr = aurasToRemove.erase(itr);
+ auraRemoved = true;
+ break;
+ }
+ }
+
+ if (!auraRemoved)
+ ++itr;
}
+
+ for (auto spellId : aurasToCast)
+ if (!HasAura(spellId))
+ CastSpell(this, spellId, true);
+
+ for (auto spellId : aurasToRemove)
+ RemoveAurasDueToSpell(spellId);
}
UpdateVisibleGameobjectsOrSpellClicks();