Пример #1
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(clanId);
         if (clan.id == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_CREATE_INVITE_0x80000000_PAK);
         }
         else if (player.rankId < clan.limitRankId)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_CREATE_INVITE_2147487867_PAK);
         }
         else if (player.age < clan.limitAgeBigger || player.age > clan.limitAgeSmaller)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_CREATE_INVITE_0x8000107A_ACK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_CREATE_INVITE_SUCCESS_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #2
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && clan.ownerId == player.playerId && player.clanAuthority == ClanAuthorityEnum.Master && player.ExecuteQuery($"DELETE FROM clan_data WHERE clan_id='{clan.id}'") && player.ExecuteQuery($"UPDATE accounts SET clan_id='0', clan_authority='0', clan_fights='0', clan_wins='0', clan_date='0' WHERE id='{player.playerId}'") && ClanManager.RemoveClan(clan))
         {
             player.clanId        = 0;
             player.clanAuthority = ClanAuthorityEnum.None;
             ClanManager.RemoveClan(clan);
             client.SendCompletePacket(PackageDataManager.CLAN_CLOSE_SUCCESS_PAK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CLOSE_2147487850_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #3
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || authorityConfig > 15 || (limitRankId != 4 && limitRankId != 17 && limitRankId != 31 && limitRankId != 46) || (limitAgeBigger != 0 && limitAgeBigger != 15 && limitAgeBigger != 20 && limitAgeBigger != 30) || (limitAgeSmaller != 0 && limitAgeSmaller != 15 && limitAgeSmaller != 20 && limitAgeSmaller != 30))
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && (clan.ownerId == player.playerId) && clan.UpdateClanInfo(authorityConfig, limitRankId, limitAgeBigger, limitAgeSmaller))
         {
             clan.authorityConfig = (ClanAuthorityConfigEnum)authorityConfig;
             clan.limitRankId     = limitRankId;
             clan.limitAgeBigger  = limitAgeBigger;
             clan.limitAgeSmaller = limitAgeSmaller;
             client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_SAVEINFO3_SUCCESS_ACK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_SAVEINFO3_ERROR_ACK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #4
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (player.clanId > 0 && clan.id > 0 && clan.informations != informations && informations.Length <= 241 && (clan.ownerId == player.playerId || player.clanAuthority >= ClanAuthorityEnum.Master && player.clanAuthority <= ClanAuthorityEnum.Auxiliar))
         {
             if (player.ExecuteQuery($"UPDATE clan_data SET clan_info='{informations}' WHERE clan_id='{clan.id}'"))
             {
                 clan.informations = informations;
                 client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_REPLACE_INTRO_SUCCESS_ACK);
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_REPLACE_INTRO_2147487860_ACK);
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.PROTOCOL_CLAN_REPLACE_INTRO_2147487835_ACK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #5
0
 private byte[] GetPlayerListData(int page, ref int count, List <Account> list)
 {
     using (PacketWriter send = new PacketWriter())
     {
         for (int i = page * 10; i < list.Count; i++)
         {
             Account player = list[i];
             if (player.nickname.Length >= Settings.NickMinLength && player.nickname.Length < Settings.NickMaxLength)
             {
                 Clan clan = ClanManager.GetClan(player.clanId);
                 send.WriteD(player.GetSessionId());
                 send.WriteD(clan.logo);
                 send.WriteS(clan.name, 17);
                 send.WriteH((short)player.GetRank());
                 send.WriteS(player.nickname, 33);
                 send.WriteC(player.nickcolor);
                 send.WriteC(player.country);
             }
             else
             {
                 Logger.Warning($" [GAME] [{GetType().Name}] Não foi possivel exibir o jogador no lobby devido seu nickname: {player.nickname} PlayerId: {player.playerId}");
             }
             if (count++ == 10)
             {
                 break;
             }
         }
         return(send.memorystream.ToArray());
     }
 }
Пример #6
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.clanId <= 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_LEAVE_2147487835_ACK);
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id == 0 || clan.ownerId == player.playerId)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_LEAVE_2147487838_ACK);
             return;
         }
         if (player.ExecuteQuery($"UPDATE accounts SET clan_id='0', clan_authority='0', clan_fights='0', clan_wins='0', clan_date='0' WHERE id='{player.playerId}'"))
         {
             List <Account> players = player.GetClanPlayers(player.playerId);
             using (PROTOCOL_CLAN_MEMBER_LEAVE_ACK packet = new PROTOCOL_CLAN_MEMBER_LEAVE_ACK(player.playerId))
             {
                 player.SendPacketForPlayers(packet, players);
             }
             players = null;
             Account ownerClan = AccountManager.GetAccount(clan.ownerId, 0);
             if (ownerClan != null)
             {
                 if (ownerClan.GetMessagesCount() < 100)
                 {
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         text       = player.nickname,
                         state      = 1,
                         noteEnum   = NoteMessageClanEnum.Secession
                     };
                     if (message != null && ownerClan.InsertMessage(message) && ownerClan.isOnline)
                     {
                         //Envia mensagem para o dono do clã, notificando que o jogador saiu do clã.
                         ownerClan.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
             }
             player.clanId        = 0;
             player.clanAuthority = ClanAuthorityEnum.None;
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_LEAVE_SUCCESS_ACK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_LEAVE_0x8000106B_ACK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #7
0
 public override void RunImplement()
 {
     try
     {
         Account  player = client.SessionPlayer;
         DateTime now    = DateTime.Now;
         if (player == null || player.clanId <= 0 || type != ChattingTypeEnum.Clan_Member_Page || text.Length > 60 || player.nickname.Length < Settings.NickMinLength || player.nickname.Length > Settings.NickMaxLength || (now - player.lastChatting).TotalSeconds < 1)
         {
             return;
         }
         if (StringFilter.CheckFilterChat(text))
         {
             client.SendPacket(new CLAN_CHAT_1390_PAK("Server", true, "Não é possivel digitar palavras inapropriadas."));
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id == 0)
         {
             return;
         }
         List <Account> players = player.GetClanPlayers(-1);
         using (CLAN_CHAT_1390_PAK packet = new CLAN_CHAT_1390_PAK(player.nickname, player.UseChatGM(), text))
         {
             player.SendPacketForPlayers(packet, players);
         }
         player.lastChatting = now;
         players             = null;
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #8
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.checkUserInfo || player.inventory.items.Count > 0)
         {
             client.SendCompletePacket(PackageDataManager.PROTOCOL_BASE_USER_INFO_ERROR_ACK);
             return;
         }
         player.checkUserInfo = true;
         Clan clan = ClanManager.GetClan(player.clanId);
         player.LoadInventory();
         player.LoadMissionList();
         player.LoadPlayerTitles();
         player.LoadPlayerBonus();
         player.LoadPlayerEvents();
         player.status.SetData(4294967295, player.playerId);
         player.status.UpdateServer(0); //0 = Auth(Ainda não selecionou o servidor) Game = Settings.ServerId
         player.DiscountPlayerItems();
         int dateNow = int.Parse(player.GetDate());
         if (player.pccafe > 0 && dateNow > player.pccafeDate && player.UpdatePccafe(0, 0, 0, 0))
         {
             player.pccafe     = 0;
             player.pccafeDate = 0;
         }
         player.ExecuteQuery($"UPDATE accounts SET last_login='******' WHERE id='{player.playerId}'");
         client.SendPacket(new PROTOCOL_BASE_USER_INFO_ACK(player, clan, dateNow, 0));
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #9
0
 public PROTOCOL_ROOM_GET_SLOTONEINFO_ACK(Account player)
 {
     this.player = player;
     if (this.player != null)
     {
         clan = ClanManager.GetClan(player.clanId);
     }
 }
Пример #10
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (player.clanId == 0 || clan.id == 0 || !(player.clanAuthority >= ClanAuthorityEnum.Master && player.clanAuthority <= ClanAuthorityEnum.Auxiliar || clan.ownerId == player.playerId))
         {
             client.SendCompletePacket(PackageDataManager.CLAN_COMMISSION_REGULAR_2147487833_PAK);
             return;
         }
         for (int i = 0; i < players.Count; i++)
         {
             Account member = AccountManager.GetAccount(players[i], 0);
             if (member != null && member.clanId == clan.id && member.clanAuthority == ClanAuthorityEnum.Auxiliar && member.ExecuteQuery($"UPDATE accounts SET clan_authority='3' WHERE id='{member.playerId}'"))
             {
                 member.clanAuthority = ClanAuthorityEnum.Membro;
                 if (member.GetMessagesCount() < 100)
                 {
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         state      = 1,
                         noteEnum   = NoteMessageClanEnum.Regular
                     };
                     if (message != null && member.InsertMessage(message) && member.isOnline)
                     {
                         //Envia mensagem para o jogador que foi demitido do seu cargo, notificando a demissão.
                         member.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
                 if (member.isOnline)
                 {
                     member.SendCompletePacket(PackageDataManager.CLAN_PRIVILEGES_DEMOTE_PAK);
                 }
                 result++;
             }
         }
         client.SendPacket(new CLAN_COMMISSION_REGULAR_PAK(result));
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
     finally
     {
         players = null;
     }
 }
Пример #11
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         int  result = 0;
         Clan clan   = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && (player.clanAuthority >= ClanAuthorityEnum.Master && player.clanAuthority <= ClanAuthorityEnum.Auxiliar || clan.ownerId == player.playerId))
         {
             for (int i = 0; i < players.Count; i++)
             {
                 Account member = AccountManager.GetAccount(players[i], 0);
                 if (member != null)
                 {
                     if (member.DeleteInvite(clan.id))
                     {
                         if (member.GetMessagesCount() < 100)
                         {
                             Message message = new Message(15)
                             {
                                 senderName = clan.name,
                                 senderId   = player.playerId,
                                 clanId     = clan.id,
                                 type       = 4,
                                 state      = 1,
                                 noteEnum   = NoteMessageClanEnum.InviteDenial
                             };
                             if (message != null && member.InsertMessage(message) && member.isOnline)
                             {
                                 //Envia mensagem para o jogador, notificando que foi rejeitado o alistamento.
                                 member.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                             }
                         }
                         result++;
                     }
                 }
             }
         }
         client.SendPacket(new CLAN_REQUEST_DENIAL_PAK(result));
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
     finally
     {
         players = null;
     }
 }
Пример #12
0
 public override void Write()
 {
     try
     {
         WriteH(3861);
         if (room.GetLeader() == null)
         {
             room.SetNewLeader(-1, 0, room.leaderSlot, false);
         }
         WriteD(room.leaderSlot);
         for (int i = 0; i < 16; i++)
         {
             Slot    slot       = room.slots[i];
             Account playerSlot = room.GetPlayerBySlot(slot);
             if (playerSlot != null)
             {
                 if (i == room.leaderSlot)
                 {
                     room.leaderName = playerSlot.nickname;
                 }
                 Clan clan = ClanManager.GetClan(playerSlot.clanId);
                 WriteC((byte)slot.state);
                 WriteC((byte)playerSlot.GetRank());
                 WriteD(clan.id);
                 WriteD((int)playerSlot.clanAuthority);
                 WriteC(clan.rank);
                 WriteD(clan.logo);
                 WriteC(playerSlot.pccafe);
                 WriteC(playerSlot.tourneyLevel);
                 WriteD((uint)playerSlot.effects);
                 //writeC((byte)pR.effect_1); //Lista de cupons 1 [1 - 90% Colete do BOPE Reforçado || 2 - Ketupat || 4 - 20% Colete Reforçado || 8 - Hollow Point Ammo Plus || 16 - 10% Colete Plus || 32 - 5% HP || 64 - Hollowpoint F. || 128 - Explosivo extra]
                 //writeC((byte)pR.effect_2); //Lista de cupons 2 [1 - C4 Speed || 2 - Hollowpoint || 4 - Bala de Ferro || 8 - 5% Colete || 16 - +1s piscando || 32 - +10% HP || 64 - Recarregamento rápido || 128 - Troca rápida] / [1/2/4/8/16/32/64/128]
                 //writeC((byte)pR.effect_3); //Lista de cupons 3 [1 - Flash Bang Protection || 2 - Receber drop || 4 - +40% de munição || 16 - 30% Respawn || 32 - +50% Respawn || 64 - +100% Respawn || 128 - +10% de munição]  [1/2/4/8/16/32/64/128]
                 //writeC((byte)pR.effect_4); //Lista de cupons 4 [1 - Item especial extra || 4 - Bala de ferro]
                 //writeC((byte)pR.effect_5); //Lista de cupons 5 [2 - Receber drop] - DEAD?
                 WriteS(clan.name, 17);
                 WriteD(0);
                 WriteC(playerSlot.country);
             }
             else
             {
                 WriteC((byte)slot.state);
                 WriteB(PackageDataManager.SLOTINFO);
             }
         }
     }
     catch (Exception ex)
     {
         Logger.Exception(ex);
     }
 }
Пример #13
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (text.Length > 120 || player == null)
         {
             return;
         }
         Clan clan          = ClanManager.GetClan(player.clanId);
         int  playersLoaded = 0;
         if (clan.id > 0 && clan.ownerId == player.playerId)
         {
             List <Account> players = clan.GetPlayers(player.playerId, true);
             for (int i = 0; i < players.Count; i++)
             {
                 Account member = players[i];
                 if ((type == 0 || member.clanAuthority == ClanAuthorityEnum.Master && type == 1 || member.clanAuthority == ClanAuthorityEnum.Auxiliar && type == 2) && member.GetMessagesCount() < 100)
                 {
                     playersLoaded++;
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         text       = text,
                         state      = 1
                     };
                     if (message != null && member.InsertMessage(message) && member.isOnline)
                     {
                         member.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
             }
         }
         client.SendPacket(new CLAN_MSG_FOR_PLAYERS_PAK(playersLoaded));
         if (playersLoaded > 0)
         {
             client.SendCompletePacket(PackageDataManager.BOX_MESSAGE_SEND_PAK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #14
0
 public override void Write()
 {
     WriteH(298);
     WriteD(error);
     if (error == 0)
     {
         WriteD(player.rankId);
         WriteD(Utilities.GetPlayerStatus(player.status, player.isOnline));
         WriteS(ClanManager.GetClan(player.clanId).name, 17);
         WriteD(player.statistics.fights);
         WriteD(player.statistics.fightsWin);
         WriteD(player.statistics.fightsLost);
         WriteD(player.statistics.fightsDraw);
         WriteD(player.statistics.kills);
         WriteD(player.statistics.headshots);
         WriteD(player.statistics.deaths);
         WriteD(player.statistics.totalfights);
         WriteD(player.statistics.totalkills);
         WriteD(player.statistics.escapes);
         WriteD(player.statistics.fights);
         WriteD(player.statistics.fightsWin);
         WriteD(player.statistics.fightsLost);
         WriteD(player.statistics.fightsDraw);
         WriteD(player.statistics.kills);
         WriteD(player.statistics.headshots);
         WriteD(player.statistics.deaths);
         WriteD(player.statistics.totalfights);
         WriteD(player.statistics.totalkills);
         WriteD(player.statistics.escapes);
         WriteD(player.equipments.primary);
         WriteD(player.equipments.secondary);
         WriteD(player.equipments.melee);
         WriteD(player.equipments.grenade);
         WriteD(player.equipments.special);
         WriteD(player.equipments.red);
         WriteD(player.equipments.blue);
         WriteD(player.equipments.helmet);
         WriteD(player.equipments.beret);
         WriteD(player.equipments.dino);
         WriteH(0);
         WriteC(0);
     }
 }
Пример #15
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_LIST_ERROR_PAK);
             return;
         }
         List <Account> clanPlayers = clan.GetPlayers(-1, false);
         using (PacketWriter writer = new PacketWriter())
         {
             int count = 0;
             for (int i = page * 14; i < clanPlayers.Count; i++)
             {
                 Account member = clanPlayers[i];
                 writer.WriteQ(member.playerId);
                 writer.WriteS(member.nickname, 33);
                 writer.WriteC(member.rankId);
                 writer.WriteC((byte)member.clanAuthority);
                 writer.WriteQ(Utilities.GetClanStatus(member.status, member.isOnline));
                 writer.WriteD(member.clanDate);
                 writer.WriteC(member.nickcolor);
                 if (count++ == 14)
                 {
                     break;
                 }
             }
             client.SendPacket(new CLAN_MEMBER_LIST_PAK(page, count, writer.memorystream.ToArray()));
         }
         clanPlayers = null;
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #16
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || text.Length > 200)
         {
             return;
         }
         ClanInvite invite = new ClanInvite
         {
             clanId     = clanId,
             playerId   = player.playerId,
             text       = text,
             inviteDate = int.Parse(DateTime.Now.ToString("yyyyMMdd"))
         };
         if (player.clanId > 0 || player.nickname.Length == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CREATE_INVITE_2147487836_PAK);
         }
         else if (ClanManager.GetClan(clanId).id == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CREATE_INVITE_0x80000000_PAK);
         }
         else if (player.GetInvitesCount(clanId) >= 100)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CREATE_INVITE_2147487831_PAK);
         }
         else if (!player.InsertInvite(invite))
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CREATE_INVITE_2147487848_PAK);
         }
         else
         {
             client.SendPacket(new PROTOCOL_CLAN_CREATE_INVITE_ACK(0, clanId));
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #17
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.nickname.Length < Settings.NickMinLength)
         {
             return;
         }
         Room room = player.room;
         if (room != null)
         {
             room.ChangeSlotState(player.slotId, SlotStateEnum.CLAN, false);
             room.StopCountDown(player.slotId);
             room.UpdateSlotsInfo();
         }
         Clan clan   = ClanManager.GetClan(player.clanId);
         int  clanId = 0;
         if (clan.id == 0)
         {
             clanId = player.GetRequestClanId();
             client.SendPacket(new CLAN_CLIENT_ENTER_PAK(clanId, player.clanAuthority));
         }
         else
         {
             client.SendPacket(new CLAN_CLIENT_ENTER_PAK(clan.id, player.clanAuthority));
         }
         if (clan.id > 0 && clanId == 0)
         {
             //Não precisa do owner != null pois o clan está sendo exibido na lista de clans e quando for obter informações precisa enviar o pacote.
             Account owner = AccountManager.GetAccount(clan.ownerId, 0);
             client.SendPacket(new PROTOCOL_CLAN_DETAIL_INFO_ACK(clan, owner, 0));
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #18
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(clanId);
         if (clan.id > 0)
         {
             //Não precisa do owner != null pois o clan está sendo exibido na lista de clans e quando for obter informações precisa enviar o pacote.
             Account owner = AccountManager.GetAccount(clan.ownerId, 0);
             client.SendPacket(new PROTOCOL_CLAN_DETAIL_INFO_ACK(clan, owner, 1));
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #19
0
 private byte[] GetPlayerListData(int page, ref int count, List <Account> list)
 {
     using (PacketWriter send = new PacketWriter())
     {
         for (int i = page * 10; i < list.Count; i++)
         {
             Account player = list[i];
             Clan    clan   = ClanManager.GetClan(player.clanId);
             send.WriteD(player.GetSessionId());
             send.WriteD(clan.logo);
             send.WriteS(clan.name, 17);
             send.WriteH((short)player.GetRank());
             send.WriteS(player.nickname, 33);
             send.WriteC(player.nickcolor);
             send.WriteC(player.country);
             if (count++ == 10)
             {
                 break;
             }
         }
         return(send.memorystream.ToArray());
     }
 }
Пример #20
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MEMBER_CONTEXT_ERROR_PAK);
         }
         else
         {
             client.SendPacket(new CLAN_MEMBER_CONTEXT_PAK(0, clan.GetClanPlayers()));
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #21
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (ClanManager.CheckNameLengthInvalid(clanName) || !StringFilter.CheckStringFilter(clanName) || ClanManager.IsClanNameExist(clanName).Result)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_NAME_ERROR_ACK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_NAME_SUCCESS_ACK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #22
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (player.clanId == 0 || clan.id == 0 || clan.logo == logo || ClanManager.IsClanLogoExist(logo).Result)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_LOGO_ERROR_ACK);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.CLAN_CHECK_LOGO_SUCCESS_ACK);
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #23
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.clanAuthority != ClanAuthorityEnum.Master)
         {
             client.SendPacket(new CLAN_COMMISSION_MASTER_PAK(0x80000000));
             return;
         }
         Account member = AccountManager.GetAccount(playerId, 0);
         if (member == null || member.clanId != player.clanId)
         {
             client.SendPacket(new CLAN_COMMISSION_MASTER_PAK(0x80000000));
         }
         else if (member.rankId >= Settings.MinRankMasterClan)
         {
             Clan clan = ClanManager.GetClan(player.clanId);
             if (player.clanId > 0 && clan.id > 0 && clan.ownerId == player.playerId && member.clanAuthority == ClanAuthorityEnum.Auxiliar && player.ExecuteQuery($"UPDATE clan_data SET owner_id='{playerId}' WHERE clan_id='{player.clanId}'") &&
                 member.ExecuteQuery($"UPDATE accounts SET clan_authority='1' WHERE id='{playerId}'") &&
                 player.ExecuteQuery($"UPDATE accounts SET clan_authority='2' WHERE id='{player.playerId}'"))
             {
                 member.clanAuthority = ClanAuthorityEnum.Master;
                 player.clanAuthority = ClanAuthorityEnum.Auxiliar;
                 clan.ownerId         = playerId;
                 if (member.GetMessagesCount() < 100)
                 {
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         state      = 1,
                         noteEnum   = NoteMessageClanEnum.Master
                     };
                     if (message != null && member.InsertMessage(message) && member.isOnline)
                     {
                         //Envia mensagem para o jogador promovido para master, notificando do seu novo cargo.
                         member.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
                 if (member.isOnline)
                 {
                     member.SendCompletePacket(PackageDataManager.CLAN_PRIVILEGES_MASTER_PAK);
                 }
                 client.SendPacket(new CLAN_COMMISSION_MASTER_PAK(0));
             }
             else
             {
                 client.SendPacket(new CLAN_COMMISSION_MASTER_PAK(2147487744));
             }
         }
         else
         {
             client.SendPacket(new CLAN_COMMISSION_MASTER_PAK(2147487928));
         }
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #24
0
        private void WriteData()
        {
            List <Account> roomPlayers = room.GetAllPlayers();

            WriteD(room.roomId);
            WriteD(slotId);
            WriteD(room.roomId);
            WriteS(room.roomName, 23);
            WriteH((ushort)room.mapId);
            WriteC(room.stage4vs4);
            WriteC((byte)room.mode);
            WriteC((byte)room.state);
            WriteC((byte)roomPlayers.Count);
            WriteC(room.GetSlotCount());
            WriteC(room.ping);
            WriteC(room.weaponsFlag);
            WriteC(room.randomMap);
            WriteC((byte)room.modeSpecial);
            WriteS(leader.nickname, 33);
            WriteD(room.killtime);
            WriteC(room.limit);
            WriteC(room.seeConf);
            WriteH((ushort)room.balancing);
            WriteS(room.password, 4);
            WriteC((byte)room.countdown.GetTimeLeft());
            WriteD(room.leaderSlot);
            for (int i = 0; i < 16; ++i)
            {
                Slot    slot   = room.slots[i];
                Account player = room.GetPlayerBySlot(slot);
                if (player != null)
                {
                    Clan clan = ClanManager.GetClan(player.clanId);
                    WriteC((byte)slot.state);
                    WriteC((byte)player.GetRank());
                    WriteD(clan.id);
                    WriteD((int)player.clanAuthority);
                    WriteC(clan.rank);
                    WriteD(clan.logo);
                    WriteC(player.pccafe);
                    WriteC(player.tourneyLevel);
                    WriteD((uint)player.effects);
                    WriteS(clan.name, 17);
                    WriteD(0);
                    WriteC(player.country);
                }
                else
                {
                    WriteC((byte)slot.state);
                    WriteB(new byte[10]);
                    WriteD(4294967295);
                    WriteB(new byte[28]);
                }
            }
            WriteC((byte)roomPlayers.Count);
            for (int i = 0; i < roomPlayers.Count; i++)
            {
                Account ac = roomPlayers[i];
                WriteC((byte)ac.slotId);
                WriteC((byte)(ac.nickname.Length + 1));
                WriteS(ac.nickname, ac.nickname.Length + 1);
                WriteC(ac.nickcolor);
            }
            if (room.IsBotMode())
            {
                WriteC(room.aiCount);
                WriteC(room.aiLevel);
            }
        }
Пример #25
0
        public override void RunImplement()
        {
            try
            {
                Account    player  = client.SessionPlayer;
                ItemsModel itemObj = player != null?player.inventory.GetItem(objectId) : null;

                if (itemObj != null)
                {
                    itemId   = itemObj.id;
                    oldCOUNT = itemObj.count;
                    if (itemObj.category == 3 && player.inventory.items.Count >= 500)
                    {
                        client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(0x80001029));
                        Logger.Warning($" [GAME] [PROTOCOL_INVENTORY_ITEM_EQUIP_REQ] Foi atingido o limite de 500 items no inventário. Nick: {player.nickname} Login: {player.login} PlayerId: {player.playerId}");
                        return;
                    }
                    if (itemId == 1301049000)
                    {
                        if (player.UpdateKDReset())
                        {
                            player.statistics.kills  = 0;
                            player.statistics.deaths = 0;
                            client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(player.statistics));
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemId == 1301048000)
                    {
                        if (player.UpdateTotalFights())
                        {
                            player.statistics.fights     = 0;
                            player.statistics.fightsWin  = 0;
                            player.statistics.fightsLost = 0;
                            player.statistics.fightsDraw = 0;
                            client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(player.statistics));
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemId == 1301050000)
                    {
                        if (player.ExecuteQuery($"UPDATE accounts SET fights_escapes='0' WHERE id='{player.playerId}'"))
                        {
                            player.statistics.escapes = 0;
                            client.SendPacket(new BASE_USER_CHANGE_STATS_PAK(player.statistics));
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemId == 1301053000)
                    {
                        Clan clan = ClanManager.GetClan(player.clanId);
                        if (clan.id > 0 && clan.ownerId == player.playerId && clan.UpdateBattlesReset())
                        {
                            clan.partidas = 0;
                            clan.vitorias = 0;
                            clan.derrotas = 0;
                            client.SendPacket(new CLAN_CHANGE_FIGHTS_PAK());
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemId == 1301055000)
                    {
                        Clan clan = ClanManager.GetClan(player.clanId);
                        if (clan.id > 0 && clan.ownerId == player.playerId)
                        {
                            if ((clan.maxPlayers + 50) <= 250 && player.ExecuteQuery($"UPDATE clan_data SET max_players='{clan.maxPlayers + 50}' WHERE clan_id='{player.clanId}'"))
                            {
                                clan.maxPlayers += 50;
                                client.SendPacket(new CLAN_CHANGE_MAX_PLAYERS_PAK(clan.maxPlayers));
                            }
                            else
                            {
                                erro = 0x80001056;
                            }
                        }
                        else
                        {
                            erro = 0x80001056;
                        }
                    }
                    else if (itemId == 1301056000)
                    {
                        Clan clan = ClanManager.GetClan(player.clanId);
                        if (clan.id > 0 && clan.pontos != 1000)
                        {
                            if (player.ExecuteQuery($"UPDATE clan_data SET pontos='{1000.0f}' WHERE clan_id='{player.clanId}'"))
                            {
                                clan.pontos = 1000;
                                client.SendPacket(new CLAN_CHANGE_POINTS_PAK());
                            }
                            else
                            {
                                erro = 0x80001056;
                            }
                        }
                        else
                        {
                            erro = 0x80001056;
                        }
                    }
                    else if (itemId > 1301113000 && itemId < 1301119000)
                    {
                        int goldReceive = itemId == 1301114000 ? 500 : (itemId == 1301115000 ? 1000 : (itemId == 1301116000 ? 5000 : (itemId == 1301117000 ? 10000 : 30000)));
                        if ((player.gold + goldReceive) <= 999999999 && player.ExecuteQuery($"UPDATE accounts SET gold='{player.gold + goldReceive}' WHERE id='{player.playerId}'"))
                        {
                            player.gold += goldReceive;
                            client.SendPacket(new AUTH_GOLD_REWARD_PAK(goldReceive, player.gold, 0));
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemId == 1301999000)
                    {
                        if ((player.exp + 515999) <= 999999999 && player.ExecuteQuery($"UPDATE accounts SET exp='{player.exp + 515999}' WHERE id='{player.playerId}'"))
                        {
                            player.exp += 515999;
                            client.SendPacket(new A_3096_PAK(515999, 0));
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (itemObj.category == 3 && RandomBoxXML.ContainsBox(itemId))
                    {
                        RandomBoxModel box = RandomBoxXML.GetBox(itemId);
                        if (box != null)
                        {
                            List <RandomBoxItem> sortedList = box.GetSortedList(GetRandomNumber(1, 100));
                            List <RandomBoxItem> rewardList = box.GetRewardList(sortedList, GetRandomNumber(0, sortedList.Count));
                            if (rewardList.Count > 0)
                            {
                                byte itemIdx = (byte)rewardList[0].index;
                                client.SendPacket(new AUTH_RANDOM_BOX_REWARD_PAK(itemId, itemIdx));
                                List <ItemsModel> rewards = new List <ItemsModel>();
                                for (int i = 0; i < rewardList.Count; i++)
                                {
                                    RandomBoxItem cupom = rewardList[i];
                                    if (cupom.item != null)
                                    {
                                        rewards.Add(cupom.item);
                                    }
                                    else if (player.UpdateAccountGold(player.gold + cupom.count))
                                    {
                                        player.gold += cupom.count;
                                        client.SendPacket(new AUTH_GOLD_REWARD_PAK(cupom.count, player.gold, 0));
                                    }
                                    else
                                    {
                                        client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                                        break;
                                    }
                                    if (cupom.special)
                                    {
                                        using (AUTH_JACKPOT_NOTICE_PAK packet = new AUTH_JACKPOT_NOTICE_PAK(player.nickname, itemId, itemIdx))
                                        {
                                            GameManager.SendPacketToAllClients(packet);
                                        }
                                    }
                                }
                                if (rewards.Count > 0)
                                {
                                    client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, rewards));
                                }
                                rewards = null;
                            }
                            else
                            {
                                client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                                return;
                            }
                            sortedList = null;
                            rewardList = null;
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                    else if (player.rankId < 31 && (itemId == 1103003001 || itemId == 1103003002 || itemId == 1103003003 || itemId == 1103003004 || itemId == 1103003005))
                    {
                        client.SendPacket(new SERVER_MESSAGE_ANNOUNCE_PAK("Você não tem rank suficiente para equipar esta boina."));
                        return;
                    }
                    else
                    {
                        int wclass = GetIdStatics(itemObj.id, 1);
                        if (wclass <= 11)
                        {
                            if (itemObj.equip == 1)
                            {
                                itemObj.equip = 2;
                                itemObj.count = int.Parse(DateTime.Now.AddSeconds(itemObj.count).ToString("yyMMddHHmm"));
                                player.ExecuteQuery($"UPDATE player_items SET count='{itemObj.count}', equip='{(int)itemObj.equip}' WHERE object_id='{objectId}' AND owner_id='{player.playerId}'");
                            }
                            else
                            {
                                client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                                return;
                            }
                        }
                        else if (wclass == 13)
                        {
                            CupomIncreaseDays(player, itemObj.name);
                        }
                        else if (wclass == 15)
                        {
                            CupomIncreaseGold(player, itemObj.id);
                        }
                        else
                        {
                            client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                            return;
                        }
                    }
                }
                else
                {
                    client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                    return;
                }
                client.SendPacket(new INVENTORY_ITEM_EQUIP_PAK(erro, itemObj, player));
            }
            catch (OverflowException ex)
            {
                Logger.Error($" [PROTOCOL_INVENTORY_ITEM_EQUIP_REQ] [OverflowException] ObjectId: {objectId} ItemId: {itemId} Count na DB: {oldCOUNT} Nick: {client.SessionPlayer.nickname}\r\n" + ex.ToString());
                client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
            }
            catch (Exception ex)
            {
                client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                PacketLog(ex);
            }
        }
Пример #26
0
 public override void RunImplement()
 {
     try
     {
         Account  player = client.SessionPlayer;
         DateTime now    = DateTime.Now;
         if (player == null || player.clanId <= 0 || (now - player.lastClanInvite).TotalSeconds < 1)
         {
             return;
         }
         if (type == 0)
         {
             long    playerId      = (long)objectValue;
             Account playerInvited = AccountManager.GetAccount(playerId, -1);
             if (playerInvited == null)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             if (playerInvited.GetMessagesCount() >= 100)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             Clan    clan    = ClanManager.GetClan(player.clanId);
             Message message = new Message(15)
             {
                 senderName = clan.name,
                 clanId     = clan.id,
                 senderId   = player.playerId,
                 type       = 5,
                 state      = 1,
                 noteEnum   = NoteMessageClanEnum.Invite
             };
             if (message != null && playerInvited.InsertMessage(message))
             {
                 playerInvited.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
             }
             client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_SUCCESS_PAK);
         }
         else if (type == 1)
         {
             Room room = player.room;
             if (room == null)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             int     slotId        = (int)objectValue;
             Account playerInvited = room.GetPlayerBySlot(slotId);
             if (playerInvited == null || !playerInvited.isOnline)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             if (playerInvited.GetMessagesCount() >= 100)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             Clan    clan    = ClanManager.GetClan(player.clanId);
             Message message = new Message(15)
             {
                 senderName = clan.name,
                 clanId     = clan.id,
                 senderId   = player.playerId,
                 type       = 5,
                 state      = 1,
                 noteEnum   = NoteMessageClanEnum.Invite
             };
             if (message != null && playerInvited.InsertMessage(message))
             {
                 playerInvited.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
             }
             client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_SUCCESS_PAK);
         }
         else if (type == 2)
         {
             Channel channel = player.GetChannel();
             if (channel == null)
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                 return;
             }
             int           sessionId = (int)objectValue;
             PlayerSession ps        = channel.GetPlayer(sessionId);
             long          pId       = ps != null ? ps.playerId : -1;
             if (pId != -1 && pId != player.playerId)
             {
                 Account playerInvited = AccountManager.GetAccount(pId, true);
                 if (playerInvited == null || !playerInvited.isOnline)
                 {
                     client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                     return;
                 }
                 if (playerInvited.GetMessagesCount() >= 100)
                 {
                     client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
                     return;
                 }
                 Clan    clan    = ClanManager.GetClan(player.clanId);
                 Message message = new Message(15)
                 {
                     senderName = clan.name,
                     clanId     = clan.id,
                     senderId   = player.playerId,
                     type       = 5,
                     state      = 1,
                     noteEnum   = NoteMessageClanEnum.Invite
                 };
                 if (message != null && playerInvited.InsertMessage(message))
                 {
                     playerInvited.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                 }
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_SUCCESS_PAK);
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_INVITE_0x80000000_PAK);
             }
         }
         player.lastClanInvite = now;
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #27
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null || player.nickname.Length == 0)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(clanId);
         if (clan.id == 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_REQUEST_ACCEPT_2147487835_PAK);
             return;
         }
         if (player.clanId > 0)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_REQUEST_ACCEPT_2147487832_PAK);
             return;
         }
         List <Account> clanPlayers = clan.GetPlayers(-1, true);
         if (clan.maxPlayers <= clanPlayers.Count)
         {
             client.SendCompletePacket(PackageDataManager.CLAN_MESSAGE_REQUEST_ACCEPT_2147487830_PAK);
         }
         else if (type == 0 || type == 1)
         {
             Account owner = AccountManager.GetAccount(clan.ownerId, 0);
             if (owner != null)
             {
                 if (owner.GetMessagesCount() < 100)
                 {
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         text       = player.nickname,
                         state      = 1,
                         noteEnum   = type == 0 ? NoteMessageClanEnum.JoinDenial : NoteMessageClanEnum.JoinAccept
                     };
                     if (message != null && owner.InsertMessage(message) && owner.isOnline)
                     {
                         owner.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
                 if (type == 1)
                 {
                     int date = int.Parse(DateTime.Now.ToString("yyyyMMdd"));
                     if (player.ExecuteQuery($"UPDATE accounts SET clan_id='{clan.id}', clan_authority='3', clan_date='{date}' WHERE id='{player.playerId}'"))
                     {
                         using (CLAN_MEMBER_INFO_INSERT_PAK packet = new CLAN_MEMBER_INFO_INSERT_PAK(player))
                         {
                             player.SendPacketForPlayers(packet, clanPlayers);
                         }
                         player.clanId        = clan.id;
                         player.clanDate      = date;
                         player.clanAuthority = ClanAuthorityEnum.Membro;
                         client.SendPacket(new CLAN_GET_CLAN_MEMBERS_PAK(clanPlayers));
                         Room room = player.room;
                         if (room != null)
                         {
                             room.SendPacketToPlayers(new PROTOCOL_ROOM_GET_SLOTONEINFO_ACK(player, clan));
                         }
                         client.SendPacket(new CLAN_NEW_INFOS_PAK(clan, owner, clanPlayers.Count + 1));
                     }
                     else
                     {
                         client.SendCompletePacket(PackageDataManager.BOX_MESSAGE_SEND_ERROR_0x80000000_PAK);
                     }
                 }
                 client.SendCompletePacket(PackageDataManager.BOX_MESSAGE_SEND_SUCCESS_PAK);
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.BOX_MESSAGE_SEND_ERROR_0x80000000_PAK);
             }
         }
         clanPlayers = null;
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
 }
