AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "Vehicle.h"
Public Member Functions | |
void | Install () |
void | Uninstall () |
void | Reset (bool evading=false) |
void | InstallAllAccessories (bool evading) |
void | ApplyAllImmunities () |
void | InstallAccessory (uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime) |
Unit * | GetBase () const |
May be called from scripts. More... | |
VehicleEntry const * | GetVehicleInfo () const |
uint32 | GetCreatureEntry () const |
bool | HasEmptySeat (int8 seatId) const |
Unit * | GetPassenger (int8 seatId) const |
int8 | GetNextEmptySeat (int8 seatId, bool next) const |
uint8 | GetAvailableSeatCount () const |
bool | AddPassenger (Unit *passenger, int8 seatId=-1) |
void | EjectPassenger (Unit *passenger, Unit *controller) |
void | RemovePassenger (Unit *passenger) |
void | RelocatePassengers () |
void | RemoveAllPassengers () |
void | Dismiss () |
bool | IsVehicleInUse () |
void | TeleportVehicle (float x, float y, float z, float ang) |
VehicleSeatEntry const * | GetSeatForPassenger (Unit const *passenger) |
SeatMap::iterator | GetSeatIteratorForPassenger (Unit *passenger) |
virtual void | CalculatePassengerPosition (float &x, float &y, float &z, float *o=nullptr) const =0 |
This method transforms supplied transport offsets into global coordinates. More... | |
virtual void | CalculatePassengerOffset (float &x, float &y, float &z, float *o=nullptr) const =0 |
This method transforms supplied global coordinates into local offsets. More... | |
Public Attributes | |
SeatMap | Seats |
Protected Member Functions | |
Vehicle (Unit *unit, VehicleEntry const *vehInfo, uint32 creatureEntry) | |
~Vehicle () override | |
Protected Member Functions inherited from TransportBase | |
TransportBase ()=default | |
virtual | ~TransportBase ()=default |
Private Types | |
enum | Status { STATUS_NONE , STATUS_INSTALLED , STATUS_UNINSTALLING } |
Private Member Functions | |
void | InitMovementInfoForBase () |
void | CalculatePassengerPosition (float &x, float &y, float &z, float *o) const override |
This method transforms supplied transport offsets into global coordinates. More... | |
void | CalculatePassengerOffset (float &x, float &y, float &z, float *o) const override |
This method transforms supplied global coordinates into local offsets. More... | |
Private Attributes | |
Unit * | _me |
VehicleEntry const * | _vehicleInfo |
uint32 | _usableSeatNum |
uint32 | _creatureEntry |
Status | _status |
Friends | |
bool | Unit::CreateVehicleKit (uint32 id, uint32 creatureEntry) |
void | Unit::RemoveVehicleKit () |
Additional Inherited Members | |
Static Protected Member Functions inherited from TransportBase | |
static void | CalculatePassengerPosition (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
static void | CalculatePassengerOffset (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
|
private |
Enumerator | |
---|---|
STATUS_NONE | |
STATUS_INSTALLED | |
STATUS_UNINSTALLING |
|
protected |
References _usableSeatNum, _vehicleInfo, InitMovementInfoForBase(), VehicleEntry::m_ID, VehicleEntry::m_seatID, MAX_VEHICLE_SEATS, and sVehicleSeatStore.
|
overrideprotected |
@Uninstall must be called before this.
References _me, _status, ASSERT, Object::GetEntry(), Object::GetTypeId(), ObjectAccessor::GetUnit(), LOG_FATAL, and STATUS_UNINSTALLING.
@Prevent adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
References _me, _status, _usableSeatNum, _vehicleInfo, Unit::AddUnitMovementFlag(), Creature::AI(), ASSERT, CalculatePassengerPosition(), CHARM_TYPE_VEHICLE, Movement::MoveSplineInit::DisableTransportPathTransformations(), Position::GetAngle(), GetBase(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetName(), Object::GetTypeId(), ObjectAccessor::GetUnit(), Unit::GetVehicle(), MovementInfo::TransportInfo::guid, Unit::HasUnitFlag(), Unit::IsAIEnabled, Object::IsCreature(), Unit::IsDuringRemoveFromWorld(), Object::IsInWorld(), Object::IsPlayer(), Movement::MoveSplineInit::Launch(), LOG_DEBUG, LOG_INFO, VehicleSeatEntry::m_attachmentOffsetX, VehicleSeatEntry::m_attachmentOffsetY, VehicleSeatEntry::m_attachmentOffsetZ, VehicleEntry::m_ID, VehicleSeatEntry::m_ID, WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, Movement::MoveSplineInit::MoveTo(), CreatureAI::PassengerBoarded(), MovementInfo::TransportInfo::pos, Position::Relocate(), Unit::RemoveAurasDueToSpell(), Unit::RemoveNpcFlag(), MovementInfo::TransportInfo::seat, Unit::SendClearTarget(), Unit::SetCharmedBy(), Unit::SetControlled(), Movement::MoveSplineInit::SetFacing(), Movement::MoveSplineInit::SetTransportEnter(), Unit::SetUnitFlag(), sScriptMgr, STATUS_UNINSTALLING, MovementInfo::TransportInfo::time, Object::ToCreature(), Object::ToPlayer(), ObjectGuid::ToString(), MovementInfo::transport, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_FLAG_PLAYER_VEHICLE, UNIT_NPC_FLAG_SPELLCLICK, UNIT_STATE_ROOT, Player::UnsummonPetTemporaryIfAny(), VEHICLE_SEAT_FLAG_B_KEEP_PET, VEHICLE_SEAT_FLAG_CAN_CONTROL, VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE, and VEHICLE_SPELL_PARACHUTE.
Referenced by Unit::_EnterVehicle(), and Unit::ChangeSeat().
void Vehicle::ApplyAllImmunities | ( | ) |
References _me, Unit::ApplySpellImmune(), BATTLEFIELD_WG_ZONEID, CREATURE_TYPE_MECHANICAL, WorldObject::FindMap(), Creature::GetCreatureTemplate(), Creature::GetSpawnId(), GetVehicleInfo(), WorldObject::GetZoneId(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, Map::Instanceable(), Creature::isWorldBoss(), MECHANIC_IMMUNE_SHIELD, MECHANIC_SHIELD, SPELL_AURA_DAMAGE_SHIELD, SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_RESISTANCE, SPELL_AURA_MOD_STAT, SPELL_AURA_MOD_TAUNT, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SCHOOL_IMMUNITY, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_EFFECT_ATTACK_ME, SPELL_EFFECT_DISPEL, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEAL_MAX_HEALTH, SPELL_EFFECT_HEAL_PCT, Object::ToCreature(), and CreatureTemplate::type.
Referenced by Reset().
|
inlineoverrideprivatevirtual |
This method transforms supplied global coordinates into local offsets.
Implements TransportBase.
References TransportBase::CalculatePassengerOffset(), and GetBase().
|
inlineoverrideprivatevirtual |
This method transforms supplied transport offsets into global coordinates.
Implements TransportBase.
References TransportBase::CalculatePassengerPosition(), and GetBase().
Referenced by AddPassenger(), and RelocatePassengers().
void Vehicle::Dismiss | ( | ) |
References _me, Creature::DespawnOrUnsummon(), GetBase(), Object::GetGUID(), LOG_DEBUG, Object::ToCreature(), ObjectGuid::ToString(), and Uninstall().
Referenced by Unit::_ExitVehicle(), BattlefieldWG::OnPlayerLeaveWar(), and Player::UpdateAreaDependentAuras().
uint8 Vehicle::GetAvailableSeatCount | ( | ) | const |
Referenced by Aura::CanStackWith(), and npc_brunnhildar_prisoner::npc_brunnhildar_prisonerAI::SpellHit().
|
inline |
May be called from scripts.
References _me.
Referenced by Unit::_EnterVehicle(), Unit::_ExitVehicle(), Creature::_IsTargetAcceptable(), Unit::_IsValidAssistTarget(), Unit::_IsValidAttackTarget(), AddPassenger(), Unit::BuildMovementPacket(), CalculatePassengerOffset(), CalculatePassengerPosition(), Dismiss(), GetPassenger(), SmartScript::GetTargets(), ObjectMgr::GetVehicleAccessoryList(), Unit::GetVehicleBase(), WorldSession::HandleEjectPassenger(), spell_auto_repair::HandleScript(), Install(), InstallAccessory(), InstallAllAccessories(), IsVehicleInUse(), ScriptMgr::OnAddPassenger(), ScriptMgr::OnInstall(), ScriptMgr::OnInstallAccessory(), ScriptMgr::OnRemovePassenger(), ScriptMgr::OnReset(), ScriptMgr::OnUninstall(), RelocatePassengers(), Reset(), TeleportVehicle(), and Uninstall().
|
inline |
References _creatureEntry.
Referenced by ObjectMgr::GetVehicleAccessoryList(), Unit::HandleSpellClick(), and InstallAccessory().
Referenced by Unit::ChangeSeat().
References GetBase(), and ObjectAccessor::GetUnit().
Referenced by boss_xt002::boss_xt002AI::AttachHeart(), Aura::CanStackWith(), spell_demolisher_ride_vehicle::CheckCast(), npc_orb_carrier::npc_orb_carrierAI::DoAction(), boss_skadi_grauf::boss_skadi_graufAI::DoAction(), SmartScript::GetTargets(), spell_switch_infragreen_bomber_station::HandleDummy(), spell_fight_fire_bomber::HandleDummy(), spell_q13280_13283_plant_battle_standard::HandleDummy(), spell_auto_repair::HandleScript(), spell_q12919_gymers_throw::HandleScript(), InstallAccessory(), boss_flame_leviathan_overload_device::boss_flame_leviathan_overload_deviceAI::OnSpellClick(), boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::PassengerBoarded(), boss_skadi_grauf::boss_skadi_graufAI::RemoveSkadi(), Spell::SelectImplicitCasterObjectTargets(), npc_vics_flying_machine::npc_vics_flying_machineAI::SpellHit(), npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire(), npc_toc5_player_vehicle::npc_toc5_player_vehicleAI::UpdateAI(), npc_vortex_ride::npc_vortex_rideAI::UpdateAI(), npc_oculus_drake::npc_oculus_drakeAI::UpdateAI(), boss_flame_leviathan::boss_flame_leviathanAI::UpdateAI(), boss_xt002::boss_xt002AI::UpdateAI(), npc_q24545_lich_king::npc_q24545_lich_kingAI::UpdateAI(), and npc_freed_protodrake::npc_freed_protodrakeAI::UpdateAI().
VehicleSeatEntry const * Vehicle::GetSeatForPassenger | ( | Unit const * | passenger | ) |
References Object::GetGUID().
Referenced by Spell::CheckCast(), WorldSession::HandleChangeSeatsOnControlledVehicle(), WorldSession::HandleEjectPassenger(), and Player::ProcessTerrainStatusUpdate().
SeatMap::iterator Vehicle::GetSeatIteratorForPassenger | ( | Unit * | passenger | ) |
References Object::GetGUID().
Referenced by spell_switch_infragreen_bomber_station::HandleDummy(), and RemovePassenger().
|
inline |
References _vehicleInfo.
Referenced by Unit::_ExitVehicle(), ApplyAllImmunities(), instance_eye_of_eternity::instance_eye_of_eternity_InstanceMapScript::CheckAchievementCriteriaMeet(), WorldSession::HandleRequestPartyMemberStatsOpcode(), InitMovementInfoForBase(), and GameObject::IsWithinDistInMap().
bool Vehicle::HasEmptySeat | ( | int8 | seatId | ) | const |
Referenced by Unit::ChangeSeat().
|
private |
References _me, Unit::AddExtraUnitMovementFlag(), GetVehicleInfo(), VehicleEntry::m_flags, MOVEMENTFLAG2_ALWAYS_ALLOW_PITCHING, MOVEMENTFLAG2_FULL_SPEED_PITCHING, MOVEMENTFLAG2_FULL_SPEED_TURNING, MOVEMENTFLAG2_NO_JUMPING, MOVEMENTFLAG2_NO_STRAFE, VEHICLE_FLAG_ALLOW_PITCHING, VEHICLE_FLAG_FULLSPEEDPITCHING, VEHICLE_FLAG_FULLSPEEDTURNING, VEHICLE_FLAG_NO_JUMPING, and VEHICLE_FLAG_NO_STRAFE.
Referenced by Vehicle().
void Vehicle::Install | ( | ) |
References _me, _status, _vehicleInfo, CLASS_CONTEXT_ABILITY, CLASS_ROGUE, GetBase(), Unit::IsClass(), Object::IsCreature(), VehicleEntry::m_powerDisplayId, POWER_ENERGY, Unit::setPowerType(), sPowerDisplayStore, sScriptMgr, and STATUS_INSTALLED.
Referenced by Creature::AddToWorld().
void Vehicle::InstallAccessory | ( | uint32 | entry, |
int8 | seatId, | ||
bool | minion, | ||
uint8 | type, | ||
uint32 | summonTime | ||
) |
@Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
References _me, _status, ASSERT, GetBase(), GetCreatureEntry(), Object::GetGUID(), GetPassenger(), Unit::HandleSpellClick(), Object::IsCreature(), Creature::IsInEvadeMode(), LOG_DEBUG, LOG_ERROR, sScriptMgr, STATUS_UNINSTALLING, WorldObject::SummonCreature(), Object::ToCreature(), ObjectGuid::ToString(), and UNIT_MASK_ACCESSORY.
Referenced by InstallAllAccessories().
void Vehicle::InstallAllAccessories | ( | bool | evading | ) |
References GetBase(), InstallAccessory(), RemoveAllPassengers(), and sObjectMgr.
Referenced by boss_flame_leviathan_seat::boss_flame_leviathan_seatAI::EnterEvadeMode(), Unit::Mount(), Reset(), and npc_hyldsmeet_protodrake::npc_hyldsmeet_protodrakeAI::UpdateAI().
bool Vehicle::IsVehicleInUse | ( | ) |
References GetBase(), and ObjectAccessor::GetUnit().
Referenced by VehicleAI::OnCharmed().
void Vehicle::RelocatePassengers | ( | ) |
References _me, ASSERT, CalculatePassengerPosition(), GetBase(), WorldObject::GetMap(), and ObjectAccessor::GetUnit().
Referenced by Map::CreatureRelocation(), Map::PlayerRelocation(), Unit::UpdateHeight(), and Unit::UpdateOrientation().
void Vehicle::RemoveAllPassengers | ( | ) |
References _me, Object::GetGUID(), LOG_DEBUG, Unit::RemoveAurasByType(), SPELL_AURA_CONTROL_VEHICLE, and ObjectGuid::ToString().
Referenced by InstallAllAccessories(), and Uninstall().
void Vehicle::RemovePassenger | ( | Unit * | passenger | ) |
References _me, _usableSeatNum, _vehicleInfo, Creature::AI(), Unit::CastSpell(), DELAYED_VEHICLE_TELEPORT, Player::GetDelayedOperations(), Object::GetEntry(), Object::GetGUID(), WorldObject::GetInstanceId(), WorldObject::GetName(), GetSeatIteratorForPassenger(), WorldObject::GetTransport(), Unit::GetVehicle(), Unit::IsAIEnabled, Object::IsCreature(), Unit::IsFlying(), Object::IsInWorld(), Object::IsPlayer(), LOG_DEBUG, LOG_ERROR, VehicleEntry::m_ID, WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, CreatureAI::PassengerBoarded(), Unit::RemoveCharmedBy(), Unit::RemoveUnitFlag(), Unit::RemoveUnitMovementFlag(), MovementInfo::TransportInfo::Reset(), Unit::SetNpcFlag(), sScriptMgr, Object::ToCreature(), Object::ToPlayer(), ObjectGuid::ToString(), MovementInfo::transport, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_FLAG_PLAYER_VEHICLE, UNIT_NPC_FLAG_SPELLCLICK, VEHICLE_SEAT_FLAG_CAN_CONTROL, VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE, and VEHICLE_SPELL_PARACHUTE.
Referenced by Unit::_ExitVehicle(), and Unit::ChangeSeat().
void Vehicle::Reset | ( | bool | evading = false | ) |
References _me, _usableSeatNum, ApplyAllImmunities(), GetBase(), Object::GetGUID(), InstallAllAccessories(), Object::IsPlayer(), LOG_DEBUG, Unit::SetNpcFlag(), sScriptMgr, ObjectGuid::ToString(), UNIT_NPC_FLAG_PLAYER_VEHICLE, and UNIT_NPC_FLAG_SPELLCLICK.
Referenced by Creature::AIM_Initialize(), CreatureAI::EnterEvadeMode(), Unit::Mount(), and Creature::Update().
void Vehicle::TeleportVehicle | ( | float | x, |
float | y, | ||
float | z, | ||
float | ang | ||
) |
References _me, DELAYED_VEHICLE_TELEPORT, GetBase(), WorldObject::GetMap(), ObjectAccessor::GetUnit(), Map::LoadGrid(), and Unit::NearTeleportTo().
Referenced by Spell::EffectTeleportUnits().
void Vehicle::Uninstall | ( | ) |
@Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
References _me, _status, GetBase(), Object::GetGUID(), Object::IsCreature(), LOG_DEBUG, LOG_ERROR, RemoveAllPassengers(), sScriptMgr, STATUS_UNINSTALLING, ObjectGuid::ToString(), and UNIT_MASK_MINION.
Referenced by Unit::_ExitVehicle(), Dismiss(), and Unit::RemoveVehicleKit().
|
friend |
|
friend |
|
private |
Referenced by GetCreatureEntry().
|
private |
|
private |
Referenced by AddPassenger(), Install(), InstallAccessory(), Uninstall(), and ~Vehicle().
|
private |
Referenced by AddPassenger(), RemovePassenger(), Reset(), and Vehicle().
|
private |
Referenced by AddPassenger(), GetVehicleInfo(), Install(), RemovePassenger(), and Vehicle().