protected override void OnPassengerRemove(Player player, VehicleSeatType seatType, byte seatPosition) { if (seatType != VehicleSeatType.Pilot) { return; } for (ItemSlot i = ItemSlot.MountFront; i <= ItemSlot.MountRight; i++) { var itemVisual = new ItemVisual { Slot = i }; // hoverboards have their flair visuals added to the player if (MountType == PetType.HoverBoard) { player.SetAppearance(itemVisual); } else { SetAppearance(itemVisual); } } if (PilotDisplayInfo != null) { player.SetAppearance(new ItemVisual { Slot = ItemSlot.Mount }); } UpdateVisuals(player); }
public bool TryGetFreeSeat(VehicleSeatType type, out VehicleSeat result) { var freeSeat = GetFreeSeat(type); if (freeSeat == null) { result = null; return(false); } result = freeSeat; return(true); }
protected override void OnPassengerAdd(Player player, VehicleSeatType seatType, byte seatPosition) { if (seatType != VehicleSeatType.Pilot) { return; } if (PilotDisplayInfo != null) { player.SetAppearance(new ItemVisual { Slot = ItemSlot.Mount, DisplayId = (ushort)PilotDisplayInfo.Id }); } PetCustomisation customisation = player.PetCustomisationManager.GetCustomisation(MountType, SpellEntry.Id); if (customisation != null) { ItemSlot slot = ItemSlot.MountFront; foreach (PetFlairEntry entry in customisation) { if (entry != null) { var itemVisual = new ItemVisual { Slot = slot, DisplayId = (ushort)(slot != ItemSlot.MountRight ? entry.ItemDisplayId[0] : entry.ItemDisplayId[1]) }; // hoverboards have their flair visuals added to the player if (MountType == PetType.HoverBoard) { player.SetAppearance(itemVisual); } else { SetAppearance(itemVisual); } } slot++; } } UpdateVisuals(player); }
/// <summary> /// Enqueue <see cref="Player"/> to be added as a passenger with supplied <see cref="VehicleSeatType"/> and seat position. /// </summary> public void EnqueuePassengerAdd(Player player, VehicleSeatType seatType, byte seatPosition) { if (seatType >= VehicleSeatType.Invalid) { throw new ArgumentOutOfRangeException(); } byte passengerCount = (byte)passengers.Count(p => p.SeatType == seatType); switch (seatType) { case VehicleSeatType.Pilot: if (passengerCount >= VehicleEntry.NumberPilots) { throw new ArgumentException(); } break; case VehicleSeatType.Passenger: if (passengerCount >= VehicleEntry.NumberPassengers) { throw new ArgumentException(); } break; case VehicleSeatType.Gunner: if (passengerCount >= VehicleEntry.NumberGunners) { throw new ArgumentException(); } break; } if (GetPassenger(seatType, seatPosition) != null) { throw new InvalidOperationException(); } if (pendingAdd.Any(p => p.Guid == player.Guid)) { throw new InvalidOperationException(); } pendingAdd.Enqueue(new VehiclePassenger(seatType, seatPosition, player.Guid)); }
public VehicleSeat(byte id, VehicleSeatType type) : base(id) { Type = type; }
public VehicleSeatBuilder WithType(VehicleSeatType type) { Type = type; return(this); }
public IEnumerable <VehicleSeat> GetOccupiedSeats(VehicleSeatType type) => GetOccupiedSeats( ) .Where(x => x.Type == type);
public VehicleSeat GetFreeSeat(VehicleSeatType type) => GetFreeSeats( ).FirstOrDefault(x => x.Type == type);
/// <summary> /// Return <see cref="VehiclePassenger"/> with supplied <see cref="VehicleSeatType"/> and seat position. /// </summary> public VehiclePassenger GetPassenger(VehicleSeatType seatType, byte seatPosition) { return(passengers.SingleOrDefault(p => p.SeatType == seatType && p.SeatPosition == seatPosition)); }
/// <summary> /// Invoked when <see cref="Player"/> is removed as a passenger from <see cref="VehicleSeatType"/> and seat position. /// </summary> protected virtual void OnPassengerRemove(Player player, VehicleSeatType seatType, byte seatPosition) { // deliberately empty }
public VehiclePassenger(VehicleSeatType seatType, byte seatPosition, uint guid) { SeatType = seatType; SeatPosition = seatPosition; Guid = guid; }