示例#1
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint        uint_  = Event.PopWiredUInt();
            CatalogItem @class = HabboIM.GetGame().GetCatalog().method_2(uint_);

            if (@class != null)
            {
                ServerMessage Message = new ServerMessage(622u);
                Message.AppendUInt(@class.uint_0);
                Message.AppendBoolean(@class.method_0().AllowGift);
                Session.SendMessage(Message);
            }
        }
示例#2
0
        public void method_7(string string_0, uint uint_1, uint uint_2, int int_0)
        {
            CatalogPage @class = this.method_5(int_0);
            CatalogItem class2 = @class.method_1(uint_2);
            uint        num    = this.method_14();
            Item        class3 = this.method_10();

            using (DatabaseClient class4 = GoldTree.GetDatabase().GetClient())
            {
                class4.AddParamWithValue("gift_message", "!" + ChatCommandHandler.smethod_4(GoldTree.DoFilter(string_0, true, true)));
                class4.ExecuteQuery(string.Concat(new object[]
                {
                    "INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('",
                    num,
                    "','",
                    uint_1,
                    "','",
                    class3.UInt32_0,
                    "','')"
                }));
                class4.ExecuteQuery(string.Concat(new object[]
                {
                    "INSERT INTO items_extra_data (item_id,extra_data) VALUES ('",
                    num,
                    "',@gift_message)"
                }));
                class4.ExecuteQuery(string.Concat(new object[]
                {
                    "INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('",
                    num,
                    "','",
                    class2.method_0().UInt32_0,
                    "','",
                    class2.int_3,
                    "','')"
                }));
            }
            GameClient class5 = GoldTree.GetGame().GetClientManager().method_2(uint_1);

            if (class5 != null)
            {
                class5.SendNotification("You have received a gift! Check your inventory.");
                class5.GetHabbo().GetInventoryComponent().method_9(true);
            }
        }
示例#3
0
        public void method_7(string string_0, uint uint_1, uint uint_2, int int_0)
        {
            CatalogItem catalogItem = this.method_5(int_0).method_1(uint_2);
            uint        num         = 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_0, true, true))));
                client.ExecuteQuery("INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('" + (object)num + "','" + (object)uint_1 + "','" + (object)obj.UInt32_0 + "','')", 30);
                client.ExecuteQuery(string.Concat(new object[3]
                {
                    (object)"INSERT INTO items_extra_data (item_id,extra_data) VALUES ('",
                    (object)num,
                    (object)"',@gift_message)"
                }), 30);
                client.ExecuteQuery("INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('" + (object)num + "','" + (object)catalogItem.method_0().UInt32_0 + "','" + (object)catalogItem.int_3 + "','')", 30);
            }
            GameClient gameClient = HabboIM.GetGame().GetClientManager().method_2(uint_1);

            if (gameClient == null)
            {
                return;
            }
            gameClient.SendNotification("Du hast ein Geschenk in Inventar erhalten!");
            gameClient.GetHabbo().GetInventoryComponent().method_9(true);
        }
示例#4
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);
        }
