当前位置: 首页>>代码示例>>C#>>正文


C# ServerMessage.AppendInteger方法代码示例

本文整理汇总了C#中ServerMessage.AppendInteger方法的典型用法代码示例。如果您正苦于以下问题:C# ServerMessage.AppendInteger方法的具体用法?C# ServerMessage.AppendInteger怎么用?C# ServerMessage.AppendInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ServerMessage的用法示例。


在下文中一共展示了ServerMessage.AppendInteger方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetPetBreeds

        public void GetPetBreeds()
        {
            string type = Request.GetString();

            string petType = PetTypeManager.GetPetTypeByHabboPetType(type);

            uint petId = PetTypeManager.GetPetRaceByItemName(petType);

            List<PetRace> races = PetTypeManager.GetRacesByPetType(petType);

            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("SellablePetBreedsMessageComposer"));

            message.AppendString(type);
            message.AppendInteger(races.Count);

            foreach (PetRace current in races)
            {
                message.AppendInteger(petId);
                message.AppendInteger(current.ColorOne);
                message.AppendInteger(current.ColorTwo);
                message.AppendBool(current.HasColorOne);
                message.AppendBool(current.HasColorTwo);
            }

            Session.SendMessage(message);
        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:26,代码来源:Rooms.cs

示例2: LoadClubGifts

        /// <summary>
        ///     Loads the club gifts.
        /// </summary>
        internal void LoadClubGifts()
        {
            if (Session?.GetHabbo() == null)
                return;

            Session.GetHabbo().GetSubscriptionManager().GetSubscription();

            ServerMessage serverMessage = new ServerMessage();
            serverMessage.Init(LibraryParser.OutgoingRequest("LoadCatalogClubGiftsMessageComposer"));
            serverMessage.AppendInteger(0); // i
            serverMessage.AppendInteger(0); // i2
            serverMessage.AppendInteger(1);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:16,代码来源:Users.cs

示例3: FollowBuddy

        /// <summary>
        /// Follows the buddy.
        /// </summary>
        internal void FollowBuddy()
        {
            var userId = Request.GetUInteger();
            var clientByUserId = AzureEmulator.GetGame().GetClientManager().GetClientByUserId(userId);

            if (clientByUserId == null || clientByUserId.GetHabbo() == null) return;
            if (clientByUserId.GetHabbo().GetMessenger() == null || clientByUserId.GetHabbo().CurrentRoom == null)
            {
                if (Session.GetHabbo().GetMessenger() == null) return;
                Response.Init(LibraryParser.OutgoingRequest("FollowFriendErrorMessageComposer"));
                Response.AppendInteger(2);
                SendResponse();
                Session.GetHabbo().GetMessenger().UpdateFriend(userId, clientByUserId, true);
                return;
            }
            if (Session.GetHabbo().Rank < 4 && Session.GetHabbo().GetMessenger() != null && !Session.GetHabbo().GetMessenger().FriendshipExists(userId))
            {
                Response.Init(LibraryParser.OutgoingRequest("FollowFriendErrorMessageComposer"));
                Response.AppendInteger(0);
                SendResponse();
                return;
            }

            var roomFwd = new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));
            roomFwd.AppendInteger(clientByUserId.GetHabbo().CurrentRoom.RoomId);
            Session.SendMessage(roomFwd);
        }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:30,代码来源:Messenger.cs

示例4: EnterRoomQueue

 public void EnterRoomQueue()
 {
     Session.GetHabbo().SpectatorMode = true;
     var ForwardToRoom = new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));
     ForwardToRoom.AppendInteger(1);
     Session.SendMessage(ForwardToRoom);
 }
开发者ID:BjkGkh,项目名称:Azure2,代码行数:7,代码来源:Rooms.cs

示例5: OpenQuests

 /// <summary>
 ///     Opens the quests.
 /// </summary>
 public void OpenQuests()
 {
     ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestListMessageComposer"));
     serverMessage.AppendInteger(0);
     serverMessage.AppendBool(Request != null);
     Session.SendMessage(serverMessage);
 }
开发者ID:weslley17w,项目名称:Yupi,代码行数:10,代码来源:Users.cs

