Esempio n. 1
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;
            }
            int amountOfQuestsInCategory = AzureEmulator.GetGame().GetQuestManager().GetAmountOfQuestsInCategory(Category);

            {
                int num = (Quest == null) ? amountOfQuestsInCategory : (Quest.Number - 1);
                int 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 == null) ? 3 : Quest.RewardType);
                Message.AppendInteger((Quest == null) ? 0u : Quest.Id);
                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 == null) ? 0 : Quest.Reward);
                Message.AppendString((Quest == null) ? string.Empty : Quest.Name);
                Message.AppendInteger(num2);
                Message.AppendInteger((Quest == null) ? 0u : Quest.GoalData);
                Message.AppendInteger((Quest == null) ? 0 : Quest.TimeUnlock);
                Message.AppendString("");
                Message.AppendString("");
                Message.AppendBool(true);
            }
        }
Esempio n. 2
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)
        {
            var flatCat = Azure.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);

            try
            {
                var rooms = Azure.GetGame().GetRoomManager().GetActiveRooms();
                Azure.GetGame()
                    .GetNavigator()
                    .SerializeNavigatorPopularRoomsNews(ref message, rooms, flatCatId, direct);
            }
            catch
            {
                message.AppendInteger(0);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Serializes the specified message.
 /// </summary>
 /// <param name="message">The message.</param>
 internal void Serialize(ServerMessage message)
 {
     message.StartArray();
     foreach (var clothing1 in Clothing)
     {
         var item1 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing1);
         foreach (var clothe in item1.Clothes)
         {
             message.AppendInteger(clothe);
         }
         message.SaveArray();
     }
     message.EndArray();
     message.StartArray();
     foreach (var clothing2 in Clothing)
     {
         var item2 = AzureEmulator.GetGame().GetClothingManager().GetClothesInFurni(clothing2);
         foreach (var clothe in item2.Clothes)
         {
             message.AppendString(item2.ItemName);
         }
         message.SaveArray();
     }
     message.EndArray();
 }
Esempio n. 4
0
        /// <summary>
        ///     Sends the ticket to moderators.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        internal static void SendTicketToModerators(SupportTicket ticket)
        {
            var message = new ServerMessage(LibraryParser.OutgoingRequest("ModerationToolIssueMessageComposer"));
            message = ticket.Serialize(message);

            Azure.GetGame().GetClientManager().StaffAlert(message);
        }
Esempio n. 5
0
        public override void Execute(GameClient session, string[] pms)
        {
            var room = session.GetHabbo().CurrentRoom;

            var user = room.GetRoomUserManager().GetRoomUserByHabbo(pms[0]);
            if (user == null)
            {
                session.SendWhisper(TextManager.GetText("user_not_found"));
            }

            var gender = user.GetClient().GetHabbo().Gender;
            var look = user.GetClient().GetHabbo().Look;
            session.GetHabbo().Gender = gender;
            session.GetHabbo().Look = look;
            using (var adapter = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                adapter.SetQuery(
                    "UPDATE users SET gender = @gender, look = @look WHERE id = " + session.GetHabbo().Id);
                adapter.AddParameter("gender", gender);
                adapter.AddParameter("look", look);
                adapter.RunQuery();
            }

            var myUser = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().UserName);
            if (myUser == null)
                return;

            var message = new ServerMessage(LibraryParser.OutgoingRequest("UpdateUserDataMessageComposer"));
            message.AppendInteger(myUser.VirtualId);
            message.AppendString(session.GetHabbo().Look);
            message.AppendString(session.GetHabbo().Gender.ToLower());
            message.AppendString(session.GetHabbo().Motto);
            message.AppendInteger(session.GetHabbo().AchievementPoints);
            room.SendMessage(message.GetReversedBytes());
        }
Esempio n. 6
0
 public override void Execute(GameClient session, string[] pms)
 {
     var str = string.Join(" ", pms);
     var message = new ServerMessage(LibraryParser.OutgoingRequest("BroadcastNotifMessageComposer"));
     message.AppendString(string.Format("{0}\r\n- {1}", str, session.GetHabbo().UserName));
     AzureEmulator.GetGame().GetClientManager().QueueBroadcaseMessage(message);
 }
