예제 #1
0
        /// <summary>
        /// </summary>
        /// <param name="character">
        /// </param>
        /// <param name="target">
        /// </param>
        /// <param name="args">
        /// </param>
        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            var check = new List <Type> {
                typeof(float), typeof(float), typeof(int)
            };

            var coord = new Coordinate();
            int pf    = character.Playfield.Identity.Instance;

            if (CheckArgumentHelper(check, args))
            {
                coord = new Coordinate(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    character.Coordinates.y,
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[3]);
            }

            check.Clear();
            check.Add(typeof(float));
            check.Add(typeof(float));
            check.Add(typeof(string));
            check.Add(typeof(float));
            check.Add(typeof(int));

            if (CheckArgumentHelper(check, args))
            {
                coord = new Coordinate(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[4], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[5]);
            }

            if (!Playfields.ValidPlayfield(pf))
            {
                character.Playfield.Publish(
                    new IMSendAOtomationMessageBodyToClient()
                {
                    Body =
                        new FeedbackMessage()
                    {
                        CategoryId = 110,
                        MessageId  = 188845972
                    },
                    client = character.Client
                });
                return;
            }

            character.Playfield.Teleport(
                (Character)character,
                coord,
                character.Heading,
                new Identity()
            {
                Type = IdentityType.Playfield, Instance = pf
            });
        }
        /// <summary>
        /// </summary>
        /// <param name="client">
        /// </param>
        /// <returns>
        /// </returns>
        public static PlayfieldAnarchyFMessage Create(IZoneClient client)
        {
            var message = new PlayfieldAnarchyFMessage
            {
                Identity =
                    new Identity
                {
                    Type     = IdentityType.Playfield2,
                    Instance =
                        client.Character.Playfield.Identity
                        .Instance
                },
                CharacterCoordinates =
                    new Vector3
                {
                    X = client.Character.Coordinates.x,
                    Y = client.Character.Coordinates.y,
                    Z = client.Character.Coordinates.z,
                },
                PlayfieldId1 =
                    new Identity
                {
                    Type     = IdentityType.Playfield1,
                    Instance =
                        client.Character.Playfield.Identity
                        .Instance
                },
                PlayfieldId2 =
                    new Identity
                {
                    Type     = IdentityType.Playfield2,
                    Instance =
                        client.Character.Playfield.Identity
                        .Instance
                },
                PlayfieldX =
                    Playfields.GetPlayfieldX(
                        client.Character.Playfield.Identity.Instance),
                PlayfieldZ =
                    Playfields.GetPlayfieldZ(
                        client.Character.Playfield.Identity.Instance)
            };

            // TODO: Add the VendorHandler again

            /* var vendorcount = VendorHandler.GetNumberofVendorsinPlayfield(client.Character.PlayField);
             * if (vendorcount > 0)
             * {
             *  var firstVendorId = VendorHandler.GetFirstVendor(client.Character.PlayField);
             *  message.PlayfieldVendorInfo = new PlayfieldVendorInfo
             *                                    {
             *                                        VendorCount = vendorcount,
             *                                        FirstVendorId = firstVendorId
             *                                    };
             * }
             */
            return(message);
        }
        /// <summary>
        /// </summary>
        /// <param name="character">
        /// </param>
        /// <returns>
        /// </returns>
        private static MessageDataFiller Filler(ICharacter character)
        {
            return(x =>
            {
                x.Identity = new Identity
                {
                    Type = IdentityType.Playfield2,
                    Instance = character.Playfield.Identity.Instance
                };
                Coordinate temp = character.Coordinates();
                x.CharacterCoordinates = new Vector3 {
                    X = temp.x, Y = temp.y, Z = temp.z,
                };
                x.PlayfieldId1 = new Identity
                {
                    Type = IdentityType.Playfield1,
                    Instance = character.Playfield.Identity.Instance
                };
                x.PlayfieldId2 = new Identity
                {
                    Type = IdentityType.Playfield2,
                    Instance = character.Playfield.Identity.Instance
                };
                x.PlayfieldX = Playfields.GetPlayfieldX(character.Playfield.Identity.Instance);
                x.PlayfieldZ = Playfields.GetPlayfieldZ(character.Playfield.Identity.Instance);

                IEnumerable <Vendor> vendors = Pool.Instance.GetAll <Vendor>(
                    character.Playfield.Identity,
                    (int)IdentityType.VendingMachine);

                /*                if (vendors.Any())
                 * {
                 *  x.PlayfieldVendorInfo = new PlayfieldVendorInfo()
                 *                          {
                 *                              VendorCount = vendors.Count(),
                 *                              FirstVendorId =
                 *                                  vendors.ElementAt(0).Identity.Instance
                 *                          };
                 * }*/
            });

            // TODO: Add the VendorHandler again

            /* var vendorcount = VendorHandler.GetNumberofVendorsinPlayfield(client.Character.PlayField);
             * if (vendorcount > 0)
             * {
             *  var firstVendorId = VendorHandler.GetFirstVendor(client.Character.PlayField);
             *  message.PlayfieldVendorInfo = new PlayfieldVendorInfo
             *                                    {
             *                                        VendorCount = vendorcount,
             *                                        FirstVendorId = firstVendorId
             *                                    };
             * }
             */
        }
