private void RunPacket(byte[] buff) { // if (closed) return; // Mudado para o metodo "read" UInt16 opcode = BitConverter.ToUInt16(buff, 0); // Debug Receive /* * { * string debugData = ""; * foreach (string str2 in BitConverter.ToString(buff).Split('-', ',', '.', ':', '\t')) * debugData += " " + str2; * Printf.warning("Receive [" + opcode + "]" + debugData); * } */ if (!receiveFirstPacket) // Nao recebeu ainda { if (!FirstPacketCheck(opcode) && opcode != 0) { string msg = "Primeiro pacote nao recebido, conexao finalizada. [" + opcode + "]"; Printf.warning(msg); SaveLog.warning(GetIPAddress() + " " + msg); Firewall.sendBlock(GetIPAddress(), msg, 1); Close(true); return; } } ReceiveLoginPacket packet = null; switch (opcode) { case 528: packet = new BASE_USER_GIFTLIST_REC(this, buff); break; case 2561: case 2563: LoginAttemps++; if (LoginAttemps > 10) { string msg = GetIPAddress() + " Enviou o login mais de 10 vezes"; Printf.warning(msg); SaveLog.warning(msg); Firewall.sendBlock(GetIPAddress(), msg, 2); Close(true); return; } else { packet = new BASE_LOGIN_REC(this, buff); break; } case 2565: packet = new BASE_USER_INFO_REC(this, buff); break; case 2666: Printf.blue("A_2666_REC"); packet = new A_2666_REC(this, buff); break; case 2672: // AutoLogin Printf.info("BASE_LOGIN_THAI_REC"); //packet = new BASE_LOGIN_THAI_REC(this, buff); return; break; case 2567: packet = new BASE_USER_CONFIGS_REC(this, buff); break; case 2575: // [2575] 0F 0A 1E 4C //packet = new UPDATE_GAMESERVERS_REC(this, buff); return; case 2577: packet = new BASE_SERVER_CHANGE_REC(this, buff); // Ultimo pacote? break; case 2579: packet = new BASE_USER_ENTER_REC(this, buff); break; case 2581: packet = new BASE_CONFIG_SAVE_REC(this, buff); break; case 2642: packet = new BASE_SERVER_LIST_REFRESH_REC(this, buff); break; case 2654: packet = new BASE_USER_EXIT_REC(this, buff); break; case 2668: // INCOMPLETO Printf.info("BASE_FREE_ITEMS_OF_LEVELUP_REC"); // packet = new BASE_FREE_ITEMS_OF_LEVELUP_REC(this, buff); return; case 2678: packet = new A_2678_REC(this, buff); break; case 2698: packet = new BASE_USER_INVENTORY_REC(this, buff); break; case 0: packet = new DEV_SERVER_DETAILS_REQ(this, buff); break; default: { string msg = "[" + opcode + "] Opcode nao encontrado " + GetIPAddress(true); Firewall.sendBlock(GetIPAddress(), msg, 1); Printf.warning(msg); SaveLog.warning(msg); Close(true); return; } } new Thread(packet.run).Start(); }
private void RunPacket(byte[] buff) { if (closed) { return; } UInt16 opcode = BitConverter.ToUInt16(buff, 0); // Debug packet receive /* * { * string debugData = ""; * foreach (string str2 in BitConverter.ToString(buff).Split('-', ',', '.', ':', '\t')) * debugData += " " + str2; * Printf.warning("[" + opcode + "]" + debugData); * } */ if (!receiveFirstPacket) // Nao recebeu ainda { if (!FirstPacketCheck(opcode)) { string msg = GetIPAddress() + "Primeiro pacote nao recebido [" + opcode + "]"; Printf.warning(msg); SaveLog.warning(msg); Firewall.sendBlock(GetIPAddress(), msg, 1); Close(0, true); return; } } ReceiveGamePacket packet = null; switch (opcode) { case 275: packet = new FRIEND_INVITE_FOR_ROOM_REC(this, buff); break; case 280: packet = new FRIEND_ACCEPT_REC(this, buff); break; case 282: packet = new FRIEND_INVITE_REC(this, buff); break; case 284: packet = new FRIEND_DELETE_REC(this, buff); break; case 290: packet = new AUTH_SEND_WHISPER_REC(this, buff); break; case 292: packet = new AUTH_SEND_WHISPER2_REC(this, buff); break; case 297: packet = new AUTH_FIND_USER_REC(this, buff); break; case 417: packet = new BOX_MESSAGE_CREATE_REC(this, buff); break; case 419: packet = new BOX_MESSAGE_REPLY_REC(this, buff); break; case 422: packet = new BOX_MESSAGE_VIEW_REC(this, buff); break; case 424: packet = new BOX_MESSAGE_DELETE_REC(this, buff); break; case 530: packet = new SHOP_BUY_ITEM_REC(this, buff); break; case 534: packet = new INVENTORY_ITEM_EQUIP_REC(this, buff); break; case 536: packet = new INVENTORY_ITEM_EFFECT_REC(this, buff); break; case 540: packet = new BOX_MESSAGE_GIFT_TAKE_REC(this, buff); break; case 542: packet = new INVENTORY_ITEM_EXCLUDE_REC(this, buff); break; case 544: packet = new AUTH_WEB_CASH_REC(this, buff); break; case 548: packet = new AUTH_CHECK_NICKNAME_REC(this, buff); break; //554 = Reparar arma case 1304: packet = new CLAN_GET_INFO_REC(this, buff); break; case 1306: packet = new CLAN_MEMBER_CONTEXT_REC(this, buff); break; case 1308: packet = new CLAN_MEMBER_LIST_REC(this, buff); break; case 1310: packet = new CLAN_CREATE_REC(this, buff); break; case 1312: packet = new CLAN_CLOSE_REC(this, buff); break; case 1314: packet = new CLAN_CHECK_CREATE_INVITE_REC(this, buff); break; case 1316: packet = new CLAN_CREATE_INVITE_REC(this, buff); break; case 1318: packet = new CLAN_PLAYER_CLEAN_INVITES_REC(this, buff); break; case 1320: packet = new CLAN_REQUEST_CONTEXT_REC(this, buff); break; case 1322: packet = new CLAN_REQUEST_LIST_REC(this, buff); break; case 1324: packet = new CLAN_REQUEST_INFO_REC(this, buff); break; case 1326: packet = new CLAN_REQUEST_ACCEPT_REC(this, buff); break; case 1329: packet = new CLAN_REQUEST_DENIAL_REC(this, buff); break; case 1332: packet = new CLAN_PLAYER_LEAVE_REC(this, buff); break; case 1334: packet = new CLAN_DEMOTE_KICK_REC(this, buff); break; case 1337: packet = new CLAN_PROMOTE_MASTER_REC(this, buff); break; case 1340: packet = new CLAN_PROMOTE_AUX_REC(this, buff); break; case 1343: packet = new CLAN_DEMOTE_NORMAL_REC(this, buff); break; case 1358: packet = new CLAN_CHATTING_REC(this, buff); break; case 1360: packet = new CLAN_CHECK_DUPLICATE_LOGO_REC(this, buff); break; case 1362: packet = new CLAN_REPLACE_NOTICE_REC(this, buff); break; case 1364: packet = new CLAN_REPLACE_INTRO_REC(this, buff); break; case 1372: packet = new CLAN_SAVEINFO3_REC(this, buff); break; case 1381: packet = new CLAN_ROOM_INVITED_REC(this, buff); break; case 1390: packet = new CLAN_CHAT_1390_REC(this, buff); break; case 1392: packet = new CLAN_MESSAGE_INVITE_REC(this, buff); break; case 1394: packet = new CLAN_MESSAGE_REQUEST_INTERACT_REC(this, buff); break; case 1396: packet = new CLAN_MSG_FOR_PLAYERS_REC(this, buff); break; case 1416: packet = new CLAN_CREATE_REQUIREMENTS_REC(this, buff); break; case 1441: packet = new CLAN_CLIENT_ENTER_REC(this, buff); break; case 1443: packet = new CLAN_CLIENT_LEAVE_REC(this, buff); break; case 1445: packet = new CLAN_CLIENT_CLAN_LIST_REC(this, buff); break; case 1447: packet = new CLAN_CHECK_DUPLICATE_NAME_REC(this, buff); break; case 1451: packet = new CLAN_CLIENT_CLAN_CONTEXT_REC(this, buff); break; case 1538: packet = new CLAN_WAR_PARTY_CONTEXT_REC(this, buff); break; case 1540: packet = new CLAN_WAR_PARTY_LIST_REC(this, buff); break; case 1542: packet = new CLAN_WAR_MATCH_TEAM_CONTEXT_REC(this, buff); break; case 1544: packet = new CLAN_WAR_MATCH_TEAM_LIST_REC(this, buff); break; case 1546: packet = new CLAN_WAR_CREATE_TEAM_REC(this, buff); break; case 1548: packet = new CLAN_WAR_JOIN_TEAM_REC(this, buff); break; case 1550: packet = new CLAN_WAR_LEAVE_TEAM_REC(this, buff); break; case 1553: packet = new CLAN_WAR_PROPOSE_REC(this, buff); break; case 1558: packet = new CLAN_WAR_ACCEPT_BATTLE_REC(this, buff); break; case 1565: packet = new CLAN_WAR_CREATE_ROOM_REC(this, buff); break; case 1567: packet = new CLAN_WAR_JOIN_ROOM_REC(this, buff); break; case 1569: packet = new CLAN_WAR_MATCH_TEAM_INFO_REC(this, buff); break; case 1571: packet = new CLAN_WAR_UPTIME_REC(this, buff); break; case 1576: packet = new CLAN_WAR_TEAM_CHATTING_REC(this, buff); break; case 2571: packet = new BASE_CHANNEL_LIST_REC(this, buff); break; case 2573: packet = new BASE_CHANNEL_ENTER_REC(this, buff); break; case 2575: packet = new BASE_HEARTBEAT_REC(this, buff); break; case 2577: packet = new BASE_SERVER_CHANGE_REC(this, buff); break; case 2579: packet = new BASE_USER_ENTER_REC(this, buff); break; case 2581: packet = new BASE_CONFIG_SAVE_REC(this, buff); break; //case 2584: // packet = new CM_2584(this, buff); break; case 2591: packet = new BASE_GET_USER_STATS_REC(this, buff); break; case 2601: packet = new BASE_MISSION_ENTER_REC(this, buff); break; case 2605: packet = new BASE_QUEST_BUY_CARD_SET_REC(this, buff); break; case 2607: packet = new BASE_QUEST_DELETE_CARD_SET_REC(this, buff); break; case 2619: packet = new BASE_TITLE_GET_REC(this, buff); break; case 2621: packet = new BASE_TITLE_USE_REC(this, buff); break; case 2623: packet = new BASE_TITLE_DETACH_REC(this, buff); break; case 2627: packet = new BASE_CHATTING_REC(this, buff); break; case 2635: packet = new BASE_MISSION_SUCCESS_REC(this, buff); break; case 2639: packet = new LOBBY_GET_PLAYERINFO_REC(this, buff); break; case 2642: packet = new BASE_SERVER_LIST_REFRESH_REC(this, buff); break; case 2644: packet = new BASE_SERVER_PASSW_REC(this, buff); break; case 2654: packet = new BASE_USER_EXIT_REC(this, buff); break; case 2661: packet = new EVENT_VISIT_CONFIRM_REC(this, buff); break; case 2663: packet = new EVENT_VISIT_REWARD_REC(this, buff); break; case 2684: packet = new GM_LOG_LOBBY_REC(this, buff); break; case 2686: packet = new GM_LOG_ROOM_REC(this, buff); break; case 2694: // BaseExitURL ?? break; case 2817: packet = new SHOP_LEAVE_REC(this, buff); break; case 2819: packet = new SHOP_ENTER_REC(this, buff); break; case 2821: packet = new SHOP_LIST_REC(this, buff); break; case 3073: packet = new LOBBY_GET_ROOMLIST_REC(this, buff); break; case 3077: packet = new LOBBY_QUICKJOIN_ROOM_REC(this, buff); break; case 3079: packet = new LOBBY_ENTER_REC(this, buff); break; case 3081: packet = new LOBBY_JOIN_ROOM_REC(this, buff); break; case 3083: packet = new LOBBY_LEAVE_REC(this, buff); break; case 3087: packet = new LOBBY_GET_ROOMINFO_REC(this, buff); break; case 3089: packet = new LOBBY_CREATE_ROOM_REC(this, buff); break; case 3094: //3096 = /exit Nick /*packet = new A_3094_REC(this, buff); */ break; case 3099: packet = new LOBBY_GET_PLAYERINFO2_REC(this, buff); break; case 3101: packet = new LOBBY_CREATE_NICK_NAME_REC(this, buff); break; case 3329: //Pode ser chamado caso state = 13| caso contrário é chamado o 3333 packet = new BATTLE_3329_REC(this, buff); break; case 3331: packet = new BATTLE_READYBATTLE_REC(this, buff); break; case 3333: packet = new BATTLE_STARTBATTLE_REC(this, buff); break; case 3337: packet = new BATTLE_RESPAWN_REC(this, buff); break; case 3343: // Incompleto Printf.warnDark("Receive 3343- BATTLE_NETWORK_PROBLEM_REC"); //packet = new BATTLE_NETWORK_PROBLEM_REC(this, buff); break; case 3344: packet = new BATTLE_SENDPING_REC(this, buff); break; case 3348: packet = new BATTLE_PRESTARTBATTLE_REC(this, buff); break; case 3354: packet = new BATTLE_DEATH_REC(this, buff); break; case 3356: packet = new BATTLE_MISSION_BOMB_INSTALL_REC(this, buff); break; case 3358: packet = new BATTLE_MISSION_BOMB_UNINSTALL_REC(this, buff); break; case 3368: packet = new BATTLE_MISSION_GENERATOR_INFO_REC(this, buff); break; case 3372: packet = new BATTLE_TIMERSYNC_REC(this, buff); break; case 3376: packet = new BATTLE_CHANGE_DIFFICULTY_LEVEL_REC(this, buff); break; case 3378: packet = new BATTLE_RESPAWN_FOR_AI_REC(this, buff); break; case 3384: packet = new BATTLE_PLAYER_LEAVE_REC(this, buff); break; case 3386: packet = new BATTLE_MISSION_DEFENCE_INFO_REC(this, buff); break; case 3390: packet = new BATTLE_DINO_DEATHBLOW_REC(this, buff); break; case 3394: packet = new BATTLE_ENDTUTORIAL_REC(this, buff); break; case 3396: packet = new VOTEKICK_START_REC(this, buff); break; case 3400: packet = new VOTEKICK_UPDATE_REC(this, buff); break; //3413 //3421 -Pausar //3423 -Recomeçar case 3428: packet = new A_3428_REC(this, buff); break; case 3585: packet = new INVENTORY_ENTER_REC(this, buff); break; case 3589: packet = new INVENTORY_LEAVE_REC(this, buff); break; case 3841: packet = new ROOM_GET_PLAYERINFO_REC(this, buff); break; case 3845: packet = new ROOM_CHANGE_SLOT_REC(this, buff); break; case 3847: packet = new BATTLE_ROOM_INFO_REC(this, buff); break; case 3849: packet = new ROOM_CLOSE_SLOT_REC(this, buff); break; case 3854: packet = new ROOM_GET_LOBBY_USER_LIST_REC(this, buff); break; case 3858: packet = new ROOM_CHANGE_INFO2_REC(this, buff); break; case 3862: packet = new BASE_PROFILE_ENTER_REC(this, buff); break; case 3864: packet = new BASE_PROFILE_LEAVE_REC(this, buff); break; case 3866: packet = new ROOM_REQUEST_HOST_REC(this, buff); break; case 3868: packet = new ROOM_RANDOM_HOST2_REC(this, buff); break; case 3870: packet = new ROOM_CHANGE_HOST_REC(this, buff); break; case 3872: packet = new ROOM_RANDOM_HOST_REC(this, buff); break; case 3874: packet = new ROOM_CHANGE_TEAM_REC(this, buff); break; case 3884: packet = new ROOM_INVITE_PLAYERS_REC(this, buff); break; case 3886: packet = new ROOM_CHANGE_INFO_REC(this, buff); break; case 3890: // "/KICK Slot" packet = new A_3890_REC(this, buff); break; case 3894: //Ativa quando usa "/EXIT (SLOT)" /*packet = new A_3894_REC(this, buff);*/ break; case 3900: // Ativa quando usa "/BLOCK (SLOT) (REASON) /*packet = new A_3900_REC(this, buff);*/ break; case 3902: //Ativa quando usa "/ROOMDEST" /*packet = new A_3902_REC(this, buff);*/ break; case 3904: packet = new BATTLE_LOADING_REC(this, buff); break; case 3906: packet = new ROOM_CHANGE_PASSW_REC(this, buff); break; //case 3910: // packet = new EVENT_PLAYTIME_REWARD_REC(this, buff); break; case 666: packet = new global.clientpacket.DEV.DEV_PROTECAO_CONTRA_LOTTER(this, buff); break; default: { string msg = "[" + opcode + "] Opcode nao encontrado " + GetIPAddress(); Firewall.sendBlock(GetIPAddress(), msg, 1); Printf.warning(msg); SaveLog.warning(msg); Close(0, true); return; } } if (packet != null) { new Thread(packet.run).Start(); } }