コード例 #1
0
        private static void GetTicketChatlog(Session Session, ClientMessage Message)
        {
            if (!Session.HasRight("moderation_tool"))
            {
                return;
            }

            ModerationTicket Ticket = ModerationTicketManager.GetTicket(Message.PopWiredUInt32());

            if (Ticket == null || Ticket.ModeratorUserId != Session.CharacterId)
            {
                Session.SendData(NotificationMessageComposer.Compose("Ticket not found or ticket is not assigned to you."));
                return;
            }

            RoomInfo Info = null;

            if (Ticket.RoomId > 0)
            {
                Info = RoomInfoLoader.GetRoomInfo(Ticket.RoomId);
            }

            Session.SendData(ModerationTicketChatlogsComposer.Compose(Ticket, Info, ModerationLogs.GetLogsForRoom(Ticket.RoomId,
                                                                                                                  (Ticket.CreatedTimestamp - 600), UnixTimestamp.GetCurrent())));
        }
コード例 #2
0
        private static void MessageUser(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)
            {
                Session.SendData(NotificationMessageComposer.Compose("That user is not online at this point in time."));
                return;
            }

            TargetSession.SendData(NotificationMessageComposer.Compose("Notification from staff:\n\n" + MessageText));
            ModerationTicketManager.MarkTicketRespondedToForUser(UserId);

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogModerationAction(MySqlClient, Session, "Sent message to user",
                                                   "User " + TargetSession.CharacterInfo.Username + " (ID " + TargetSession.CharacterId + "): '" +
                                                   MessageText + "'.");
            }
        }
コード例 #3
0
        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)");
            }
        }
コード例 #4
0
        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 + "'.");
            }
        }