Esempio n. 7
0
        public override bool Execute(GameClient client, string[] pms)
        {
            var message =
                new ServerMessage(LibraryParser.OutgoingRequest("SuperNotificationMessageComposer"));

            message.AppendString("Azure");
            message.AppendInteger(4);
            message.AppendString("title");
            message.AppendString("ManiaEVO 1.2");
            message.AppendString("message");
            var info = new StringBuilder();
            info.Append("<h5><b>ManiaEVO 1.2 - Base: Azure</b><h5></br></br>");
            info.Append("<br />");
            info.AppendFormat(
                "<b><br />Desenvolvedores:</b> <br />iPlezier <br />Claudi0<br />Kessiler <br /><br /> ");
            info.AppendFormat(
                "<b>Créditos:</b> <br />Jamal, Claudio, Boris, Lucca, Antoine, IhToN<br /> <br /> ");
            info.AppendFormat("<b>Estatisticas:</b> <br />");
            var userCount = Azure.GetGame().GetClientManager().Clients.Count;
            var roomsCount = Azure.GetGame().GetRoomManager().LoadedRooms.Count;
            info.AppendFormat("<b>Usuários:</b> {0} em {1}{2}.<br /><br /><br />", userCount, roomsCount,
                (roomsCount == 1) ? " Quarto" : " Quartos");
            message.AppendString(info.ToString());
            message.AppendString("linkUrl");
            message.AppendString("event:");
            message.AppendString("linkTitle");
            message.AppendString("ok");
            client.SendMessage(message);

            return true;
        }
Esempio n. 8
0
        internal static void MatchingPollResults(GameClient client, Poll poll)
        {
            var room = client.GetHabbo().CurrentRoom;
            if (poll == null || poll.Type != PollType.Matching || room == null)
                return;

            var users = room.GetRoomUserManager().GetRoomUsers();

            for (var i = 0; i < 10; i++)
            {
                Thread.Sleep(1000);
                foreach (var roomUser in users)
                {
                    var user = Azure.GetHabboById(roomUser.UserId);
                    if (user.AnsweredPool)
                    {
                        var 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 (var roomUser in users)
                Azure.GetHabboById(roomUser.UserId).AnsweredPool = false;
        }
Esempio n. 9
0
        public override void Execute(GameClient session, string[] pms)
        {
            var head = session.GetHabbo().Look.Split('.').FirstOrDefault(element => element.StartsWith("hd-"));
            var 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 (var dbClient = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery(
                    "UPDATE users SET look = @look WHERE id = " + session.GetHabbo().Id);
                dbClient.AddParameter("look", session.GetHabbo().Look);
                dbClient.RunQuery();
            }
            var room = session.GetHabbo().CurrentRoom;
            var user = room.GetRoomUserManager().GetRoomUserByHabbo(session.GetHabbo().Id);
            if (user == null) return;

            var 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);
        }
 /// <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 = Azure.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) ? 0u : 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;
 }
Esempio n. 11
0
        public override bool Execute(GameClient session, string[] pms)
        {
            using (var adapter = Azure.GetDatabaseManager().GetQueryReactor())
            {
                FurniDataParser.SetCache();
                Azure.GetGame().GetItemManager().LoadItems(adapter);
                Azure.GetGame().GetCatalog().Initialize(adapter);
                Azure.GetGame().ReloadItems();
                FurniDataParser.Clear();
            }
            Azure.GetGame()
                .GetClientManager()
                .QueueBroadcaseMessage(
                    new ServerMessage(LibraryParser.OutgoingRequest("PublishShopMessageComposer")));
            var 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");

            Azure.GetGame().GetClientManager().QueueBroadcaseMessage(message);
            return true;
        }
Esempio n. 12
0
 internal ServerMessage GetServerMessage(ServerMessage message, RoomItem item)
 {
     var cracks = 0;
     var cracks_max = MaxCracks(item.GetBaseItem().Name);
     if (AzureEmulator.IsNum(item.ExtraData))
         cracks = Convert.ToInt16(item.ExtraData);
     var state = "0";
     if (cracks >= cracks_max)
         state = "14";
     else if (cracks >= cracks_max * 6 / 7)
         state = "12";
     else if (cracks >= cracks_max * 5 / 7)
         state = "10";
     else if (cracks >= cracks_max * 4 / 7)
         state = "8";
     else if (cracks >= cracks_max * 3 / 7)
         state = "6";
     else if (cracks >= cracks_max * 2 / 7)
         state = "4";
     else if (cracks >= cracks_max * 1 / 7)
         state = "2";
     message.AppendInteger(7);
     message.AppendString(state); //state (0-7)
     message.AppendInteger(cracks); //actual
     message.AppendInteger(cracks_max); //max
     return message;
 }
Esempio n. 13
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 = Azure.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 == null) ? 3 : quest.RewardType);
                message.AppendInteger((quest == null) ? 0u : quest.Id);
                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 == null) ? 0 : quest.Reward);
                message.AppendString((quest == null) ? string.Empty : quest.Name);
                message.AppendInteger(num2);
                message.AppendInteger((quest == null) ? 0u : quest.GoalData);
                message.AppendInteger((quest == null) ? 0 : quest.TimeUnlock);
                message.AppendString("");
                message.AppendString("");
                message.AppendBool(true);
            }
        }
