diff options
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r-- | src/game/Player.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 19e5c7e02d2..af7057518fb 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -19186,18 +19186,20 @@ void Player::UpdateForQuestWorldObjects() Creature *obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr); if(!obj) continue; + // check if this unit requires quest specific flags + if(!obj->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK)) + continue; - SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap; - for(SpellClickInfoMap::const_iterator itr = map.lower_bound(obj->GetEntry()); itr != map.upper_bound(obj->GetEntry()); ++itr) + SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(obj->GetEntry()); + for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) { - if(itr->second.questId != 0) + if(itr->second.questStart || itr->second.questEnd) { obj->BuildCreateUpdateBlockForPlayer(&udata,this); break; } } - } } udata.BuildPacket(&packet); @@ -20754,16 +20756,17 @@ void Player::ResummonPetTemporaryUnSummonedIfAny() bool Player::canSeeSpellClickOn(Creature const *c) const { - SpellClickInfoMap::const_iterator lower = objmgr.mSpellClickInfoMap.lower_bound(c->GetEntry()); - SpellClickInfoMap::const_iterator upper = objmgr.mSpellClickInfoMap.upper_bound(c->GetEntry()); - if(lower == upper) + if(!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK)) + return false; + + SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(c->GetEntry()); + if(clickPair.first == clickPair.second) return true; - for(SpellClickInfoMap::const_iterator itr = lower; itr != upper; ++itr) - { - if(itr->second.questId == 0 || GetQuestStatus(itr->second.questId) == itr->second.questStatus) + for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr) + if(itr->second.IsFitToRequirements(this)) return true; - } + return false; } |