Exemple #1
0
 static DB()
 {
     ActiveEvents        = new ActiveEvents();
     ActiveGiveaways     = new ActiveGiveaways();
     BackgroundInventory = new BackgroundInventory();
     Cooldowns           = new Cooldowns();
     Events             = new Database.Events();
     EventLogs          = new EventLogs();
     EventSchedule      = new EventSchedule();
     GiveawayLogs       = new GiveawayLogs();
     Giveaways          = new Giveaways();
     Inventory          = new Inventory();
     LeagueData         = new LeagueData();
     Mappings           = new Mappings();
     ModerationLogs     = new ModerationLogs();
     PendingUsers       = new PendingUsers();
     ProfileBackgrounds = new ProfileBackgrounds();
     Rewards            = new Rewards();
     RoleInventory      = new RoleInventory();
     Roles        = new Roles();
     Settings     = new Settings();
     Statistics   = new Statistics();
     Streamers    = new Streamers();
     SystemTimers = new SystemTimers();
     TempRoles    = new TempRoles();
     Toxicity     = new Toxicity();
     Users        = new Users();
 }
Exemple #2
0
        public void Chat(string MessageText, bool Shout = false, bool CanOverrideRoomMute = false)
        {
            if (mIsLeavingRoom && mForcedLeave)
            {
                return;
            }

            Unidle();

            if (mInstance.RoomMuted && !CanOverrideRoomMute)
            {
                return;
            }

            mInstance.BroadcastChatMessage(this, MessageText, Shout, ChatEmotions.GetEmotionForText(MessageText));

            if (mType == RoomActorType.UserCharacter)
            {
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogChatMessage(MySqlClient, mReferenceId, mInstance.RoomId, "(" + (Shout ? "Shout" : "Say") + ") " + MessageText);
                    IncrecementAntiSpam(MySqlClient);
                }
            }
        }
Exemple #3
0
        public void Whisper(string MessageText, uint TargetUserId, bool CanOverrideRoomMute = false)
        {
            if (mIsLeavingRoom && mForcedLeave)
            {
                return;
            }

            Unidle();

            if (mInstance.RoomMuted && !CanOverrideRoomMute)
            {
                return;
            }

            ServerMessage Message = RoomChatComposer.Compose(Id, MessageText, 0, ChatType.Whisper);

            if (Type == RoomActorType.UserCharacter)
            {
                Session Session = SessionManager.GetSessionByCharacterId(mReferenceId);

                if (Session != null)
                {
                    Session.SendData(Message);
                }
            }

            string LogTargetName = "Unknown User";

            if (TargetUserId != mReferenceId)
            {
                RoomActor TargetActor = mInstance.GetActorByReferenceId(TargetUserId);

                if (TargetActor == null || TargetActor.Type != RoomActorType.UserCharacter)
                {
                    return;
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(TargetActor.ReferenceId);

                if (TargetSession != null)
                {
                    if (!TargetSession.IgnoreCache.UserIsIgnored(this.ReferenceId))
                    {
                        TargetSession.SendData(Message);
                    }

                    LogTargetName = TargetSession.CharacterInfo.Username;
                }
            }

            if (mType == RoomActorType.UserCharacter)
            {
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogChatMessage(MySqlClient, mReferenceId, mInstance.RoomId, "(Whisper to " + LogTargetName + ") " + MessageText);
                    IncrecementAntiSpam(MySqlClient);
                }
            }
        }