示例6: CallGuide

        /// <summary>
        ///     Calls the guide.
        /// </summary>
        internal void CallGuide()
        {
            Request.GetBool();

            int userId = Request.GetIntegerFromString();
            string message = Request.GetString();

            GuideManager guideManager = Yupi.GetGame().GetGuideManager();

            if (guideManager.GuidesCount <= 0)
            {
                Response.Init(LibraryParser.OutgoingRequest("OnGuideSessionError"));
                Response.AppendInteger(0);
                SendResponse();
                return;
            }

            GameClient guide = guideManager.GetRandomGuide();

            if (guide == null)
            {
                Response.Init(LibraryParser.OutgoingRequest("OnGuideSessionError"));
                Response.AppendInteger(0);
                SendResponse();
                return;
            }

            ServerMessage onGuideSessionAttached =
                new ServerMessage(LibraryParser.OutgoingRequest("OnGuideSessionAttachedMessageComposer"));
            onGuideSessionAttached.AppendBool(false);
            onGuideSessionAttached.AppendInteger(userId);
            onGuideSessionAttached.AppendString(message);
            onGuideSessionAttached.AppendInteger(30);
            Session.SendMessage(onGuideSessionAttached);

            ServerMessage onGuideSessionAttached2 =
                new ServerMessage(LibraryParser.OutgoingRequest("OnGuideSessionAttachedMessageComposer"));
            onGuideSessionAttached2.AppendBool(true);
            onGuideSessionAttached2.AppendInteger(userId);
            onGuideSessionAttached2.AppendString(message);
            onGuideSessionAttached2.AppendInteger(15);
            guide.SendMessage(onGuideSessionAttached2);
            guide.GetHabbo().GuideOtherUser = Session;
            Session.GetHabbo().GuideOtherUser = guide;
        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:48,代码来源:Guides.cs

示例7: GetPetBreeds

 public void GetPetBreeds()
 {
     var type = Request.GetString();
     string petType;
     var petId = PetRace.GetPetId(type, out petType);
     var races = PetRace.GetRacesForRaceId(petId);
     var message = new ServerMessage(LibraryParser.OutgoingRequest("SellablePetBreedsMessageComposer"));
     message.AppendString(petType);
     message.AppendInteger(races.Count);
     foreach (var current in races)
     {
         message.AppendInteger(petId);
         message.AppendInteger(current.Color1);
         message.AppendInteger(current.Color2);
         message.AppendBool(current.Has1Color);
         message.AppendBool(current.Has2Color);
     }
     Session.SendMessage(message);
 }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:19,代码来源:Rooms.cs

示例8: AnswerGuideRequest

        /// <summary>
        ///     Answers the guide request.
        /// </summary>
        internal void AnswerGuideRequest()
        {
            bool state = Request.GetBool();

            if (!state)
                return;

            GameClient requester = Session.GetHabbo().GuideOtherUser;
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("OnGuideSessionStartedMessageComposer"));

            message.AppendInteger(requester.GetHabbo().Id);
            message.AppendString(requester.GetHabbo().UserName);
            message.AppendString(requester.GetHabbo().Look);
            message.AppendInteger(Session.GetHabbo().Id);
            message.AppendString(Session.GetHabbo().UserName);
            message.AppendString(Session.GetHabbo().Look);
            requester.SendMessage(message);
            Session.SendMessage(message);
        }
开发者ID:AngelRmz,项目名称:Yupi,代码行数:22,代码来源:Guides.cs

示例9: RetrieveSongId

        /// <summary>
        /// Retrieves the song identifier.
        /// </summary>
        internal void RetrieveSongId()
        {
            string text = Request.GetString();

            uint songId = SoundMachineSongManager.GetSongId(text);

            if (songId != 0u)
            {
                var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RetrieveSongIDMessageComposer"));
                serverMessage.AppendString(text);
                serverMessage.AppendInteger(songId);
                Session.SendMessage(serverMessage);
            }
        }
开发者ID:kessiler,项目名称:azureEmulator,代码行数:17,代码来源:Music.cs

