[8016] Work at npc click table data use.

* 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
This commit is contained in:
VladimirMangos 2009-06-15 00:52:35 +04:00
parent 08fe4933c5
commit 5254a498df
9 changed files with 106 additions and 30 deletions

View file

@ -18477,18 +18477,20 @@ void Player::UpdateForQuestWorldObjects()
Creature *obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr);
if(!obj)
continue;
// check if this unit requires quest specific flags
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(obj->GetEntry()); itr != map.upper_bound(obj->GetEntry()); ++itr)
// check if this unit requires quest specific flags
if(!obj->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
continue;
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);
@ -20004,12 +20006,14 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
bool Player::canSeeSpellClickOn(Creature const *c) const
{
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
for(SpellClickInfoMap::const_iterator itr = map.lower_bound(c->GetEntry()); itr != map.upper_bound(c->GetEntry()); ++itr)
{
if(itr->second.questId == 0 || GetQuestStatus(itr->second.questId) == QUEST_STATUS_INCOMPLETE)
if(!c->HasFlag(UNIT_NPC_FLAGS,UNIT_NPC_FLAG_SPELLCLICK))
return false;
SpellClickInfoMapBounds clickPair = objmgr.GetSpellClickInfoMapBounds(c->GetEntry());
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
if(itr->second.IsFitToRequirements(this))
return true;
}
return false;
}