Пример #1
0
        public ServerMessage method_19(CatalogPage class48_0)
        {
            ServerMessage Message5_0 = new ServerMessage((uint)sbyte.MaxValue);

            Message5_0.AppendInt32(class48_0.Int32_0);
            switch (class48_0.string_1)
            {
            case "frontpage":
                Message5_0.AppendStringWithBreak("frontpage3");
                Message5_0.AppendInt32(3);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendStringWithBreak("");
                Message5_0.AppendInt32(11);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak(class48_0.string_9);
                Message5_0.AppendStringWithBreak(class48_0.string_6);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                Message5_0.AppendStringWithBreak(class48_0.string_10);
                Message5_0.AppendStringWithBreak("#FAF8CC");
                Message5_0.AppendStringWithBreak("#FAF8CC");
                Message5_0.AppendStringWithBreak("Liest mehr >");
                Message5_0.AppendStringWithBreak("magic.credits");
                break;

            case "recycler_info":
                Message5_0.AppendStringWithBreak(class48_0.string_1);
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendInt32(3);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak(class48_0.string_6);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                break;

            case "recycler_prizes":
                Message5_0.AppendStringWithBreak("recycler_prizes");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak("catalog_recycler_headline3");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                break;

            case "spaces":
                Message5_0.AppendStringWithBreak("spaces_new");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                break;

            case "recycler":
                Message5_0.AppendStringWithBreak(class48_0.string_1);
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak(class48_0.string_5, (byte)10);
                Message5_0.AppendStringWithBreak(class48_0.string_6);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                break;

            case "trophies":
                Message5_0.AppendStringWithBreak("trophies");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                break;

            case "pets":
                Message5_0.AppendStringWithBreak("pets");
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendInt32(4);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak("");
                Message5_0.AppendStringWithBreak("Farbe auswählen:");
                Message5_0.AppendStringWithBreak("Rasse auswählen:");
                break;

            case "club_buy":
                Message5_0.AppendStringWithBreak("club_buy");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak("habboclub_2");
                Message5_0.AppendInt32(1);
                break;

            case "club_gifts":
                Message5_0.AppendStringWithBreak("club_gifts");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak("habboclub_2");
                Message5_0.AppendInt32(1);
                Message5_0.AppendStringWithBreak("");
                Message5_0.AppendInt32(1);
                break;

            case "soundmachine":
                Message5_0.AppendStringWithBreak(class48_0.string_1);
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendInt32(2);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                break;

            default:
                Message5_0.AppendStringWithBreak(class48_0.string_1);
                Message5_0.AppendInt32(3);
                Message5_0.AppendStringWithBreak(class48_0.string_2);
                Message5_0.AppendStringWithBreak(class48_0.string_3);
                Message5_0.AppendStringWithBreak(class48_0.string_4);
                Message5_0.AppendInt32(3);
                Message5_0.AppendStringWithBreak(class48_0.string_5);
                Message5_0.AppendStringWithBreak(class48_0.string_7);
                Message5_0.AppendStringWithBreak(class48_0.string_8);
                break;
            }
            Message5_0.AppendInt32(class48_0.list_0.Count);
            foreach (CatalogItem catalogItem in class48_0.list_0)
            {
                catalogItem.method_1(Message5_0);
            }
            return(Message5_0);
        }
