*Some work on vehicle.
--HG-- branch : trunk
This commit is contained in:
@@ -17,10 +17,12 @@
|
|||||||
#ifdef USE_DYNAMIC_CAST
|
#ifdef USE_DYNAMIC_CAST
|
||||||
#define CAST_PLR(a) (dynamic_cast<Player*>(a))
|
#define CAST_PLR(a) (dynamic_cast<Player*>(a))
|
||||||
#define CAST_CRE(a) (dynamic_cast<Creature*>(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))
|
#define CAST_AI(a,b) (dynamic_cast<a*>(b))
|
||||||
#else
|
#else
|
||||||
#define CAST_PLR(a) (static_cast<Player*>(a))
|
#define CAST_PLR(a) (static_cast<Player*>(a))
|
||||||
#define CAST_CRE(a) (static_cast<Creature*>(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))
|
#define CAST_AI(a,b) (static_cast<a*>(b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -18,3 +18,88 @@
|
|||||||
|
|
||||||
#include "precompiled.h"
|
#include "precompiled.h"
|
||||||
#include "def_ulduar.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();
|
||||||
|
}
|
||||||
|
|||||||
@@ -763,10 +763,17 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||||||
char* e = strtok((char*)args, " ");
|
char* e = strtok((char*)args, " ");
|
||||||
char* i = strtok(NULL, " ");
|
char* i = strtok(NULL, " ");
|
||||||
|
|
||||||
if (!e || !i)
|
if (!e)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
uint32 entry = (uint32)atoi(e);
|
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);
|
uint32 id = (uint32)atoi(i);
|
||||||
|
|
||||||
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
|
CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
|
||||||
@@ -781,8 +788,6 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||||||
|
|
||||||
Vehicle *v = new Vehicle;
|
Vehicle *v = new Vehicle;
|
||||||
Map *map = m_session->GetPlayer()->GetMap();
|
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))
|
if(!v->Create(objmgr.GenerateLowGuid(HIGHGUID_VEHICLE), map, m_session->GetPlayer()->GetPhaseMask(), entry, id, m_session->GetPlayer()->GetTeam(), x, y, z, o))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1092,10 +1092,16 @@ enum Targets
|
|||||||
TARGET_DEST_DYNOBJ_NONE = 88,
|
TARGET_DEST_DYNOBJ_NONE = 88,
|
||||||
TARGET_DEST_TRAJ = 89,
|
TARGET_DEST_TRAJ = 89,
|
||||||
TARGET_UNIT_MINIPET = 90,
|
TARGET_UNIT_MINIPET = 90,
|
||||||
|
TARGET_UNK_91 = 91,
|
||||||
|
TARGET_UNK_92 = 92,
|
||||||
TARGET_CORPSE_AREA_ENEMY_PLAYER = 93,
|
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
|
enum SpellMissInfo
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,6 +48,7 @@
|
|||||||
#include "BattleGround.h"
|
#include "BattleGround.h"
|
||||||
#include "Util.h"
|
#include "Util.h"
|
||||||
#include "TemporarySummon.h"
|
#include "TemporarySummon.h"
|
||||||
|
#include "Vehicle.h"
|
||||||
|
|
||||||
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
|
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
|
||||||
|
|
||||||
@@ -1728,6 +1729,15 @@ void Spell::SetTargetMap(uint32 i, uint32 cur)
|
|||||||
case TARGET_UNIT_RAID_CASTER:
|
case TARGET_UNIT_RAID_CASTER:
|
||||||
pushType = PUSH_CASTER_CENTER;
|
pushType = PUSH_CASTER_CENTER;
|
||||||
break;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7000,7 +7000,7 @@ void AuraEffect::HandleAuraControlVehicle(bool apply, bool Real, bool /*changeAm
|
|||||||
//if(caster->GetTypeId() == TYPEID_PLAYER)
|
//if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||||
// if(Pet *pet = ((Player*)caster)->GetPet())
|
// if(Pet *pet = ((Player*)caster)->GetPet())
|
||||||
// pet->Remove(PET_SAVE_AS_CURRENT);
|
// pet->Remove(PET_SAVE_AS_CURRENT);
|
||||||
caster->EnterVehicle(vehicle, 0);
|
caster->EnterVehicle(vehicle, m_amount - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5010,6 +5010,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
|||||||
((Player*)m_caster)->learnSpell(discoveredSpell, false);
|
((Player*)m_caster)->learnSpell(discoveredSpell, false);
|
||||||
return;
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ SpellMgr::SpellMgr()
|
|||||||
case TARGET_UNIT_PET:
|
case TARGET_UNIT_PET:
|
||||||
case TARGET_UNIT_PARTY_CASTER:
|
case TARGET_UNIT_PARTY_CASTER:
|
||||||
case TARGET_UNIT_RAID_CASTER:
|
case TARGET_UNIT_RAID_CASTER:
|
||||||
|
case TARGET_UNIT_VEHICLE:
|
||||||
|
case TARGET_UNIT_PASSENGER:
|
||||||
SpellTargetType[i] = TARGET_TYPE_UNIT_CASTER;
|
SpellTargetType[i] = TARGET_TYPE_UNIT_CASTER;
|
||||||
break;
|
break;
|
||||||
case TARGET_UNIT_MINIPET:
|
case TARGET_UNIT_MINIPET:
|
||||||
|
|||||||
+1
-1
@@ -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)
|
// 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
|
// caster pointer can be deleted in time aura remove, find it by guid at each iteration
|
||||||
for(;;)
|
for(;;)
|
||||||
|
|||||||
+38
-6
@@ -48,11 +48,29 @@ void Vehicle::AddToWorld()
|
|||||||
AIM_Initialize();
|
AIM_Initialize();
|
||||||
switch(GetEntry())
|
switch(GetEntry())
|
||||||
{
|
{
|
||||||
case 27850:InstallAccessory(27905,1);break;
|
//case 27850:InstallAccessory(27905,1);break;
|
||||||
case 28312:InstallAccessory(28319,7);break;
|
case 28312:InstallAccessory(28319,7);break;
|
||||||
case 32627:InstallAccessory(32629,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);
|
Creature::Update(diff);
|
||||||
//310
|
//310
|
||||||
//if(getPowerType() == POWER_ENERGY)
|
if(getPowerType() == POWER_ENERGY)
|
||||||
// ModifyPower(POWER_ENERGY, 1);
|
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)
|
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;
|
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
|
int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
|
||||||
{
|
{
|
||||||
SeatMap::const_iterator seat = m_Seats.find(seatId);
|
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)
|
void Vehicle::InstallAccessory(uint32 entry, int8 seatId)
|
||||||
{
|
{
|
||||||
//Creature *accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
|
const CreatureInfo *cInfo = objmgr.GetCreatureTemplate(entry);
|
||||||
Creature *accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
|
if(!cInfo)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Creature *accessory;
|
||||||
|
if(cInfo->VehicleId)
|
||||||
|
accessory = SummonVehicle(entry, GetPositionX(), GetPositionY(), GetPositionZ());
|
||||||
|
else
|
||||||
|
accessory = SummonCreature(entry, GetPositionX(), GetPositionY(), GetPositionZ());
|
||||||
if(!accessory)
|
if(!accessory)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class Vehicle : public Creature
|
|||||||
void SetVehicleId(uint32 vehicleid);
|
void SetVehicleId(uint32 vehicleid);
|
||||||
|
|
||||||
bool HasEmptySeat(int8 seatId) const;
|
bool HasEmptySeat(int8 seatId) const;
|
||||||
|
Unit *GetPassenger(int8 seatId) const;
|
||||||
int8 GetNextEmptySeat(int8 seatId, bool next) const;
|
int8 GetNextEmptySeat(int8 seatId, bool next) const;
|
||||||
bool AddPassenger(Unit *passenger, int8 seatId = -1);
|
bool AddPassenger(Unit *passenger, int8 seatId = -1);
|
||||||
void RemovePassenger(Unit *passenger);
|
void RemovePassenger(Unit *passenger);
|
||||||
|
|||||||
Reference in New Issue
Block a user