示例#1
0
        unsafe public static void ProcessData(byte[] buffer, int ClientIndex)
        {
            TPacket *tmpPacket = Silkroad.ToTPacket(buffer);

            if (debug)
            {
                Console.WriteLine("[ProcessData][{0:X}][{1} bytes][Index {2}]\n{3}\n", tmpPacket->opcode, tmpPacket->size, ClientIndex, BitConverter.ToString(buffer, 6, tmpPacket->size).Replace('-', ' '));
            }

            switch (tmpPacket->opcode)
            {
            case CLIENT_OPCODES.LOGIN_CLIENT_KEEP_ALIVE:
            case CLIENT_OPCODES.LOGIN_CLIENT_ACCEPT_HANDSHAKE:
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_INFO:
                SendServerInfo(ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_PATCH_REQUEST:
                SendPatchInfo(ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_LAUNCHER:
                SendLauncherInfo(ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_SERVERLIST_REQUEST:
                SendServerList(ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_AUTH:
                /*if (debug)
                 *  Debugx.DumpBuffer(buffer, 1, tmpPacket->opcode, tmpPacket->size);*/
                SendLogin(buffer, ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_LAUNCHER_UNK1:
                SendLauncherUnk1(ClientIndex);
                break;

            case CLIENT_OPCODES.LOGIN_CLIENT_AUTH_UNK1:
                SendServerUnk1(ClientIndex);
                break;

            default:
                //Debugx.DumpBuffer(buffer, 1, tmpPacket->opcode, tmpPacket->size);
                Console.WriteLine("default Opcode: {0}", tmpPacket->opcode);
                break;
            }
        }
示例#2
0
        unsafe public static void ProcessData(byte[] buffer, int Index)
        {
            reader = new PacketReader(buffer, buffer.Length);
            reader.ModifyIndex(6);

            TPacket *tmpPacket = Silkroad.ToTPacket(buffer);

            if (debug)
            {
                Console.WriteLine("[ProcessData][{0:X}][{1} bytes][Index {2}]\n{3}\n", tmpPacket->opcode, tmpPacket->size, Index, BitConverter.ToString(buffer, 6, tmpPacket->size).Replace('-', ' '));
            }

            //Console.WriteLine("{0}", tmpPacket->opcode);

            switch (tmpPacket->opcode)
            {
            case CLIENT_OPCODES.GAME_CLIENT_KEEP_ALIVE:
            case CLIENT_OPCODES.GAME_CLIENT_ACCEPT_HANDSHAKE:
                /*if(debug)
                 *  Debugx.DumpBuffer(buffer, 1, tmpPacket->opcode, tmpPacket->size);*/
                //hansh(Index);
                Auth.SendServerInfo(Index);      //force cliente acept xD
                break;

            case CLIENT_OPCODES.GAME_CLIENT_INFO:
                Auth.SendServerInfo(Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_PATCH_REQUEST:
                Auth.SendPatchInfo(Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_AUTH:
                Auth.OnAuth(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_CHARACTER:
                Character.OnCharacter(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_INGAME_REQUEST:
                Character.OnIngameRequest(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_INGAME_NOTIFY:
                Players.OnIngameNotify(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_CHARACTER_STATE:
                Character.OnState(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_MOVEMENT:
                Movement.OnMovement(tmpPacket->data, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_CLOSE:
                OnGameQuit(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_EMOTION:
                PlayerAction.OnEmotion(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_ITEM_MOVE:
                Items.MoveItem(tmpPacket->data, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_CHAT:
                Chat.OnChat(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_TARGET:
                Players.OnTarget(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_MASTERYUPDATE:
                Mastery.OnMasteryUpdate(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_SKILLUPDATE:
                Mastery.OnSkillUpdate(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_STR_UPDATE:
                Stats.STRUpdate(Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_INT_UPDATE:
                Stats.INTUpdate(Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_PLAYER_ACTION:
                PlayerAction.Action(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_RESPAWN:
                Character.ReSpawnMe(Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_GM:
                GameMaster.OnGM(reader, Index);
                break;

            case CLIENT_OPCODES.GAME_CLIENT_ITEM_USE:
                Items.OnUseItem(reader, Index);
                break;

            default:
                Console.WriteLine("Default Opcode:{0}", tmpPacket->opcode);
                break;
            }
        }