[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

@ -43,6 +43,7 @@
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Vehicle.h"
#include "CellImpl.h"
#define NULL_AURA_SLOT 0xFF
@ -6684,19 +6685,35 @@ void Aura::HandleArenaPreparation(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
}
void Aura::HandleAuraControlVehicle(bool /*apply*/, bool Real)
/**
* Such auras are applied from a caster(=player) to a vehicle.
* This has been verified using spell #49256
*/
void Aura::HandleAuraControlVehicle(bool apply, bool Real)
{
if(!Real)
return;
if(m_target->GetTypeId() != TYPEID_PLAYER)
Unit *player = GetCaster();
Vehicle *vehicle = dynamic_cast<Vehicle*>(m_target);
if(!player || player->GetTypeId()!=TYPEID_PLAYER || !vehicle)
return;
if(Pet *pet = m_target->GetPet())
pet->Remove(PET_SAVE_AS_CURRENT);
if (apply)
{
if(Pet *pet = player->GetPet())
pet->Remove(PET_SAVE_AS_CURRENT);
((Player*)player)->EnterVehicle(vehicle);
}
else
{
SpellEntry const *spell = GetSpellProto();
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
((Player*)m_target)->GetSession()->SendPacket(&data);
// some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
player->RemoveAurasDueToSpell(spell->Id);
((Player*)player)->ExitVehicle(vehicle);
}
}
void Aura::HandleAuraConvertRune(bool apply, bool Real)