Exemple #1
0
        void HookProxy_OutgoingPacket(byte[] data)
        {
            NetworkMessage msg = new NetworkMessage(client, data);

            if (OutgoingPacket != null)
            {
                OutgoingPacket.Invoke(data);
            }
            byte Type = msg.GetByte();

            switch (Type)
            {
            case 0x82:
                Location loc      = msg.GetLocation();
                uint     itemId   = msg.GetUInt16();
                byte     stackPos = msg.GetByte();
                byte     Index    = msg.GetByte();
                if (ItemUsePacket != null)
                {
                    ItemUsePacket.Invoke(loc, stackPos, (int)itemId, Index);
                }

                break;

            case 0x96:
                byte   type    = msg.GetByte();
                string message = msg.PeekString();
                msg.AddString(message);
                break;

            case 101:
            case 102:
            case 103:
            case 104:
            case 106:
            case 107:
            case 108:
            case 109:
                client.Map.PlayerHavedMoved = true;
                // client.StatusBar = "moved " + Type.ToString("X");
                break;
            }
        }
Exemple #2
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;
            }
        }