diff options
author | megamage <none@none> | 2009-06-15 23:07:43 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-06-15 23:07:43 -0500 |
commit | 00f4a31b735f327b715ff12d82f78de33c95539e (patch) | |
tree | eedf5857ff1a8be6bbbb7eb98b005565a07b9cb5 /src/game/Player.cpp | |
parent | 572a9191d970b9b960555c8a5d31efd3160a8b44 (diff) |
[8016] Work at npc click table data use. Author: VladimirMangos
* New fields in `npc_spellclick_spells` for allow set npc spell click mode from quest to infinity
or to another quest, or from reward quest.
* Not expect (and forbid set UNIT_NPC_FLAG_SPELLCLICK in DB and set it at `npc_spellclick_spells` loading.
* Apply some speedups for creature checks affected by spel click state
*Also add target position of 51852. By Roland
--HG--
branch : trunk
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; } |