[7776] Completed implementation of CMSG_SPELLCLICK

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
This commit is contained in:
arrai 2009-04-29 17:44:39 +02:00
parent 6e87802fa5
commit fefe56e3c5
19 changed files with 225 additions and 39 deletions

View file

@ -12284,7 +12284,7 @@ void Player::AddQuest( Quest const *pQuest, Object *questGiver )
CastSpell(this,itr->second->spellId,true);
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::CompleteQuest( uint32 quest_id )
@ -13015,7 +13015,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 MaNGOS, but used in scripting code
@ -13136,7 +13136,7 @@ void Player::ItemAddedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
@ -13177,7 +13177,7 @@ void Player::ItemRemovedQuestCheck( uint32 entry, uint32 count )
}
}
}
UpdateForQuestsGO();
UpdateForQuestWorldObjects();
}
void Player::KilledMonster( uint32 entry, uint64 guid )
@ -18323,7 +18323,7 @@ bool Player::HasQuestForGO(int32 GOId) const
return false;
}
void Player::UpdateForQuestsGO()
void Player::UpdateForQuestWorldObjects()
{
if(m_clientGUIDs.empty())
return;
@ -18338,6 +18338,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);
@ -19204,8 +19222,8 @@ void Player::ExitVehicle(Vehicle *vehicle)
data << uint32(0);
GetSession()->SendPacket(&data);
// only for flyable vehicles?
CastSpell(this, 45472, true); // Parachute
// maybe called at dummy aura remove?
// CastSpell(this, 45472, true); // Parachute
}
bool Player::isTotalImmune()
@ -19849,3 +19867,15 @@ void Player::ResummonPetTemporaryUnSummonedIfAny()
m_temporaryUnsummonedPetNumber = 0;
}
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)
return true;
}
return false;
}