|
Project SkyFire Core
SkyFire 5.4.8 server core API documentation
|
#include <Vehicle.h>
Public Member Functions | |
| bool | AddPassenger (Unit *passenger, int8 seatId=-1) |
| Attempts to add a passenger to the vehicle on 'seatId'. | |
| void | ApplyAllImmunities () |
| Applies specific immunities that cannot be set in DB. | |
| uint8 | GetAvailableSeatCount () const |
| Gets the available seat count. | |
| Unit * | GetBase () const |
| May be called from scripts. | |
| uint32 | GetCreatureEntry () const |
| Position const & | GetLastShootPos () const |
| SeatMap::const_iterator | GetNextEmptySeat (int8 seatId, bool next) const |
| Gets the next empty seat based on current seat. | |
| Unit * | GetPassenger (int8 seatId) const |
| Gets a passenger on specified seat. | |
| VehicleSeatEntry const * | GetSeatForPassenger (Unit const *passenger) const |
| Returns information on the seat of specified passenger, represented by the format in VehicleSeat.dbc. | |
| VehicleEntry const * | GetVehicleInfo () const |
| bool | HasEmptySeat (int8 seatId) const |
| Checks if vehicle's seat specified by 'seatId' is empty. | |
| void | Install () |
| Initializes power type for vehicle. Nothing more. | |
| void | InstallAccessory (uint32 entry, int8 seatId, bool minion, TempSummonType type, uint32 summonTime) |
| Installs an accessory. | |
| void | InstallAllAccessories (bool evading) |
| bool | IsVehicleInUse () const |
| Returns information whether the vehicle is currently used by any unit. | |
| void | RelocatePassengers () |
| Relocate passengers. Must be called after m_base::Relocate. | |
| void | RemoveAllPassengers () |
| Removes all current and pending passengers from the vehicle. | |
| Vehicle * | RemovePassenger (Unit *passenger) |
| Removes the passenger from the vehicle. | |
| void | RemovePendingEventsForPassenger (Unit *passenger) |
| void | Reset (bool evading=false) |
| Reapplies immunities and reinstalls accessories. Only has effect for creatures. | |
| void | SetLastShootPos (Position const &pos) |
| void | Uninstall () |
| Removes all passengers and sets status to STATUS_UNINSTALLING. No new passengers can be added to the vehicle after this call. | |
Public Attributes | |
| SeatMap | Seats |
| The collection of all seats on the vehicle. Including vacant ones. | |
Protected Member Functions | |
| Vehicle (Unit *unit, VehicleEntry const *vehInfo, uint32 creatureEntry) | |
| ~Vehicle () | |
| Protected Member Functions inherited from TransportBase | |
| TransportBase () | |
| virtual | ~TransportBase () |
Protected Attributes | |
| uint32 | UsableSeatNum |
| Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags. | |
Private Types | |
| typedef std::list< VehicleJoinEvent * > | PendingJoinEventContainer |
| enum | Status { STATUS_NONE , STATUS_INSTALLED , STATUS_UNINSTALLING } |
Private Member Functions | |
| void | CalculatePassengerOffset (float &x, float &y, float &z, float *o) const |
| This method transforms supplied global coordinates into local offsets. | |
| void | CalculatePassengerPosition (float &x, float &y, float &z, float *o) const |
| This method transforms supplied transport offsets into global coordinates. | |
| SeatMap::iterator | GetSeatIteratorForPassenger (Unit *passenger) |
| Gets seat iterator for specified passenger. | |
| void | InitMovementInfoForBase () |
| Sets correct MovementFlags2 based on VehicleFlags from DBC. | |
| void | RemovePendingEvent (VehicleJoinEvent *e) |
| Removes @VehicleJoinEvent objects from pending join event store. This method only removes it after it's executed or aborted to prevent leaving pointers to deleted events. | |
| void | RemovePendingEventsForSeat (int8 seatId) |
| Removes any pending events for given seatId. Executed when a @VehicleJoinEvent::Execute is called. | |
Private Attributes | |
| uint32 | _creatureEntry |
| Can be different than the entry of _me in case of players. | |
| Position | _lastShootPos |
| Unit * | _me |
| The underlying unit with the vehicle kit. Can be player or creature. | |
| PendingJoinEventContainer | _pendingJoinEvents |
| Collection of delayed join events for prospective passengers. | |
| Status | _status |
| Internal variable for sanity checks. | |
| VehicleEntry const * | _vehicleInfo |
| DBC data for vehicle. | |
| GuidSet | vehiclePlayers |
Friends | |
| bool | Unit::CreateVehicleKit (uint32 id, uint32 creatureEntry, bool) |
| void | Unit::RemoveVehicleKit (bool) |
| class | VehicleJoinEvent |
Additional Inherited Members | |
| Static Protected Member Functions inherited from TransportBase | |
| static void | CalculatePassengerOffset (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
| static void | CalculatePassengerPosition (float &x, float &y, float &z, float *o, float transX, float transY, float transZ, float transO) |
|
private |
|
private |
|
protected |
Definition at line 24 of file Vehicle.cpp.
References _creatureEntry, _me, _status, _vehicleInfo, InitMovementInfoForBase(), MAX_VEHICLE_SEATS, Seats, STATUS_NONE, sVehicleSeatStore, TYPEID_PLAYER, UNIT_FIELD_NPC_FLAGS, UNIT_NPC_FLAG_PLAYER_VEHICLE, UNIT_NPC_FLAG_SPELLCLICK, and UsableSeatNum.
Referenced by RemoveAllPassengers(), and RemovePassenger().
|
protected |
@Uninstall must be called before this.
Definition at line 47 of file Vehicle.cpp.
References _status, ASSERT, Seats, and STATUS_UNINSTALLING.
Attempts to add a passenger to the vehicle on 'seatId'.
| [in,out] | The | prospective passenger. |
| seatId | Identifier for the seat. Value of -1 indicates the next available seat. |
@Prevent adding passengers when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
Definition at line 415 of file Vehicle.cpp.
References _me, _pendingJoinEvents, _status, _vehicleInfo, EventProcessor::AddEvent(), ASSERT, EventProcessor::CalculateTime(), Unit::ExitVehicle(), GetBase(), Object::GetEntry(), Object::GetGUIDLow(), WorldObject::GetName(), ObjectAccessor::GetUnit(), Unit::m_Events, VehicleJoinEvent::Seat, Seats, SF_LOG_DEBUG, SF_LOG_ERROR, STATUS_UNINSTALLING, BasicEvent::to_Abort, TYPEID_UNIT, and VehicleJoinEvent.
Referenced by Unit::_EnterVehicle(), and LuaVehicle::AddPassenger().
| void Vehicle::ApplyAllImmunities | ( | ) |
Applies specific immunities that cannot be set in DB.
Definition at line 184 of file Vehicle.cpp.
References _me, CREATURE_TYPE_MECHANICAL, GetVehicleInfo(), IMMUNITY_EFFECT, IMMUNITY_MECHANIC, IMMUNITY_STATE, 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_UNATTACKABLE, SPELL_AURA_PERIODIC_HEAL, SPELL_AURA_SCHOOL_ABSORB, SPELL_AURA_SCHOOL_IMMUNITY, SPELL_AURA_SPLIT_DAMAGE_PCT, SPELL_EFFECT_DISPEL, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEAL_PCT, SPELL_EFFECT_KNOCK_BACK, SPELL_EFFECT_KNOCK_BACK_DEST, and UNIT_STATE_ROOT.
Referenced by LuaVehicle::ApplyAllImmunities(), and Reset().
|
inlineprivatevirtual |
This method transforms supplied global coordinates into local offsets.
Implements TransportBase.
Definition at line 86 of file Vehicle.h.
References TransportBase::CalculatePassengerOffset(), and GetBase().
|
inlineprivatevirtual |
This method transforms supplied transport offsets into global coordinates.
Implements TransportBase.
Definition at line 78 of file Vehicle.h.
References TransportBase::CalculatePassengerPosition(), and GetBase().
Referenced by RelocatePassengers().
| uint8 Vehicle::GetAvailableSeatCount | ( | ) | const |
Gets the available seat count.
Definition at line 657 of file Vehicle.cpp.
References Seats.
Referenced by Aura::CanStackWith(), and LuaVehicle::GetAvailableSeatCount().
|
inline |
May be called from scripts.
Definition at line 38 of file Vehicle.h.
References _me.
Referenced by Unit::_EnterVehicle(), Unit::_ExitVehicle(), AddPassenger(), CalculatePassengerOffset(), CalculatePassengerPosition(), LuaVehicle::GetBase(), GetPassenger(), SmartScript::GetTargets(), ObjectMgr::GetVehicleAccessoryList(), WorldSession::HandleEjectPassenger(), spell_auto_repair::spell_auto_repair_SpellScript::HandleScript(), Install(), InstallAllAccessories(), ScriptMgr::OnAddPassenger(), ScriptMgr::OnInstall(), ScriptMgr::OnInstallAccessory(), ScriptMgr::OnRemovePassenger(), ScriptMgr::OnReset(), ScriptMgr::OnUninstall(), RelocatePassengers(), RemovePassenger(), Reset(), and Uninstall().
|
inline |
Definition at line 40 of file Vehicle.h.
References _creatureEntry.
Referenced by Player::CanSeeSpellClickOn(), LuaVehicle::GetCreatureEntry(), ObjectMgr::GetVehicleAccessoryList(), Unit::HandleSpellClick(), InstallAccessory(), Reset(), and Player::UpdateForQuestWorldObjects().
|
inline |
Definition at line 54 of file Vehicle.h.
References _lastShootPos.
| SeatMap::const_iterator Vehicle::GetNextEmptySeat | ( | int8 | seatId, |
| bool | next ) const |
Gets the next empty seat based on current seat.
| seatId | Identifier for the current seat. |
| next | true if iterating forward, false means iterating backwards. |
Definition at line 329 of file Vehicle.cpp.
References Seats.
Gets a passenger on specified seat.
| seatId | Seat to look on. |
Definition at line 306 of file Vehicle.cpp.
References GetBase(), ObjectAccessor::GetUnit(), and Seats.
Referenced by npc_orb_carrier::npc_orb_carrierAI::DoAction(), LuaVehicle::GetPassenger(), spell_q13280_13283_plant_battle_standard::spell_q13280_13283_plant_battle_standard_SpellScript::HandleDummy(), WorldSession::HandlePetCastSpellOpcode(), spell_auto_repair::spell_auto_repair_SpellScript::HandleScript(), spell_q12919_gymers_throw::spell_q12919_gymers_throw_SpellScript::HandleScript(), generic_vehicleAI_toc5::generic_vehicleAI_toc5AI::UpdateAI(), and npc_snobold_vassal::npc_snobold_vassalAI::UpdateAI().
| VehicleSeatEntry const * Vehicle::GetSeatForPassenger | ( | Unit const * | passenger | ) | const |
Returns information on the seat of specified passenger, represented by the format in VehicleSeat.dbc.
| [in,out] | The | passenger for which we check the seat info. |
Definition at line 614 of file Vehicle.cpp.
References Object::GetGUID(), and Seats.
Referenced by SpellInfo::CheckVehicle(), WorldSession::HandleChangeSeatsOnControlledVehicle(), and WorldSession::HandleEjectPassenger().
|
private |
Gets seat iterator for specified passenger.
| [in,out] | passenger | Passenger to look up. |
Definition at line 636 of file Vehicle.cpp.
References Object::GetGUID(), and Seats.
Referenced by RemovePassenger().
|
inline |
Definition at line 39 of file Vehicle.h.
References _vehicleInfo.
Referenced by ApplyAllImmunities(), Object::BuildMovementUpdate(), and InitMovementInfoForBase().
| bool Vehicle::HasEmptySeat | ( | int8 | seatId | ) | const |
Checks if vehicle's seat specified by 'seatId' is empty.
| seatId | Identifier for the seat. |
Definition at line 285 of file Vehicle.cpp.
References Seats.
Referenced by LuaVehicle::HasEmptySeat(), and npc_ros_dark_rider::npc_ros_dark_riderAI::Reset().
|
private |
Sets correct MovementFlags2 based on VehicleFlags from DBC.
Definition at line 585 of file Vehicle.cpp.
References _me, 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 | ( | ) |
Initializes power type for vehicle. Nothing more.
Definition at line 64 of file Vehicle.cpp.
References _me, _status, _vehicleInfo, GetBase(), POWER_BLOOD, POWER_ENERGY, POWER_HEAT, POWER_OOZE, POWER_PYRITE, POWER_STEAM, POWER_WRATH, sScriptMgr, STATUS_INSTALLED, and TYPEID_UNIT.
Referenced by Creature::AddToWorld().
| void Vehicle::InstallAccessory | ( | uint32 | entry, |
| int8 | seatId, | ||
| bool | minion, | ||
| TempSummonType | type, | ||
| uint32 | summonTime ) |
Installs an accessory.
| entry | The NPC entry of accessory. |
| seatId | Identifier for the seat to add the accessory to. |
| minion | true if accessory considered a 'minion'. Implies that the accessory will despawn when the vehicle despawns. Essentially that it has no life without the vehicle. Their fates are bound. |
| type | See enum @SummonType. |
| summonTime | Time after which the minion is despawned in case of a timed despawn @type specified. |
@Prevent adding accessories when vehicle is uninstalling. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
If for some reason adding accessory to vehicle fails it will unsummon in @VehicleJoinEvent::Abort
Definition at line 374 of file Vehicle.cpp.
References _me, _status, Unit::AddUnitTypeMask(), ASSERT, GetCreatureEntry(), SF_LOG_DEBUG, SF_LOG_ERROR, STATUS_UNINSTALLING, TYPEID_UNIT, and UNIT_MASK_ACCESSORY.
Referenced by LuaVehicle::InstallAccessory(), and InstallAllAccessories().
| void Vehicle::InstallAllAccessories | ( | bool | evading | ) |
Definition at line 109 of file Vehicle.cpp.
References GetBase(), InstallAccessory(), RemoveAllPassengers(), sObjectMgr, and TYPEID_PLAYER.
Referenced by Unit::Mount(), and Reset().
| bool Vehicle::IsVehicleInUse | ( | ) | const |
Returns information whether the vehicle is currently used by any unit.
Definition at line 567 of file Vehicle.cpp.
References Seats.
Referenced by LuaVehicle::IsVehicleInUse().
| void Vehicle::RelocatePassengers | ( | ) |
Relocate passengers. Must be called after m_base::Relocate.
Definition at line 536 of file Vehicle.cpp.
References _me, ASSERT, CalculatePassengerPosition(), GetBase(), ObjectAccessor::GetUnit(), and Seats.
Referenced by Map::CreatureRelocation(), Map::MoveAllCreaturesInMoveList(), Map::PlayerRelocation(), LuaVehicle::RelocatePassengers(), Creature::SetPosition(), Unit::UpdateHeight(), and Unit::UpdateOrientation().
| void Vehicle::RemoveAllPassengers | ( | ) |
Removes all current and pending passengers from the vehicle.
Setting to_Abort to true will cause @VehicleJoinEvent::Abort to be executed on next @Unit::UpdateEvents call This will properly "reset" the pending join process for the passenger.
Update vehicle pointer in every pending join event - Abort may be called after vehicle is deleted
Definition at line 241 of file Vehicle.cpp.
References _creatureEntry, _me, _pendingJoinEvents, _status, SF_LOG_DEBUG, SPELL_AURA_CONTROL_VEHICLE, STATUS_UNINSTALLING, VehicleJoinEvent::Target, BasicEvent::to_Abort, Vehicle(), and VehicleJoinEvent.
Referenced by spell_the_lich_king_eject_all_passengers::spell_the_lich_king_eject_all_passengers_SpellScript::HandleDummy(), InstallAllAccessories(), LuaVehicle::RemoveAllPassengers(), and Uninstall().
Removes the passenger from the vehicle.
| [in,out] | unit | The passenger to remove. |
Definition at line 487 of file Vehicle.cpp.
References _me, _vehicleInfo, ASSERT, GetBase(), WorldObject::GetName(), GetSeatIteratorForPassenger(), Object::GetTypeId(), Unit::GetVehicle(), Unit::IsFlying(), WorldObject::m_movementInfo, Object::RemoveFlag(), MovementInfo::ResetTransport(), Seats, Unit::SetVehicle(), SF_LOG_DEBUG, sScriptMgr, TYPEID_PLAYER, TYPEID_UNIT, UNIT_FIELD_FLAGS, UNIT_FIELD_NPC_FLAGS, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_FLAG_PLAYER_VEHICLE, UNIT_NPC_FLAG_SPELLCLICK, UsableSeatNum, Vehicle(), VEHICLE_SEAT_FLAG_CAN_CONTROL, VEHICLE_SEAT_FLAG_PASSENGER_NOT_SELECTABLE, and VEHICLE_SPELL_PARACHUTE.
Referenced by AuraEffect::HandleAuraControlVehicle(), and LuaVehicle::RemovePassenger().
|
private |
Removes @VehicleJoinEvent objects from pending join event store. This method only removes it after it's executed or aborted to prevent leaving pointers to deleted events.
| [in] | e | The VehicleJoinEvent* to remove from pending event store. |
Definition at line 681 of file Vehicle.cpp.
References _pendingJoinEvents, and VehicleJoinEvent.
| void Vehicle::RemovePendingEventsForPassenger | ( | Unit * | passenger | ) |
Definition at line 729 of file Vehicle.cpp.
References _pendingJoinEvents.
Referenced by AuraEffect::HandleAuraControlVehicle(), and spell_ulduar_stone_grip::spell_ulduar_stone_grip_AuraScript::OnRemoveVehicle().
|
private |
Removes any pending events for given seatId. Executed when a @VehicleJoinEvent::Execute is called.
Removes any pending events for given passenger. Executed when vehicle control aura is removed while adding passenger is in progress.
| seatId | Identifier for the seat. |
| passenger | Unit that is supposed to enter the vehicle. |
Definition at line 704 of file Vehicle.cpp.
References _pendingJoinEvents.
| void Vehicle::Reset | ( | bool | evading = false | ) |
Reapplies immunities and reinstalls accessories. Only has effect for creatures.
| evading | true if called from CreatureAI::EnterEvadeMode |
Definition at line 162 of file Vehicle.cpp.
References _me, ApplyAllImmunities(), GetBase(), GetCreatureEntry(), InstallAllAccessories(), SF_LOG_DEBUG, sScriptMgr, and TYPEID_UNIT.
Referenced by Creature::AIM_Initialize(), and LuaVehicle::Reset().
|
inline |
Definition at line 53 of file Vehicle.h.
References _lastShootPos.
| void Vehicle::Uninstall | ( | ) |
Removes all passengers and sets status to STATUS_UNINSTALLING. No new passengers can be added to the vehicle after this call.
@Prevent recursive uninstall call. (Bad script in OnUninstall/OnRemovePassenger/PassengerBoarded hook.)
Definition at line 133 of file Vehicle.cpp.
References _creatureEntry, _me, _status, GetBase(), RemoveAllPassengers(), SF_LOG_DEBUG, SF_LOG_ERROR, sScriptMgr, STATUS_UNINSTALLING, TYPEID_UNIT, and UNIT_MASK_MINION.
|
friend |
|
friend |
|
friend |
Definition at line 63 of file Vehicle.h.
References VehicleJoinEvent.
Referenced by AddPassenger(), RemoveAllPassengers(), RemovePendingEvent(), and VehicleJoinEvent.
|
private |
Can be different than the entry of _me in case of players.
Definition at line 101 of file Vehicle.h.
Referenced by GetCreatureEntry(), RemoveAllPassengers(), Uninstall(), and Vehicle().
|
private |
Definition at line 103 of file Vehicle.h.
Referenced by GetLastShootPos(), and SetLastShootPos().
|
private |
The underlying unit with the vehicle kit. Can be player or creature.
Definition at line 97 of file Vehicle.h.
Referenced by AddPassenger(), ApplyAllImmunities(), GetBase(), InitMovementInfoForBase(), Install(), InstallAccessory(), RelocatePassengers(), RemoveAllPassengers(), RemovePassenger(), Reset(), Uninstall(), and Vehicle().
|
private |
Collection of delayed join events for prospective passengers.
Definition at line 106 of file Vehicle.h.
Referenced by AddPassenger(), RemoveAllPassengers(), RemovePendingEvent(), RemovePendingEventsForPassenger(), and RemovePendingEventsForSeat().
|
private |
Internal variable for sanity checks.
Definition at line 102 of file Vehicle.h.
Referenced by AddPassenger(), Install(), InstallAccessory(), RemoveAllPassengers(), Uninstall(), Vehicle(), and ~Vehicle().
|
private |
DBC data for vehicle.
Definition at line 98 of file Vehicle.h.
Referenced by AddPassenger(), GetVehicleInfo(), Install(), RemovePassenger(), and Vehicle().
| SeatMap Vehicle::Seats |
The collection of all seats on the vehicle. Including vacant ones.
Definition at line 56 of file Vehicle.h.
Referenced by AddPassenger(), GetAvailableSeatCount(), GetNextEmptySeat(), GetPassenger(), GetSeatForPassenger(), GetSeatIteratorForPassenger(), spell_pursue::spell_pursue_SpellScript::HandleScript(), HasEmptySeat(), IsVehicleInUse(), FlameLeviathanPursuedTargetSelector::operator()(), RelocatePassengers(), RemovePassenger(), Vehicle(), and ~Vehicle().
|
protected |
Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags.
Definition at line 64 of file Vehicle.h.
Referenced by RemovePassenger(), and Vehicle().