Ejemplo n.º 1
0
        public bool Parse(GameClient Session, RoomUser User, Room Room, string Message)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentRoom == null)
            {
                return(false);
            }

            if (!Message.StartsWith(":"))
            {
                return(false);
            }

            Message = Message.Substring(1);
            string[] Split = Message.Split(' ');

            if (Split.Length == 0)
            {
                return(false);
            }

            if (!commandRegisterInvokeable.TryGetValue(Split[0].ToLower(), out ChatCommand CmdInfo))
            {
                return(false);
            }

            if (!_commands.TryGetValue(CmdInfo.commandID, out IChatCommand Cmd))
            {
                return(false);
            }

            int AutorisationType = CmdInfo.UserGotAuthorization2(Session, Room.RoomData.Langue);

            switch (AutorisationType)
            {
            case 2:
                User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.authorized.premium", Session.Langue));
                return(true);

            case 3:
                User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.authorized.accred", Session.Langue));
                return(true);

            case 4:
                User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.authorized.owner", Session.Langue));
                return(true);

            case 5:
                User.SendWhisperChat(ButterflyEnvironment.GetLanguageManager().TryGetValue("cmd.authorized.langue", Session.Langue));
                return(true);
            }
            if (!CmdInfo.UserGotAuthorization(Session))
            {
                return(false);
            }

            if (CmdInfo.UserGotAuthorizationStaffLog())
            {
                ButterflyEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Id, Session.GetHabbo().Username, Session.GetHabbo().CurrentRoomId, string.Empty, Split[0].ToLower(), string.Format("Tchat commande: {0}", string.Join(" ", Split)));
            }


            Cmd.Execute(Session, Session.GetHabbo().CurrentRoom, User, Split);
            return(true);
        }