示例10: ChangeLook

        /// <summary>
        ///     Changes the look.
        /// </summary>
        internal void ChangeLook()
        {
            string text = Request.GetString().ToUpper();
            string text2 = Request.GetString();

            text2 = Yupi.FilterFigure(text2);

            Session.GetHabbo().Look = text2;
            Session.GetHabbo().Gender = text.ToLower() == "f" ? "f" : "m";

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                commitableQueryReactor.SetQuery(
                    $"UPDATE users SET look = @look, gender = @gender WHERE id = {Session.GetHabbo().Id}");
                commitableQueryReactor.AddParameter("look", text2);
                commitableQueryReactor.AddParameter("gender", text);
                commitableQueryReactor.RunQuery();
            }

            Yupi.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_AvatarLooks", 1);

            Session.GetMessageHandler()
                .GetResponse()
                .Init(LibraryParser.OutgoingRequest("UpdateAvatarAspectMessageComposer"));
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToUpper());
            Session.GetMessageHandler().SendResponse();

            Session.GetMessageHandler()
                .GetResponse()
                .Init(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
            Session.GetMessageHandler().GetResponse().AppendInteger(-1);
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Look);
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Gender.ToLower());
            Session.GetMessageHandler().GetResponse().AppendString(Session.GetHabbo().Motto);
            Session.GetMessageHandler().GetResponse().AppendInteger(Session.GetHabbo().AchievementPoints);
            Session.GetMessageHandler().SendResponse();

            if (!Session.GetHabbo().InRoom)
                return;

            Room currentRoom = Session.GetHabbo().CurrentRoom;

            RoomUser roomUserByHabbo = currentRoom?.GetRoomUserManager().GetRoomUserByHabbo(Session.GetHabbo().Id);

            if (roomUserByHabbo == null)
                return;

            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
            serverMessage.AppendInteger(roomUserByHabbo.VirtualId); //serverMessage.AppendInt32(-1);
            serverMessage.AppendString(Session.GetHabbo().Look);
            serverMessage.AppendString(Session.GetHabbo().Gender.ToLower());
            serverMessage.AppendString(Session.GetHabbo().Motto);
            serverMessage.AppendInteger(Session.GetHabbo().AchievementPoints);
            currentRoom.SendMessage(serverMessage);

            if (Session.GetHabbo().GetMessenger() != null)
                Session.GetHabbo().GetMessenger().OnStatusChanged(true);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:62,代码来源:Users.cs

示例11: UpdateBadges

        /// <summary>
        ///     Updates the badges.
        /// </summary>
        internal void UpdateBadges()
        {
            Session.GetHabbo().GetBadgeComponent().ResetSlots();

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                commitableQueryReactor.RunFastQuery(
                    $"UPDATE users_badges SET badge_slot = 0 WHERE user_id = {Session.GetHabbo().Id}");

            for (int i = 0; i < 5; i++)
            {
                int slot = Request.GetInteger();
                string code = Request.GetString();

                if (code.Length == 0)
                    continue;

                if (!Session.GetHabbo().GetBadgeComponent().HasBadge(code) || slot < 1 || slot > 5)
                    return;

                Session.GetHabbo().GetBadgeComponent().GetBadge(code).Slot = slot;

                using (IQueryAdapter queryreactor2 = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    queryreactor2.SetQuery("UPDATE users_badges SET badge_slot = " + slot +
                                           " WHERE badge_id = @badge AND user_id = " + Session.GetHabbo().Id);
                    queryreactor2.AddParameter("badge", code);
                    queryreactor2.RunQuery();
                }
            }

            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("UserBadgesMessageComposer"));
            serverMessage.AppendInteger(Session.GetHabbo().Id);

            serverMessage.StartArray();

            foreach (
                Badge badge in
                    Session.GetHabbo().GetBadgeComponent().BadgeList.Values.Cast<Badge>().Where(badge => badge.Slot > 0)
                )
            {
                serverMessage.AppendInteger(badge.Slot);
                serverMessage.AppendString(badge.Code);
                serverMessage.SaveArray();
            }

            serverMessage.EndArray();

            if (Session.GetHabbo().InRoom &&
                Yupi.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId) != null)
                Yupi.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId).SendMessage(serverMessage);
            else
                Session.SendMessage(serverMessage);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:56,代码来源:Users.cs

