[7776] Completed implementation of CMSG_SPELLCLICK Author: arrai

For vehicles, you have to add the correct SPELL_AURA_CONTROL_VEHICLE spells to
    npc_spellclick_spells, otherwise you won't be able to use them

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-05 16:56:15 -05:00
parent dcb2b5aa01
commit e69d2cbed9
18 changed files with 228 additions and 42 deletions

View File

@@ -12562,7 +12562,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
CastSpell(this,itr->second->spellId,true);
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::CompleteQuest( uint32 quest_id )
@@ -13293,7 +13293,7 @@ void Player::SetQuestStatus( uint32 quest_id, QuestStatus status )
if (q_status.uState != QUEST_NEW) q_status.uState = QUEST_CHANGED;
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
// not used in TrinIty, but used in scripting code
@@ -13414,7 +13414,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
@@ -13455,7 +13455,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::KilledMonster( uint32 entry, uint64 guid )
@@ -18890,7 +18890,7 @@ bool Player::HasQuestForGO(int32 GOId) const
return false;
}
void Player::UpdateForQuestsGO()
void Player::UpdateForQuestWorldObjects()
{
if(m_clientGUIDs.empty())
return;
@@ -18905,6 +18905,24 @@ void Player::UpdateForQuestsGO()
if(obj)
obj->BuildValuesUpdateBlockForPlayer(&udata,this);
}
else if(IS_CREATURE_GUID(*itr) || IS_VEHICLE_GUID(*itr))
{
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)
{
if(itr->second.questId != 0)
{
obj->BuildCreateUpdateBlockForPlayer(&udata,this);
break;
}
}
}
}
udata.BuildPacket(&packet);
GetSession()->SendPacket(&packet);
@@ -20455,3 +20473,18 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
m_temporaryUnsummonedPetNumber = 0;
}
bool Player::canSeeSpellClickOn(Creature const *c) const
{
SpellClickInfoMap const& map = objmgr.mSpellClickInfoMap;
if(map.empty())
return true;
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)
return true;
}
return false;
}