Esempio n. 14
0
 /// <summary>
 ///     Smalls the promo composer.
 /// </summary>
 /// <param name="message">The message.</param>
 /// <returns>ServerMessage.</returns>
 internal ServerMessage SmallPromoComposer(ServerMessage message)
 {
     message.AppendInteger(HotelViewPromosIndexers.Count);
     foreach (var current in HotelViewPromosIndexers)
         current.Serialize(message);
     return message;
 }
Esempio n. 15
0
 internal void GenerateMessage(ServerMessage message)
 {
     message.Init(LibraryParser.OutgoingRequest("TargetedOfferMessageComposer"));
     message.AppendInteger(1);//show
     message.AppendInteger(Id);
     message.AppendString(Identifier);
     message.AppendString(Identifier);
     message.AppendInteger(CostCredits);
     if (CostDiamonds > 0)
     {
         message.AppendInteger(CostDiamonds);
         message.AppendInteger(105);
     }
     else
     {
         message.AppendInteger(CostDuckets);
         message.AppendInteger(0);
     }
     message.AppendInteger(PurchaseLimit);
     var TimeLeft = ExpirationTime - AzureEmulator.GetUnixTimeStamp();
     message.AppendInteger(TimeLeft);
     message.AppendString(Title);
     message.AppendString(Description);
     message.AppendString(Image);
     message.AppendString("");
     message.StartArray();
     foreach (string Product in Products)
     {
         message.AppendString(Product);
         message.SaveArray();
     }
     message.EndArray();
 }
Esempio n. 16
0
        /// <summary>
        ///     Serializes the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        internal void Serialize(ServerMessage message)
        {
            message.StartArray();
            foreach (
                var item1 in
                    Clothing.Select(clothing1 => Azure.GetGame().GetClothingManager().GetClothesInFurni(clothing1)))
            {
                foreach (var clothe in item1.Clothes)
                    message.AppendInteger(clothe);

                message.SaveArray();
            }
            message.EndArray();
            message.StartArray();

            foreach (
                var item2 in
                    Clothing.Select(clothing2 => Azure.GetGame().GetClothingManager().GetClothesInFurni(clothing2)))
            {
                foreach (var clothe in item2.Clothes)
                    message.AppendString(item2.ItemName);
                message.SaveArray();
            }

            message.EndArray();
        }
Esempio n. 17
0
        public override void Execute(GameClient session, string[] pms)
        {
            var client = AzureEmulator.GetGame().GetClientManager().GetClientByUserName(pms[0]);
            if (client == null)
            {
                session.SendWhisper(TextManager.GetText("user_not_found"));
                return;
            }
            if (client.GetHabbo().Rank >= session.GetHabbo().Rank)
            {
                session.SendWhisper(TextManager.GetText("user_is_higher_rank"));
                return;
            }
            int time;
            if (!int.TryParse(pms[1], out time))
            {
                session.SendWhisper(TextManager.GetText("enter_numbers"));
                return;
            }

            client.GetHabbo().FloodTime = AzureEmulator.GetUnixTimeStamp() + Convert.ToInt32(pms[1]);
            var serverMessage = new ServerMessage(LibraryParser.OutgoingRequest("FloodFilterMessageComposer"));
            serverMessage.AppendInteger(Convert.ToInt32(pms[1]));
            client.SendMessage(serverMessage);
        }
        /// <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 =
                Azure.GetGame().GetCatalog().Categories.Values.OfType<CatalogPage>().ToList();

            var 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);

            var 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 (var 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 (var i in cat.FlatOffers.Keys)
                    message.AppendInteger(i);

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

                message.AppendInteger(sortedSubPages.Count());

                foreach (var 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 (var i2 in subCat.FlatOffers.Keys)
                        message.AppendInteger(i2);

                    message.AppendInteger(0);
                }
            }

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

            return message;
        }