示例12: LoadSettings

        /// <summary>
        ///     Loads the settings.
        /// </summary>
        internal void LoadSettings()
        {
            UserPreferences preferences = Session.GetHabbo().Preferences;
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("LoadVolumeMessageComposer"));

            serverMessage.AppendIntegersArray(preferences.Volume, ',', 3, 0, 100);

            serverMessage.AppendBool(preferences.PreferOldChat);
            serverMessage.AppendBool(preferences.IgnoreRoomInvite);
            serverMessage.AppendBool(preferences.DisableCameraFollow);
            serverMessage.AppendInteger(3); // collapse friends (3 = no)
            serverMessage.AppendInteger(preferences.ChatColor); //bubble
            Session.SendMessage(serverMessage);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:17,代码来源:Users.cs

示例13: GetGroupForumThreadRoot

        /// <summary>
        ///     Gets the group forum thread root.
        /// </summary>
        internal void GetGroupForumThreadRoot()
        {
            uint groupId = Request.GetUInteger();
            int startIndex = Request.GetInteger();

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    $"SELECT count(id) FROM groups_forums_posts WHERE group_id = '{groupId}' AND parent_id = 0");

                dbClient.GetInteger();

                dbClient.SetQuery(
                    $"SELECT * FROM groups_forums_posts WHERE group_id = '{groupId}' AND parent_id = 0 ORDER BY timestamp DESC, pinned DESC LIMIT @startIndex, @totalPerPage;");

                dbClient.AddParameter("startIndex", startIndex);
                dbClient.AddParameter("totalPerPage", TotalPerPage);

                DataTable table = dbClient.GetTable();
                int threadCount = table.Rows.Count <= TotalPerPage ? table.Rows.Count : TotalPerPage;

                List<GroupForumPost> threads = (from DataRow row in table.Rows select new GroupForumPost(row)).ToList();

                ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumThreadRootMessageComposer"));
                message.AppendInteger(groupId);
                message.AppendInteger(startIndex);
                message.AppendInteger(threadCount);

                foreach (GroupForumPost thread in threads)
                {
                    message.AppendInteger(thread.Id);
                    message.AppendInteger(thread.PosterId);
                    message.AppendString(thread.PosterName);
                    message.AppendString(thread.Subject);
                    message.AppendBool(thread.Pinned);
                    message.AppendBool(thread.Locked);
                    message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                    message.AppendInteger(thread.MessageCount + 1);
                    message.AppendInteger(0);
                    message.AppendInteger(0);
                    message.AppendInteger(0);
                    message.AppendString(string.Empty);
                    message.AppendInteger(Yupi.GetUnixTimeStamp() - thread.Timestamp);
                    message.AppendByte(thread.Hidden ? 10 : 1);
                    message.AppendInteger(0);
                    message.AppendString(thread.Hider);
                    message.AppendInteger(0);
                }

                Session.SendMessage(message);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:55,代码来源:Groups.cs

