Exemplo n.º 1
0
 private static void HandleDiscoverTaxi(GameSession session)
 {
     List<int> unlockedTaxis = session.Player.UnlockedTaxis;
     int mapId = session.Player.MapId;
     if (!unlockedTaxis.Contains(mapId))
     {
         unlockedTaxis.Add(mapId);
     }
     session.Send(TaxiPacket.DiscoverTaxi(mapId));
 }
        public override void Handle(GameSession session, PacketReader packet)
        {
            RequestTaxiMode mode = (RequestTaxiMode)packet.ReadByte();

            int  mapId     = 0;
            long mesoPrice = 60000;

            if (mode != RequestTaxiMode.DiscoverTaxi)
            {
                mapId = packet.ReadInt();
            }

            switch (mode)
            {
            case RequestTaxiMode.Car:
                mesoPrice = 5000;     //For now make all car taxis cost 5k, as we don't know the formula to calculate it yet.
                goto case RequestTaxiMode.RotorsMeso;

            case RequestTaxiMode.RotorsMeso:
                if (session.Player.Wallet.Meso.Modify(-mesoPrice))
                {
                    HandleTeleport(session, mapId);
                }
                else
                {
                    // TODO: Reject packets
                }
                break;

            case RequestTaxiMode.RotorsMeret:
                if (session.Player.Wallet.Meret.Modify(-15))
                {
                    HandleTeleport(session, mapId);
                }
                else
                {
                    // TODO: Reject packets
                }
                break;

            case RequestTaxiMode.DiscoverTaxi:
                //TODO: Save somewhere and load somewhere? Perhaps on login.
                session.Send(TaxiPacket.DiscoverTaxi(session.Player.MapId));
                break;

            default:
                IPacketHandler <GameSession> .LogUnknownMode(mode);

                break;
            }
        }