Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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;
        }
Exemplo n.º 3
0
        /// <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();
        }
Exemplo n.º 4
0
        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;
        }
Exemplo n.º 5
0
        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;
        }
Exemplo n.º 6
0
Arquivo: About.cs Projeto: sgf/Yupi
        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;
        }
Exemplo n.º 7
0
 internal static void GenerateMessage(Pet pet)
 {
     ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("RespectPetComposer"));
     serverMessage.AppendInteger(pet.VirtualId);
     serverMessage.AppendBool(true);
     pet.Room.SendMessage(serverMessage);
 }
Exemplo n.º 8
0
        /// <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;
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        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;
        }
        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);
        }
Exemplo n.º 12
0
        /// <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);
            }
        }
Exemplo n.º 13
0
 /// <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;
 }
Exemplo n.º 14
0
        /// <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);
        }
Exemplo n.º 15
0
        /// <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;
        }
Exemplo n.º 16
0
 internal static void GenerateMessage(Pet pet)
 {
     ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("PetRespectNotificationMessageComposer"));
     serverMessage.AppendInteger(1);
     serverMessage.AppendInteger(pet.VirtualId);
     pet.SerializeInventory(serverMessage);
     pet.Room.SendMessage(serverMessage);
 }
Exemplo n.º 17
0
        /// <summary>
        ///     Composes the index.
        /// </summary>
        /// <param name="rank">The rank.</param>
        /// <param name="type">The type.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage ComposeIndex(uint rank, string type)
        {
            IEnumerable<CatalogPage> pages =
                Yupi.GetGame().GetCatalogManager().Categories.Values.OfType<CatalogPage>().ToList();

            IOrderedEnumerable<CatalogPage> sortedPages = pages.Where(x => x.ParentId == -2 && x.MinRank <= rank).OrderBy(x => x.OrderNum);

            if (type == "NORMAL")
                sortedPages = pages.Where(x => x.ParentId == -1 && x.MinRank <= rank).OrderBy(x => x.OrderNum);

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

            message.AppendBool(true);
            message.AppendInteger(0);
            message.AppendInteger(-1);
            message.AppendString("root");
            message.AppendString(string.Empty);
            message.AppendInteger(0);
            message.AppendInteger(sortedPages.Count());

            foreach (CatalogPage cat in sortedPages)
            {
                message.AppendBool(cat.Visible);
                message.AppendInteger(cat.IconImage);
                message.AppendInteger(cat.PageId);
                message.AppendString(cat.CodeName);
                message.AppendString(cat.Caption);
                message.AppendInteger(cat.FlatOffers.Count);

                foreach (uint i in cat.FlatOffers.Keys)
                    message.AppendInteger(i);

                IOrderedEnumerable<CatalogPage> sortedSubPages =
                    pages.Where(x => x.ParentId == cat.PageId && x.MinRank <= rank).OrderBy(x => x.OrderNum);

                message.AppendInteger(sortedSubPages.Count());

                foreach (CatalogPage subCat in sortedSubPages)
                {
                    message.AppendBool(subCat.Visible);
                    message.AppendInteger(subCat.IconImage);
                    message.AppendInteger(subCat.PageId);
                    message.AppendString(subCat.CodeName);
                    message.AppendString(subCat.Caption);
                    message.AppendInteger(subCat.FlatOffers.Count);

                    foreach (uint i2 in subCat.FlatOffers.Keys)
                        message.AppendInteger(i2);

                    message.AppendInteger(0);
                }
            }

            message.AppendBool(false);
            message.AppendString(type);

            return message;
        }
Exemplo n.º 18
0
        internal static void GenerateMessage(Pet pet, uint amount)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("AddPetExperienceMessageComposer"));

            serverMessage.AppendInteger(pet.PetId);
            serverMessage.AppendInteger(pet.VirtualId);
            serverMessage.AppendInteger(amount);
            pet.Room.SendMessage(serverMessage);
        }
Exemplo n.º 19
0
        public override bool Execute(GameClient session, string[] pms)
        {
            string str = string.Join(" ", pms);
            ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("BroadcastNotifMessageComposer"));
            message.AppendString($"{str}\r\n- {session.GetHabbo().UserName}");
            Yupi.GetGame().GetClientManager().QueueBroadcaseMessage(message);

            return true;
        }
Exemplo n.º 20
0
Arquivo: Chatlog.cs Projeto: sgf/Yupi
 internal void Serialize(ref ServerMessage message)
 {
     Habbo habbo = Yupi.GetHabboById(UserId);
     message.AppendInteger(Yupi.DifferenceInMilliSeconds(TimeStamp, DateTime.Now));
     message.AppendInteger(UserId);
     message.AppendString(habbo == null ? "*User not found*" : habbo.UserName);
     message.AppendString(Message);
     message.AppendBool(GlobalMessage);
 }
