Example #1
0
        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);
        }
Example #2
0
        public bool TryGetFreeSeat(VehicleSeatType type, out VehicleSeat result)
        {
            var freeSeat = GetFreeSeat(type);

            if (freeSeat == null)
            {
                result = null;
                return(false);
            }

            result = freeSeat;
            return(true);
        }
Example #3
0
        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);
        }
Example #4
0
        /// <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));
        }
Example #5
0
 public VehicleSeat(byte id, VehicleSeatType type) : base(id)
 {
     Type = type;
 }
Example #6
0
 public VehicleSeatBuilder WithType(VehicleSeatType type)
 {
     Type = type;
     return(this);
 }
Example #7
0
 public IEnumerable <VehicleSeat> GetOccupiedSeats(VehicleSeatType type) =>
 GetOccupiedSeats( )
 .Where(x => x.Type == type);
Example #8
0
 public VehicleSeat GetFreeSeat(VehicleSeatType type) =>
 GetFreeSeats( ).FirstOrDefault(x => x.Type == type);
Example #9
0
 /// <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));
 }
Example #10
0
 /// <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
 }
Example #11
0
 public VehiclePassenger(VehicleSeatType seatType, byte seatPosition, uint guid)
 {
     SeatType     = seatType;
     SeatPosition = seatPosition;
     Guid         = guid;
 }