diff options
Diffstat (limited to 'src/server/game/Entities')
| -rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 29 | ||||
| -rw-r--r-- | src/server/game/Entities/Player/Player.h | 2 | ||||
| -rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 8 |
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(); |
