Core/Vehicles: Correct usage of npc_spellclick_spells instead of blatant hacks for vehicle entry.
Note: This may break a few vehicles, but only due to the absence of proper, non-hackish data.
This commit is contained in:
@@ -559,25 +559,8 @@ void WorldSession::HandleSpellClick(WorldPacket & recv_data)
|
||||
if (!unit->IsInWorld())
|
||||
return;
|
||||
|
||||
SpellClickInfoMapBounds clickPair = sObjectMgr->GetSpellClickInfoMapBounds(unit->GetEntry());
|
||||
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
|
||||
{
|
||||
if (itr->second.IsFitToRequirements(_player, unit))
|
||||
{
|
||||
Unit *caster = (itr->second.castFlags & NPC_CLICK_CAST_CASTER_PLAYER) ? (Unit*)_player : (Unit*)unit;
|
||||
Unit *target = (itr->second.castFlags & NPC_CLICK_CAST_TARGET_PLAYER) ? (Unit*)_player : (Unit*)unit;
|
||||
uint64 origCasterGUID = (itr->second.castFlags & NPC_CLICK_CAST_ORIG_CASTER_OWNER) ? unit->GetOwnerGUID() : 0;
|
||||
caster->CastSpell(target, itr->second.spellId, true, NULL, NULL, origCasterGUID);
|
||||
}
|
||||
}
|
||||
|
||||
if (unit->IsVehicle())
|
||||
{
|
||||
if (unit->CheckPlayerCondition(_player))
|
||||
_player->EnterVehicle(unit);
|
||||
}
|
||||
|
||||
unit->AI()->DoAction(EVENT_SPELLCLICK);
|
||||
if (!unit->HandleSpellClick(_player))
|
||||
sLog->outErrorDb("Missing npc_spellclick_spells data for creature %u", unit->GetEntry());
|
||||
}
|
||||
|
||||
void WorldSession::HandleMirrrorImageDataRequest(WorldPacket & recv_data)
|
||||
|
||||
Reference in New Issue
Block a user