public override void RunImplement() { Account player = client.SessionPlayer; if (player == null || player.match == null) { return; } try { int channelId = serverInfo - ((serverInfo / 10) * 10); Channel ch = ServersManager.GetChannel(channelId); if (ch != null) { Match match = ch.GetMatch(id); if (match != null) { client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0, match.clan)); } else { client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0x80000000)); } } else { client.SendPacket(new CLAN_WAR_MATCH_TEAM_INFO_PAK(0x80000000)); } } catch (Exception ex) { PacketLog(ex); } }
public override void RunImplement() { Channel channel = ServersManager.GetChannel(channelId); if (channel != null) { channel.RemoveEmptyRooms(); List <Room> rooms = channel.rooms; List <Account> waiting = channel.GetWaitPlayers(); int Rpages = (int)Math.Ceiling(rooms.Count / 15d); int Apages = (int)Math.Ceiling(waiting.Count / 10d); if (client.lastRoomPage >= Rpages) { client.lastRoomPage = 0; } if (client.lastPlayerPage >= Apages) { client.lastPlayerPage = 0; } int roomsCount = 0, playersCount = 0; byte[] roomsArray = GetRoomListData(ref roomsCount, rooms); byte[] waitingArray = GetPlayerListData(client.lastPlayerPage, ref playersCount, waiting); client.SendPacket(new API_ROOM_LIST_ACK(rooms.Count, waiting.Count, client.lastRoomPage++, client.lastPlayerPage++, roomsCount, playersCount, roomsArray, waitingArray)); } }
public override void RunImplement() { try { Account p = client.SessionPlayer; if (p != null && p.match != null && p.matchSlot == p.match.leader && p.match.state == MatchStateEnum.Ready) { int channelId = serverInfo - (serverInfo / 10 * 10); Match mt = ServersManager.GetChannel(channelId).GetMatch(id); if (mt != null) { Account lider = mt.GetLeader(); if (lider != null && lider.client != null && lider.isOnline) { lider.SendPacket(new CLAN_WAR_MATCH_REQUEST_BATTLE_PAK(p.match, p)); client.SendCompletePacket(PackageDataManager.CLAN_WAR_LEAVE_TEAM_SUCCESS_PAK); return; } } } client.SendCompletePacket(PackageDataManager.CLAN_WAR_MATCH_PROPOSE_ERROR_PAK); } catch (Exception ex) { PacketLog(ex); } }
public override void RunImplement() { Channel channel = ServersManager.GetChannel(channelId); if (channel != null) { Room room = channel.GetRoom(roomId); if (room != null) { client.SendPacket(new API_ROOM_INFO_ACK(room)); } } }
public override void RunImplement() { try { Account player = client.SessionPlayer; if (player == null || player.channelId >= 0) { return; } Channel channel = ServersManager.GetChannel(channelId); if (channel != null) { if (ChannelRequirementCheck(player, channel)) { client.SendCompletePacket(PackageDataManager.BASE_CHANNEL_ENTER_0x80000202_PAK); } else if (channel.players.Count >= Settings.MaxPlayersChannel) { client.SendCompletePacket(PackageDataManager.BASE_CHANNEL_ENTER_0x80000201_PAK); } else { player.channelId = channelId; client.SendPacket(new BASE_CHANNEL_ENTER_PAK(player.channelId, channel.announce)); player.status.UpdateChannel((byte)player.channelId); player.UpdateCacheInfo(); } } else { client.SendCompletePacket(PackageDataManager.BASE_CHANNEL_ENTER_0x80000000_PAK); client.Close(3000); } } catch (Exception ex) { PacketLog(ex); } /* * 0x80000201 STBL_IDX_EP_SERVER_USER_FULL_C * 0x80000202 - De acordo com o ChannelType * 0x80000203 STBL_IDX_EP_SERVER_NOT_SATISFY_MTS * 0x80000204 STR_UI_GOTO_GWARNET_CHANNEL_ERROR * 0x80000205 STR_UI_GOTO_AZERBAIJAN_CHANNEL_ERROR * 0x80000206 STR_POPUP_MOBILE_CERTIFICATION_ERROR * 0x80000207 STR_UI_GOTO_TURKISH_CHANNEL_ERROR * 0x80000208 STR_UI_GOTO_MENA_CHANNEL_ERROR */ }
public override void RunImplement() { try { Account p = client.SessionPlayer; if (type >= 2 || p == null || p.match != null || p.room != null) { client.SendPacket(new CLAN_WAR_JOIN_TEAM_PAK(0x80000000)); return; } int channelId = serverInfo - ((serverInfo / 10) * 10); Channel ch = ServersManager.GetChannel(type == 0 ? channelId : p.channelId); if (ch != null) { if (p.clanId == 0) { client.SendPacket(new CLAN_WAR_JOIN_TEAM_PAK(0x8000105B)); } else { Match mt = type == 1 ? ch.GetMatch(matchId, p.clanId) : ch.GetMatch(matchId); if (mt != null) { JoinPlayer(p, mt); } else { client.SendPacket(new CLAN_WAR_JOIN_TEAM_PAK(0x80000000)); } } } else { client.SendPacket(new CLAN_WAR_JOIN_TEAM_PAK(0x80000000)); } } catch (Exception ex) { PacketLog(ex); } }
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 RunImplement() { try { Account player = client.SessionPlayer; if (player == null) { return; } Match mt = player.match; int channelId = serverInfo - (serverInfo / 10 * 10); Match mt2 = ServersManager.GetChannel(channelId).GetMatch(id); if (mt != null && mt2 != null && player.matchSlot == mt.leader) { if (type == 1) { if (mt.formação != mt2.formação) { client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_WAR_ACCEPTED_BATTLE_ERROR_0x80001092_PAK); } else if (mt2.GetCountPlayers() != mt.formação || mt.GetCountPlayers() != mt.formação) { client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_WAR_ACCEPTED_BATTLE_ERROR_0x80001091_PAK); } else if (mt2.state == MatchStateEnum.Play || mt.state == MatchStateEnum.Play) { client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_WAR_ACCEPTED_BATTLE_ERROR_0x80001090_PAK); } else { mt.state = MatchStateEnum.Play; Account pM = mt2.GetLeader(); if (pM != null && pM.match != null) { pM.SendPacket(new CLAN_WAR_ENEMY_INFO_PAK(mt)); pM.SendPacket(new CLAN_WAR_CREATED_ROOM_PAK(mt)); mt2.slots[pM.matchSlot].state = SlotMatchStateEnum.Ready; } mt2.state = MatchStateEnum.Play; client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_WAR_ACCEPTED_BATTLE_SUCCESS_PAK); } } else { Account pM = mt2.GetLeader(); if (pM != null && pM.match != null) { pM.SendCompletePacket(PackageDataManager.CLAN_WAR_RECUSED_BATTLE_ERROR_0x80001093_PAK); } } } else { client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_WAR_ACCEPTED_BATTLE_ERROR_0x80001094_PAK); } } catch (Exception ex) { PacketLog(ex); } }