示例#5
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)
        {
            CatalogPage @class = this.method_5(int_0);

            if (@class == null || [email protected]_1 || [email protected]_0 || @class.uint_0 > Session.GetHabbo().Rank)
            {
                return(false);
            }
            else
            {
                if (@class.bool_2 && (!Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") || !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip")))
                {
                    return(false);
                }
                else
                {
                    CatalogItem class2 = @class.method_1(uint_1);
                    if (class2 == null)
                    {
                        return(false);
                    }
                    else
                    {
                        uint num = 0u;
                        if (bool_0)
                        {
                            if (!class2.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 class3 = GoldTree.GetDatabase().GetClient())
                            {
                                class3.AddParamWithValue("gift_user", string_1);
                                try
                                {
                                    num = (uint)class3.ReadDataRow("SELECT Id FROM users WHERE username = @gift_user LIMIT 1")[0];
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (num == 0u)
                            {
                                ServerMessage Message = new ServerMessage(76u);
                                Message.AppendBoolean(true);
                                Message.AppendStringWithBreak(string_1);
                                Session.SendMessage(Message);
                                return(false);
                            }
                        }
                        bool flag  = false;
                        bool flag2 = false;
                        int  int_  = class2.int_2;
                        if (Session.GetHabbo().Credits < class2.int_0)
                        {
                            flag = true;
                        }
                        if ((int_ == 0 && Session.GetHabbo().ActivityPoints < class2.int_1) || (int_ > 0 && Session.GetHabbo().VipPoints < class2.int_1))
                        {
                            flag2 = true;
                        }
                        if (flag || flag2)
                        {
                            ServerMessage Message2 = new ServerMessage(68u);
                            Message2.AppendBoolean(flag);
                            Message2.AppendBoolean(flag2);
                            Session.SendMessage(Message2);
                            return(false);
                        }
                        else
                        {
                            if (bool_0 && class2.method_0().Type == 'e')
                            {
                                Session.SendNotif("You can not send this item as a gift.");
                                return(false);
                            }
                            else
                            {
                                string text = class2.method_0().InteractionType.ToLower();
                                if (text != null)
                                {
                                    if (!(text == "pet"))
                                    {
                                        if (text == "roomeffect")
                                        {
                                            double num2 = 0.0;
                                            try
                                            {
                                                num2 = double.Parse(string_0);
                                            }
                                            catch (Exception)
                                            {
                                            }
                                            string_0 = num2.ToString().Replace(',', '.');
                                            goto IL_4FC;
                                        }
                                        if (text == "postit")
                                        {
                                            string_0 = "FFFF33";
                                            goto IL_4FC;
                                        }
                                        if (text == "dimmer")
                                        {
                                            string_0 = "1,1,1,#000000,255";
                                            goto IL_4FC;
                                        }
                                        if (text == "trophy")
                                        {
                                            string_0 = string.Concat(new object[]
                                            {
                                                Session.GetHabbo().Username,
                                                Convert.ToChar(9),
                                                DateTime.Now.Day,
                                                "-",
                                                DateTime.Now.Month,
                                                "-",
                                                DateTime.Now.Year,
                                                Convert.ToChar(9),
                                                ChatCommandHandler.smethod_4(GoldTree.DoFilter(string_0, true, true))
                                            });
                                            goto IL_4FC;
                                        }
                                        if (text == "musicdisc")
                                        {
                                            string_0 = class2.song_id.ToString();
                                            goto IL_4FC;
                                        }
                                    }
                                    else
                                    {
                                        try
                                        {
                                            string[] array = string_0.Split(new char[]
                                            {
                                                '\n'
                                            });
                                            string string_3 = array[0];
                                            string text2    = array[1];
                                            string text3    = array[2];
                                            int.Parse(text2);
                                            if (!this.method_8(string_3))
                                            {
                                                return(false);
                                            }
                                            if (text2.Length > 2)
                                            {
                                                return(false);
                                            }
                                            if (text3.Length != 6)
                                            {
                                                return(false);
                                            }
                                            goto IL_4FC;
                                        }
                                        catch (Exception)
                                        {
                                            return(false);
                                        }
                                    }
                                }
                                if (class2.string_0.StartsWith("disc_"))
                                {
                                    string_0 = class2.string_0.Split(new char[]
                                    {
                                        '_'
                                    })[1];
                                }
                                else
                                {
                                    string_0 = "";
                                }
IL_4FC:
                                if (class2.int_0 > 0)
                                {
                                    Session.GetHabbo().Credits -= class2.int_0;
                                    Session.GetHabbo().method_13(true);
                                }
                                if (class2.int_1 > 0 && int_ == 0)
                                {
                                    Session.GetHabbo().ActivityPoints -= class2.int_1;
                                    Session.GetHabbo().method_15(true);
                                }
                                else
                                {
                                    if (class2.int_1 > 0 && int_ > 0)
                                    {
                                        Session.GetHabbo().VipPoints -= class2.int_1;
                                        Session.GetHabbo().method_16(0);
                                        Session.GetHabbo().method_14(false, true);
                                    }
                                }
                                ServerMessage Message3 = new ServerMessage(67u);
                                Message3.AppendUInt(class2.method_0().UInt32_0);
                                Message3.AppendStringWithBreak(class2.method_0().Name);
                                Message3.AppendInt32(class2.int_0);
                                Message3.AppendInt32(class2.int_1);
                                Message3.AppendInt32(class2.int_2);
                                if (bool_1)
                                {
                                    Message3.AppendInt32(1);
                                }
                                else
                                {
                                    Message3.AppendInt32(0);
                                }
                                Message3.AppendStringWithBreak(class2.method_0().Type.ToString());
                                Message3.AppendInt32(class2.method_0().Sprite);
                                Message3.AppendStringWithBreak("");
                                Message3.AppendInt32(1);
                                Message3.AppendInt32(-1);
                                Message3.AppendStringWithBreak("");
                                Session.SendMessage(Message3);
                                if (bool_0)
                                {
                                    uint num3   = this.method_14();
                                    Item class4 = this.method_10();
                                    using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                                    {
                                        class3.AddParamWithValue("gift_message", "!" + ChatCommandHandler.smethod_4(GoldTree.DoFilter(string_2, true, true)) + " - " + Session.GetHabbo().Username);
                                        class3.AddParamWithValue("extra_data", string_0);
                                        class3.ExecuteQuery(string.Concat(new object[]
                                        {
                                            "INSERT INTO items (Id,user_id,base_item,extra_data,wall_pos) VALUES ('",
                                            num3,
                                            "','",
                                            num,
                                            "','",
                                            class4.UInt32_0,
                                            "',@gift_message,'')"
                                        }));
                                        class3.ExecuteQuery(string.Concat(new object[]
                                        {
                                            "INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('",
                                            num3,
                                            "','",
                                            class2.method_0().UInt32_0,
                                            "','",
                                            class2.int_3,
                                            "',@extra_data)"
                                        }));
                                    }
                                    GameClient class5 = GoldTree.GetGame().GetClientManager().method_2(num);
                                    if (class5 != null)
                                    {
                                        class5.SendNotif("You have received a gift! Check your inventory.");
                                        class5.GetHabbo().method_23().method_9(true);
                                        class5.GetHabbo().GiftsReceived++;
                                        class5.GetHabbo().CheckGiftReceivedAchievements();
                                    }
                                    Session.GetHabbo().GiftsGiven++;
                                    Session.GetHabbo().CheckGiftGivenAchievements();
                                    Session.SendNotif("Gift sent successfully!");
                                    return(true);
                                }
                                else
                                {
                                    this.method_9(Session, class2.method_0(), class2.int_3, string_0, true, 0u);
                                    if (class2.uint_2 > 0u)
                                    {
                                        GoldTree.GetGame().GetAchievementManager().addAchievement(Session, class2.uint_2, 1);
                                    }
                                    if (!string.IsNullOrEmpty(class2.BadgeID))
                                    {
                                        Session.GetHabbo().method_22().method_2(Session, class2.BadgeID, true);
                                    }
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
        }