Пример #28
0
 /// <summary>
 /// Gera efeitos dos cupons na Database.
 /// </summary>
 /// <param name="cuponId">Id do cupom</param>
 /// <param name="cuponDays">Dias do cupom</param>
 /// <param name="player">Jogador</param>
 private void CreateCuponEffects(int cupomId, int cuponDays, Account player)
 {
     if (cupomId == 1201051000)
     {
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && clan.ownerId == player.playerId)
         {
             if (!ClanManager.CheckNameLengthInvalid(txt) && StringFilter.CheckStringFilter(txt) && !ClanManager.IsClanNameExist(txt).Result&& clan.UpdateName(txt).Result)
             {
                 clan.name = txt;
                 List <Account> players = player.GetClanPlayers(-1);
                 using (CLAN_CHANGE_NAME_PAK packet = new CLAN_CHANGE_NAME_PAK(txt))
                 {
                     player.SendPacketForPlayers(packet, players);
                 }
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                 return;
             }
         }
     }
     else if (cupomId == 1201052000)
     {
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && clan.ownerId == player.playerId && !ClanManager.IsClanLogoExist(objetivo).Result&& clan.UpdateLogo(objetivo).Result)
         {
             clan.logo = objetivo;
             List <Account> players = player.GetClanPlayers(-1);
             using (CLAN_CHANGE_LOGO_PAK packet = new CLAN_CHANGE_LOGO_PAK(objetivo))
             {
                 player.SendPacketForPlayers(packet, players);
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else if (cupomId == 1201047000)
     {
         if (!AccountManager.CheckNickLengthInvalid(txt) && StringFilter.CheckStringFilter(txt) && !AccountManager.CheckNicknameExist(txt).Result&& player.UpdateNick(txt).Result)
         {
             player.nickname = txt;
             if (!NickHistoryManager.CreateHistory(player.playerId, player.nickname, txt, "Change nick"))
             {
                 Logger.Warning($" [GAME] [PROTOCOL_INVENTORY_ITEM_EFFECT_REQ] (CuponId: 1201047000) Não foi possivel salvar o histórico de nome. PlayerId: {player.playerId} Nickname: {txt} Motivo: Change nick.");
             }
             if (player.room != null)
             {
                 using (PROTOCOL_ROOM_GET_NICKNAME_ACK packet = new PROTOCOL_ROOM_GET_NICKNAME_ACK(player.slotId, player.nickname, player.nickcolor))
                 {
                     player.room.SendPacketToPlayers(packet);
                 }
             }
             client.SendPacket(new PROTOCOL_AUTH_CHANGE_NICKNAME_ACK(player.nickname));
             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);
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_2147483923_PAK);
             return;
         }
     }
     else if (cupomId == 1200006000)
     {
         if (player.ExecuteQuery($"UPDATE accounts SET nickcolor='{(int)objetivo}' WHERE id='{player.playerId}'"))
         {
             player.nickcolor = (byte)objetivo;
             client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(cupomId, 3, "NameColor [Active]", 2, cuponDays, 0)));
             client.SendPacket(new BASE_2612_PAK(player));
             if (player.room != null)
             {
                 using (PROTOCOL_ROOM_GET_NICKNAME_ACK packet = new PROTOCOL_ROOM_GET_NICKNAME_ACK(player.slotId, player.nickname, player.nickcolor))
                 {
                     player.room.SendPacketToPlayers(packet);
                 }
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else if (cupomId == 1200009000)
     {
         if ((int)objetivo >= 51 || (int)objetivo < player.rankId - 10 || (int)objetivo > player.rankId + 10)
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
         else if (player.ExecuteQuery($"UPDATE player_bonus SET fakerank='{(int)objetivo}' WHERE player_id='{player.playerId}'"))
         {
             player.bonus.fakeRank = (int)objetivo;
             client.SendPacket(new PROTOCOL_BASE_USER_EFFECTS_ACK(info.Length, player.bonus));
             client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(cupomId, 3, "Patente falsa [Active]", 2, cuponDays, 0)));
             if (player.room != null)
             {
                 player.room.UpdateSlotsInfo();
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else if (cupomId == 1200010000)
     {
         if (AccountManager.CheckNickLengthInvalid(txt))
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
         if (StringFilter.CheckStringFilter(txt) && !AccountManager.CheckNicknameExist(txt).Result&& player.UpdateFakeNick().Result&& player.UpdateNick(txt).Result)
         {
             player.bonus.fakeNick = player.nickname;
             player.nickname       = txt;
             if (!NickHistoryManager.CreateHistory(player.playerId, player.nickname, txt, "Change nick false"))
             {
                 Logger.Warning($" [GAME] [PROTOCOL_INVENTORY_ITEM_EFFECT_REQ] (CuponId: 1200010000) Não foi possivel salvar o histórico de nome. PlayerId: {player.playerId} Nickname: {txt} Motivo: Change nick false.");
             }
             client.SendPacket(new PROTOCOL_BASE_USER_EFFECTS_ACK(info.Length, player.bonus));
             client.SendPacket(new PROTOCOL_AUTH_CHANGE_NICKNAME_ACK(player.nickname));
             client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(cupomId, 3, "FakeNick [Active]", 2, cuponDays, 0)));
             Room room = player.room;
             if (room != null)
             {
                 room.UpdateSlotsInfo();
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_2147483923_PAK);
             return;
         }
     }
     else if (cupomId == 1200014000)
     {
         if (player.ExecuteQuery($"UPDATE player_bonus SET sightcolor='{(int)objetivo}' WHERE player_id='{player.playerId}'"))
         {
             player.bonus.sightColor = (short)objetivo;
             client.SendPacket(new PROTOCOL_BASE_USER_EFFECTS_ACK(info.Length, player.bonus));
             client.SendPacket(new PROTOCOL_INVENTORY_ITEM_CREATE_ACK(1, player, new ItemsModel(cupomId, 3, "Cor da mira [Active]", 2, cuponDays, 0)));
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else if (cupomId == 1200005000)
     {
         Clan clan = ClanManager.GetClan(player.clanId);
         if (clan.id > 0 && clan.ownerId == player.playerId && player.ExecuteQuery($"UPDATE clan_data SET color='{(int)objetivo}' WHERE clan_id='{clan.id}'"))
         {
             clan.nameColor = (byte)objetivo;
             client.SendPacket(new CLAN_CHANGE_NAME_COLOR_PAK(clan.nameColor));
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else if (cupomId == 1201085000)
     {
         if (player.room != null)
         {
             Account playerRoom = player.room.GetPlayerBySlot((int)objetivo);
             if (playerRoom != null)
             {
                 client.SendPacket(new PROTOCOL_ROOM_INSPECTPLAYER_ACK(playerRoom));
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
                 return;
             }
         }
         else
         {
             client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
             return;
         }
     }
     else
     {
         Logger.Error("[ITEM_EFFECT] Efeito do cupom não encontrado! Id: " + cupomId);
         client.SendCompletePacket(PackageDataManager.INVENTORY_ITEM_EQUIP_0x80000000_PAK);
         return;
     }
 }
Пример #29
0
        public override void Handle(User usr)
        {
            Subtype type = (Subtype)int.Parse(getBlock(0));

            switch (type)
            {
            case Subtype.CheckForDuplicate:
            {
                string name = getBlock(1).Replace(" ", "");
                if (name.Length > 4)
                {
                    ClanManager.CheckForDuplicate(usr, name);
                }
                break;
            }

            case Subtype.AddClan:
            {
                string name = getBlock(1).Replace(" ", "");
                if (name.Length > 4)
                {
                    ClanManager.AddClan(usr, name);
                }
                break;
            }

            case Subtype.ApplyClan:
            {
                int clanId = int.Parse(getBlock(1));
                if (clanId > 0)
                {
                    string time = DateTime.Now.ToString("dd/MM/yyyy");

                    Clan clan = ClanManager.GetClan(clanId);
                    if (clan != null)
                    {
                        if (clan.ClanUsers.Count >= clan.maxUsers)
                        {
                            return;
                        }

                        ClanPendingUsers pending = new ClanPendingUsers(usr.userId, usr.nickname, usr.exp.ToString(), time);
                        clan.pendingUsers.TryAdd(usr.userId, pending);

                        usr.clan = clan;

                        usr.send(new SP_Clan(SP_Clan.ClanCodes.ApplyClan));

                        if (usr.clan != null)
                        {
                            DB.RunQuery("UPDATE clans_invite SET clanid='" + clanId + "' WHERE userid='" + usr.userId + "'");
                        }
                        else
                        {
                            DB.RunQuery("INSERT INTO clans_invite (userid, clanid) VALUES ('" + usr.userId + "', '" + clanId + "')");
                        }

                        DB.RunQuery("UPDATE users SET clanrank='9', clanid='" + clanId + "' WHERE id='" + usr.userId + "'");
                    }
                }
                break;
            }

            case Subtype.LeaveClan:
            {
                if (usr.clan != null)
                {
                    Clan clan = usr.clan;
                    if (clan.pendingUsers.ContainsKey(usr.userId))
                    {
                        ClanPendingUsers u;
                        clan.pendingUsers.TryRemove(usr.userId, out u);
                    }

                    int clanrank = clan.clanRank(usr);
                    if (clanrank == 2)
                    {
                        foreach (User u in clan.GetUsers())
                        {
                            u.clan = null;
                        }

                        ClanManager.RemoveClan(usr);

                        DB.RunQuery("UPDATE users SET clanid='-1', clanrank='0' WHERE clanid='" + clan.id + "'");
                        DB.RunQuery("DELETE FROM clans WHERE id='" + clan.id + "'");
                    }
                    else
                    {
                        usr.clan = null;

                        if (clanrank == 9)
                        {
                            ClanPendingUsers u;
                            clan.pendingUsers.TryRemove(usr.userId, out u);
                        }
                        else
                        {
                            ClanUsers u;
                            clan.ClanUsers.TryRemove(usr.userId, out u);
                        }

                        usr.send(new SP_Clan(SP_Clan.ClanCodes.LeaveClan));

                        DB.RunQuery("UPDATE users SET clanid='-1', clanrank='0' WHERE id='" + usr.userId + "'");
                        DB.RunQuery("UPDATE clans SET count='" + usr.clan.ClanUsers.Count + "' WHERE id='" + usr.clan.id + "'");
                    }
                }
                break;
            }

            case Subtype.MyClan:
            {
                if (usr.clan == null)
                {
                    return;
                }
                usr.send(new SP_Clan.MyClanInformation(usr));
                break;
            }

            case Subtype.Members:
            {
                if (usr.clan == null)
                {
                    return;
                }
                int page     = int.Parse(getBlock(1));
                int clanrank = usr.clan.clanRank(usr);

                if (page == 1)
                {
                    usr.send(new SP_Clan.UserList.NormalUser(usr.clan));
                }
                else if (page == 2 && (clanrank == 1 || clanrank == 2))
                {
                    usr.send(new SP_Clan.UserList.Pending(usr));
                }

                break;
            }

            case Subtype.SearchClan:
            {
                int         t       = int.Parse(getBlock(1));
                SearchType  subtype = (SearchType)t;
                int         page    = int.Parse(getBlock(1));
                string      key     = getBlock(2);
                List <Clan> list    = new List <Clan>();

                switch (subtype)
                {
                case SearchType.Name:
                {
                    list = new List <Clan>(ClanManager.Clans.Values.Where(c => c != null && c.name.ToLower().Contains(key.ToLower())).ToArray());
                    break;
                }

                case SearchType.Master:
                {
                    list = new List <Clan>(ClanManager.Clans.Values.Where(c => c != null && c.Master.ToLower().Contains(key.ToLower())).ToArray());
                    break;
                }

                default:
                {
                    list = new List <Clan>(ClanManager.Clans.Values.Where(c => c != null && (c.Master.ToLower().Contains(key.ToLower()) || c.name.ToLower().Contains(key.ToLower()))).ToArray());
                    break;
                }
                }

                if (key.Length >= 3)
                {
                    usr.send(new SP_Clan.SearchClan(list));
                }
                else
                {
                    usr.send(new SP_Clan.CheckClan(SP_Clan.CheckClan.ErrorCodes.NotFound));
                }
                break;
            }

            case Subtype.ClanInfo:
            {
                int clanId = int.Parse(getBlock(1));
                if (clanId > 0)
                {
                    Clan clan = ClanManager.GetClan(clanId);
                    if (clan != null)
                    {
                        usr.send(new SP_Clan.UserList.NormalUser(usr, clan));
                    }
                }
                break;
            }

            case Subtype.ChangeAnnDec:
            {
                if (usr.clan == null)
                {
                    return;
                }
                int clanrank = usr.clan.clanRank(usr);
                if (clanrank < 1 || clanrank == 9 || usr.clan == null)
                {
                    return;
                }

                string Message = DB.Stripslash(getBlock(2));

                bool description = getBlock(1) == "0";
                if (description)
                {
                    usr.clan.Description = Message;
                }
                else
                {
                    usr.clan.Announcment = Message;
                }

                // Send query after to let the server be lagfree

                DB.RunQuery("UPDATE clans SET description='" + usr.clan.Description + "', announcment='" + usr.clan.Announcment + "' WHERE id='" + usr.clan.id + "'");
                break;
            }

            case Subtype.JoinAction:
            {
                if (usr.clan == null)
                {
                    return;
                }
                int subtype = int.Parse(getBlock(1));
                int userId  = int.Parse(getBlock(2));

                Clan clan = usr.clan;

                switch (subtype)
                {
                case 0:             // Accept Join
                {
                    if (clan.ClanUsers.Count >= clan.maxUsers)
                    {
                        usr.send(new SP_Chat("SYSTEM", SP_Chat.ChatType.Whisper, "SYSTEM >> No more slot available for the clan, please expand if is possible", usr.sessionId, usr.nickname));
                        return;
                    }

                    string time = DateTime.Now.ToString("dd/MM/yyyy");

                    DataTable dt = DB.RunReader("SELECT * FROM users WHERE id='" + userId + "'");
                    if (dt.Rows.Count > 0)
                    {
                        DataRow row = dt.Rows[0];
                        DB.RunQuery("DELETE FROM clans_invite WHERE userid='" + userId + "'");
                        DB.RunQuery("UPDATE clans SET count='" + clan.ClanUsers.Count + "' WHERE id='" + clan.id + "'");
                        DB.RunQuery("UPDATE users SET clanid='" + clan.id + "', clanrank='0', clanjoindate='" + time + "' WHERE id='" + userId + "'");
                        if (clan.pendingUsers.ContainsKey(userId))
                        {
                            ClanPendingUsers u;
                            clan.pendingUsers.TryRemove(userId, out u);
                        }
                        ClanUsers c = new ClanUsers(userId, row["nickname"].ToString(), row["exp"].ToString(), time, 0);
                        clan.ClanUsers.TryAdd(userId, c);
                    }

                    User user = UserManager.GetUser(userId);
                    if (user != null)
                    {
                        user.clan = clan;
                        clan.Users.TryAdd(userId, user);
                    }

                    ClanPendingUsers cc;
                    if (clan.pendingUsers.ContainsKey(userId))
                    {
                        clan.pendingUsers.TryRemove(userId, out cc);
                    }

                    break;
                }

                case 1:             // Refuse Join
                {
                    DB.RunQuery("DELETE FROM clans_invite WHERE userid='" + userId + "'");
                    DB.RunQuery("UPDATE users SET clanid='-1', clanrank='0' WHERE id='" + userId + "'");
                    User u = UserManager.GetUser(userId);
                    if (u != null)
                    {
                        u.clan = null;
                    }

                    ClanPendingUsers c;
                    if (clan.pendingUsers.ContainsKey(userId))
                    {
                        clan.pendingUsers.TryRemove(userId, out c);
                    }
                    break;
                }
                }

                DB.RunQuery("DELETE FROM clans_invite WHERE userid='" + userId + "'");

                usr.send(new SP_Clan.UserList.Pending(subtype, userId));

                break;
            }

            case Subtype.RankAction:
            {
                if (usr.clan == null)
                {
                    return;
                }
                int subtype  = int.Parse(getBlock(1));
                int userId   = int.Parse(getBlock(2));
                int clanrank = usr.clan.clanRank(usr);
                if (clanrank >= 1)
                {
                    clanrank = 0;
                    switch (subtype)
                    {
                    case 0:
                    {
                        clanrank = 1;
                        DB.RunQuery("UPDATE users SET clanrank='1' WHERE id='" + userId + "'");
                        break;
                    }

                    case 1:
                    {
                        clanrank = 0;
                        DB.RunQuery("UPDATE users SET clanrank='0' WHERE id='" + userId + "'");
                        break;
                    }

                    case 2:
                    {
                        DB.RunQuery("UPDATE users SET clanid='-1', clanrank='0' WHERE id='" + userId + "'");
                        DB.RunQuery("UPDATE clans SET count='" + usr.clan.ClanUsers.Count + "' WHERE id='" + usr.clan.id + "'");
                        User      u2;
                        ClanUsers u;
                        usr.clan.Users.TryRemove(userId, out u2);
                        usr.clan.ClanUsers.TryRemove(userId, out u);
                        break;
                    }
                    }

                    if (subtype != 2)
                    {
                        usr.clan.ClanUsers.Values.Where(s => s.id == userId).First().clanrank = clanrank;
                    }
                    else
                    {
                        User u = UserManager.GetUser(userId);
                        if (u != null)
                        {
                            u.clan = null;
                        }
                    }

                    usr.send(new SP_Clan.Change(subtype, userId));
                }
                break;
            }

            case Subtype.Promote:
            {
                if (usr.clan == null)
                {
                    return;
                }
                int  userId = int.Parse(getBlock(1));
                Clan clan   = usr.clan;

                if (clan != null)
                {
                    DataTable dt = DB.RunReader("SELECT * FROM users WHERE id='" + userId + "'");
                    if (dt.Rows.Count > 0)
                    {
                        DataRow row = dt.Rows[0];
                        if (userId != usr.userId)
                        {
                            DB.RunQuery("UPDATE users SET clanrank='0' WHERE id='" + usr.userId + "'");
                            DB.RunQuery("UPDATE users SET clanrank='2' WHERE id='" + userId + "'");
                            clan.Master    = row["nickname"].ToString();
                            clan.MasterEXP = row["exp"].ToString();
                            clan.ClanUsers.Values.Where(r => string.Compare(r.nickname, clan.Master, true) == 0).First().clanrank  = 2;
                            clan.ClanUsers.Values.Where(r => string.Compare(r.nickname, usr.nickname, true) == 0).First().clanrank = 0;

                            byte[] buffer = (new SP_Chat("ClanSystem", SP_Chat.ChatType.Clan, "ClanSystem >> " + usr.nickname + " passed master to " + clan.Master + " :/", (uint)clan.id, "NULL")).GetBytes();

                            foreach (User u in clan.Users.Values)
                            {
                                u.sendBuffer(buffer);
                            }

                            usr.send(new SP_Clan.Change());
                        }
                    }
                }
                break;
            }

            case Subtype.NickChange:
            {
                if (usr.clan == null)
                {
                    return;
                }
                string newNick = getBlock(1);
                Clan   c       = ClanManager.GetClanByName(newNick);
                if (usr.clan != null)
                {
                    if (c == null)
                    {
                        if (usr.HasItem("CB02"))         //>--- CHG_CLANNICK
                        {
                            DB.RunQuery("UPDATE clans SET name='" + newNick + "' WHERE id='" + usr.clan.id + "'");
                            c.name = newNick;
                            usr.deleteItem("CB02");
                            usr.send(new SP_Clan.Change(usr, true));
                        }
                    }
                    else
                    {
                        usr.send(new SP_Chat("SYSTEM", SP_Chat.ChatType.Whisper, "SYSTEM >> A clan has already this name, please choose another one", usr.sessionId, usr.nickname));
                    }
                }

                break;
            }

            case Subtype.MarkChange:
            {
                if (usr.clan == null)
                {
                    return;
                }
                uint iconID = uint.Parse(getBlock(1));
                if (usr.HasItem("CB54") && usr.clan != null)         //>--- CHG_CLANMARK
                {
                    DB.RunQuery("UPDATE clans SET iconid='" + iconID + "' WHERE id='" + usr.clan.id + "'");
                    usr.clan.iconid = iconID;

                    usr.deleteItem("CB54");
                    usr.send(new SP_Clan.Change(usr, false));
                }
                break;
            }

            case Subtype.DisbandClan:
            {
                if (usr.clan == null)
                {
                    return;
                }
                ClanManager.RemoveClan(usr);
                break;
            }

            case Subtype.NewSearchClan:
            {
                int         page     = int.Parse(getBlock(1));
                int         sortType = int.Parse(getBlock(2));
                List <Clan> clans    = new List <Clan>();

                switch (sortType)
                {
                case 0:             // By rank desc
                {
                    clans = ClanManager.Clans.Values.OrderByDescending(r => r.exp).Skip(page * 10).Take(10).ToList();
                    break;
                }

                case 1:             // By rank asc
                {
                    clans = ClanManager.Clans.Values.OrderBy(r => r.exp).Skip(page * 10).Take(10).ToList();
                    break;
                }
                }

                usr.send(new SP_Clan.SearchClan(page, sortType, clans));
                break;
            }

            default:
            {
                Log.WriteError("Unknown Clan Subtype " + (int)Subtype.DisbandClan);
                break;
            }
            }
        }
Пример #30
0
 public override void RunImplement()
 {
     try
     {
         Account player = client.SessionPlayer;
         if (player == null)
         {
             return;
         }
         Clan clan = ClanManager.GetClan(player.clanId);
         if (player.clanId == 0 || clan.id == 0 || !(player.clanAuthority >= ClanAuthorityEnum.Master && player.clanAuthority <= ClanAuthorityEnum.Auxiliar || clan.ownerId == player.playerId))
         {
             client.SendCompletePacket(PackageDataManager.CLAN_DEPORTATION_2147487833_PAK);
             return;
         }
         List <Account> clanPlayers = clan.GetPlayers(-1, true);
         for (int i = 0; i < players.Count; i++)
         {
             Account member = AccountManager.GetAccount(players[i], 0);
             if (member != null && member.clanId == clan.id && member.match == null && member.ExecuteQuery($"UPDATE accounts SET clan_id='0', clan_authority='0', clan_fights='0', clan_wins='0' WHERE id='{member.playerId}'"))
             {
                 using (PROTOCOL_CLAN_MEMBER_LEAVE_ACK packet = new PROTOCOL_CLAN_MEMBER_LEAVE_ACK(member.playerId))
                 {
                     member.SendPacketForPlayers(packet, clanPlayers, member.playerId);
                 }
                 member.clanId        = 0;
                 member.clanAuthority = ClanAuthorityEnum.None;
                 lock (member.clanPlayers)
                 {
                     member.clanPlayers.Clear();
                 }
                 if (member.GetMessagesCount() < 100)
                 {
                     Message message = new Message(15)
                     {
                         senderName = clan.name,
                         senderId   = player.playerId,
                         clanId     = clan.id,
                         type       = 4,
                         state      = 1,
                         noteEnum   = NoteMessageClanEnum.Deportation
                     };
                     if (message != null && member.InsertMessage(message) && member.isOnline)
                     {
                         //Envia mensagem para o jogador que foi expulso do clã, notificando a expulsão.
                         member.SendPacket(new BOX_MESSAGE_RECEIVE_PAK(message));
                     }
                 }
                 if (member.isOnline)
                 {
                     member.SendCompletePacket(PackageDataManager.CLAN_PRIVILEGES_KICK_PAK);
                 }
                 result++;
                 clanPlayers.Remove(member);
             }
             else
             {
                 client.SendCompletePacket(PackageDataManager.CLAN_DEPORTATION_2147487833_PAK);
                 break;
             }
         }
         client.SendPacket(new CLAN_DEPORTATION_PAK(result));
     }
     catch (Exception ex)
     {
         PacketLog(ex);
     }
     finally
     {
         players = null;
     }
 }