Exemple #4
0
        private static void GetRoomObjects(Session Session, ClientMessage Message)
        {
            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.AbsoluteRoomId);

            if (Instance == null || Session.RoomJoined || !Session.RoomAuthed) // if instance not found, or user already joined us, OR if the user isn't authed in the first place, let's gtfo
            {
                return;
            }

            Instance.SendObjects(Session);

            if (!Instance.AddUserToRoom(Session))
            {
                RoomManager.RemoveUserFromRoom(Session);
                return;
            }

            Session.RoomAuthed = true;
            Session.RoomJoined = true;

            ModerationLogs.LogRoomEntry(Session.CharacterId, Instance.RoomId);
            MessengerHandler.MarkUpdateNeeded(Session, 0, false);

            Session.SendData(RoomWallsStatusComposer.Compose(Instance.Info.HideWalls, Instance.Info.WallThickness, Instance.Info.FloorThickness));
            Session.SendData(RoomInfoRightsComposer.Compose(Instance.Info.Type == RoomType.Flat, Instance.RoomId,
                                                            (Instance.Info.Type == RoomType.Flat && Instance.CheckUserRights(Session, true)), Instance.Info.PubInternalName));

            /*if (Instance.Info.Type == RoomType.Flat)
             * {
             *  Session.SendData(RoomInfoComposer.Compose(Instance.Info, true));
             * }*/

            if (Session.CharacterInfo.IsMuted)
            {
                Session.SendData(RoomMutedComposer.Compose((int)Session.CharacterInfo.MutedSecondsLeft));
            }

            if (Instance.Info.OwnerId != Session.CharacterId)
            {
                QuestManager.ProgressUserQuest(Session, QuestType.SOCIAL_VISIT);
            }

            if (Session.QuestCache.CurrentQuestId > 0)
            {
                Quest Quest = QuestManager.GetQuest(Session.QuestCache.CurrentQuestId);

                if (Quest != null)
                {
                    Session.SendData(QuestStartedComposer.Compose(Session, Quest));
                }
            }
        }
        private static void OnInvite(Session Session, ClientMessage Message)
        {
            int         Count   = Message.PopWiredInt32();
            List <uint> Targets = new List <uint>();

            for (int i = 0; (i < Count && i < 50); i++)
            {
                Targets.Add(Message.PopWiredUInt32());
            }

            string MessageText = UserInputFilter.FilterString(Message.PopString());

            if (MessageText.Length > 121)
            {
                MessageText = MessageText.Substring(0, 121);
            }

            List <Session> Users = new List <Session>();

            foreach (uint UserId in Targets)
            {
                if (!Session.MessengerFriendCache.Friends.Contains(UserId))
                {
                    continue;
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

                if (TargetSession == null)
                {
                    continue;
                }

                Users.Add(TargetSession);

                TargetSession.SendData(MessengerImInviteComposer.Compose(Session.CharacterId, Wordfilter.Filter(MessageText)));
            }

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                String to = "";
                foreach (Session User in Users)
                {
                    to += User.CharacterInfo.Username + " [" + User.CharacterId + "], ";
                }
                to = to.Substring(0, to.Length - 2);
                ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(INVITATION to " + to + ") " + MessageText);
            }
        }
        private static void OnSendIm(Session Session, ClientMessage Message)
        {
            uint   UserId = Message.PopWiredUInt32();
            string Text   = UserInputFilter.FilterString(Message.PopString()).Trim();

            if (UserId <= 0 || Text.Length < 1)
            {
                return;
            }

            if (Session.CharacterInfo.IsMuted)
            {
                Session.SendData(MessengerImErrorComposer.Compose(4, UserId));
                return;
            }

            if (!Session.MessengerFriendCache.Friends.Contains(UserId))
            {
                Session.SendData(MessengerImErrorComposer.Compose(6, UserId));
                return;
            }

            Session TargetSession = SessionManager.GetSessionByCharacterId(UserId);

            if (TargetSession == null)
            {
                Session.SendData(MessengerImErrorComposer.Compose(5, UserId));
                return;
            }

            if (TargetSession.CharacterInfo.IsMuted)
            {
                Session.SendData(MessengerImErrorComposer.Compose(3, UserId));
            }

            TargetSession.SendData(MessengerImMessageComposer.Compose(Session.CharacterId, Wordfilter.Filter(Text)));

            using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
            {
                ModerationLogs.LogChatMessage(MySqlClient, Session.CharacterId, 0, "(MESSAGE to " + TargetSession.CharacterInfo.Username + " [" + TargetSession.CharacterId + "]) " + Text);
            }
        }
