aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorWyrserth <wyrserth@protonmail.com>2019-07-05 14:11:15 +0200
committerShauren <shauren.trinity@gmail.com>2021-12-14 20:52:13 +0100
commitedf12fd6a1b989d7785bc0619002eda1ccc87368 (patch)
treeb225ce3361419b08c0f766105dda8e92db3cd7c6 /src/server/game/Entities
parent104ec7a81a5bb782f81fd05b872bf664e4de1c89 (diff)
Core/Conditions: allow spellclick conditions to properly work for aura apply/remove (#23527)
(cherry picked from commit 12e545f7e2247f91db3fd1e8e2f961982422a147)
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Player/Player.cpp29
-rw-r--r--src/server/game/Entities/Player/Player.h2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp8
3 files changed, 18 insertions, 21 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index ea41877c2c7..838c57edf19 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -16546,7 +16546,7 @@ void Player::SendQuestUpdate(uint32 questId)
}
}
- UpdateForQuestWorldObjects();
+ UpdateVisibleGameobjectsOrSpellClicks();
PhasingHandler::OnConditionChange(this);
}
@@ -16914,8 +16914,7 @@ void Player::ItemRemovedQuestCheck(uint32 entry, uint32 count)
IncompleteQuest(questId);
}
}
-
- UpdateForQuestWorldObjects();
+ UpdateVisibleGameobjectsOrSpellClicks();
}
void Player::KilledMonster(CreatureTemplate const* cInfo, ObjectGuid guid)
@@ -17095,7 +17094,7 @@ void Player::UpdateQuestObjectiveProgress(QuestObjectiveType objectiveType, int3
}
if (anyObjectiveChangedCompletionState)
- UpdateForQuestWorldObjects();
+ UpdateVisibleGameobjectsOrSpellClicks();
}
bool Player::HasQuestForItem(uint32 itemid) const
@@ -25257,7 +25256,7 @@ bool Player::HasQuestForGO(int32 GOId) const
return false;
}
-void Player::UpdateForQuestWorldObjects()
+void Player::UpdateVisibleGameobjectsOrSpellClicks()
{
if (m_clientGUIDs.empty())
return;
@@ -25306,23 +25305,13 @@ void Player::UpdateForQuestWorldObjects()
auto clickBounds = sObjectMgr->GetSpellClickInfoMapBounds(obj->GetEntry());
for (auto const& clickPair : clickBounds)
{
- //! This code doesn't look right, but it was logically converted to condition system to do the exact
- //! same thing it did before. It definitely needs to be overlooked for intended functionality.
if (ConditionContainer const* conds = sConditionMgr->GetConditionsForSpellClickEvent(obj->GetEntry(), clickPair.second.spellId))
{
- bool buildUpdateBlock = false;
- for (ConditionContainer::const_iterator jtr = conds->begin(); jtr != conds->end() && !buildUpdateBlock; ++jtr)
- if ((*jtr)->ConditionType == CONDITION_QUESTREWARDED || (*jtr)->ConditionType == CONDITION_QUESTTAKEN || (*jtr)->ConditionType == CONDITION_QUEST_COMPLETE)
- buildUpdateBlock = true;
-
- if (buildUpdateBlock)
- {
- UF::ObjectData::Base objMask;
- UF::UnitData::Base unitMask;
- unitMask.MarkChanged(&UF::UnitData::NpcFlags, 0); // NpcFlags[0] has UNIT_NPC_FLAG_SPELLCLICK
- obj->BuildValuesUpdateForPlayerWithMask(&udata, objMask.GetChangesMask(), unitMask.GetChangesMask(), this);
- break;
- }
+ UF::ObjectData::Base objMask;
+ UF::UnitData::Base unitMask;
+ unitMask.MarkChanged(&UF::UnitData::NpcFlags, 0); // NpcFlags[0] has UNIT_NPC_FLAG_SPELLCLICK
+ obj->BuildValuesUpdateForPlayerWithMask(&udata, objMask.GetChangesMask(), unitMask.GetChangesMask(), this);
+ break;
}
}
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 7cecd210ce8..e49678bb0db 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1599,7 +1599,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void UpdateQuestObjectiveProgress(QuestObjectiveType objectiveType, int32 objectId, int64 addCount, ObjectGuid victimGuid = ObjectGuid::Empty);
bool HasQuestForItem(uint32 itemId) const;
bool HasQuestForGO(int32 goId) const;
- void UpdateForQuestWorldObjects();
+ void UpdateVisibleGameobjectsOrSpellClicks();
bool CanShareQuest(uint32 questId) const;
int32 GetQuestObjectiveData(QuestObjective const& objective) const;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index a54f2db3fae..3836068f982 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -3223,6 +3223,10 @@ void Unit::_ApplyAura(AuraApplication* aurApp, uint32 effMask)
if (effMask & 1 << i && (!aurApp->GetRemoveMode()))
aurApp->_HandleEffect(i, true);
}
+
+ if (Player* player = ToPlayer())
+ if (sConditionMgr->IsSpellUsedInSpellClickConditions(aurApp->GetBase()->GetId()))
+ player->UpdateVisibleGameobjectsOrSpellClicks();
}
// removes aura application from lists and unapplies effects
@@ -3309,6 +3313,10 @@ void Unit::_UnapplyAura(AuraApplicationMap::iterator& i, AuraRemoveMode removeMo
aura->HandleAuraSpecificMods(aurApp, caster, false, false);
+ if (Player* player = ToPlayer())
+ if (sConditionMgr->IsSpellUsedInSpellClickConditions(aurApp->GetBase()->GetId()))
+ player->UpdateVisibleGameobjectsOrSpellClicks();
+
// only way correctly remove all auras from list
//if (removedAuras != m_removedAurasCount) new aura may be added
i = m_appliedAuras.begin();