public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.TileTransformThing)
                return false;

            Destination = destination;
            Type = IncomingPacketType.TileTransformThing;

            Position = msg.GetLocation();
            StackPosition = msg.GetByte();
            ThingId = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063)
            {
                CreatureId = msg.GetUInt32();
                CreatureDirection = msg.GetByte();
            }
            else
            {
                Item = new Pokemon.Objects.Item(Client, ThingId, 0);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Position);

                if (Item.HasExtraByte)
                    Item.Count = msg.GetByte();
            }

            return true;
        }
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            int position = msg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.TileTransformThing)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.TileTransformThing;

            Position      = msg.GetLocation();
            StackPosition = msg.GetByte();
            ThingId       = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063)
            {
                CreatureId        = msg.GetUInt32();
                CreatureDirection = msg.GetByte();
            }
            else
            {
                Item          = new Pokemon.Objects.Item(Client, ThingId, 0);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Position);

                if (Item.HasExtraByte)
                {
                    Item.Count = msg.GetByte();
                }
            }

            return(true);
        }
Пример #3
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.TileAddThing)
                return false;

            Destination = destination;
            Type = IncomingPacketType.TileAddThing;

            Location = msg.GetLocation();
            Stack = msg.GetByte();
            ThingId = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062)
            {
                Creature = new PacketCreature(Client);

                if (ThingId == 0x0062)
                {
                    Creature.Type = PacketCreatureType.Known;
                    Creature.Id = msg.GetUInt32();
                }
                else if (ThingId == 0x0061)
                {
                    Creature.Type = PacketCreatureType.Unknown;
                    Creature.RemoveId = msg.GetUInt32();
                    Creature.Id = msg.GetUInt32();
                    Creature.Name = msg.GetString();
                }

                Creature.Health = msg.GetByte();
                Creature.Direction = msg.GetByte();

                Creature.Outfit = msg.GetOutfit();

                Creature.LightLevel = msg.GetByte();
                Creature.LightColor = msg.GetByte();

                Creature.Speed = msg.GetUInt16();
                Creature.Skull = (Constants.Skull)msg.GetByte();
                Creature.PartyShield = (PartyShield)msg.GetByte();
            }
            else if (ThingId == 0x0063)
            {
                Creature = new PacketCreature(Client);
                Creature.Type = PacketCreatureType.Turn;
                Creature.Id = msg.GetUInt32();
                Creature.Direction = msg.GetByte();
            }
            else
            {
                Item = new Pokemon.Objects.Item(Client, ThingId);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Location);

                if (Item.HasExtraByte)
                    Item.Count = msg.GetByte();
            }

            return true;
        }
Пример #4
0
        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.TileAddThing)
            {
                return(false);
            }

            Destination = destination;
            Type        = IncomingPacketType.TileAddThing;

            Location = msg.GetLocation();
            Stack    = msg.GetByte();
            ThingId  = msg.GetUInt16();

            if (ThingId == 0x0061 || ThingId == 0x0062)
            {
                Creature = new PacketCreature(Client);

                if (ThingId == 0x0062)
                {
                    Creature.Type = PacketCreatureType.Known;
                    Creature.Id   = msg.GetUInt32();
                }
                else if (ThingId == 0x0061)
                {
                    Creature.Type     = PacketCreatureType.Unknown;
                    Creature.RemoveId = msg.GetUInt32();
                    Creature.Id       = msg.GetUInt32();
                    Creature.Name     = msg.GetString();
                }

                Creature.Health    = msg.GetByte();
                Creature.Direction = msg.GetByte();

                Creature.Outfit = msg.GetOutfit();

                Creature.LightLevel = msg.GetByte();
                Creature.LightColor = msg.GetByte();

                Creature.Speed       = msg.GetUInt16();
                Creature.Skull       = (Constants.Skull)msg.GetByte();
                Creature.PartyShield = (PartyShield)msg.GetByte();
            }
            else if (ThingId == 0x0063)
            {
                Creature           = new PacketCreature(Client);
                Creature.Type      = PacketCreatureType.Turn;
                Creature.Id        = msg.GetUInt32();
                Creature.Direction = msg.GetByte();
            }
            else
            {
                Item          = new Pokemon.Objects.Item(Client, ThingId);
                Item.Location = Pokemon.Objects.ItemLocation.FromLocation(Location);

                if (Item.HasExtraByte)
                {
                    Item.Count = msg.GetByte();
                }
            }

            return(true);
        }