Esempio n. 19
0
 internal void Serialize(ref ServerMessage message)
 {
     Habbo habbo = AzureEmulator.GetHabboById(UserId);
     message.AppendInteger(AzureEmulator.DifferenceInMilliSeconds(TimeStamp, DateTime.Now));
     message.AppendInteger(UserId);
     message.AppendString(habbo == null ? "*User not found*" : habbo.UserName);
     message.AppendString(Message);
     message.AppendBool(true);
 }
Esempio n. 20
0
        /// <summary>
        /// Completes the user talent.
        /// </summary>
        /// <param name="Session">The session.</param>
        /// <param name="Talent">The talent.</param>
        internal void CompleteUserTalent(GameClient Session, Talent Talent)
        {
            if (Session == null || Session.GetHabbo() == null || Session.GetHabbo().CurrentTalentLevel < Talent.Level || Session.GetHabbo().Talents.ContainsKey(Talent.Id))
                return;
            if (!LevelIsCompleted(Session, Talent.Type, Talent.Level))
                return;
            if (!string.IsNullOrEmpty(Talent.Prize) && Talent.PrizeBaseItem > 0u)
            {
                Item item = AzureEmulator.GetGame().GetItemManager().GetItem(Talent.PrizeBaseItem);
                AzureEmulator.GetGame().GetCatalog().DeliverItems(Session, item, 1, "", 0, 0, "");
            }
            var value = new UserTalent(Talent.Id, 1);
            Session.GetHabbo().Talents.Add(Talent.Id, value);
            using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
            {
                queryReactor.RunFastQuery(string.Concat("REPLACE INTO users_talents VALUES (", Session.GetHabbo().Id, ", ", Talent.Id, ", ", 1, ");"));
            }
            var 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);
            }

            Session.SendMessage(serverMessage);

            if (Talent.Type == "citizenship")
            {
                if (Talent.Level == 3)
                    AzureEmulator.GetGame().GetAchievementManager().ProgressUserAchievement(Session, "ACH_Citizenship", 1);
                else if (Talent.Level == 4)
                {
                    Session.GetHabbo().GetSubscriptionManager().AddSubscription(7);
                    using (IQueryAdapter queryReactor = AzureEmulator.GetDatabaseManager().GetQueryReactor())
                    {
                        queryReactor.RunFastQuery(string.Concat(new object[]
                        {
                            "UPDATE users SET talent_status = 'helper' WHERE id = ",
                            Session.GetHabbo().Id,
                            ";"
                        }));
                    }
                }
            }
        }
Esempio n. 21
0
 public void OnUserWalk(GameClient session, RoomItem item, RoomUser user)
 {
     if (item == null || user == null) return;
     var data = item.ExtraData.Split(Convert.ToChar(9));
     if (item.ExtraData == "" || data.Length < 4) return;
     var message = new ServerMessage(LibraryParser.OutgoingRequest("InternalLinkMessageComposer"));
     message.AppendString(data[3]);
     session.SendMessage(message);
 }
Esempio n. 22
0
        public override bool Execute(GameClient session, string[] pms)
        {
            var str = string.Join(" ", pms);
            var message = new ServerMessage(LibraryParser.OutgoingRequest("BroadcastNotifMessageComposer"));
            message.AppendString($"{str}\r\n- {session.GetHabbo().UserName}");
            Azure.GetGame().GetClientManager().QueueBroadcaseMessage(message);

            return true;
        }
