aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-05-05 16:56:15 -0500
committermegamage <none@none>2009-05-05 16:56:15 -0500
commite69d2cbed95b6cddd009f68dd80fd4614342d1fc (patch)
tree8dd0777d15adf284f2b0146e791ac4cd868b36e3 /src/game/SpellAuras.cpp
parentdcb2b5aa019c409b1b9b1061aa4dd24c8ecacb5d (diff)
[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
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp32
1 files changed, 27 insertions, 5 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 264a4c39aea..29783de6c70 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -47,6 +47,7 @@
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
+#include "Vehicle.h"
#include "CellImpl.h"
pAuraHandler AuraHandler[TOTAL_AURAS]=
@@ -6726,19 +6727,40 @@ void AuraEffect::HandleArenaPreparation(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
}
+/**
+ * Such auras are applied from a caster(=player) to a vehicle.
+ * This has been verified using spell #49256
+ */
void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real)
{
if(!Real)
return;
- if(m_target->GetTypeId() != TYPEID_PLAYER)
+ if(m_target->GetTypeId() != TYPEID_UNIT || !((Creature*)m_target)->isVehicle())
+ return;
+
+ Unit *caster = GetCaster();
+ if(!caster)
return;
- if(Pet *pet = ((Player*)m_target)->GetPet())
- pet->Remove(PET_SAVE_AS_CURRENT);
+ Vehicle *vehicle = dynamic_cast<Vehicle*>(m_target);
- //WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
- //((Player*)m_target)->GetSession()->SendPacket(&data);
+ if (apply)
+ {
+ if(caster->GetTypeId() == TYPEID_PLAYER)
+ if(Pet *pet = ((Player*)caster)->GetPet())
+ pet->Remove(PET_SAVE_AS_CURRENT);
+ caster->EnterVehicle(vehicle);
+ }
+ else
+ {
+ SpellEntry const *spell = GetSpellProto();
+
+ // some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
+ caster->RemoveAurasDueToSpell(spell->Id);
+
+ caster->ExitVehicle();
+ }
}
void AuraEffect::HandleAuraConvertRune(bool apply, bool Real)