Exemple #7
0
        public static bool HandleCommand(Session Session, string Input)
        {
            Input = Input.Substring(1, Input.Length - 1);
            string[] Bits = Input.Split(' ');

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
            RoomActor    Actor    = (Instance == null ? null : Instance.GetActorByReferenceId(Session.CharacterId));

            switch (Bits[0].ToLower())
            {
            case "commands":
            {
                Session.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.commands.info") + ":\n\n:commands\n:online\n:about\n:pickall"));
                return(true);
            }

            case "update_catalog":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Snowlight.Game.Catalog.CatalogManager.RefreshCatalogData(MySqlClient);
                }
                Session.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.updatecatalog.success")));
                return(true);
            }

            case "online":
            {
                List <string> OnlineUsers = SessionManager.ConnectedUserData.Values.ToList();
                StringBuilder MessageText = new StringBuilder((string)LangManager.GetValue("command.online.part1") + " " + OnlineUsers.Count + " " + (string)LangManager.GetValue("command.online.part2") + "\n");

                foreach (string OnlineUser in OnlineUsers)
                {
                    MessageText.Append('\n');
                    MessageText.Append("- " + OnlineUser);
                }

                Session.SendData(NotificationMessageComposer.Compose(MessageText.ToString()));
                return(true);
            }

            case "superkick":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.invalidsyntax") + " - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string  Username      = UserInputFilter.FilterString(Bits[1].Trim());
                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' is offline or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                SessionManager.StopSession(TargetSession.Id);

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Superkicked user from server (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "kick":
            {
                if (!Session.HasRight("moderation_tool"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.invalidsyntax") + " - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string  Username      = UserInputFilter.FilterString(Bits[1].Trim());
                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' is offline, not in a room, or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                RoomManager.RemoveUserFromRoom(TargetSession, true);
                TargetSession.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.kick.success")));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Kicked user from room (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "roomunmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Instance.RoomMuted)
                {
                    Instance.RoomMuted = false;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.roomunmute.success"), 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.roomunmute.error"), 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "roommute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (!Instance.RoomMuted)
                {
                    Instance.RoomMuted = true;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.roommute.success"), 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.roommute.error"), 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "unmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.invalidsyntax") + " - :unmute <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string Username = UserInputFilter.FilterString(Bits[1].Trim());

                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' " + (string)LangManager.GetValue("command.cannotproceedcmd3"), 0, ChatType.Whisper));
                    return(true);
                }

                if (!TargetSession.CharacterInfo.IsMuted)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' " + (string)LangManager.GetValue("command.unmute.error"), 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Unmute(MySqlClient);
                }

                TargetSession.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.unmute.sucess")));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' " + (string)LangManager.GetValue("command.unmute.sucess2"), 0, ChatType.Whisper));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "mute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.invalidsyntax") + " - :mute <username> [length in seconds]", 0, ChatType.Whisper));
                    return(true);
                }

                string Username   = UserInputFilter.FilterString(Bits[1].Trim());
                int    TimeToMute = 0;

                if (Bits.Length >= 3)
                {
                    int.TryParse(Bits[2], out TimeToMute);
                }

                if (TimeToMute <= 0)
                {
                    TimeToMute = 300;
                }

                if (TimeToMute > 3600)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.mute.error"), 0, ChatType.Whisper));
                    return(true);
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("mute"))
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.targetuser") + " '" + Username + "' " + (string)LangManager.GetValue("command.cannotproceedcmd4"), 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Mute(MySqlClient, TimeToMute);
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " + TimeToMute + " seconds.");
                }

                TargetSession.SendData(RoomMutedComposer.Compose(TimeToMute));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, (string)LangManager.GetValue("command.mute.sucess.part1") + " '" + Username + "' " + (string)LangManager.GetValue("command.mute.sucess.part2") + " " + TimeToMute + " seconds.", 0, ChatType.Whisper));
                return(true);
            }

            case "clipping":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Actor.OverrideClipping = !Actor.OverrideClipping;
                Actor.ApplyEffect(Actor.ClippingEnabled ? 0 : 23);
                Session.CurrentEffect = 0;
                return(true);

            case "about":

                Session.SendData(UserAlertModernComposer.Compose("Powered by Snowlight", "This hotel is proudly powered by Snowlight, the premium open-source Habbo Hotel emulator.\n\nhttp://www.meth0d.org/snowlight"));
                return(true);

            case "t":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Session.SendData(NotificationMessageComposer.Compose("Position: " + Actor.Position.ToString() + ", Rotation: " + Actor.BodyRotation));
                return(true);

            case "emptyinv":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Session.InventoryCache.ClearAndDeleteAll();
                Session.SendData(InventoryRefreshComposer.Compose());
                Session.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.emptyinv.sucess")));
                return(true);

            case "pickall":

                if (!Instance.CheckUserRights(Session, true))
                {
                    Session.SendData(NotificationMessageComposer.Compose((string)LangManager.GetValue("command.pickall.error")));
                    return(true);
                }

                Instance.PickAllToUserInventory(Session);
                return(true);
            }

            return(false);
        }
