Exemplo n.º 1
0
        public static void Handle(Entities.GameClient client, GeneralDataPacket General)
        {
            client.AttackPacket = null;

            if (client.Booth != null)
            {
                client.Booth.CancelBooth();
            }
            if (client.DynamicMap != null)
            {
                if (!client.LeaveDynamicMap())
                {
                    client.NetworkClient.Disconnect("FAILED_TO_PORTAL_DYNAMIC_MAP");
                }
                return;
            }
            if (client.Map.InheritanceMap == client.Map.MapID)
            {
                Core.PortalPoint StartLocation = new Core.PortalPoint(client.Map.MapID, General.Data1Low, General.Data1High);
                if (Core.Screen.ValidDistance(client.X, client.Y, StartLocation.X, StartLocation.Y))
                {
                    if (Core.Kernel.Portals.ContainsKey(StartLocation))
                    {
                        Core.PortalPoint Destination;
                        if (Core.Kernel.Portals.TryGetValue(StartLocation, out Destination))
                        {
                            client.Teleport(Destination.MapID, Destination.X, Destination.Y);
                            return;
                        }
                    }
                }
            }
            client.Teleport(client.Map.MapID, client.LastX, client.LastY);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Handling the GetSynAttr action from GeneralDataPacket.
        /// </summary>
        /// <param name="client">The client.</param>
        /// <param name="General">The GeneralDataPacket.</param>
        public static void Handle(Entities.GameClient client, GeneralDataPacket General)
        {
            client.LoadGuildInfo();

            Core.LoginHandler.Handle(client);

            client.Teleport(client.Map.MapID, client.X, client.Y);             // poor fix, but updates lastmap to proper ...
        }
Exemplo n.º 3
0
        public static void BeginTravel(Entities.GameClient client, ushort mapid, ushort x, ushort y, int secs = 40)
        {
            uint dynamicid;

            Core.Kernel.Maps.selectorCollection1[999].CreateDynamic(out dynamicid);
            client.TeleportDynamic(dynamicid, 70, 60);

            int travelTime = (secs * 1000);

            /*for (int i = 0; i < (travelTime / 1000); i++)
             * {
             *      ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
             *                                                             {
             *                                                              using (var msg = Packets.Message.MessageCore.CreateCenter(
             *                                                                      string.Format("Hitting destination in {0}", ((travelTime / 1000) - i))))
             *                                                                     {
             *                                                                      client.Send(msg);
             *                                                                     }
             *                                                              }, 1000 * i);
             * }*/

            int j = 0;

            for (int i = secs; i > 0; i--)
            {
                int    waitTime = (j * 1000);
                string message  = string.Format(Core.MessageConst.TRAVEL_TIME, i);
                ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
                {
                    using (var msg = Packets.Message.MessageCore.CreateCenter(
                               message))
                    {
                        client.Send(msg);
                    }
                }, waitTime);
                j++;
            }

            ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
            {
                using (var msg = Packets.Message.MessageCore.CreateCenter(
                           Core.MessageConst.TRAVEL_REACH))
                {
                    client.Send(msg);
                }
            }, travelTime);

            ProjectX_V3_Lib.Threading.DelayedTask.StartDelayedTask(() =>
            {
                client.Teleport(mapid, x, y);
                using (var str = new Packets.StringPacket(new Packets.StringPacker("autorun_end")))
                {
                    str.Action = Enums.StringAction.RoleEffect;
                    str.Data   = client.EntityUID;
                    client.Send(str);
                }
            }, travelTime);
        }
Exemplo n.º 4
0
        /// <summary>
        /// N****s be running from police.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="FullCommand"></param>
        /// <param name="Command"></param>
        public static void Handle_MM(Entities.GameClient client, string FullCommand, string[] Command)
        {
            ushort map;

            if (!ushort.TryParse(Command[1], out map))
            {
                return;
            }
            ushort x;

            if (!ushort.TryParse(Command[2], out x))
            {
                return;
            }
            ushort y;

            if (!ushort.TryParse(Command[3], out y))
            {
                return;
            }
            client.Teleport(map, x, y);
        }
Exemplo n.º 5
0
 public void Leave(Entities.GameClient client)
 {
     TeamMembers.Remove(client);
     client.Equipments.ClearMask();
     client.Teleport(client.LastMapID, client.LastMapX, client.LastMapY);
 }