示例#1
0
        /// <summary>
        ///     Determines whether this instance can use the specified minimum rank.
        /// </summary>
        /// <param name="minRank">The minimum rank.</param>
        /// <param name="user">The user.</param>
        /// <returns><c>true</c> if this instance can use the specified minimum rank; otherwise, <c>false</c>.</returns>
        public static bool CanUse(short minRank, GameClient user)
        {
            Habbo habbo = user.GetHabbo();

            uint userRank = habbo.Rank;
            bool staff    = habbo.HasFuse("fuse_any_room_controller");

            switch (minRank)
            {
            case -3:
                return(habbo.HasFuse("fuse_vip_commands") || habbo.Vip);

            case -2:
                return(staff || habbo.CurrentRoom.RoomData.OwnerId == habbo.Id);

            case -1:
                return(staff || habbo.CurrentRoom.RoomData.OwnerId == habbo.Id ||
                       habbo.CurrentRoom.CheckRights(user));

            case 0:
                return(false);
            }

            return(userRank >= minRank);
        }
示例#2
0
        internal ServerMessage SerializeTool(Habbo habbo)
        {
            var Response = new ServerMessage(Outgoing.OpenModTools);

            Response.AppendInt32(Tickets.Count);
            foreach (SupportTicket ticket in Tickets)
            {
                ticket.SerializeBody(Response);
            }

            Response.AppendInt32(UserMessagePresets.Count);
            foreach (var Preset in UserMessagePresets)
            {
                Response.AppendString(Preset);
            }

            Response.AppendInt32(0);

            /*Response.AppendInt32(ModActions.Count);
             * foreach (ModAction modAction in ModActions)
             * {
             *  Response.AppendString(modAction.ModName);
             *  Response.AppendBoolean(modAction.Used);
             *  Response.AppendInt32(modAction.SubActions.Count);
             *
             *  foreach (ModSubAction modSubAction in modAction.SubActions)
             *  {
             *      Response.AppendString(modSubAction.ModName);
             *      Response.AppendString(modSubAction.Message);
             *      Response.AppendInt32(modSubAction.BanHours);
             *      Response.AppendInt32(modSubAction.BanAvatarHours);
             *      Response.AppendInt32(modSubAction.MuteHours);
             *      Response.AppendInt32(modSubAction.TradingHours);
             *      Response.AppendString(modSubAction.ReminderText);
             *      Response.AppendBoolean(false); // showHabboWay
             *  }
             * }*/

            Response.AppendBoolean(habbo.HasFuse("fuse_tickets"));    // ticket_queue fuse
            Response.AppendBoolean(habbo.HasFuse("fuse_chatlogs"));   // chatlog fuse
            Response.AppendBoolean(habbo.HasFuse("fuse_user_alert")); // message / caution fuse - user info
            Response.AppendBoolean(habbo.HasFuse("fuse_user_kick"));  // kick fuse - user info
            Response.AppendBoolean(habbo.HasFuse("fuse_ban"));        // ban fuse
            Response.AppendBoolean(habbo.HasFuse("fuse_room_alert")); // send caution
            Response.AppendBoolean(habbo.HasFuse("fuse_room_kick"));  // kick check

            Response.AppendInt32(RoomMessagePresets.Count);
            foreach (var Preset in RoomMessagePresets)
            {
                Response.AppendString(Preset);
            }

            return(Response);
        }
示例#3
0
        public UserPerksComposer(Habbo Habbo)
            : base(ServerPacketHeader.UserPerksMessageComposer)
        {
            WriteInteger(16); // Count
            WriteString("USE_GUIDE_TOOL");
            WriteString("");
            WriteBoolean(Habbo.HasFuse("fuse_helptool"));

            WriteString("GIVE_GUIDE_TOURS");
            WriteString("requirement.unfulfilled.helper_le");
            WriteBoolean(false);

            WriteString("JUDGE_CHAT_REVIEWS");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("VOTE_IN_COMPETITIONS");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("CALL_ON_HELPERS");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("CITIZEN");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("TRADE");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("HEIGHTMAP_EDITOR_BETA");
            WriteString(""); // ??
            WriteBoolean(false);

            WriteString("EXPERIMENTAL_CHAT_BETA");
            WriteString("requirement.unfulfilled.helper_level_2");
            WriteBoolean(true);

            WriteString("EXPERIMENTAL_TOOLBAR");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("BUILDER_AT_WORK");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("NAVIGATOR_PHASE_ONE_2014");
            WriteString(""); // ??
            WriteBoolean(false);

            WriteString("CAMERA");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("NAVIGATOR_PHASE_TWO_2014");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("MOUSE_ZOOM");
            WriteString(""); // ??
            WriteBoolean(true);

            WriteString("NAVIGATOR_ROOM_THUMBNAIL_CAMERA");
            WriteString(""); // ??
            WriteBoolean(false);
        }
