aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/include/sc_creature.h2
-rw-r--r--src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp85
-rw-r--r--src/game/Debugcmds.cpp11
-rw-r--r--src/game/SharedDefines.h8
-rw-r--r--src/game/Spell.cpp10
-rw-r--r--src/game/SpellAuras.cpp2
-rw-r--r--src/game/SpellEffects.cpp5
-rw-r--r--src/game/SpellMgr.cpp2
-rw-r--r--src/game/Unit.cpp2
-rw-r--r--src/game/Vehicle.cpp44
-rw-r--r--src/game/Vehicle.h1
11 files changed, 160 insertions, 12 deletions
diff --git a/src/bindings/scripts/include/sc_creature.h b/src/bindings/scripts/include/sc_creature.h
index 6e6a16a9f13..db12a846757 100644
--- a/src/bindings/scripts/include/sc_creature.h
+++ b/src/bindings/scripts/include/sc_creature.h
@@ -17,10 +17,12 @@
#ifdef USE_DYNAMIC_CAST
#define CAST_PLR(a) (dynamic_cast<Player*>(a))
#define CAST_CRE(a) (dynamic_cast<Creature*>(a))
+#define CAST_VEH(a) (dynamic_cast<Vehicle*>(a))
#define CAST_AI(a,b) (dynamic_cast<a*>(b))
#else
#define CAST_PLR(a) (static_cast<Player*>(a))
#define CAST_CRE(a) (static_cast<Creature*>(a))
+#define CAST_VEH(a) (static_cast<Vehicle*>(a))
#define CAST_AI(a,b) (static_cast<a*>(b))
#endif
diff --git a/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp b/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp
index a736b2db12a..a8e2a4198f9 100644
--- a/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp
+++ b/src/bindings/scripts/scripts/zone/ulduar/ulduar/boss_flame_leviathan.cpp
@@ -18,3 +18,88 @@
#include "precompiled.h"
#include "def_ulduar.h"
+#include "vehicle.h"
+
+#define SPELL_PURSUED 62374
+#define SPELL_GATHERING_SPEED 62375
+#define SPELL_BATTERING_RAM 62376
+#define SPELL_FLAME_VENTS 62396
+#define SPELL_MISSILE_BARRAGE 62400
+#define SPELL_SYSTEMS_SHUTDOWN 62475
+
+#define SPELL_CANNON 62397
+
+#define SPELL_OVERLOAD_CIRCUIT 62399
+
+#define SPELL_SEARING_FLAME 62402
+
+struct TRINITY_DLL_DECL boss_flame_leviathanAI : public BossAI
+{
+ boss_flame_leviathanAI(Creature *c) : BossAI(c, BOSS_LEVIATHAN)
+ {
+ assert(c->isVehicle());
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(!UpdateVictim())
+ return;
+
+ events.Update(diff);
+
+ if(me->hasUnitState(UNIT_STAT_CASTING))
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+
+struct TRINITY_DLL_DECL boss_flame_leviathan_seatAI : public ScriptedAI
+{
+ boss_flame_leviathan_seatAI(Creature *c) : ScriptedAI(c)
+ {
+ assert(c->isVehicle());
+ }
+
+ void Reset()
+ {
+ if(const CreatureInfo *cInfo = me->GetCreatureInfo())
+ me->SetDisplayId(cInfo->DisplayID_H2); // A for gm, H1 invisible
+ }
+
+ void UpdateAI(const uint32 diff)
+ {
+ if(!UpdateVictim())
+ return;
+
+ if(me->hasUnitState(UNIT_STAT_CASTING))
+ return;
+
+ DoMeleeAttackIfReady();
+ }
+};
+
+CreatureAI* GetAI_boss_flame_leviathan(Creature *_Creature)
+{
+ return new boss_flame_leviathanAI (_Creature);
+}
+
+CreatureAI* GetAI_boss_flame_leviathan_seat(Creature *_Creature)
+{
+ return new boss_flame_leviathan_seatAI (_Creature);
+}
+
+void AddSC_boss_flame_leviathan()
+{
+ Script *newscript;
+ newscript = new Script;
+ newscript->Name="boss_flame_leviathan";
+ newscript->GetAI = &GetAI_boss_flame_leviathan;
+ newscript->RegisterSelf();
+
+ newscript = new Script;
+ newscript->Name="boss_flame_leviathan_seat";
+ newscript->GetAI = &GetAI_boss_flame_leviathan_seat;
+ newscript->RegisterSelf();
+}
diff --git a/src/game/Debugcmds.cpp b/src/game/Debugcmds.cpp
index 2e432ab1c0f..d8b94df4e10 100644
--- a/src/game/Debugcmds.cpp
+++ b/src/game/Debugcmds.cpp
@@ -763,10 +763,17 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
char* e = strtok((char*)args, " ");
char* i = strtok(NULL, " ");
- if (!e || !i)
+ if (!e)
return false;
uint32 entry = (uint32)atoi(e);
+
+ float x, y, z, o = m_session->GetPlayer()->GetOrientation();
+ m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize());
+
+ if(!i)
+ return m_session->GetPlayer()->SummonVehicle(entry, x, y, z, o);
+
uint32 id = (uint32)atoi(i);
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
@@ -781,8 +788,6 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
Vehicle *v = new Vehicle;
Map *map = m_session->GetPlayer()->GetMap();
- float x, y, z, o = m_session->GetPlayer()->GetOrientation();
- m_session->GetPlayer()->GetClosePoint(x, y, z, m_session->GetPlayer()->GetObjectSize());
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
{
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 6a264ecfe32..e1440d45454 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -1092,10 +1092,16 @@ enum Targets
TARGET_DEST_DYNOBJ_NONE = 88,
TARGET_DEST_TRAJ = 89,
TARGET_UNIT_MINIPET = 90,
+ TARGET_UNK_91 = 91,
+ TARGET_UNK_92 = 92,
TARGET_CORPSE_AREA_ENEMY_PLAYER = 93,
+ TARGET_UNIT_VEHICLE = 94,
+ TARGET_UNIT_DRIVER = 95, //?
+ TARGET_UNIT_PASSENGER = 97,
+ TARGET_UNIT_AREA_PATH = 104,
};
-#define TOTAL_SPELL_TARGETS 94
+#define TOTAL_SPELL_TARGETS 105
enum SpellMissInfo
{
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index 115419245d0..99d568ee09a 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -48,6 +48,7 @@
#include "BattleGround.h"
#include "Util.h"
#include "TemporarySummon.h"
+#include "Vehicle.h"
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
@@ -1728,6 +1729,15 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
case TARGET_UNIT_RAID_CASTER:
pushType = PUSH_CASTER_CENTER;
break;
+ case TARGET_UNIT_VEHICLE:
+ if(Vehicle *vehicle = m_caster->m_Vehicle)
+ AddUnitTarget(vehicle, i);
+ break;
+ case TARGET_UNIT_PASSENGER:
+ if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isVehicle())
+ if(Unit *unit = ((Vehicle*)m_caster)->GetPassenger(1)) // maybe not right
+ AddUnitTarget(unit, i);
+ break;
}
break;
}
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 224f9cb25ed..053221147b4 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -7000,7 +7000,7 @@ void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real, bool /*changeAm
//if(caster->GetTypeId() == TYPEID_PLAYER)
// if(Pet *pet = ((Player*)caster)->GetPet())
// pet->Remove(PET_SAVE_AS_CURRENT);
- caster->EnterVehicle(vehicle, 0);
+ caster->EnterVehicle(vehicle, m_amount - 1);
}
else
{
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 58f59f429c4..549f79ab5f4 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -5010,6 +5010,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
((Player*)m_caster)->learnSpell(discoveredSpell, false);
return;
}
+ case 62428: // Load into Catapult
+ if(m_caster->m_Vehicle && m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isVehicle())
+ if(Unit *passenger = ((Vehicle*)m_caster)->GetPassenger(0))
+ passenger->CastSpell(m_caster->m_Vehicle, damage, true);
+ return;
}
break;
}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 67f31ad7759..d5c611a4cbe 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -107,6 +107,8 @@ SpellMgr::SpellMgr()
case TARGET_UNIT_PET:
case TARGET_UNIT_PARTY_CASTER:
case TARGET_UNIT_RAID_CASTER:
+ case TARGET_UNIT_VEHICLE:
+ case TARGET_UNIT_PASSENGER:
SpellTargetType[i] = TARGET_TYPE_UNIT_CASTER;
break;
case TARGET_UNIT_MINIPET:
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 84299185595..1896655b50f 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3918,7 +3918,7 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
}
// update single target auras list (before aura add to aura list, to prevent unexpected remove recently added aura)
- if (Aur->IsSingleTarget() && Aur->GetTarget())
+ if (Aur->IsSingleTarget())
{
// caster pointer can be deleted in time aura remove, find it by guid at each iteration
for(;;)
diff --git a/src/game/Vehicle.cpp b/src/game/Vehicle.cpp
index 16a995eedee..2271bcc3c4a 100644
--- a/src/game/Vehicle.cpp
+++ b/src/game/Vehicle.cpp
@@ -48,11 +48,29 @@ void Vehicle::AddToWorld()
AIM_Initialize();
switch(GetEntry())
{
- case 27850:InstallAccessory(27905,1);break;
+ //case 27850:InstallAccessory(27905,1);break;
case 28312:InstallAccessory(28319,7);break;
case 32627:InstallAccessory(32629,7);break;
+ case 33109:InstallAccessory(33167,1);break;
+ case 33060:InstallAccessory(33067,7);break;
+ case 33113:
+ InstallAccessory(33114,0);
+ InstallAccessory(33114,1);
+ InstallAccessory(33114,2);
+ InstallAccessory(33114,3);
+ InstallAccessory(33139,7);
+ break;
+ case 33114:
+ InstallAccessory(33143,1);
+ //InstallAccessory(33142,0);
+ InstallAccessory(33142,2);
+ break;
+ }
+ if(!GetMaxPower(POWER_MANA)) // m_vehicleInfo->36
+ {
+ setPowerType(POWER_ENERGY);
+ SetMaxPower(POWER_ENERGY, 100);
}
- //setPowerType(POWER_ENERGY);SetMaxPower(POWER_ENERGY, 100);
}
}
@@ -96,8 +114,8 @@ void Vehicle::Update(uint32 diff)
{
Creature::Update(diff);
//310
- //if(getPowerType() == POWER_ENERGY)
- // ModifyPower(POWER_ENERGY, 1);
+ if(getPowerType() == POWER_ENERGY)
+ ModifyPower(POWER_ENERGY, 100);
}
bool Vehicle::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehicleId, uint32 team, float x, float y, float z, float o, const CreatureData * data)
@@ -159,6 +177,13 @@ bool Vehicle::HasEmptySeat(int8 seatId) const
return !seat->second.passenger;
}
+Unit *Vehicle::GetPassenger(int8 seatId) const
+{
+ SeatMap::const_iterator seat = m_Seats.find(seatId);
+ if(seat == m_Seats.end()) return NULL;
+ return seat->second.passenger;
+}
+
int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
{
SeatMap::const_iterator seat = m_Seats.find(seatId);
@@ -185,8 +210,15 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
{
- //Creature *accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
- Creature *accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
+ const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
+ if(!cInfo)
+ return;
+
+ Creature *accessory;
+ if(cInfo->VehicleId)
+ accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
+ else
+ accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
if(!accessory)
return;
diff --git a/src/game/Vehicle.h b/src/game/Vehicle.h
index d1e606caf4a..e0473c45560 100644
--- a/src/game/Vehicle.h
+++ b/src/game/Vehicle.h
@@ -53,6 +53,7 @@ class Vehicle : public Creature
void SetVehicleId(uint32 vehicleid);
bool HasEmptySeat(int8 seatId) const;
+ Unit *GetPassenger(int8 seatId) const;
int8 GetNextEmptySeat(int8 seatId, bool next) const;
bool AddPassenger(Unit *passenger, int8 seatId = -1);
void RemovePassenger(Unit *passenger);