예제 #4
0
        public override void ExecuteCommand(Client client, Identity target, string[] args)
        {
            List <Type> check = new List <Type>();

            check.Add(typeof(float));
            check.Add(typeof(float));
            check.Add(typeof(int));

            AOCoord coord = new AOCoord();
            int     pf    = client.Character.PlayField;

            if (CheckArgumentHelper(check, args))
            {
                coord = new AOCoord(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    client.Character.Coordinates.y,
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[3]);
            }

            check.Clear();
            check.Add(typeof(float));
            check.Add(typeof(float));
            check.Add(typeof(string));
            check.Add(typeof(float));
            check.Add(typeof(int));

            if (CheckArgumentHelper(check, args))
            {
                coord = new AOCoord(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[4], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[5]);
            }

            if (!Playfields.ValidPlayfield(pf))
            {
                client.SendFeedback(110, 188845972);
                return;
            }

            Client mClient = null;

            if ((mClient = FindClient.FindClientById(target.Instance)) == null)
            {
                client.SendChatText("Target not found");
                return;
            }

            mClient.Teleport(coord, mClient.Character.Heading, pf);
        }
예제 #5
0
        /// <summary>
        /// </summary>
        /// <param name="character">
        /// </param>
        /// <param name="target">
        /// </param>
        /// <param name="args">
        /// </param>
        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            var check = new List <Type> {
                typeof(float), typeof(float), typeof(int)
            };

            var coord = new Coordinate();
            int pf    = character.Playfield.Identity.Instance;

            if (CheckArgumentHelper(check, args))
            {
                coord = new Coordinate(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    character.Coordinates().y,
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[3]);
            }

            check.Clear();
            check.Add(typeof(float));
            check.Add(typeof(float));
            check.Add(typeof(string));
            check.Add(typeof(float));
            check.Add(typeof(int));

            if (CheckArgumentHelper(check, args))
            {
                coord = new Coordinate(
                    float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[4], NumberStyles.Any, CultureInfo.InvariantCulture),
                    float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
                pf = int.Parse(args[5]);
            }

            if (!Playfields.ValidPlayfield(pf))
            {
                FeedbackMessageHandler.Default.Send(character, 110, 188845972);
            }
            else
            {
                character.Playfield.Teleport(
                    (Character)character,
                    coord,
                    character.Heading,
                    new Identity()
                {
                    Type = IdentityType.Playfield, Instance = pf
                });
            }
        }
예제 #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        public static void Send(Client client)
        {
            PacketWriter packetWriter = new PacketWriter();

            packetWriter.PushBytes(new byte[] { 0xDF, 0xDF });
            packetWriter.PushShort(10);
            packetWriter.PushShort(1);
            packetWriter.PushShort(0);
            packetWriter.PushInt(3086);
            packetWriter.PushInt(client.Character.Id);
            packetWriter.PushInt(0x5F4B1A39);
            packetWriter.PushIdentity(40016, client.Character.PlayField);
            packetWriter.PushByte(0);

            packetWriter.PushInt(4);
            packetWriter.PushCoord(client.Character.Coordinates);
            packetWriter.PushByte(97);
            packetWriter.PushIdentity(51100, client.Character.PlayField);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);
            packetWriter.PushIdentity(40016, client.Character.PlayField);
            packetWriter.PushInt(0);
            packetWriter.PushInt(0);

            int vendorcount = VendorHandler.GetNumberofVendorsinPlayfield(client.Character.PlayField);

            if (vendorcount > 0)
            {
                packetWriter.PushInt(51035);
                packetWriter.PushInt(1);
                packetWriter.PushInt(1);
                packetWriter.PushInt(vendorcount);
                packetWriter.PushInt(VendorHandler.GetFirstVendor(client.Character.PlayField));
            }
            // TODO: Use correct World Position for each "outdoors" playfield -Suiv-
            // Playfield WorldPos X
            packetWriter.PushInt(Playfields.GetPlayfieldX(client.Character.PlayField));
            // Playfield WorldPos Z
            packetWriter.PushInt(Playfields.GetPlayfieldZ(client.Character.PlayField));

            byte[] packet = packetWriter.Finish();
            client.SendCompressed(packet);
        }