aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSnapperRy <snapperryen@gmail.com>2016-07-15 18:32:16 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-05 17:38:36 +0100
commitc8e7e68e666839859dba9422e37d49ad957d441a (patch)
treeb1e90fcc862a522834296eabe34182593cbbd4ed
parent90be9d143b6c7da1af89afb3a597add27d50b678 (diff)
Core/SpellArea: iterate spell_area entries by player's current area instead of quest id. (#17509)
(cherry picked from commit d7e47de264a20dc689b4b30663c2de09613b791f)
-rw-r--r--src/server/game/Entities/Player/Player.cpp33
-rw-r--r--src/server/game/Entities/Player/Player.h2
2 files changed, 14 insertions, 21 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 44c0382ed1d..155b7274d62 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -14839,7 +14839,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
StartCriteriaTimer(CRITERIA_TIMED_TYPE_QUEST, quest_id);
- SendQuestUpdate(quest_id);
+ SendQuestUpdate();
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
@@ -15184,7 +15184,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
UpdatePvPState();
}
- SendQuestUpdate(quest_id);
+ SendQuestUpdate();
SendQuestGiverStatusMultiple();
@@ -15838,7 +15838,7 @@ void Player::SetQuestStatus(uint32 questId, QuestStatus status, bool update /*=
}
if (update)
- SendQuestUpdate(questId);
+ SendQuestUpdate();
sScriptMgr->OnQuestStatusChange(this, questId, status);
}
@@ -15853,7 +15853,7 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/)
}
if (update)
- SendQuestUpdate(questId);
+ SendQuestUpdate();
}
void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
@@ -15869,33 +15869,26 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
SetQuestCompletedBit(questBit, false);
if (update)
- SendQuestUpdate(questId);
+ SendQuestUpdate();
}
-void Player::SendQuestUpdate(uint32 questId)
+void Player::SendQuestUpdate()
{
uint32 zone = 0, area = 0;
+ GetZoneAndAreaId(zone, area);
- SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForQuestMapBounds(questId);
- if (saBounds.first != saBounds.second)
- {
- GetZoneAndAreaId(zone, area);
-
- for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
- if (itr->second->autocast && itr->second->IsFitToRequirements(this, zone, area))
- if (!HasAura(itr->second->spellId))
- CastSpell(this, itr->second->spellId, true);
- }
+ SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(area);
- saBounds = sSpellMgr->GetSpellAreaForQuestEndMapBounds(questId);
if (saBounds.first != saBounds.second)
{
- if (!zone || !area)
- GetZoneAndAreaId(zone, area);
-
for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
+ {
if (!itr->second->IsFitToRequirements(this, zone, area))
RemoveAurasDueToSpell(itr->second->spellId);
+ else if (itr->second->autocast)
+ if (!HasAura(itr->second->spellId))
+ CastSpell(this, itr->second->spellId, true);
+ }
}
UpdateForQuestWorldObjects();
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index ffabf1aed11..69920f66b59 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1568,7 +1568,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void SetQuestStatus(uint32 questId, QuestStatus status, bool update = true);
void RemoveActiveQuest(uint32 questId, bool update = true);
void RemoveRewardedQuest(uint32 questId, bool update = true);
- void SendQuestUpdate(uint32 questId);
+ void SendQuestUpdate();
QuestGiverStatus GetQuestDialogStatus(Object* questGiver);
void SetDailyQuestStatus(uint32 quest_id);