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


C# Messages.ServerMessage类代码示例

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


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

示例1: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            Room room = session.GetHabbo().CurrentRoom;

            using (IQueryAdapter commitableQueryReactor = Yupi.GetDatabaseManager().GetQueryReactor())
                commitableQueryReactor.RunFastQuery(
                    $"UPDATE rooms_data SET roomtype = 'public' WHERE id = {room.RoomId}");

            uint roomId = session.GetHabbo().CurrentRoom.RoomId;
            List<RoomUser> users = new List<RoomUser>(session.GetHabbo().CurrentRoom.GetRoomUserManager().UserList.Values);

            Yupi.GetGame().GetRoomManager().UnloadRoom(session.GetHabbo().CurrentRoom, "Unload command");

            Yupi.GetGame().GetRoomManager().LoadRoom(roomId);

            ServerMessage roomFwd = new ServerMessage(LibraryParser.OutgoingRequest("RoomForwardMessageComposer"));
            roomFwd.AppendInteger(roomId);

            byte[] data = roomFwd.GetReversedBytes();

            foreach (RoomUser user in users.Where(user => user != null && user.GetClient() != null))
                user.GetClient().SendMessage(data);

            return true;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:25,代码来源:MakePublic.cs

示例2: Compose

        /// <summary>
        ///     Composes the specified session.
        /// </summary>
        /// <param name="session">The session.</param>
        /// <param name="talent">The Talent.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage Compose(GameClient session, Talent talent)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("TalentLevelUpMessageComposer"));

            serverMessage.AppendString(talent.Type);
            serverMessage.AppendInteger(talent.Level);
            serverMessage.AppendInteger(0);

            if (talent.Type == "citizenship" && talent.Level == 4)
            {
                serverMessage.AppendInteger(2);
                serverMessage.AppendString("HABBO_CLUB_VIP_7_DAYS");
                serverMessage.AppendInteger(7);
                serverMessage.AppendString(talent.Prize);
                serverMessage.AppendInteger(0);
            }
            else
            {
                serverMessage.AppendInteger(1);
                serverMessage.AppendString(talent.Prize);
                serverMessage.AppendInteger(0);
            }

            return serverMessage;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:31,代码来源:AchievementTalentComposer.cs