示例14: DeleteGroup

        internal void DeleteGroup()
        {
            uint groupId = Request.GetUInteger();

            Group group = Yupi.GetGame().GetGroupManager().GetGroup(groupId);
            Room room = Yupi.GetGame().GetRoomManager().GetRoom(group.RoomId);

            if (room?.RoomData?.Group == null)
                Session.SendNotif(Yupi.GetLanguage().GetVar("command_group_has_no_room"));
            else
            {
                foreach (GroupMember user in group.Members.Values)
                {
                    GameClient clientByUserId = Yupi.GetGame().GetClientManager().GetClientByUserId(user.Id);

                    if (clientByUserId == null)
                        continue;

                    clientByUserId.GetHabbo().UserGroups.Remove(user);

                    if (clientByUserId.GetHabbo().FavouriteGroup == group.Id)
                        clientByUserId.GetHabbo().FavouriteGroup = 0;
                }

                room.RoomData.Group = null;
                room.RoomData.GroupId = 0;

                Yupi.GetGame().GetGroupManager().DeleteGroup(@group.Id);

                ServerMessage deleteGroup = new ServerMessage(LibraryParser.OutgoingRequest("GroupDeletedMessageComposer"));

                deleteGroup.AppendInteger(groupId);
                room.SendMessage(deleteGroup);

                List<RoomItem> roomItemList = room.GetRoomItemHandler().RemoveAllFurniture(Session);
                room.GetRoomItemHandler().RemoveItemsByOwner(ref roomItemList, ref Session);
                RoomData roomData = room.RoomData;
                uint roomId = room.RoomData.Id;

                Yupi.GetGame().GetRoomManager().UnloadRoom(room, "Delete room");
                Yupi.GetGame().GetRoomManager().QueueVoteRemove(roomData);

                using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                {
                    commitableQueryReactor.RunFastQuery($"DELETE FROM rooms_data WHERE id = {roomId}");
                    commitableQueryReactor.RunFastQuery($"DELETE FROM users_favorites WHERE room_id = {roomId}");
                    commitableQueryReactor.RunFastQuery($"DELETE FROM items_rooms WHERE room_id = {roomId}");
                    commitableQueryReactor.RunFastQuery($"DELETE FROM rooms_rights WHERE room_id = {roomId}");
                    commitableQueryReactor.RunFastQuery($"UPDATE users SET home_room = '0' WHERE home_room = {roomId}");
                }

                RoomData roomData2 =
                    (from p in Session.GetHabbo().UsersRooms where p.Id == roomId select p).SingleOrDefault();

                if (roomData2 != null)
                    Session.GetHabbo().UsersRooms.Remove(roomData2);
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:58,代码来源:Groups.cs

示例15: GetGroupForums

        /// <summary>
        ///     Gets the group forums.
        /// </summary>
        internal void GetGroupForums()
        {
            int selectType = Request.GetInteger();
            int startIndex = Request.GetInteger();

            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("GroupForumListingsMessageComposer"));
            message.AppendInteger(selectType);
            List<Group> groupList = new List<Group>();

            switch (selectType)
            {
                case 0:
                case 1:
                    using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
                    {
                        dbClient.SetQuery("SELECT count(id) FROM groups_forums_data WHERE forum_messages_count > 0");

                        int qtdForums = dbClient.GetInteger();

                        dbClient.SetQuery(
                            "SELECT group_id FROM groups_forums_data WHERE forum_messages_count > 0 ORDER BY forum_messages_count DESC LIMIT @startIndex, @totalPerPage;");

                        dbClient.AddParameter("startIndex", startIndex);
                        dbClient.AddParameter("totalPerPage", TotalPerPage);

                        DataTable table = dbClient.GetTable();

                        message.AppendInteger(qtdForums == 0 ? 1 : qtdForums);
                        message.AppendInteger(startIndex);

                        groupList.AddRange(from DataRow rowGroupData in table.Rows
                            select uint.Parse(rowGroupData["group_id"].ToString())
                            into groupId
                            select Yupi.GetGame().GetGroupManager().GetGroup(groupId));

                        message.AppendInteger(table.Rows.Count);

                        foreach (Group theGroup in groupList)
                            theGroup.SerializeForumRoot(message);

                        Session.SendMessage(message);
                    }
                    break;

                case 2:
                    groupList.AddRange(
                        Session.GetHabbo()
                            .UserGroups.Select(groupUser => Yupi.GetGame().GetGroupManager().GetGroup(groupUser.GroupId))
                            .Where(aGroup => aGroup != null && aGroup.Forum.Id != 0));

                    message.AppendInteger(groupList.Count == 0 ? 1 : groupList.Count);

                    groupList =
                        groupList.OrderByDescending(x => x.Forum.ForumMessagesCount).Skip(startIndex).Take(20).ToList();

                    message.AppendInteger(startIndex);
                    message.AppendInteger(groupList.Count);

                    foreach (Group theGroup in groupList)
                        theGroup.SerializeForumRoot(message);

                    Session.SendMessage(message);
                    break;

                default:
                    message.AppendInteger(1);
                    message.AppendInteger(startIndex);
                    message.AppendInteger(0);
                    Session.SendMessage(message);
                    break;
            }
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:75,代码来源:Groups.cs


注:本文中的ServerMessage.AppendInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。