public void SendModerationAlert(string AlertMessage, bool IsCaution) { ServerMessage Message = IsCaution ? HotelManagerNotificationComposer.Compose("Caution from moderator:\n\n" + AlertMessage) : NotificationMessageComposer.Compose("Notification from staff:\n\n" + AlertMessage); lock (mActorSyncRoot) { foreach (RoomActor Actor in mActors.Values) { if (Actor.Type == RoomActorType.AiBot) { continue; } Session TargetSession = SessionManager.GetSessionByCharacterId(Actor.ReferenceId); if (TargetSession == null) { continue; } TargetSession.SendData(Message); if (IsCaution) { TargetSession.CharacterInfo.ModerationCautions++; } } } }
private static void CautionUser(Session Session, ClientMessage Message) { if (!Session.HasRight("moderation_tool")) { return; } uint UserId = Message.PopWiredUInt32(); string MessageText = Message.PopString(); Session TargetSession = SessionManager.GetSessionByCharacterId(UserId); if (TargetSession != null) { TargetSession.SendData(HotelManagerNotificationComposer.Compose("Caution from moderator:\n\n" + MessageText)); ModerationTicketManager.MarkTicketRespondedToForUser(UserId); } else { Session.SendData(NotificationMessageComposer.Compose("That user is not online at this point in time.")); } CharacterInfo Info = (TargetSession != null ? TargetSession.CharacterInfo : null); using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { if (Info == null) { Info = CharacterInfoLoader.GetCharacterInfo(MySqlClient, UserId); } if (Info != null) { Info.ModerationCautions++; } ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent caution to user", "User " + TargetSession.CharacterInfo.Username + " (ID " + TargetSession.CharacterId + "): '" + MessageText + "'."); MySqlClient.SetParameter("userid", TargetSession.CharacterInfo.Id); MySqlClient.SetParameter("modid", Session.CharacterId); MySqlClient.SetParameter("timestamp", UnixTimestamp.GetCurrent()); MySqlClient.SetParameter("value", MessageText); MySqlClient.ExecuteNonQuery("INSERT INTO user_cautions (moderator_id,user_id,value,timestamp) VALUES (@modid,@userid,@value,@timestamp)"); } }
private static void CautionUser(Session Session, ClientMessage Message) { if (!Session.HasRight("moderation_tool")) { return; } uint UserId = Message.PopWiredUInt32(); string MessageText = Message.PopString(); Session TargetSession = SessionManager.GetSessionByCharacterId(UserId); if (TargetSession != null) { TargetSession.SendData(HotelManagerNotificationComposer.Compose("Caution from moderator:\n\n" + MessageText)); ModerationTicketManager.MarkTicketRespondedToForUser(UserId); } else { Session.SendData(NotificationMessageComposer.Compose("That user is not online at this point in time.")); } CharacterInfo Info = (TargetSession != null ? TargetSession.CharacterInfo : null); using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient()) { if (Info == null) { Info = CharacterInfoLoader.GetCharacterInfo(MySqlClient, UserId); } if (Info != null) { Info.ModerationCautions++; } ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent caution to user", "User " + TargetSession.CharacterInfo.Username + " (ID " + TargetSession.CharacterId + "): '" + MessageText + "'."); } }