Core/SpellArea: iterate spell_area entries by player's current area instead of quest id. (#17509)

This commit is contained in:
SnapperRy
2016-07-15 18:32:16 +02:00
committed by GitHub
parent a732749d72
commit d7e47de264
2 changed files with 15 additions and 22 deletions

View File

@@ -14819,7 +14819,7 @@ void Player::AddQuest(Quest const* quest, Object* questGiver)
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_QUEST, quest_id);
SendQuestUpdate(quest_id);
SendQuestUpdate();
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER)) // check if Quest Tracker is enabled
{
@@ -15058,7 +15058,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
UpdatePvPState();
}
SendQuestUpdate(quest_id);
SendQuestUpdate();
SendQuestGiverStatusMultiple();
@@ -15704,7 +15704,7 @@ void Player::SetQuestStatus(uint32 questId, QuestStatus status, bool update /*=
}
if (update)
SendQuestUpdate(questId);
SendQuestUpdate();
sScriptMgr->OnQuestStatusChange(this, questId, status);
}
@@ -15719,7 +15719,7 @@ void Player::RemoveActiveQuest(uint32 questId, bool update /*= true*/)
}
if (update)
SendQuestUpdate(questId);
SendQuestUpdate();
}
void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
@@ -15732,33 +15732,26 @@ void Player::RemoveRewardedQuest(uint32 questId, bool update /*= true*/)
}
if (update)
SendQuestUpdate(questId);
SendQuestUpdate();
}
void Player::SendQuestUpdate(uint32 questId)
void Player::SendQuestUpdate()
{
uint32 zone = 0, area = 0;
GetZoneAndAreaId(zone, area);
SpellAreaForQuestMapBounds saBounds = sSpellMgr->GetSpellAreaForAreaMapBounds(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);
}
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();

View File

@@ -1363,7 +1363,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);