Exemple #8
0
        public static bool HandleCommand(Session Session, string Input)
        {
            Input = Input.Substring(1, Input.Length - 1);
            string[] Bits = Input.Split(' ');

            RoomInstance Instance = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
            RoomActor    Actor    = (Instance == null ? null : Instance.GetActorByReferenceId(Session.CharacterId));

            switch (Bits[0].ToLower())
            {
            case "commands":
            {
                Session.SendData(NotificationMessageComposer.Compose("The following commands are available to regular users:\n\n:commands\n:online\n:about\n:pickall"));
                return(true);
            }

            case "online":
            {
                List <string> OnlineUsers = SessionManager.ConnectedUserData.Values.ToList();
                StringBuilder MessageText = new StringBuilder("There are currently " + OnlineUsers.Count + " user(s) online:\n");

                foreach (string OnlineUser in OnlineUsers)
                {
                    MessageText.Append('\n');
                    MessageText.Append("- " + OnlineUser);
                }

                Session.SendData(NotificationMessageComposer.Compose(MessageText.ToString()));
                return(true);
            }

            case "superkick":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string  Username      = UserInputFilter.FilterString(Bits[1].Trim());
                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' is offline or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                SessionManager.StopSession(TargetSession.Id);

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Superkicked user from server (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "kick":
            {
                if (!Session.HasRight("moderation_tool"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string  Username      = UserInputFilter.FilterString(Bits[1].Trim());
                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' is offline, not in a room, or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                RoomManager.RemoveUserFromRoom(TargetSession, true);
                TargetSession.SendData(NotificationMessageComposer.Compose("You have been kicked from the room by a community staff member."));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Kicked user from room (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "roomunmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Instance.RoomMuted)
                {
                    Instance.RoomMuted = false;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "The current room has been unmuted successfully.", 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "This room is not muted.", 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "roommute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (!Instance.RoomMuted)
                {
                    Instance.RoomMuted = true;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "The current room has been muted successfully.", 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "This room is already muted.", 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "unmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :unmute <username>", 0, ChatType.Whisper));
                    return(true);
                }

                string Username = UserInputFilter.FilterString(Bits[1].Trim());

                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' does not exist or is not online.", 0, ChatType.Whisper));
                    return(true);
                }

                if (!TargetSession.CharacterInfo.IsMuted)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' is not muted.", 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Unmute(MySqlClient);
                }

                TargetSession.SendData(NotificationMessageComposer.Compose("You have been unmuted. Please reload the room."));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' was successfully unmuted.", 0, ChatType.Whisper));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "mute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :mute <username> [length in seconds]", 0, ChatType.Whisper));
                    return(true);
                }

                string Username   = UserInputFilter.FilterString(Bits[1].Trim());
                int    TimeToMute = 0;

                if (Bits.Length >= 3)
                {
                    int.TryParse(Bits[2], out TimeToMute);
                }

                if (TimeToMute <= 0)
                {
                    TimeToMute = 300;
                }

                if (TimeToMute > 3600)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "The maximum mute time is one hour.", 0, ChatType.Whisper));
                    return(true);
                }

                Session TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(Username));

                if (TargetSession == null || TargetSession.HasRight("mute"))
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Target user '" + Username + "' does not exist, is not online, or cannot be muted.", 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Mute(MySqlClient, TimeToMute);
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " + TimeToMute + " seconds.");
                }

                TargetSession.SendData(RoomMutedComposer.Compose(TimeToMute));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, "User '" + Username + "' has been muted successfully for " + TimeToMute + " seconds.", 0, ChatType.Whisper));
                return(true);
            }

            case "clipping":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Actor.OverrideClipping = !Actor.OverrideClipping;
                Actor.ApplyEffect(Actor.ClippingEnabled ? 0 : 23);
                Session.CurrentEffect = 0;
                return(true);

            case "about":

                Session.SendData(UserAlertModernComposer.Compose("Powered by Snowlight", "This hotel is proudly powered by Snowlight, the premium open-source Habbo Hotel emulator.\n\nhttp://www.meth0d.org/snowlight"));
                return(true);

            case "t":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Session.SendData(NotificationMessageComposer.Compose("Position: " + Actor.Position.ToString() + ", Rotation: " + Actor.BodyRotation));
                return(true);

            case "emptyinv":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Session.InventoryCache.ClearAndDeleteAll();
                Session.SendData(InventoryRefreshComposer.Compose());
                Session.SendData(NotificationMessageComposer.Compose("Your inventory has been emptied."));
                return(true);

            case "pickall":

                if (!Instance.CheckUserRights(Session, true))
                {
                    Session.SendData(NotificationMessageComposer.Compose("You do not have rights to pickall in this room."));
                    return(true);
                }

                Instance.PickAllToUserInventory(Session);
                return(true);
            }

            return(false);
        }