示例3: GetServerMessage

        internal ServerMessage GetServerMessage(ServerMessage message, RoomItem item)
        {
            int cracks = 0;
            int cracksMax = MaxCracks(item.GetBaseItem().Name);

            if (Yupi.IsNum(item.ExtraData))
                cracks = Convert.ToInt16(item.ExtraData);

            string state = "0";

            if (cracks >= cracksMax)
                state = "14";
            else if (cracks >= cracksMax*6/7)
                state = "12";
            else if (cracks >= cracksMax*5/7)
                state = "10";
            else if (cracks >= cracksMax*4/7)
                state = "8";
            else if (cracks >= cracksMax*3/7)
                state = "6";
            else if (cracks >= cracksMax*2/7)
                state = "4";
            else if (cracks >= cracksMax*1/7)
                state = "2";

            message.AppendInteger(7);
            message.AppendString(state); //state (0-7)
            message.AppendInteger(cracks); //actual
            message.AppendInteger(cracksMax); //max

            return message;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:32,代码来源:CrackableEggHandler.cs

示例4: GenerateMessage

 internal static void GenerateMessage(Pet pet)
 {
     ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetComposer"));
     serverMessage.AppendInteger(pet.VirtualId);
     serverMessage.AppendBool(true);
     pet.Room.SendMessage(serverMessage);
 }
开发者ID:bblackv,项目名称:Yupi,代码行数:7,代码来源:RespectPetComposer.cs

示例5: Execute

        public override bool Execute(GameClient client, string[] pms)
        {
            ServerMessage message =
                new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

            message.AppendString("Yupi");
            message.AppendInteger(4);
            message.AppendString("title");
            message.AppendString("Yupi");
            message.AppendString("message");
            StringBuilder info = new StringBuilder();
            info.Append("<h5><b>Yupi - Based on Azure Emulator</b><h5></br></br>");
            info.Append("<br />");
            info.AppendFormat(
                "<b><br />Developed by:</b> <br />Kessiler Rodrigues (Kessiler)<br />Claudio Santoro (sant0ro/bi0s) <br />Rafael Oliveira (iPlezier) <br /><br /> ");
            info.AppendFormat(
                "<b>Thanks to:</b> <br />Jamal, Mike Santifort, Martinmine, Rockster, The old Azure Team, Bruna F., and to all people that uses Yupi.<br /> <br /> ");
            info.AppendFormat("<b>Warning:</b><br />1. This emulator was planned to be used for ManiaHotel (maniahotel.com.br)  <br />2. Please don't sell this emulator or earn money with it<br />3. All rights reserved to Sulake Corporation Oy<br />4. All Emulator rights for Mania Dev<br />");
            message.AppendString(info.ToString());
            message.AppendString("linkUrl");
            message.AppendString("event:");
            message.AppendString("linkTitle");
            message.AppendString("ok");
            client.SendMessage(message);

            return true;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:27,代码来源:About.cs

示例6: GenerateMessage

        internal static void GenerateMessage(Pet pet, ServerMessage message, bool levelAfterName = false)
        {
            message.AppendInteger(pet.PetId);
            message.AppendString(pet.Name);

            if (levelAfterName)
                message.AppendInteger(pet.Level);

            message.AppendInteger(pet.RaceId);
            message.AppendInteger(pet.Race);
            message.AppendString(pet.Type == "pet_monster" ? "ffffff" : pet.Color);
            message.AppendInteger(pet.Type == "pet_monster" ? 0u : pet.RaceId);

            if (pet.Type == "pet_monster" && pet.MoplaBreed != null)
            {
                string[] array = pet.MoplaBreed.PlantData.Substring(12).Split(' ');
                string[] array2 = array;

                foreach (string s in array2)
                    message.AppendInteger(int.Parse(s));

                message.AppendInteger(pet.MoplaBreed.GrowingStatus);

                return;
            }

            message.AppendInteger(0);
            message.AppendInteger(0);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:29,代码来源:SerializePetInventoryComposer.cs

示例7: MatchingPollResults

        internal static void MatchingPollResults(GameClient client, Poll poll)
        {
            Room room = client.GetHabbo().CurrentRoom;
            if (poll == null || poll.Type != PollType.Matching || room == null)
                return;

            HashSet<RoomUser> users = room.GetRoomUserManager().GetRoomUsers();

            for (int i = 0; i < 10; i++)
            {
                Thread.Sleep(1000);
                foreach (RoomUser roomUser in users)
                {
                    Habbo user = Yupi.GetHabboById(roomUser.UserId);
                    if (user.AnsweredPool)
                    {
                        ServerMessage result =
                            new ServerMessage(LibraryParser.OutgoingRequest("MatchingPollResultMessageComposer"));
                        result.AppendInteger(poll.Id);
                        result.AppendInteger(2);
                        result.AppendString("0");
                        result.AppendInteger(poll.AnswersNegative);
                        result.AppendString("1");
                        result.AppendInteger(poll.AnswersPositive);
                        client.SendMessage(result);
                    }
                }
            }

            foreach (RoomUser roomUser in users)
                Yupi.GetHabboById(roomUser.UserId).AnsweredPool = false;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:32,代码来源:StartQuestion.cs

示例8: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            if (!session.GetHabbo().Look.Contains("hd-"))
                return true;

            string head = session.GetHabbo().Look.Split('.').FirstOrDefault(element => element.StartsWith("hd-"));
            string color = "1";
            if (!string.IsNullOrEmpty(head))
            {
                color = head.Split('-')[2];
                session.GetHabbo().Look = session.GetHabbo().Look.Replace('.' + head, string.Empty);
            }
            session.GetHabbo().Look += ".hd-99999-" + color;

            using (IQueryAdapter dbClient = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    "UPDATE users SET look = @look WHERE id = " + session.GetHabbo().Id);
                dbClient.AddParameter("look", session.GetHabbo().Look);
                dbClient.RunQuery();
            }
            Room room = session.GetHabbo().CurrentRoom;
            RoomUser user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
            if (user == null) return true;

            ServerMessage roomUpdate = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
            roomUpdate.AppendInteger(user.VirtualId);
            roomUpdate.AppendString(session.GetHabbo().Look);
            roomUpdate.AppendString(session.GetHabbo().Gender.ToLower());
            roomUpdate.AppendString(session.GetHabbo().Motto);
            roomUpdate.AppendInteger(session.GetHabbo().AchievementPoints);
            room.SendMessage(roomUpdate);

            return true;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:35,代码来源:FaceLess.cs

示例9: SerializeQuest

        /// <summary>
        ///     Serializes the quest.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="session">The session.</param>
        /// <param name="quest">The quest.</param>
        /// <param name="category">The category.</param>
        internal static void SerializeQuest(ServerMessage message, GameClient session, Quest quest, string category)
        {
            if (message == null || session == null)
            {
                return;
            }
            var amountOfQuestsInCategory = Yupi.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(category);

            {
                var num = quest == null ? amountOfQuestsInCategory : quest.Number - 1;
                var num2 = quest == null ? 0 : session.GetHabbo().GetQuestProgress(quest.Id);
                if (quest != null && quest.IsCompleted(num2))
                {
                    num++;
                }
                message.AppendString(category);
                message.AppendInteger(quest == null ? 0 : (quest.Category.Contains("xmas2012") ? 0 : num));
                message.AppendInteger(quest == null
                    ? 0
                    : (quest.Category.Contains("xmas2012") ? 0 : amountOfQuestsInCategory));
                message.AppendInteger(quest?.RewardType ?? 3);
                message.AppendInteger(quest?.Id ?? 0);
                message.AppendBool(quest != null && session.GetHabbo().CurrentQuestId == quest.Id);
                message.AppendString(quest == null ? string.Empty : quest.ActionName);
                message.AppendString(quest == null ? string.Empty : quest.DataBit);
                message.AppendInteger(quest?.Reward ?? 0);
                message.AppendString(quest == null ? string.Empty : quest.Name);
                message.AppendInteger(num2);
                message.AppendInteger(quest?.GoalData ?? 0u);
                message.AppendInteger(quest?.TimeUnlock ?? 0);
                message.AppendString(string.Empty);
                message.AppendString(string.Empty);
                message.AppendBool(true);
            }
        }
开发者ID:sgf,项目名称:Yupi,代码行数:42,代码来源:QuestListComposer.cs

示例10: SendTicketToModerators

        /// <summary>
        ///     Sends the ticket to moderators.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        internal static void SendTicketToModerators(SupportTicket ticket)
        {
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolIssueMessageComposer"));
            message = ticket.Serialize(message);

            Yupi.GetGame().GetClientManager().StaffAlert(message);
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:11,代码来源:ModerationTool.cs

示例11: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            GameClient client = Yupi.GetGame().GetClientManager().GetClientByUserName(pms[0]);
            if (client == null)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_not_found"));
                return true;
            }
            if (client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("user_is_higher_rank"));
                return true;
            }
            int time;
            if (!int.TryParse(pms[1], out time))
            {
                session.SendWhisper(Yupi.GetLanguage().GetVar("enter_numbers"));
                return true;
            }

            client.GetHabbo().FloodTime = Yupi.GetUnixTimeStamp() + Convert.ToInt32(pms[1]);
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
            serverMessage.AppendInteger(Convert.ToInt32(pms[1]));
            client.SendMessage(serverMessage);
            return true;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:26,代码来源:FloodUser.cs

示例12: Execute

        public override bool Execute(GameClient session, string[] pms)
        {
            using (IQueryAdapter adapter = Yupi.GetDatabaseManager().GetQueryReactor())
            {
                FurnitureDataManager.SetCache();
                Yupi.GetGame().GetItemManager().LoadItems(adapter);
                Yupi.GetGame().GetCatalog().Initialize(adapter);
                Yupi.GetGame().ReloadItems();
                FurnitureDataManager.Clear();
            }
            Yupi.GetGame()
                .GetClientManager()
                .QueueBroadcaseMessage(
                    new ServerMessage(LibraryParser.OutgoingRequest("PublishShopMessageComposer")));
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));
            message.AppendString("ninja_promo_LTD");
            message.AppendInteger(4);
            message.AppendString("title");
            message.AppendString("Novo Raro Limitado!");
            message.AppendString("message");
            message.AppendString(
                "<i><h1>Como Assim?</h1>, Um Novo Raro Limitado foi Adicionado na Loja!<br> Descubra como ele é Abrindo a Loja!</br>");
            message.AppendString("linkUrl");
            message.AppendString("event:catalog/open/ultd_furni");
            message.AppendString("linkTitle");
            message.AppendString("Ver o Raro");

            Yupi.GetGame().GetClientManager().QueueBroadcaseMessage(message);
            return true;
        }
