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); } }
public override void RunImplement() { try { Account player = client.SessionPlayer; DateTime now = DateTime.Now; if (player == null || type < ChattingTypeEnum.All || type > ChattingTypeEnum.Clan_Member_Page || text.Length > 60 || player.nickname.Length < Settings.NickMinLength || player.nickname.Length > Settings.NickMaxLength || (now - player.lastChatting).TotalSeconds < 1) { return; } Room room = player.room; Slot sender = null; if (type == ChattingTypeEnum.Team) { if (room == null) { return; } Logger.ChatAll($"[{player.nickname}] [Team] {text}"); if (StringFilter.CheckFilterChat(text)) { client.SendPacket(new LOBBY_CHATTING_PAK("Server", player.GetSessionId(), 0, true, "Não é possivel digitar palavras inapropriadas.")); return; } sender = room.slots[player.slotId]; int[] array = room.GetTeamArray(sender.teamId); using (PROTOCOL_ROOM_CHATTING_ACK packet = new PROTOCOL_ROOM_CHATTING_ACK((int)type, sender.Id, player.UseChatGM(), text)) { byte[] data = packet.GetCompleteBytes("CHAT_NORMAL_REQ-1"); lock (room.slots) { for (int i = 0; i < array.Length; i++) { Slot receiver = room.slots[array[i]]; Account playerSlot = room.GetPlayerBySlot(receiver); if (playerSlot != null && SlotValidMessage(sender, receiver)) { playerSlot.SendCompletePacket(data); } } } } } else if (type == ChattingTypeEnum.All || type == ChattingTypeEnum.Lobby) { if (room != null) { Logger.ChatAll($"[{player.nickname}] [Room] (Id: {room.roomId}) {text}"); if (ServerCommands(player, room)) { client.SendPacket(new PROTOCOL_ROOM_CHATTING_ACK((int)type, player.slotId, true, text)); return; } if (StringFilter.CheckFilterChat(text)) { client.SendPacket(new LOBBY_CHATTING_PAK("Server", player.GetSessionId(), 0, true, "Não é possivel digitar palavras inapropriadas.")); return; } sender = room.slots[player.slotId]; using (PROTOCOL_ROOM_CHATTING_ACK packet = new PROTOCOL_ROOM_CHATTING_ACK((int)type, sender.Id, player.UseChatGM(), text)) { byte[] data = packet.GetCompleteBytes("CHAT_NORMAL_REQ-2"); lock (room.slots) { for (int i = 0; i < 16; i++) { Slot receiver = room.slots[i]; Account playerSlot = room.GetPlayerBySlot(receiver); if (playerSlot != null && SlotValidMessage(sender, receiver)) { playerSlot.SendCompletePacket(data); } } } } } else { Channel channel = player.GetChannel(); if (channel == null) { return; } Logger.ChatAll($"[{player.nickname}] [Lobby] {text}"); ApiManager.SendPacketToAllClients(new API_CHANNEL_CHATTING_ACK(player, text)); if (ServerCommands(player, room)) { client.SendPacket(new LOBBY_CHATTING_PAK(player, text, true)); return; } if (StringFilter.CheckFilterChat(text)) { client.SendPacket(new LOBBY_CHATTING_PAK("Server", player.GetSessionId(), 0, true, "Não é possivel digitar palavras inapropriadas.")); return; } using (LOBBY_CHATTING_PAK packet = new LOBBY_CHATTING_PAK(player, text)) { channel.SendPacketToWaitPlayers(packet); } } } player.lastChatting = now; } catch (Exception ex) { PacketLog(ex); } }