Esempio n. 23
0
 /// <summary>
 /// Serializes the specified composer.
 /// </summary>
 /// <param name="Composer">The composer.</param>
 /// <returns>ServerMessage.</returns>
 internal ServerMessage Serialize(ServerMessage Composer)
 {
     Composer.AppendInteger(Index);
     Composer.AppendString(Header);
     Composer.AppendString(Body);
     Composer.AppendString(Button);
     Composer.AppendInteger(inGamePromo);
     Composer.AppendString(SpecialAction);
     Composer.AppendString(Image);
     return Composer;
 }
Esempio 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;
 }
Esempio n. 25
0
 /// <summary>
 ///     Serializes the specified composer.
 /// </summary>
 /// <param name="composer">The composer.</param>
 /// <returns>ServerMessage.</returns>
 internal ServerMessage Serialize(ServerMessage composer)
 {
     composer.AppendInteger(_index);
     composer.AppendString(_header);
     composer.AppendString(_body);
     composer.AppendString(_button);
     composer.AppendInteger(_inGamePromo);
     composer.AppendString(_specialAction);
     composer.AppendString(_image);
     return composer;
 }
Esempio n. 26
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;
 }
Esempio n. 27
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(AzureEmulator.GetGame().GetClientManager().GetClient(UserId) != null);
     reply.AppendBool(false);
     reply.AppendString(string.Empty);
     reply.AppendInteger(0);
     reply.AppendString(Look);
     reply.AppendString(LastOnline);
 }
Esempio n. 28
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)
 {
     var 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;
 }
Esempio n. 29
0
 /// <summary>
 /// Composes the club purchase page.
 /// </summary>
 /// <param name="session">The session.</param>
 /// <param name="windowId">The window identifier.</param>
 /// <returns>ServerMessage.</returns>
 internal static ServerMessage ComposeClubPurchasePage(GameClient session, int windowId)
 {
     var message = new ServerMessage(LibraryParser.OutgoingRequest("CatalogueClubPageMessageComposer"));
     var habboClubItems = AzureEmulator.GetGame().GetCatalog().HabboClubItems;
     message.AppendInteger(habboClubItems.Count);
     foreach (var item in habboClubItems)
     {
         message.AppendInteger(item.Id);
         message.AppendString(item.Name);
         message.AppendBool(false);
         message.AppendInteger(item.CreditsCost);
         if (item.DiamondsCost > 0)
         {
             message.AppendInteger(item.DiamondsCost);
             message.AppendInteger(105);
         }
         else
         {
             message.AppendInteger(item.DucketsCost);
             message.AppendInteger(0);
         }
         message.AppendBool(true);
         var fuckingArray = item.Name.Split('_');
         double dayTime = 31;
         if (item.Name.Contains("DAY"))
             dayTime = int.Parse(fuckingArray[3]);
         else if (item.Name.Contains("MONTH"))
         {
             var monthTime = int.Parse(fuckingArray[3]);
             dayTime = monthTime * 31;
         }
         else if (item.Name.Contains("YEAR"))
         {
             var yearTimeOmg = int.Parse(fuckingArray[3]);
             dayTime = yearTimeOmg * 31 * 12;
         }
         var newExpiryDate = DateTime.Now.AddDays(dayTime);
         if (session.GetHabbo().GetSubscriptionManager().HasSubscription)
             newExpiryDate =
                 AzureEmulator.UnixToDateTime(session.GetHabbo().GetSubscriptionManager().GetSubscription().ExpireTime)
                     .AddDays(dayTime);
         message.AppendInteger((int)dayTime / 31);
         message.AppendInteger((int)dayTime);
         message.AppendBool(false);// can gift
         message.AppendInteger((int)dayTime);
         message.AppendInteger(newExpiryDate.Year);
         message.AppendInteger(newExpiryDate.Month);
         message.AppendInteger(newExpiryDate.Day);
     }
     message.AppendInteger(windowId);
     return message;
 }
Esempio n. 30
0
        public override bool Execute(GameClient session, string[] pms)
        {
            session.GetHabbo().NewNavigator = !session.GetHabbo().NewNavigator;

            var msg = new ServerMessage(LibraryParser.OutgoingRequest("SendPerkAllowancesMessageComposer"));
            msg.AppendInteger(1);
            msg.AppendString("NAVIGATOR_PHASE_TWO_2014");
            msg.AppendString("");
            msg.AppendBool(session.GetHabbo().NewNavigator);

            session.SendMessage(msg);
            return true;
        }