Пример #2
0
        public bool method_6(GameClient Session, int int_0, uint uint_1, string string_0, bool bool_0, string string_1, string string_2, bool bool_1)
        {
            int         num1        = 0;
            int         num2        = 0;
            CatalogPage catalogPage = this.method_5(int_0);

            if (catalogPage == null || !catalogPage.bool_1 || !catalogPage.bool_0 || catalogPage.uint_0 > Session.GetHabbo().Rank || catalogPage.bool_2 && (!Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") || !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")))
            {
                return(false);
            }
            CatalogItem catalogItem = catalogPage.method_1(uint_1);

            if (catalogItem == null)
            {
                return(false);
            }
            uint id = 0;

            if (bool_0)
            {
                if (Session.GetHabbo().jail == 1)
                {
                    Session.SendNotification("Du bist gebannt und kannst keine Geschenke versenden!");
                    return(false);
                }

                if (!catalogItem.method_0().AllowGift)
                {
                    return(false);
                }
                if (Session.GetHabbo().method_4() > 0)
                {
                    TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                    if (timeSpan.Seconds > 4)
                    {
                        Session.GetHabbo().int_23 = 0;
                    }
                    if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 3)
                    {
                        Session.GetHabbo().bool_15 = true;
                        return(false);
                    }
                    if (Session.GetHabbo().bool_15&& timeSpan.Seconds < Session.GetHabbo().method_4())
                    {
                        return(false);
                    }
                    Session.GetHabbo().bool_15    = false;
                    Session.GetHabbo().dateTime_0 = DateTime.Now;
                    ++Session.GetHabbo().int_23;
                }
                using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                {
                    client.AddParamWithValue("gift_user", (object)string_1);
                    try
                    {
                        id = (uint)client.ReadDataRow("SELECT Id FROM users WHERE username = @gift_user LIMIT 1", 30)[0];
                    }
                    catch (Exception ex)
                    {
                    }
                }
                if ((int)id == 0)
                {
                    ServerMessage Message5_0 = new ServerMessage(76U);
                    Message5_0.AppendBoolean(true);
                    Message5_0.AppendStringWithBreak(string_1);
                    Session.SendMessage(Message5_0);
                    return(false);
                }
            }
            if (catalogItem.IsLimited)
            {
                if (catalogItem.LimitedSold >= catalogItem.LimitedCount)
                {
                    Session.SendNotification("Dieses Möbelstück war limitiert und ist leider ausverkauft.");
                    return(false);
                }
                ++catalogItem.LimitedSold;
                using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                    client.ExecuteQuery(string.Concat(new object[4]
                    {
                        (object)"UPDATE catalog_items SET limited_sold = ",
                        (object)catalogItem.LimitedSold,
                        (object)" WHERE id = ",
                        (object)catalogItem.uint_0
                    }), 30);
                num2 = catalogItem.LimitedSold;
                num1 = catalogItem.LimitedCount;
                catalogPage.method_0();
                Session.SendMessage(catalogPage.message5_0);
            }
            bool Bool1 = false;
            bool Bool2 = false;
            int  num3  = catalogItem.int_2;

            if (Session.GetHabbo().Credits < catalogItem.int_0)
            {
                Bool1 = true;
            }
            if (num3 == 0 && Session.GetHabbo().ActivityPoints < catalogItem.int_1 || num3 > 0 && Session.GetHabbo().VipPoints < catalogItem.int_1)
            {
                Bool2 = true;
            }
            if (Bool1 || Bool2)
            {
                ServerMessage Message5_0 = new ServerMessage(68U);
                Message5_0.AppendBoolean(Bool1);
                Message5_0.AppendBoolean(Bool2);
                Session.SendMessage(Message5_0);
                return(false);
            }
            if (bool_0 && (int)catalogItem.method_0().Type == 101)
            {
                Session.SendNotification("Du kannst diese Item nicht als Geschenk kaufen.");
                return(false);
            }
            switch (catalogItem.method_0().InteractionType.ToLower())
            {
            case "pet":
                try
                {
                    string[] strArray   = string_0.Split('\n');
                    string   string_0_1 = strArray[0];
                    string   s          = strArray[1];
                    string   str        = strArray[2];
                    int.Parse(s);
                    if (!this.method_8(string_0_1) || s.Length > 2)
                    {
                        return(false);
                    }
                    if (str.Length != 6)
                    {
                        return(false);
                    }
                    break;
                }
                catch (Exception ex)
                {
                    return(false);
                }

            case "roomeffect":
                double num4 = 0.0;
                try
                {
                    num4 = double.Parse(string_0);
                }
                catch (Exception ex)
                {
                }
                string_0 = num4.ToString().Replace(',', '.');
                break;

            case "postit":
                string_0 = "FFFF33";
                break;

            case "dimmer":
                string_0 = "1,1,1,#000000,255";
                break;

            case "trophy":
                string_0 = Session.GetHabbo().Username + (object)Convert.ToChar(9) + (object)DateTime.Now.Day + "-" + (object)DateTime.Now.Month + "-" + (object)DateTime.Now.Year + (object)Convert.ToChar(9) + ChatCommandHandler.smethod_4(HabboIM.DoFilter(string_0, true, true));
                break;

            case "musicdisc":
                string_0 = catalogItem.song_id.ToString();
                break;

            default:
                if (catalogItem.string_0.StartsWith("disc_"))
                {
                    string_0 = catalogItem.string_0.Split('_')[1];
                    break;
                }
                string_0 = "";
                break;
            }
            if (catalogItem.int_0 > 0)
            {
                Session.GetHabbo().Credits -= catalogItem.int_0;
                Session.GetHabbo().UpdateCredits(true);
            }
            if (catalogItem.int_1 > 0 && num3 == 0)
            {
                Session.GetHabbo().ActivityPoints -= catalogItem.int_1;
                Session.GetHabbo().UpdateActivityPoints(true);
            }
            else if (catalogItem.int_1 > 0 && num3 > 0)
            {
                Session.GetHabbo().VipPoints -= catalogItem.int_1;
                Session.GetHabbo().method_16(0);
                Session.GetHabbo().UpdateVipPoints(false, true);
            }
            ServerMessage Message5_0_1 = new ServerMessage(67U);

            Message5_0_1.AppendUInt(catalogItem.method_0().UInt32_0);
            Message5_0_1.AppendStringWithBreak(catalogItem.method_0().Name);
            Message5_0_1.AppendInt32(catalogItem.int_0);
            Message5_0_1.AppendInt32(catalogItem.int_1);
            Message5_0_1.AppendInt32(catalogItem.int_2);
            if (bool_1)
            {
                Message5_0_1.AppendInt32(1);
            }
            else
            {
                Message5_0_1.AppendInt32(0);
            }
            Message5_0_1.AppendStringWithBreak(catalogItem.method_0().Type.ToString());
            Message5_0_1.AppendInt32(catalogItem.method_0().Sprite);
            Message5_0_1.AppendStringWithBreak("");
            Message5_0_1.AppendInt32(1);
            Message5_0_1.AppendInt32(-1);
            Message5_0_1.AppendStringWithBreak("");
            Session.SendMessage(Message5_0_1);
            if (bool_0)
            {
                uint num5 = this.method_14();
                Item obj  = this.method_10();
                using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                {
                    client.AddParamWithValue("gift_message", (object)("!" + ChatCommandHandler.smethod_4(HabboIM.DoFilter(string_2, true, true)) + " - " + Session.GetHabbo().Username));
                    client.AddParamWithValue("extra_data", (object)string_0);
                    client.ExecuteQuery("INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('" + (object)num5 + "','" + (object)id + "','" + (object)obj.UInt32_0 + "','')", 30);
                    client.ExecuteQuery(string.Concat(new object[3]
                    {
                        (object)"INSERT INTO items_extra_data (item_id,extra_data) VALUES ('",
                        (object)num5,
                        (object)"',@gift_message)"
                    }), 30);
                    client.ExecuteQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('" + (object)num5 + "','" + (object)catalogItem.method_0().UInt32_0 + "','" + (object)catalogItem.int_3 + "',@extra_data)", 30);
                }
                GameClient gameClient = HabboIM.GetGame().GetClientManager().method_2(id);
                if (gameClient != null)
                {
                    gameClient.SendNotification("Du hast ein Geschenk bekommen! Überprüfe dein Inventar.");
                    gameClient.GetHabbo().GetInventoryComponent().method_9(true);
                    ++gameClient.GetHabbo().GiftsReceived;
                    gameClient.GetHabbo().CheckGiftReceivedAchievements();
                }
                ++Session.GetHabbo().GiftsGiven;
                Session.GetHabbo().CheckGiftGivenAchievements();
                Session.SendNotification("Geschenk erfolgreich gesendet.");
                return(true);
            }
            this.method_9(Session, catalogItem.method_0(), catalogItem.int_3, string_0, true, 0U);
            if (catalogItem.uint_2 > 0U)
            {
                HabboIM.GetGame().GetAchievementManager().addAchievement(Session, catalogItem.uint_2, 1);
            }
            if (!string.IsNullOrEmpty(catalogItem.BadgeID))
            {
                Session.GetHabbo().GetBadgeComponent().SendBadge(Session, catalogItem.BadgeID, true);
            }
            return(true);
        }