Exemplo n.º 21
0
 /// <summary>
 ///     Composes the specified session.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <param name="quests">The quests.</param>
 /// <param name="send">if set to <c>true</c> [send].</param>
 /// <returns>ServerMessage.</returns>
 internal static ServerMessage Compose(GameClient session, List<Quest> quests, bool send)
 {
     var dictionary = new Dictionary<string, int>();
     var dictionary2 = new Dictionary<string, Quest>();
     foreach (var current in quests)
     {
         if (!current.Category.Contains("xmas2012"))
         {
             if (!dictionary.ContainsKey(current.Category))
             {
                 dictionary.Add(current.Category, 1);
                 dictionary2.Add(current.Category, null);
             }
             if (current.Number >= dictionary[current.Category])
             {
                 var questProgress = session.GetHabbo().GetQuestProgress(current.Id);
                 if (session.GetHabbo().CurrentQuestId != current.Id && questProgress >= current.GoalData)
                 {
                     dictionary[current.Category] = current.Number + 1;
                 }
             }
         }
     }
     foreach (var current2 in quests)
     {
         foreach (var current3 in dictionary)
         {
             if (!current2.Category.Contains("xmas2012") && current2.Category == current3.Key &&
                 current2.Number == current3.Value)
             {
                 dictionary2[current3.Key] = current2;
                 break;
             }
         }
     }
     var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("QuestListMessageComposer"));
     serverMessage.AppendInteger(dictionary2.Count);
     foreach (var current4 in dictionary2)
     {
         if (current4.Value != null)
         {
             SerializeQuest(serverMessage, session, current4.Value, current4.Key);
         }
     }
     foreach (var current5 in dictionary2)
     {
         if (current5.Value == null)
         {
             SerializeQuest(serverMessage, session, current5.Value, current5.Key);
         }
     }
     serverMessage.AppendBool(send);
     return serverMessage;
 }
Exemplo n.º 22
0
        /// <summary>
        ///     Composes the specified session.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="groupForum"></param>
        /// <param name="requesterId"></param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage Compose(Group group, GroupForum groupForum, uint requesterId)
        {
            string string1 = string.Empty, string2 = string.Empty, string3 = string.Empty, string4 = string.Empty;

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

            message.AppendInteger(group.Id);
            message.AppendString(group.Name);
            message.AppendString(group.Description);
            message.AppendString(group.Badge);
            message.AppendInteger(0);
            message.AppendInteger(0);
            message.AppendInteger(groupForum.ForumMessagesCount);
            message.AppendInteger(0);
            message.AppendInteger(0);
            message.AppendInteger(groupForum.ForumLastPosterId);
            message.AppendString(groupForum.ForumLastPosterName);
            message.AppendInteger(groupForum.ForumLastPostTime);
            message.AppendInteger(groupForum.WhoCanRead);
            message.AppendInteger(groupForum.WhoCanPost);
            message.AppendInteger(groupForum.WhoCanThread);
            message.AppendInteger(groupForum.WhoCanMod);

            if (groupForum.WhoCanRead == 1 && !group.Members.ContainsKey(requesterId))
                string1 = "not_member";
            if (groupForum.WhoCanRead == 2 && !group.Admins.ContainsKey(requesterId))
                string1 = "not_admin";
            if (groupForum.WhoCanPost == 1 && !group.Members.ContainsKey(requesterId))
                string2 = "not_member";
            if (groupForum.WhoCanPost == 2 && !group.Admins.ContainsKey(requesterId))
                string2 = "not_admin";
            if (groupForum.WhoCanPost == 3 && requesterId != group.CreatorId)
                string2 = "not_owner";
            if (groupForum.WhoCanThread == 1 && !group.Members.ContainsKey(requesterId))
                string3 = "not_member";
            if (groupForum.WhoCanThread == 2 && !group.Admins.ContainsKey(requesterId))
                string3 = "not_admin";
            if (groupForum.WhoCanThread == 3 && requesterId != group.CreatorId)
                string3 = "not_owner";
            if (groupForum.WhoCanMod == 2 && !group.Admins.ContainsKey(requesterId))
                string4 = "not_admin";
            if (groupForum.WhoCanMod == 3 && requesterId != group.CreatorId)
                string4 = "not_owner";

            message.AppendString(string1);
            message.AppendString(string2);
            message.AppendString(string3);
            message.AppendString(string4);
            message.AppendString(string.Empty);
            message.AppendBool(requesterId == group.CreatorId);
            message.AppendBool(true);

            return message;
        }
Exemplo n.º 23
0
 /// <summary>
 ///     Searializes the specified reply.
 /// </summary>
 /// <param name="reply">The reply.</param>
 internal void Searialize(ServerMessage reply)
 {
     reply.AppendInteger(UserId);
     reply.AppendString(UserName);
     reply.AppendString(Motto);
     reply.AppendBool(Yupi.GetGame().GetClientManager().GetClient(UserId) != null);
     reply.AppendBool(false);
     reply.AppendString(string.Empty);
     reply.AppendInteger(0);
     reply.AppendString(Look);
     reply.AppendString(LastOnline);
 }