开发者ID:weslley17w,项目名称:Yupi,代码行数:30,代码来源:LTD.cs

示例13: Serialize

        /// <summary>
        ///     Serializes the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        internal void Serialize(ServerMessage message)
        {
            message.StartArray();

            foreach (ClothingItem item1 in Clothing.Select(clothing1 => Yupi.GetGame().GetClothingManager().GetClothesInFurni(clothing1)))
            {
                foreach (int clothe in item1.Clothes)
                    message.AppendInteger(clothe);

                message.SaveArray();
            }

            message.EndArray();
            message.StartArray();

            foreach (ClothingItem item2 in Clothing.Select(clothing2 => Yupi.GetGame().GetClothingManager().GetClothesInFurni(clothing2)))
            {
                foreach (int clothe in item2.Clothes)
                    message.AppendString(item2.ItemName);

                message.SaveArray();
            }

            message.EndArray();
        }
开发者ID:sgf,项目名称:Yupi,代码行数:29,代码来源:UserClothesManager.cs

示例14: Compose

 /// <summary>
 ///     Composes the specified session.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <param name="quest">The quest.</param>
 /// <returns>ServerMessage.</returns>
 internal static ServerMessage Compose(GameClient session, Quest quest)
 {
     var amountOfQuestsInCategory = Yupi.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(quest.Category);
     var i = quest == null ? amountOfQuestsInCategory : quest.Number;
     var i2 = quest == null ? 0 : session.GetHabbo().GetQuestProgress(quest.Id);
     var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestCompletedMessageComposer"));
     serverMessage.AppendString(quest.Category);
     serverMessage.AppendInteger(i);
     serverMessage.AppendInteger(quest.Name.Contains("xmas2012") ? 1 : amountOfQuestsInCategory);
     serverMessage.AppendInteger(quest == null ? 3 : quest.RewardType);
     serverMessage.AppendInteger(quest == null ? 0 : quest.Id);
     serverMessage.AppendBool(quest != null && session.GetHabbo().CurrentQuestId == quest.Id);
     serverMessage.AppendString(quest == null ? string.Empty : quest.ActionName);
     serverMessage.AppendString(quest == null ? string.Empty : quest.DataBit);
     serverMessage.AppendInteger(quest == null ? 0 : quest.Reward);
     serverMessage.AppendString(quest == null ? string.Empty : quest.Name);
     serverMessage.AppendInteger(i2);
     serverMessage.AppendInteger(quest == null ? 0u : quest.GoalData);
     serverMessage.AppendInteger(quest == null ? 0 : quest.TimeUnlock);
     serverMessage.AppendString("");
     serverMessage.AppendString("");
     serverMessage.AppendBool(true);
     serverMessage.AppendBool(true);
     return serverMessage;
 }
开发者ID:sgf,项目名称:Yupi,代码行数:31,代码来源:QuestCompletedComposer.cs

示例15: Compose

        /// <summary>
        ///     Composes the specified score.
        /// </summary>
        /// <param name="score">The score.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage Compose(uint score)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AchievementPointsMessageComposer"));

            serverMessage.AppendInteger(score);

            return serverMessage;
        }
开发者ID:sgf,项目名称:Yupi,代码行数:13,代码来源:AchievementScoreUpdateComposer.cs


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