示例#4
0
        private void CompleteLogin()
        {
            // Actually logged in?
            if (mHabbo != null)
            {
                // Send user rights
                mMessageHandler.GetResponse().Initialize(2); // "@B"
                if (mHabbo.HasFuse("fuse_use_vip_outfits") || mHabbo.HasFuse("fuse_sysadmin") || mHabbo.HasFuse("fuse_admin") || mHabbo.HasFuse("fuse_mod"))
                {
                    mMessageHandler.GetResponse().AppendInt32(2);
                }
                else if (mHabbo.HasFuse("fuse_furni_chooser"))
                {
                    mMessageHandler.GetResponse().AppendInt32(1);
                }
                else
                {
                    mMessageHandler.GetResponse().AppendInt32(0);
                }
                mMessageHandler.GetResponse().AppendInt32(0);
                mMessageHandler.SendResponse();

                // Login OK!
                mMessageHandler.GetResponse().Initialize(3); // "@C"
                mMessageHandler.SendResponse();

                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write("\nThe user [ ");
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.Write(mHabbo.Username);
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(" / ");
                Console.ForegroundColor = ConsoleColor.DarkYellow;
                Console.Write(this.mConnection.ipAddress);
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.Write(" ] has signed in \n");
                Console.ResetColor();

                using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
                {
                    try
                    {
                        dbClient.ExecuteQuery("UPDATE users SET online = '1' WHERE username = '******'");
                    }
                    catch { }
                }

                if (this.GetHabbo().HomeRoom > 0)
                {
                    mMessageHandler.GetResponse().Initialize(455);
                    mMessageHandler.GetResponse().AppendInt32(this.GetHabbo().HomeRoom);
                    //mMessageHandler.SendResponse();
                }

                mMessageHandler.GetResponse().Initialize(458);
                mMessageHandler.GetResponse().AppendInt32(30);
                mMessageHandler.GetResponse().AppendInt32(AleedaEnvironment.GetCache().GetRoomFavs().GetUserCount(mHabbo.ID));
                AleedaEnvironment.GetCache().GetRoomFavs().AppendRoomIds(mMessageHandler.GetResponse(), mHabbo.ID);
                mMessageHandler.SendResponse();

                mMessageHandler.GetResponse().Initialize(71);
                mMessageHandler.SendResponse();

                //AddActivityPoints(15);

                #region Modtool
                if (mHabbo.HasFuse("fuse_sysadmin") || mHabbo.HasFuse("fuse_admin") || mHabbo.HasFuse("fuse_mod"))
                {
                    mMessageHandler.GetResponse().Initialize(531); // "HS"
                    mMessageHandler.GetResponse().AppendInt32(-1);
                    mMessageHandler.GetResponse().AppendInt32(3);
                    mMessageHandler.GetResponse().AppendString("Your language and/or behavior is unacceptable. Please behave appropriately or expect further action.");
                    mMessageHandler.GetResponse().AppendString("This room is unacceptable to the hotel management.");
                    mMessageHandler.GetResponse().AppendString("Speaking a foreign language is against hotel policy, if you cotinue you will be banned.");
                    mMessageHandler.GetResponse().AppendInt32(0);
                    mMessageHandler.GetResponse().AppendInt32(14);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(0);
                    mMessageHandler.GetResponse().AppendString("");
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendString("test");
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendString("test");
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendInt32(1);
                    mMessageHandler.GetResponse().AppendString("test");
                    mMessageHandler.SendResponse();
                }
                #endregion

                // Register handlers
                mMessageHandler.UnRegisterPreLogin();
                mMessageHandler.RegisterUser();
                mMessageHandler.RegisterNavigator();
                mMessageHandler.RegisterCatalog();
                mMessageHandler.RegisterRoom();
                mMessageHandler.RegisterPublicRooms();
                mMessageHandler.RegisterRoomUser();
            }
        }