public static void Evaluate(UserObject userobj, ProtoMessage msg, AresTCPPacketReader packet, uint time) { UserPool.Broadcast(AresTcpPackets.NoSuch(msg.ToString())); if (!userobj.LoggedIn) { if (msg > ProtoMessage.MSG_CHAT_CLIENT_LOGIN) { throw new Exception(); } } switch (msg) { case ProtoMessage.MSG_CHAT_CLIENT_LOGIN: Login(userobj, packet, time); break; case ProtoMessage.MSG_CHAT_CLIENT_PUBLIC: PublicText(userobj, packet); break; case ProtoMessage.MSG_CHAT_CLIENT_AVATAR: Avatar(userobj, packet); break; case ProtoMessage.MSG_CHAT_CLIENT_PERSONAL_MESSAGE: String text = packet.ReadString(); if (ServerEvents.OnPersonalMessage(userobj, text)) { userobj.PersonalMessage = text; } break; case ProtoMessage.MSG_CHAT_CLIENT_UPDATE_STATUS: break; case ProtoMessage.MSG_CHAT_SERVER_UPDATE_USER_STATUS: userobj.LastFastPing = time; AresTcpPackets.UpdateUserStatus(userobj, userobj); break; case ProtoMessage.MSG_CHAT_CLIENT_COMMAND: //Command(userobj, packet.ReadString()); break; } }
private static void PublicText(UserObject userobj, AresTCPPacketReader packet) { String text = packet.ReadString(); //UserPool.Users.ForEach(x => { x.SendPacket(AresTcpPackets.Public(userobj.Name, text)); }); UserPool.Users.ForEach(x => { if (x.LoggedIn && x.Vroom == userobj.Vroom) { if (!x.Ignores.Contains(userobj.Name)) { x.SendPacket(AresTcpPackets.NoSuch(userobj.Avatar.Length.ToString())); if (String.IsNullOrEmpty(userobj.CustomName)) { x.SendPacket(AresTcpPackets.Public(userobj.Name, text)); } else { x.SendPacket(AresTcpPackets.NoSuch(userobj.CustomName + text)); } } } }); }