Ejemplo n.º 1
0
        public static void F_FLIGHT(BaseClient client, PacketIn packet)
        {
            GameClient cclient = (GameClient)client;

            ushort targetOid = packet.GetUint16();
            ushort state     = packet.GetUint16();

            if (state == 20) // Flight Master
            {
                Creature flightMaster = cclient.Plr.Region.GetObject(targetOid) as Creature;

                if (flightMaster == null || flightMaster.InteractType != InteractType.INTERACTTYPE_FLIGHT_MASTER || cclient.Plr.Get2DDistanceToObject(flightMaster, true) > FLIGHT_DISTANCE_TOLERANCE)
                {
                    cclient.Plr.SendLocalizeString(ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_FLIGHT_MASTER_RANGE_ERR);
                    return;
                }

                ushort destId = packet.GetUint16();

                List <Zone_Taxi> destinations = WorldMgr.GetTaxis(cclient.Plr);

                if (destinations.Count <= destId - 1)
                {
                    return;
                }

                Zone_Taxi destination = destinations[destId - 1];

                if (!cclient.Plr.RemoveMoney(destination.Info.Price))
                {
                    cclient.Plr.SendLocalizeString(ChatLogFilters.CHATLOGFILTERS_USER_ERROR, Localized_text.TEXT_FLIGHT_LACK_FUNDS);
                    return;
                }

                Pet pet = cclient.Plr.CrrInterface.GetTargetOfInterest() as Pet;
                if (pet != null)
                {
                    pet.Destroy();
                }
                cclient.Plr.AbtInterface.ResetCooldowns();
                cclient.Plr.Teleport(destination.ZoneID, destination.WorldX, destination.WorldY, destination.WorldZ, destination.WorldO);
            }
        }