Exemplo n.º 24
0
        /// <summary>
        ///     Generates the extra data.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <returns>ServerMessage.</returns>
        internal ServerMessage GenerateExtraData(ServerMessage message)
        {
            message.AppendInteger(0);
            message.AppendInteger(5);
            message.AppendInteger(4);
            message.AppendInteger(Enabled);
            message.AppendInteger(Data1);
            message.AppendInteger(Data2);
            message.AppendInteger(Data3);

            return message;
        }
Exemplo n.º 25
0
        /// <summary>
        ///     Serializes the promotions result list flatcats.
        /// </summary>
        /// <param name="flatCatId">The flat cat identifier.</param>
        /// <param name="direct">if set to <c>true</c> [direct].</param>
        /// <param name="message">The message.</param>
        internal static void SerializePromotionsResultListFlatcats(int flatCatId, bool direct, ServerMessage message)
        {
            PublicCategory flatCat = Yupi.GetGame().GetNavigator().GetFlatCat(flatCatId);

            message.AppendString("new_ads");
            message.AppendString(flatCat.Caption);
            message.AppendInteger(0);
            message.AppendBool(true);
            message.AppendInteger(-1);

            KeyValuePair<RoomData, uint>[] rooms = Yupi.GetGame().GetRoomManager().GetEventRooms();
            Yupi.GetGame().GetNavigator().SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
        }
Exemplo n.º 26
0
        public bool Execute(params object[] stuff)
        {
            RoomUser bot = Room.GetRoomUserManager().GetBotByName(OtherString);

            if (bot == null || OtherExtraString == "null")
                return false;

            bot.BotData.Look = OtherExtraString;
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("SetRoomUserMessageComposer"));
            serverMessage.AppendInteger(1);
            bot.Serialize(serverMessage, false);
            Room.SendMessage(serverMessage);

            return true;
        }
Exemplo n.º 27
0
 internal static void MatchingPollAnswer(GameClient client, Poll poll)
 {
     if (poll == null || poll.Type != PollType.Matching)
         return;
     ServerMessage message = new ServerMessage(LibraryParser.OutgoingRequest("MatchingPollMessageComposer"));
     message.AppendString("MATCHING_POLL");
     message.AppendInteger(poll.Id);
     message.AppendInteger(poll.Id);
     message.AppendInteger(15580);
     message.AppendInteger(poll.Id);
     message.AppendInteger(29);
     message.AppendInteger(5);
     message.AppendString(poll.PollName);
     client.GetHabbo().CurrentRoom.SendMessage(message);
 }
Exemplo n.º 28
0
        public override void OnUserWalk(GameClient session, RoomItem item, RoomUser user)
        {
            if (item == null || user == null)
                return;

            string[] data = item.ExtraData.Split(Convert.ToChar(9));

            if (item.ExtraData == "" || data.Length < 4)
                return;

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

            message.AppendString(data[3]);
            session.SendMessage(message);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Composes the specified playlist capacity.
        /// </summary>
        /// <param name="playlistCapacity">The playlist capacity.</param>
        /// <param name="playlist">The playlist.</param>
        /// <returns>ServerMessage.</returns>
        internal static ServerMessage Compose(int playlistCapacity, List<SongInstance> playlist)
        {
            ServerMessage serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("JukeboxPlaylistMessageComposer"));

            serverMessage.AppendInteger(playlistCapacity);
            serverMessage.AppendInteger(playlist.Count);

            foreach (SongInstance current in playlist)
            {
                serverMessage.AppendInteger(current.DiskItem.ItemId);
                serverMessage.AppendInteger(current.SongData.Id);
            }

            return serverMessage;
        }
Exemplo n.º 30
0
        /// <summary>
        ///     Serializes the search result list flatcats.
        /// </summary>
        /// <param name="flatCatId">The flat cat identifier.</param>
        /// <param name="direct">if set to <c>true</c> [direct].</param>
        /// <param name="message">The message.</param>
        internal static void SerializeSearchResultListFlatcats(int flatCatId, bool direct, ServerMessage message)
        {
            PublicCategory flatCat = Yupi.GetGame().GetNavigator().GetFlatCat(flatCatId);

            if (flatCat == null)
                return;

            message.AppendString($"category__{flatCat.Caption}");
            message.AppendString(flatCat.Caption);
            message.AppendInteger(0);
            message.AppendBool(true);
            message.AppendInteger(-1);

            KeyValuePair<RoomData, uint>[] rooms = Yupi.GetGame().GetRoomManager().GetActiveRooms();
            Yupi.GetGame().GetNavigator().SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
        }
Exemplo n.º 31
0
 /// <summary>
 ///     Appends the server message.
 /// </summary>
 /// <param name="message">The message.</param>
 public void AppendServerMessage(ServerMessage message)
 {
     AppendBytes(message.GetBytes(), false);
 }
Exemplo n.º 32
0
 /// <summary>
 ///     Appends the response.
 /// </summary>
 /// <param name="message">The message.</param>
 internal void AppendResponse(ServerMessage message)
 {
     AppendBytes(message.GetReversedBytes());
 }