Exemple #9
0
        public static bool HandleCommand(Session Session, string Input)
        {
            Input = Input.Substring(1, Input.Length - 1);
            string[] Bits = Input.Split(' ');

            RoomInstance Instance      = RoomManager.GetInstanceByRoomId(Session.CurrentRoomId);
            RoomActor    Actor         = (Instance == null ? null : Instance.GetActorByReferenceId(Session.CharacterId));
            Session      TargetSession = null;
            RoomActor    TargetActor   = null;
            String       TargetName    = "";

            switch (Bits[0].ToLower())
            {
                #region users
                #region misc
            case "commands":
            {
                Session.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.commands.info") + ":\n\n:commands\n:online\n:about\n:pickall"));
                return(true);
            }

            case "online":
            {
                List <string> OnlineUsers = SessionManager.ConnectedUserData.Values.ToList();
                StringBuilder MessageText = new StringBuilder(Localization.GetValue("command.online", OnlineUsers.Count.ToString()) + "\n");

                foreach (string OnlineUser in OnlineUsers)
                {
                    MessageText.Append('\n');
                    MessageText.Append("- " + OnlineUser);
                }

                Session.SendData(NotificationMessageComposer.Compose(MessageText.ToString()));
                return(true);
            }

            case "about":

                Session.SendData(UserAlertModernComposer.Compose("Powered by Snowlight", "This hotel is proudly powered by Snowlight,\nedited by flx5. \nCredits to Meth0d."));
                return(true);

                #endregion
                #region furni
            case "empty":
            case "emptyinv":

                if (Bits.Length > 2)
                {
                    return(false);
                }

                if (!Session.HasRight("hotel_admin") && Bits.Length == 2)
                {
                    return(false);
                }

                Session Targetuser = Session;

                if (Bits.Length == 2)
                {
                    uint userid = CharacterResolverCache.GetUidFromName(Bits[1]);
                    Targetuser = SessionManager.GetSessionByCharacterId(userid);
                }

                Targetuser.PetInventoryCache.ClearAndDeleteAll();
                Targetuser.InventoryCache.ClearAndDeleteAll();
                Targetuser.SendData(InventoryRefreshComposer.Compose());
                Targetuser.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.emptyinv.sucess")));
                return(true);

            case "pickall":

                if (!Instance.CheckUserRights(Session, true))
                {
                    Session.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.pickall.error")));
                    return(true);
                }
                Instance.PickAllToUserInventory(Session);
                return(true);

                #endregion
                #region extra
            case "moonwalk":
                if (!Session.CharacterInfo.IsPremium)
                {
                    return(false);
                }

                Actor.WalkingBackwards = !Actor.WalkingBackwards;
                Actor.Dance(Actor.WalkingBackwards ? 4 : 0);
                Session.SendData(RoomChatComposer.Compose(Actor.Id, "TEST " + Actor.WalkingBackwards, 0, ChatType.Whisper));
                return(true);

                #region push
            case "push":
                if (!Session.CharacterInfo.IsPremium || Bits.Length != 2)
                {
                    return(false);
                }
                TargetName  = UserInputFilter.FilterString(Bits[1].Trim());
                TargetActor = Instance.GetActorByReferenceId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetActor == null || TargetActor.IsMoving)
                {
                    return(false);
                }



                if ((TargetActor.Position.X == Actor.Position.X - 1) || (TargetActor.Position.X == Actor.Position.X + 1) || (TargetActor.Position.Y == Actor.Position.Y - 1) || (TargetActor.Position.Y == Actor.Position.Y + 1))
                {
                    Vector2 Newposition = null;

                    if (TargetActor.Position.X == Actor.Position.X - 1 && TargetActor.Position.Y == Actor.Position.Y)
                    {
                        Newposition = new Vector2(TargetActor.Position.X - 1, TargetActor.Position.Y);
                    }

                    if (TargetActor.Position.X == Actor.Position.X + 1 && TargetActor.Position.Y == Actor.Position.Y)
                    {
                        Newposition = new Vector2(TargetActor.Position.X + 1, TargetActor.Position.Y);
                    }

                    if (TargetActor.Position.X == Actor.Position.X && TargetActor.Position.Y == Actor.Position.Y + 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X, TargetActor.Position.Y + 1);
                    }

                    if (TargetActor.Position.X == Actor.Position.X && TargetActor.Position.Y == Actor.Position.Y - 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X, TargetActor.Position.Y - 1);
                    }

                    if (TargetActor.Position.X == Actor.Position.X + 1 && TargetActor.Position.Y == Actor.Position.Y + 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X + 1, TargetActor.Position.Y + 1);
                    }

                    if (TargetActor.Position.X == Actor.Position.X - 1 && TargetActor.Position.Y == Actor.Position.Y - 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X - 1, TargetActor.Position.Y - 1);
                    }

                    if (TargetActor.Position.X == Actor.Position.X - 1 && TargetActor.Position.Y == Actor.Position.Y + 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X - 1, TargetActor.Position.Y + 1);
                    }

                    if (TargetActor.Position.X == Actor.Position.X + 1 && TargetActor.Position.Y == Actor.Position.Y - 1)
                    {
                        Newposition = new Vector2(TargetActor.Position.X + 1, TargetActor.Position.Y - 1);
                    }

                    if (Newposition == null || !Instance.IsValidPosition(Newposition) || (Instance.Model.DoorPosition.GetVector2().X == Newposition.X && Instance.Model.DoorPosition.GetVector2().Y == Newposition.Y))
                    {
                        return(false);
                    }

                    TargetActor.MoveTo(Newposition);
                    Actor.Chat("*" + Session.CharacterInfo.Username + " pushes " + Bits[1] + "*");
                    return(true);
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Bits[1] + " is not in your area.", 0, ChatType.Whisper));
                    return(false);
                }

                #endregion

            case "pull":
                if (!Session.CharacterInfo.IsPremium || Bits.Length != 2)
                {
                    return(false);
                }

                TargetName  = UserInputFilter.FilterString(Bits[1].Trim());
                TargetActor = Instance.GetActorByReferenceId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetActor == null || TargetActor.IsMoving)
                {
                    return(false);
                }

                if ((TargetActor.Position.X > Actor.Position.X - 10) && (TargetActor.Position.X < Actor.Position.X + 10) && (TargetActor.Position.Y > Actor.Position.Y - 10) && (TargetActor.Position.Y < Actor.Position.Y + 10) && (Instance.Model.DoorPosition.GetVector2().X == Actor.SquareInFront.X && Instance.Model.DoorPosition.GetVector2().Y == Actor.SquareInFront.Y))
                {
                    TargetActor.MoveTo(Actor.SquareInFront);
                    Actor.Chat("*" + Session.CharacterInfo.Username + " pulls " + Bits[1] + "*");
                    return(true);
                }

                Session.SendData(RoomChatComposer.Compose(Actor.Id, Bits[1] + " is not in your area.", 0, ChatType.Whisper));
                return(false);

                #endregion
                #endregion

                #region debugging
                #region items
            case "update_catalog":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Snowlight.Game.Catalog.CatalogManager.RefreshCatalogData(MySqlClient);
                }
                Session.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.updatecatalog.success")));
                return(true);
            }

            case "update_items":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    Snowlight.Game.Items.ItemDefinitionManager.Initialize(MySqlClient);
                }
                Session.SendData(NotificationMessageComposer.Compose("Items reloaded"));
                return(true);
            }

                #endregion
                #region rooms
            case "unload":
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }
                Instance.BroadcastMessage(NotificationMessageComposer.Compose("This room was unloaded!"));
                Instance.Unload();
                return(true);

            case "t":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Session.SendData(NotificationMessageComposer.Compose("Position: " + Actor.Position.ToString() + ", Rotation: " + Actor.BodyRotation));
                return(true);

                #endregion

            case "update_rights":
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    RightsManager.RebuildCache(MySqlClient);
                }

                return(true);

            case "effect":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                if (Bits.Length < 1)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :effect <id>", 0, ChatType.Whisper));
                    return(true);
                }

                int effectID;

                if (int.TryParse(Bits[1], out effectID))
                {
                    Actor.ApplyEffect(effectID);
                    Session.CurrentEffect = 0;
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :effect <id>", 0, ChatType.Whisper));
                }

                return(true);

            case "clipping":

                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                Actor.OverrideClipping = !Actor.OverrideClipping;
                Actor.ApplyEffect(Actor.ClippingEnabled ? 0 : 23);
                Session.CurrentEffect = 0;
                return(true);

                #endregion

                #region moderation
                #region kick
            case "superkick":      // Kick User out of the Hotel
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.invalidsyntax") + " - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                TargetName    = UserInputFilter.FilterString(Bits[1].Trim());
                TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' is offline or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                SessionManager.StopSession(TargetSession.Id);

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Superkicked user from server (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "kick":     //kick User out of Room
            {
                if (!Session.HasRight("moderation_tool"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.invalidsyntax") + " - :kick <username>", 0, ChatType.Whisper));
                    return(true);
                }

                TargetName    = UserInputFilter.FilterString(Bits[1].Trim());
                TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetSession == null || TargetSession.HasRight("moderation_tool") || !TargetSession.InRoom)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' is offline, not in a room, or cannot be kicked.", 0, ChatType.Whisper));
                    return(true);
                }

                RoomManager.RemoveUserFromRoom(TargetSession, true);
                TargetSession.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.kick.success")));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Kicked user from room (chat command)",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

                #endregion
                #region mute
            case "roomunmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Instance.RoomMuted)
                {
                    Instance.RoomMuted = false;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.roomunmute.success"), 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.roomunmute.error"), 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "roommute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (!Instance.RoomMuted)
                {
                    Instance.RoomMuted = true;
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.roommute.success"), 0, ChatType.Whisper));
                }
                else
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.roommute.error"), 0, ChatType.Whisper));
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted room", "Room '"
                                                       + Instance.Info.Name + "' (ID " + Instance.RoomId + ")");
                }

                return(true);
            }

            case "unmute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.invalidsyntax") + " - :unmute <username>", 0, ChatType.Whisper));
                    return(true);
                }

                TargetName = UserInputFilter.FilterString(Bits[1].Trim());

                TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetSession == null)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' " + Localization.GetValue("command.cannotproceedcmd3"), 0, ChatType.Whisper));
                    return(true);
                }

                if (!TargetSession.CharacterInfo.IsMuted)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' " + Localization.GetValue("command.unmute.error"), 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Unmute(MySqlClient);
                }

                TargetSession.SendData(NotificationMessageComposer.Compose(Localization.GetValue("command.unmute.sucess")));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' " + Localization.GetValue("command.unmute.sucess2"), 0, ChatType.Whisper));

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Unmuted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ").");
                }

                return(true);
            }

            case "mute":
            {
                if (!Session.HasRight("mute"))
                {
                    return(false);
                }

                if (Bits.Length < 2)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.invalidsyntax") + " - :mute <username> [length in seconds]", 0, ChatType.Whisper));
                    return(true);
                }

                TargetName = UserInputFilter.FilterString(Bits[1].Trim());
                int TimeToMute = 0;

                if (Bits.Length >= 3)
                {
                    int.TryParse(Bits[2], out TimeToMute);
                }

                if (TimeToMute <= 0)
                {
                    TimeToMute = 300;
                }

                if (TimeToMute > 3600)
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.mute.error"), 0, ChatType.Whisper));
                    return(true);
                }

                TargetSession = SessionManager.GetSessionByCharacterId(CharacterResolverCache.GetUidFromName(TargetName));

                if (TargetSession == null || TargetSession.HasRight("mute"))
                {
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.targetuser") + " '" + TargetName + "' " + Localization.GetValue("command.cannotproceedcmd4"), 0, ChatType.Whisper));
                    return(true);
                }

                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    TargetSession.CharacterInfo.Mute(MySqlClient, TimeToMute);
                    ModerationLogs.LogModerationAction(MySqlClient, Session, "Muted user",
                                                       "User '" + TargetSession.CharacterInfo.Username + "' (ID " + TargetSession.CharacterId + ") for " + TimeToMute + " seconds.");
                }

                TargetSession.SendData(RoomMutedComposer.Compose(TimeToMute));
                Session.SendData(RoomChatComposer.Compose(Actor.Id, Localization.GetValue("command.mute.sucess.part1") + " '" + TargetName + "' " + Localization.GetValue("command.mute.sucess.part2") + " " + TimeToMute + " seconds.", 0, ChatType.Whisper));
                return(true);
            }

                #endregion
                #region credits
            case "coins":
            case "credits":
                using (SqlDatabaseClient MySqlClient = SqlDatabaseManager.GetClient())
                {
                    if (!Session.HasRight("hotel_admin"))
                    {
                        return(false);
                    }
                    if (Bits.Length < 2)
                    {
                        Session.SendData(RoomChatComposer.Compose(Actor.Id, "Invalid syntax - :" + Bits[0].ToLower() + " <user> <amount>", 0, ChatType.Whisper));
                        return(false);
                    }
                    int Valor;
                    if (!Int32.TryParse(Bits[2], out Valor))
                    {
                        Session.SendData(RoomChatComposer.Compose(Actor.Id, "Amount must be numeric!", 0, ChatType.Whisper));
                        return(false);
                    }

                    TargetName = UserInputFilter.FilterString(Bits[1].Trim());
                    uint UserID = CharacterResolverCache.GetUidFromName(TargetName);

                    if (UserID == 0)
                    {
                        Session.SendData(RoomChatComposer.Compose(Actor.Id, "User not found!", 0, ChatType.Whisper));
                        return(false);
                    }
                    Session TargetUser = SessionManager.GetSessionByCharacterId(UserID);
                    if (TargetUser == null)
                    {
                        Session.SendData(RoomChatComposer.Compose(Actor.Id, "User not online!", 0, ChatType.Whisper));
                        return(false);
                    }
                    TargetUser.CharacterInfo.UpdateCreditsBalance(MySqlClient, (int)Valor);
                    TargetUser.SendData(RoomChatComposer.Compose(TargetUser.Id, "You received " + Valor + " coins!", 0, ChatType.Whisper));
                    Session.SendData(RoomChatComposer.Compose(Actor.Id, TargetName + " received " + Valor + " coins!", 0, ChatType.Whisper));
                    TargetUser.SendData(CreditsBalanceComposer.Compose(TargetUser.CharacterInfo.CreditsBalance));

                    return(true);
                }

                #endregion
                #region messages
            case "ha":
            {
                if (!Session.HasRight("hotel_admin"))
                {
                    return(false);
                }
                string Alert = UserInputFilter.FilterString(MergeInputs(Bits, 1));
                SessionManager.BroadcastPacket(UserAlertModernComposer.Compose("Important notice from Hotel Management", Alert));
                return(true);
            }
                #endregion
                #endregion
            }


            return(false);
        }