Ejemplo n.º 1
0
        private void ParseIncomingPacket(NetworkMessage msg)
        {
            int      x, y, id;
            byte     z, stack, number, Color;
            Location location;
            string   message, name;
            byte     PacketType = msg.GetByte();

            switch (PacketType)
            {
            case 0xF3:

                uint   Len           = msg.GetUInt32();
                byte[] incommingData = new byte[Len];
                for (int k = 0; k < Len; k++)
                {
                    incommingData[k] = msg.GetByte();
                }
                if (IncommingPacket != null)
                {
                    IncommingPacket.Invoke(incommingData);
                }
                break;

            case 0xB4:

                Color   = msg.GetByte();
                message = msg.GetString();
                if (message.ToLower().Contains("you see"))
                {
                    message += "\n  [ID] = " + client.Memory.ReadInt32(client.Addresses.Client.LastSeendId).ToString();
                }
                ForwardTextPacket(Color, message);
                break;

            case 0x6A:
                x      = msg.GetUInt16();
                y      = msg.GetUInt16();
                z      = msg.GetByte();
                stack  = msg.GetByte();
                stack -= 1;
                id     = msg.GetUInt16();
                Item i = new Item(client, id);

                if (TileAddThing != null)
                {
                    TileAddThing.Invoke(new Location(x, y, z), stack, id);
                }
                break;

            case 0x6D:
                Location FromLoc, ToLocation;
                byte     stackOrder;
                FromLoc    = msg.GetLocation();
                stackOrder = msg.GetByte();

                ToLocation = msg.GetLocation();
                if (CreateMovePacket != null)
                {
                    CreateMovePacket.Invoke(FromLoc, stackOrder, ToLocation);
                }
                break;

            case 0x84:
                Location loc   = msg.GetLocation();
                byte     color = msg.GetByte();
                message          = msg.GetString();
                client.StatusBar = message + " " + color.ToString() + " " + loc.ToString();
                break;
            }
        }