예제 #1
0
 public void Handle(GameClient session, ClientMessage message)
 {
     try
     {
         ServerMessage response = new ServerMessage(950u);
         session.GetHabbo().GetUserDataFactory().UpdateFriendStream();
         int streamCount = session.GetHabbo().GetUserDataFactory().GetFriendStream().Rows.Count;
         response.AppendInt32(streamCount);
         DataTable dataTable_ = session.GetHabbo().GetUserDataFactory().GetFriendStream();
         foreach (DataRow row in dataTable_.Rows)
         {
             int type = (int)row["type"];
             if (type == 5)
             {
                 uint id      = (uint)row["id"];
                 int  likes   = 0;
                 bool canlike = false;
                 using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                 {
                     likes = @class.ReadInt32("SELECT COUNT(friend_stream_id) FROM friend_stream_likes WHERE friend_stream_id = '" + id + "' LIMIT 1", 30);
                     DataRow datarow = @class.ReadDataRow(string.Concat(new object[]
                     {
                         "SELECT id FROM friend_stream_likes WHERE friend_stream_id = '",
                         id,
                         "' AND userid = '",
                         session.GetHabbo().Id,
                         "' LIMIT 1"
                     }), 30);
                     canlike = (datarow == null);
                 }
                 uint   userid   = (uint)row["userid"];
                 string username = HabboIM.GetGame().GetClientManager().GetNameById(userid);
                 string gender   = row["gender"].ToString().ToLower();
                 string look     = (string)row["look"];
                 int    time     = (int)((HabboIM.GetUnixTimestamp() - (double)row["time"]) / 60.0);
                 string data     = (string)row["data"];
                 response.AppendUInt(id);
                 response.AppendInt32(1); // type 1
                 response.AppendStringWithBreak(userid.ToString());
                 response.AppendStringWithBreak(username);
                 response.AppendStringWithBreak(gender);
                 response.AppendStringWithBreak("http://live-hotel.biz/web-gallery/friendstream/index.gif?figure=" + look + ".gif");
                 response.AppendInt32(time);
                 response.AppendInt32(2);
                 response.AppendInt32(likes);
                 response.AppendBoolean(canlike);
                 response.AppendStringWithBreak("1");
                 response.AppendStringWithBreak(data);
             }
         }
         session.SendMessage(response);
     }
     catch (Exception x)
     {
         session.SendNotification("Es trat folgender Fehler auf:\r\n" + x);
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine(x);
         Console.ForegroundColor = ConsoleColor.Gray;
     }
 }
예제 #2
0
        public void method_3(int int_1)
        {
            AvatarEffect @class = this.method_5(int_1, false);

            if (@class != null && [email protected]_0 && [email protected]_0 && (this.method_8() != null && this.method_8().GetHabbo() != null))
            {
                Room class2 = this.method_9();
                if (class2 != null)
                {
                    RoomUser class3 = class2.GetRoomUserByHabbo(this.method_8().GetHabbo().Id);
                    if (class3.byte_1 <= 0 && class3.class34_1 == null)
                    {
                        using (DatabaseClient class4 = HabboIM.GetDatabase().GetClient())
                        {
                            class4.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_effects SET is_activated = '1', activated_stamp = '",
                                HabboIM.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                this.uint_0,
                                "' AND effect_id = '",
                                int_1,
                                "' LIMIT 1"
                            }));
                        }
                        @class.method_0();
                        ServerMessage Message = new ServerMessage(462u);
                        Message.AppendInt32(@class.int_0);
                        Message.AppendInt32(@class.int_1);
                        this.method_8().SendMessage(Message);
                    }
                }
            }
        }
        public void method_3(string type, int time)
        {
            type = type.ToLower();

            if (this.Subscriptions.ContainsKey(type))
            {
                Subscription subscription = this.Subscriptions[type];

                subscription.AppendTime(time);

                if (subscription.ExpirationTime <= 0 || subscription.ExpirationTime >= 2147483647)
                {
                    return;
                }

                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("subcrbr", type);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE user_subscriptions SET timestamp_expire = '",
                        subscription.ExpirationTime,
                        "' WHERE user_id = '",
                        this.UserId,
                        "' AND subscription_id = @subcrbr LIMIT 1"
                    }));
                    return;
                }
            }

            if (!this.Subscriptions.ContainsKey("habbo_vip"))
            {
                int now        = (int)HabboIM.GetUnixTimestamp();
                int expiration = (int)HabboIM.GetUnixTimestamp() + time;

                Subscription subscription = new Subscription(type, now, expiration);

                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("subcrbr", type);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "INSERT INTO user_subscriptions (user_id,subscription_id,timestamp_activated,timestamp_expire) VALUES ('",
                        this.UserId,
                        "',@subcrbr,'",
                        now,
                        "','",
                        expiration,
                        "')"
                    }));
                }

                this.Subscriptions.Add(subscription.Type.ToLower(), subscription);
            }
        }
예제 #4
0
        public override void OnTrigger(GameClient Session, RoomItem RoomItem_0, int int_0, bool bool_0)
        {
            uint num2   = Convert.ToUInt32(1732);
            Room class3 = HabboIM.GetGame().GetRoomManager().method_15(num2);

            if (Session.GetHabbo().CurrentRoom == class3 && Session.GetHabbo().jailtime > 180)
            {
                Room     class2        = Session.GetHabbo().CurrentRoom;
                RoomUser Aktuelleruser = class2.GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (Math.Abs(Aktuelleruser.X - 13) < 2 && Math.Abs(Aktuelleruser.Y - 9) < 2)
                {
                    if (Session.GetHabbo().knastarbeit == false)
                    {
                        Session.GetHabbo().last_gearbeitet = HabboIM.GetUnixTimestamp();

                        Session.GetHabbo().knastarbeit = true;
                        Session.SendNotification("Du hast begonnen zu arbeiten!");
                        Session.GetHabbo().GetEffectsInventoryComponent().method_2(169, true);
                        var t = Task.Run(async delegate
                        {
                            await Task.Delay(3150);

                            X:
                            await Task.Delay(2025);
                            if (Session.GetHabbo().last_gearbeitet + 1 * 5 < HabboIM.GetUnixTimestamp())
                            {
                                Session.GetHabbo().knastarbeit = false;
                                Session.GetHabbo().Whisper("Du hast deine Arbeit beendet und eine Haftverkürzung von 2 Minuten erhalten!");
                                Session.GetHabbo().jailtime -= 120;
                                Session.GetHabbo().UpdateJailTime(true);
                                Session.GetHabbo().GetEffectsInventoryComponent().method_2(0, true);
                            }
                            return(true);
                        });
                    }
                }
                else
                {
                    Session.SendNotification("Du bist nicht nah genug am Taler Denkmal um diese Funktion nutzen zu können!");
                }
            }
            else
            {
                if (Session.GetHabbo().CurrentRoom == class3 && Session.GetHabbo().jail == 0)
                {
                    Session.SendNotification("Du musst inhaftiert sein um diese Funktion verwenden zu können!");
                }
                if (Session.GetHabbo().CurrentRoom == class3 && Session.GetHabbo().jail == 1)
                {
                    Session.SendNotification("Du musst mindestens 3 Minuten lang inhaftiert sein um deine Haftzeit mit dieser Funktion zu verkürzen!");
                }
            }
        }
예제 #5
0
        public void method_1(GameClient Session, uint uint_0, int int_0)
        {
            UserItem @class = Session.GetHabbo().GetInventoryComponent().GetItemById(uint_0);

            if (@class == null || int_0 > ServerConfiguration.MarketplacePriceLimit || !this.method_0(@class))
            {
                ServerMessage Message = new ServerMessage(610u);
                Message.AppendBoolean(false);
                Session.SendMessage(Message);
            }
            else
            {
                int num  = this.method_2((float)int_0);
                int num2 = int_0 + num;
                int num3 = 1;
                if (@class.method_1().Type == 'i')
                {
                    num3++;
                }
                using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                {
                    class2.AddParamWithValue("public_name", @class.method_1().PublicName);
                    class2.AddParamWithValue("extra_data", @class.string_0);
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "INSERT INTO catalog_marketplace_offers (furni_id, item_id,user_id,asking_price,total_price,public_name,sprite_id,item_type,timestamp,extra_data) VALUES ('",
                        uint_0,
                        "','",
                        @class.uint_1,
                        "','",
                        Session.GetHabbo().Id,
                        "','",
                        int_0,
                        "','",
                        num2,
                        "',@public_name,'",
                        @class.method_1().Sprite,
                        "','",
                        num3,
                        "','",
                        HabboIM.GetUnixTimestamp(),
                        "',@extra_data)"
                    }));
                }
                Session.GetHabbo().GetInventoryComponent().method_12(uint_0, 0u, true);
                ServerMessage Message2 = new ServerMessage(610u);
                Message2.AppendBoolean(true);
                Session.SendMessage(Message2);
            }
        }
        public int CalculateHCSubscription(Habbo habbo)
        {
            if (habbo.GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                return(((int)HabboIM.GetUnixTimestamp() - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400);
            }
            else
            {
                if (habbo.GetSubscriptionManager().GetSubscriptionByType(habbo.Id.ToString()) != null)
                {
                    return((habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime - habbo.GetSubscriptionManager().GetSubscriptionByType("habbo_club").StartingTime) / 2678400);
                }

                return(0);
            }
        }
예제 #7
0
        public MessengerBuddy(uint uint_1, string string_4, string string_5, string string_6, string string_7)
        {
            this.uint_0   = uint_1;
            this.string_0 = string_4;
            this.string_1 = string_5;
            this.string_2 = string_6;
            double timestamp;

            if (double.TryParse(string_7, NumberStyles.Any, CustomCultureInfo.GetCustomCultureInfo(), out timestamp))
            {
                this.string_3 = HabboIM.TimestampToDate(timestamp).ToString();
            }
            else
            {
                this.string_3 = HabboIM.TimestampToDate(HabboIM.GetUnixTimestamp()).ToString();
            }
            this.bool_0 = false;
        }
예제 #8
0
 public void PlaySong()
 {
     if (this.mSongQueuePosition >= this.mPlaylist.Count)
     {
         this.mSongQueuePosition = 0;
     }
     if (this.mPlaylist.Count == 0)
     {
         this.Stop();
     }
     else
     {
         if (!this.mPlaylist.ContainsKey(this.mSongQueuePosition))
         {
             this.mSongQueuePosition = 0;
         }
         this.mSong       = this.mPlaylist[this.mSongQueuePosition];
         this.mSongLength = this.mSong.SongData.Length / 1000;
         this.mStartedPlayingTimestamp = HabboIM.GetUnixTimestamp();
         mBroadcastNeeded = true;
     }
 }
예제 #9
0
 public void method_3(GameClient Session)
 {
     try
     {
         if (Session.GetHabbo().InRoom)
         {
             RoomUser @class = Session.GetHabbo().CurrentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);
             if (@class.int_1 <= ServerConfiguration.SleepTimer)
             {
                 double double_ = HabboIM.GetUnixTimestamp();
                 Session.GetHabbo().LastActivityPointsUpdate = double_;
                 if (ServerConfiguration.PointingAmount > 0 && (Session.GetHabbo().ActivityPoints < ServerConfiguration.PixelLimit || ServerConfiguration.PixelLimit == 0))
                 {
                     Session.GetHabbo().ActivityPoints += ServerConfiguration.PointingAmount;
                     Session.GetHabbo().method_16(ServerConfiguration.PointingAmount);
                 }
                 if (ServerConfiguration.CreditingAmount > 0 && (Session.GetHabbo().Credits < ServerConfiguration.CreditLimit || ServerConfiguration.CreditLimit == 0))
                 {
                     Session.GetHabbo().Credits += ServerConfiguration.CreditingAmount;
                     if (Session.GetHabbo().IsVIP)
                     {
                         Session.GetHabbo().Credits += ServerConfiguration.CreditingAmount;
                     }
                     Session.GetHabbo().UpdateCredits(true);
                 }
                 if (ServerConfiguration.PixelingAmount > 0 && (Session.GetHabbo().VipPoints < ServerConfiguration.PointLimit || ServerConfiguration.PointLimit == 0))
                 {
                     Session.GetHabbo().VipPoints += ServerConfiguration.PixelingAmount;
                     Session.GetHabbo().UpdateVipPoints(false, true);
                 }
             }
         }
     }
     catch
     {
     }
 }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     if (Session != null)
     {
         uint    num     = Event.PopWiredUInt();
         DataRow dataRow = null;
         using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
         {
             dataRow = @class.ReadDataRow("SELECT furni_id, item_id, user_id, extra_data, offer_id, state, timestamp FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1");
         }
         if (dataRow != null)
         {
             int num2 = (int)Math.Floor(((double)dataRow["timestamp"] + 172800.0 - HabboIM.GetUnixTimestamp()) / 60.0);
             int num3 = int.Parse(dataRow["state"].ToString());
             if (num2 <= 0)
             {
                 num3 = 3;
             }
             if ((uint)dataRow["user_id"] == Session.GetHabbo().Id&& num3 != 2)
             {
                 Item class2 = HabboIM.GetGame().GetItemManager().method_2((uint)dataRow["item_id"]);
                 if (class2 != null)
                 {
                     HabboIM.GetGame().GetCatalog().method_9(Session, class2, 1, (string)dataRow["extra_data"], false, (uint)dataRow["furni_id"]);
                     using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                     {
                         @class.ExecuteQuery("DELETE FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1");
                     }
                     ServerMessage Message = new ServerMessage(614u);
                     Message.AppendUInt((uint)dataRow["offer_id"]);
                     Message.AppendBoolean(true);
                     Session.SendMessage(Message);
                 }
             }
         }
     }
 }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string        text    = Event.PopFixedString();
            ServerMessage Message = new ServerMessage(7u);

            Message.AppendStringWithBreak(text.ToLower());
            if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
            {
                double num  = (double)Session.GetHabbo().GetSubscriptionManager().GetSubscriptionByType("habbo_vip").ExpirationTime;
                double num2 = num - HabboIM.GetUnixTimestamp();
                int    num3 = (int)Math.Ceiling(num2 / 86400.0);
                int    num4 = num3 / 31;
                if (num4 >= 1)
                {
                    num4--;
                }
                Message.AppendInt32(num3 - num4 * 31);
                Message.AppendBoolean(true);
                Message.AppendInt32(num4);
                Message.AppendBoolean(true);
                Message.AppendBoolean(true);
                Message.AppendBoolean(Session.GetHabbo().IsVIP);
                Message.AppendInt32(0);
                Message.AppendInt32(0);
            }
            else
            {
                if (Session.GetHabbo().GetSubscriptionManager().HasSubscription(text))
                {
                    double num  = (double)Session.GetHabbo().GetSubscriptionManager().GetSubscriptionByType(text).ExpirationTime;
                    double num2 = num - HabboIM.GetUnixTimestamp();
                    int    num3 = (int)Math.Ceiling(num2 / 86400.0);
                    int    num4 = num3 / 31;
                    if (num4 >= 1)
                    {
                        num4--;
                    }
                    Message.AppendInt32(num3 - num4 * 31);
                    Message.AppendBoolean(true);
                    Message.AppendInt32(num4);
                    if (Session.GetHabbo().Rank >= 2u)
                    {
                        Message.AppendInt32(1);
                        Message.AppendInt32(1);
                        Message.AppendInt32(2);
                    }
                    else
                    {
                        Message.AppendInt32(1);
                    }
                }
                else
                {
                    for (int i = 0; i < 3; i++)
                    {
                        Message.AppendInt32(0);
                    }
                }
            }
            Session.SendMessage(Message);
        }
예제 #12
0
        public void BanUser(GameClient Session, string string_0, double length, string reason, bool banIp, bool banStatic)
        {
            if (!Session.GetHabbo().IsJuniori)
            {
                ModerationBanType enum4_  = ModerationBanType.USERNAME;
                string            text    = Session.GetHabbo().Username;
                string            object_ = "user";

                double timestamp = HabboIM.GetUnixTimestamp() + length;

                if (banIp)
                {
                    enum4_ = ModerationBanType.IP;

                    if (!ServerConfiguration.IPLastBan)
                    {
                        text = Session.GetConnection().String_0;
                    }
                    else
                    {
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            text = dbClient.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;");
                        }
                    }
                    object_ = "ip";
                }


                if (banStatic)
                {
                    enum4_  = ModerationBanType.STATICID;
                    text    = Session.GetHabbo().static_id;
                    object_ = "static_id";
                }

                this.Bans.Add(new ModerationBan(enum4_, text, reason, timestamp));

                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("rawvar", object_);
                    dbClient.AddParamWithValue("var", text);
                    dbClient.AddParamWithValue("reason", reason);
                    dbClient.AddParamWithValue("mod", string_0);

                    dbClient.ExecuteQuery(string.Concat(new object[]
                    {
                        "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
                        timestamp,
                        "',@mod,'",
                        DateTime.Now.ToLongDateString(),
                        "', '1')"
                    }));
                }

                if (banIp)
                {
                    DataTable dataTable = null;

                    using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                    {
                        dbClient.AddParamWithValue("var", text);
                        dataTable = dbClient.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var");
                    }

                    if (dataTable != null)
                    {
                        IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                DataRow dataRow = (DataRow)enumerator.Current;
                                using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                                {
                                    @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
                                }
                            }
                        }
                        finally
                        {
                            IDisposable disposable = enumerator as IDisposable;
                            if (disposable != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
                }


                if (banStatic)
                {
                    DataTable dataTable = null;

                    using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                    {
                        dbClient.AddParamWithValue("var", text);
                        dataTable = dbClient.ReadDataTable("SELECT Id FROM users WHERE static_id_last = @var AND static_id_last != ''");
                    }

                    if (dataTable != null)
                    {
                        IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                        try
                        {
                            while (enumerator.MoveNext())
                            {
                                DataRow dataRow = (DataRow)enumerator.Current;
                                using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                                {
                                    @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
                                }
                            }
                        }
                        finally
                        {
                            IDisposable disposable = enumerator as IDisposable;
                            if (disposable != null)
                            {
                                disposable.Dispose();
                            }
                        }
                    }
                }


                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
                }

                Session.NotifyBan("Du bist gebannt: " + reason);
                Session.method_12();
            }
        }
예제 #13
0
        public void method_9(GameClient Session, Item Item, int int_0, string string_0, bool bool_0, uint uint_1)
        {
            if (Session == null || Session.GetHabbo() == null)
            {
                return;
            }
            string str = Item.Type.ToString();

            if (str != null)
            {
                if (str == "i" || str == "s")
                {
                    for (int index = 0; index < int_0; ++index)
                    {
                        uint num = bool_0 || uint_1 <= 0U ? this.method_14() : uint_1;
                        switch (Item.InteractionType.ToLower())
                        {
                        case "pet":
                            string[] strArray = string_0.Split('\n');
                            Pet      pet      = this.method_11(Session.GetHabbo().Id, strArray[0], Convert.ToInt32(Item.Name.Split('t')[1]), strArray[1], strArray[2]);
                            Session.GetHabbo().GetInventoryComponent().AddPet(pet);
                            Session.GetHabbo().GetInventoryComponent().method_11(num, 320U, "0", bool_0);
                            break;

                        case "teleport":
                            uint uint_1_1 = this.method_14();
                            using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                            {
                                client.ExecuteQuery("INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES ('" + (object)num + "','" + (object)uint_1_1 + "')", 30);
                                client.ExecuteQuery("INSERT INTO tele_links (tele_one_id,tele_two_id) VALUES ('" + (object)uint_1_1 + "','" + (object)num + "')", 30);
                            }
                            Session.GetHabbo().GetInventoryComponent().method_11(uint_1_1, Item.UInt32_0, "0", bool_0);
                            Session.GetHabbo().GetInventoryComponent().method_11(num, Item.UInt32_0, "0", bool_0);
                            break;

                        case "dimmer":
                            using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                                client.ExecuteQuery("INSERT INTO room_items_moodlight (item_id,enabled,current_preset,preset_one,preset_two,preset_three) VALUES ('" + (object)num + "','0','1','#000000,255,0','#000000,255,0','#000000,255,0')", 30);
                            Session.GetHabbo().GetInventoryComponent().method_11(num, Item.UInt32_0, string_0, bool_0);
                            break;

                        default:
                            Session.GetHabbo().GetInventoryComponent().method_11(num, Item.UInt32_0, string_0, bool_0);
                            break;
                        }
                        ServerMessage Message5_0 = new ServerMessage(832U);
                        Message5_0.AppendInt32(1);
                        if (Item.InteractionType.ToLower() == "pet")
                        {
                            Message5_0.AppendInt32(3);
                            ++Session.GetHabbo().NewPetsBuyed;
                            Session.GetHabbo().CheckPetCountAchievements();
                        }
                        else if (Item.Type.ToString() == "i")
                        {
                            Message5_0.AppendInt32(2);
                        }
                        else
                        {
                            Message5_0.AppendInt32(1);
                        }
                        Message5_0.AppendInt32(1);
                        Message5_0.AppendUInt(num);
                        Session.SendMessage(Message5_0);
                    }
                    Session.GetHabbo().GetInventoryComponent().method_9(false);
                    return;
                }
                if (str == "e")
                {
                    for (int index = 0; index < int_0; ++index)
                    {
                        Session.GetHabbo().GetEffectsInventoryComponent().method_0(Item.Sprite, 3600);
                    }
                    return;
                }
                if (str == "h")
                {
                    for (int index = 0; index < int_0; ++index)
                    {
                        Session.GetHabbo().GetSubscriptionManager().method_3("habbo_club", 2678400);
                        Session.GetHabbo().CheckHCAchievements();
                    }
                    ServerMessage Message5_0_1 = new ServerMessage(7U);
                    Message5_0_1.AppendStringWithBreak("habbo_club");
                    if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    {
                        int num = (int)Math.Ceiling(((double)Session.GetHabbo().GetSubscriptionManager().GetSubscriptionByType("habbo_club").ExpirationTime - HabboIM.GetUnixTimestamp()) / 86400.0);
                        int i   = num / 31;
                        if (i >= 1)
                        {
                            --i;
                        }
                        Message5_0_1.AppendInt32(num - i * 31);
                        Message5_0_1.AppendBoolean(true);
                        Message5_0_1.AppendInt32(i);
                    }
                    else
                    {
                        for (int index = 0; index < 3; ++index)
                        {
                            Message5_0_1.AppendInt32(0);
                        }
                    }
                    Session.SendMessage(Message5_0_1);
                    ServerMessage Message5_0_2 = new ServerMessage(2U);
                    if (Session.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes)
                    {
                        Message5_0_2.AppendInt32(2);
                    }
                    else if (Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    {
                        Message5_0_2.AppendInt32(1);
                    }
                    else
                    {
                        Message5_0_2.AppendInt32(0);
                    }
                    if (Session.GetHabbo().HasFuse("acc_anyroomowner"))
                    {
                        Message5_0_2.AppendInt32(7);
                    }
                    else if (Session.GetHabbo().HasFuse("acc_anyroomrights"))
                    {
                        Message5_0_2.AppendInt32(5);
                    }
                    else if (Session.GetHabbo().HasFuse("acc_supporttool"))
                    {
                        Message5_0_2.AppendInt32(4);
                    }
                    else if (Session.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                    {
                        Message5_0_2.AppendInt32(2);
                    }
                    else
                    {
                        Message5_0_2.AppendInt32(0);
                    }
                    Session.SendMessage(Message5_0_2);
                    return;
                }
            }
            Session.SendNotification("Something went wrong! The item type could not be processed. Please do not try to buy this item anymore, instead inform support as soon as possible.");
        }
예제 #14
0
 public void method_0()
 {
     this.bool_0   = true;
     this.double_0 = HabboIM.GetUnixTimestamp();
 }
예제 #15
0
 internal double method_3()
 {
     return(HabboIM.GetUnixTimestamp() - 172800.0);
 }
예제 #16
0
        public ServerMessage method_9(uint uint_0)
        {
            int int_ = 0;

            using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
            {
                DataTable dataTable = @class.ReadDataTable("SELECT timestamp, state, offer_id, item_type, sprite_id, total_price FROM catalog_marketplace_offers WHERE user_id = '" + uint_0 + "'");
                string    text      = @class.ReadDataRow("SELECT SUM(asking_price) FROM catalog_marketplace_offers WHERE state = '2' AND user_id = '" + uint_0 + "'")[0].ToString();
                if (text.Length > 0)
                {
                    int_ = int.Parse(text);
                }
                ServerMessage Message = new ServerMessage(616u);
                Message.AppendInt32(int_);
                if (dataTable != null)
                {
                    Message.AppendInt32(dataTable.Rows.Count);
                    IEnumerator enumerator = dataTable.Rows.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            DataRow dataRow = (DataRow)enumerator.Current;
                            int     num     = (int)Math.Floor(((double)dataRow["timestamp"] + 172800.0 - HabboIM.GetUnixTimestamp()) / 60.0);
                            int     num2    = int.Parse(dataRow["state"].ToString());
                            if (num <= 0 && num2 != 2)
                            {
                                num2 = 3;
                                num  = 0;
                            }
                            Message.AppendUInt((uint)dataRow["offer_id"]);
                            Message.AppendInt32(num2);
                            Message.AppendInt32(int.Parse(dataRow["item_type"].ToString()));
                            Message.AppendInt32((int)dataRow["sprite_id"]);
                            Message.AppendStringWithBreak("");
                            Message.AppendInt32((int)dataRow["total_price"]);
                            Message.AppendInt32(num);
                            Message.AppendInt32((int)dataRow["sprite_id"]);
                        }
                        goto IL_1DE;
                    }
                    finally
                    {
                        IDisposable disposable = enumerator as IDisposable;
                        if (disposable != null)
                        {
                            disposable.Dispose();
                        }
                    }
                }
                Message.AppendInt32(0);
IL_1DE:
                return(Message);
            }
        }
예제 #17
0
 public bool HasExpired()
 {
     return((double)this.ExpirationTime > HabboIM.GetUnixTimestamp());
 }
        public static void Initialise()
        {
            double lastDatabaseUpdate  = HabboIM.GetUnixTimestamp();
            double lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp();

            while (true)
            {
                try
                {
                    DateTime now      = DateTime.Now;
                    TimeSpan timeSpan = now - HabboIM.ServerStarted;
                    new PerformanceCounter("Processor", "% Processor Time", "_Total");
                    int Status = 1;

                    int UsersOnline = HabboIM.GetGame().GetClientManager().ClientCount;
                    int RoomsLoaded = HabboIM.GetGame().GetRoomManager().LoadedRoomsCount;

                    try
                    {
                        if (HabboIM.GetConfig().data["shutdown-server"] != null)
                        {
                            DateTime shutdown_server_time = Convert.ToDateTime(HabboIM.GetConfig().data["shutdown-server"]);
                            var      time  = shutdown_server_time.TimeOfDay.TotalSeconds;
                            string   s     = DateTime.Now.ToString("HH:mm:ss");
                            DateTime dt2   = DateTime.ParseExact(s, "HH:mm:ss", CultureInfo.InvariantCulture);
                            var      time2 = dt2.TimeOfDay.TotalSeconds;
                            try
                            {
                                if (HabboIM.GetConfig().data["shutdown-warning-alert"] != null)
                                {
                                    if (time - time2 <= 60 && time - time2 >= 50)
                                    {
                                        try
                                        {
                                            if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                            {
                                                string        str      = HabboIM.GetConfig().data["shutdown-warning-alert"];
                                                ServerMessage Message2 = new ServerMessage(808u);
                                                Message2.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("cmd_ha_title"));
                                                Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                ServerMessage Message3 = new ServerMessage(161u);
                                                Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                HabboIM.GetGame().GetClientManager().method_15(Message2, Message3);
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                            if (time - time2 <= 11 && time - time2 >= 0)
                            {
                                try
                                {
                                    if (int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(HabboIM.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                    {
                                        HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                    }
                                }
                                catch
                                {
                                    HabboIM.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }

                    double timestamp = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate;

                    if (timestamp >= 5)
                    {
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE server_status SET stamp = UNIX_TIMESTAMP(), status = '", Status, "', users_online = '", UsersOnline, "', rooms_loaded = '", RoomsLoaded, "', server_ver = '", HabboIM.Version, "' LIMIT 1"
                            }));
                            uint num3 = (uint)dbClient.ReadInt32("SELECT users FROM system_stats ORDER BY ID DESC LIMIT 1");
                            if ((long)UsersOnline > (long)((ulong)num3))
                            {
                                dbClient.ExecuteQuery(string.Concat(new object[]
                                {
                                    "UPDATE system_stats SET users = '",
                                    UsersOnline,
                                    "', rooms = '",
                                    RoomsLoaded,
                                    "' ORDER BY ID DESC LIMIT 1"
                                }));
                            }
                        }

                        lastDatabaseUpdate = HabboIM.GetUnixTimestamp();
                    }
                    double timestamp2 = HabboIM.GetUnixTimestamp() - lastDatabaseUpdate2;
                    if (timestamp2 >= 30.0)
                    {
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "INSERT INTO online_statistik (`useronline`,`rooms_loaded`,`timestamp`) VALUES ('",
                                UsersOnline,
                                "','",
                                RoomsLoaded,
                                "', '",
                                HabboIM.GetUnixTimestamp(),
                                "');"
                            }), 30);
                        }
                        lastDatabaseUpdate2 = HabboIM.GetUnixTimestamp();
                    }
                    HabboIM.GetGame().GetClientManager().method_23();

                    Console.Title = string.Concat(new object[]
                    {
                        "HabboIM Emulator | Spieler: ",
                        UsersOnline,
                        " | Räume: ",
                        RoomsLoaded,
                        " | Online: ",
                        timeSpan.Days,
                        " Tage, ",
                        timeSpan.Hours,
                        " Stunden und ",
                        timeSpan.Minutes,
                        " Minuten"
                    });

                    if (HabboIM.hour_lastlotto != now.Hour)
                    {
                        HabboIM.hour_lastlotto = now.Hour;

                        //ServerMessage Message2 = new ServerMessage(808u);
                        //Message2.AppendStringWithBreak("MyHuBBa Lotterie");
                        //Message2.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System");
                        ServerMessage Message3 = new ServerMessage(161u);
                        //Message3.AppendStringWithBreak("Aufgepasst, nun könnt ihr an unserer Lotterie teilnehmen. Verwende hierzu den Befehl :lotto ZAHL und schon nimmst du teil. Die Zahl darf zwischen 1 & 50 liegen. Kosten für Teilnahme beträgt 3.500 Taler!\r\n- System");
                        //HabboIM.GetGame().GetClientManager().method_15(Message2, Message3);

                        HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Sende jetzt eine Zahl von 0-50 mit :lotto Zahl ein. Kosten: 3.500 Taler.");
                        HabboIM.lotto = true;


                        Random rand      = new Random();
                        int    lottozahl = rand.Next(1, 50); // Lottozahlen definieren
                        Console.BackgroundColor = ConsoleColor.Black;
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine("Lotto: Ziehung gestartet! Die Zahl lautet " + lottozahl);

                        HabboIM.lottozahl   = lottozahl;
                        HabboIM.lottowinner = 0;
                        HabboIM.lotto_end   = HabboIM.GetUnixTimestamp() + 5 * 60;
                        //Info für den dummen Hazed:
                        // 5 * 60 steht für 5 Minuten, da 5 Minuten 5 mal 60 Sekunden sind.
                        HabboIM.lotto_einsatz = 3500;
                    }
                    if (HabboIM.GetUnixTimestamp() >= HabboIM.lotto_end && HabboIM.lotto == true)
                    {
                        Console.BackgroundColor = ConsoleColor.Black;
                        Console.ForegroundColor = ConsoleColor.DarkCyan;
                        Console.WriteLine("Lotto: Ziehung gestoppt!");
                        HabboIM.lotto = false;
                        HabboIM.GetGame().GetClientManager().resetlotto();

                        GameClients.GameClient client;
                        try
                        {
                            client = HabboIM.GetGame().GetClientManager().method_2(HabboIM.lottowinner);


                            client.GetHabbo().Credits += HabboIM.lotto_einsatz;
                            client.GetHabbo().UpdateCredits(true);

                            HabboIM.GetGame().GetClientManager().method_WHISPER("" + client.GetHabbo().Username + " hat den Jackpot in Höhe von " + HabboIM.lotto_einsatz.ToString() + " Talern geknackt! (Zahl: " + HabboIM.lottozahl + ")");
                            HabboIM.lotto_einsatz   = 3500;
                            Console.BackgroundColor = ConsoleColor.Black;
                            Console.ForegroundColor = ConsoleColor.DarkCyan;
                            Console.WriteLine("Lotto: " + client.GetHabbo().Username + " hat den Jackpot geknackt.");
                        }
                        catch
                        {
                            HabboIM.GetGame().GetClientManager().method_WHISPER("Lotto: Heute hat leider keiner den Jackpot geknackt!");
                            HabboIM.lotto_einsatz   = 3500;
                            Console.BackgroundColor = ConsoleColor.Black;
                            Console.ForegroundColor = ConsoleColor.DarkCyan;
                            Console.WriteLine("Lotto: Keiner konnte den Jackpot knacken.");
                        }
                    }



                    var minimum_users = int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare_minimum_spieler"]);

                    if (HabboIM.hour_lastrr + HabboIM.nxt_rr * 60 < HabboIM.GetUnixTimestamp())
                    {
                        HabboIM.hour_lastrr = HabboIM.GetUnixTimestamp();
                        if (int.Parse(HabboIM.GetConfig().data["habboim.zufallsrare"]) == 1)
                        {
                            //Wenn genug Habbos Online
                            if (UsersOnline >= minimum_users)
                            {
                                //Ausgabe in Konsole
                                Console.BackgroundColor = ConsoleColor.Black;
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.WriteLine("____________________________________________________________________________________________________");
                                Console.WriteLine("                                                                                                    ");
                                Console.ForegroundColor = ConsoleColor.DarkGreen;
                                Console.Write("[");
                                string time1 = DateTime.Now.ToString();
                                Console.Write(time1 + "] ");
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.Write("Zufallsrare: Verteilt!");
                                Console.WriteLine();
                                Console.ForegroundColor = ConsoleColor.DarkGreen;
                                Console.Write("[");
                                string time2 = DateTime.Now.ToString();
                                Console.Write(time2 + "] ");
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.Write("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!");
                                Console.WriteLine();
                            }
                            else
                            {
                                if (UsersOnline < minimum_users)
                                {
                                    string time3 = DateTime.Now.ToString();
                                    Console.BackgroundColor = ConsoleColor.Black;
                                    Console.ForegroundColor = ConsoleColor.Red;
                                    Console.WriteLine("____________________________________________________________________________________________________");
                                    Console.WriteLine("                                                                                                    ");
                                    Console.ForegroundColor = ConsoleColor.DarkRed;
                                    Console.Write("[");
                                    Console.Write(time3 + "] ");
                                    Console.ForegroundColor = ConsoleColor.Red;
                                    Console.Write("Zufallsrare nicht verteilt. Grund: Nicht genug Online! Minimum: " + minimum_users + " Habbos.");
                                    Console.WriteLine();
                                    HabboIM.zufallsrare = false;
                                }
                            }

                            if (UsersOnline >= minimum_users)
                            {
                                //Ermittle über Websocket den Gewinner des Zufallsrare
                                HabboIM.zufallsrare = false;
                                string random_rare = "9307620";
                                HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare);
                            }
                        }

                        //string random_rare = "5|ZUFALLSRARE|Baumstamm|15180";
                        //HabboIM.GetWebSocketManager().SendMessageToEveryConnection(random_rare);

                        /* using (DatabaseClient stafflist = HabboIM.GetDatabase().GetClient())
                         * {
                         *   //DataTable start = stafflist.ReadDataTable("SELECT id FROM users ORDER BY desc LIMIT 1")
                         *   //DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users WHERE id = '" + testst + "' LIMIT 1");
                         *   StringBuilder StringStaff = new StringBuilder();
                         *   DataTable Staffs = stafflist.ReadDataTable("SELECT * FROM users ORDER BY id desc");
                         *   foreach(DataRow testRow in Staffs.Rows)
                         *   {
                         *       int dreiund = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count);
                         *       Console.WriteLine("ZUFALL (MIT FOREACH) " + dreiund);
                         *   }
                         *   int testst = rand.Next(Staffs.Rows.Count, Staffs.Rows.Count);
                         *   Console.WriteLine("STAFF ROW " + Staffs.Rows.Count);
                         *
                         *           Console.WriteLine("ZUFALL (OHNE FOREACH) " + testst);
                         *
                         *
                         *   //Console.WriteLine("User gefunden ID:" + testst);
                         *    foreach (DataRow baumstammRow in Staffs.Rows)
                         *    {
                         *        //Console.WriteLine("User gefunden ID:" + testst);
                         *        // Console.WriteLine((string)baumstammRow["username"]);
                         *        Console.WriteLine(testst);
                         *    }
                         *   //Console.WriteLine((string)baumstammRow["username"]);
                         *
                         * }*/
                    }
                }
                catch (Exception ex)
                {
                    Program.DeleteMenu(Program.GetSystemMenu(Program.GetConsoleWindow(), true), Program.SC_CLOSE, Program.MF_BYCOMMAND);
                    Logging.LogThreadException(ex.ToString(), "Server status update task");
                }
                Thread.Sleep(5000);
            }
        }
        public WebSocketServerManager(string SocketURL)
        {
            FleckLog.Level = LogLevel.Error;
            allSockets     = new List <IWebSocketConnection>();
            socketbyName   = new Dictionary <string, IWebSocketConnection>();
            namebySocket   = new Dictionary <IWebSocketConnection, string>();
            server         = new WebSocketServer(SocketURL);

            server.Start(socket =>
            {
                socket.OnOpen = () =>
                {
                    if (allSockets.Contains(socket))
                    {
                        allSockets.Remove(socket);
                    }
                    allSockets.Add(socket);
                };
                socket.OnClose = () =>
                {
                    string name = "";
                    if (namebySocket.ContainsKey(socket))
                    {
                        name = namebySocket[socket].ToString();
                        namebySocket.Remove(socket);
                    }
                    if (socketbyName.ContainsKey(name) && name != "")
                    {
                        socketbyName.Remove(name);
                    }
                    if (allSockets.Contains(socket))
                    {
                        allSockets.Remove(socket);
                    }
                    if (name != "")
                    {
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.AddParamWithValue("name", name);
                            dbClient.ExecuteQuery("UPDATE users SET websocket='0' WHERE username=@name");
                        }
                    }
                };
                socket.OnMessage = message =>
                {
                    var msg = message;
                    int pId = 0;
                    if (!int.TryParse(msg.Split('|')[0], out pId))
                    {
                        return;
                    }
                    if (msg.Length > 1024)
                    {
                        return;
                    }
                    if (msg.StartsWith("1|"))
                    {
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.AddParamWithValue("auth", msg.Substring(2));
                            DataRow drow = null;
                            drow         = dbClient.ReadDataRow("SELECT username FROM users WHERE auth_ticket= @auth LIMIT 1");
                            if (drow == null)
                            {
                                socket.Close();
                            }
                            else
                            {
                                if (socketbyName.ContainsKey((string)drow["username"]))
                                {/* socketbyName[(string)drow["username"]].Close();*/
                                    socketbyName.Remove((string)drow["username"]);
                                }
                                socketbyName.Add(drow["username"].ToString(), socket);
                                if (namebySocket.ContainsKey(socket))
                                {
                                    namebySocket.Remove(socket);
                                }
                                namebySocket.Add(socket, drow["username"].ToString());
                                dbClient.AddParamWithValue("name", drow["username"].ToString());
                            }
                        }
                    }
                    else
                    {
                        GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(GetNameByWebSocket(socket));
                        Room room          = Session.GetHabbo().CurrentRoom;
                        string[] args      = msg.Split('|');
                        switch (int.Parse(args[0]))
                        {
                        case 88:
                            {
                                GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(args[1]));



                                if (class4 == null)
                                {
                                    Session.GetHabbo().Whisper("Diese Person ist bereits offline. Du kannst die Anfrage deshalb nicht mehr annehmen.");
                                    break;
                                }

                                if (class4.GetHabbo().sexanfrage != Session.GetHabbo().Id)
                                {
                                    Session.GetHabbo().Whisper("Ooops, da lief wohl etwas schief.");
                                    break;
                                }
                                if (class4.GetHabbo().boyfriend != 0 || Session.GetHabbo().boyfriend != 0)
                                {
                                    Session.GetHabbo().Whisper("Du bist noch mit wem zusammen.");
                                    break;
                                }
                                if (args[2] == "1")
                                {
                                    class4.GetHabbo().lovepoints  = 0;
                                    class4.GetHabbo().kissed      = 0;
                                    class4.GetHabbo().lovedate    = 0;
                                    class4.GetHabbo().hugged      = 0;
                                    class4.GetHabbo().hugtime     = 0;
                                    class4.GetHabbo().kisstime    = 0;
                                    class4.GetHabbo().boyfriend   = 0;
                                    Session.GetHabbo().lovepoints = 0;
                                    Session.GetHabbo().kissed     = 0;
                                    Session.GetHabbo().lovedate   = 0;
                                    Session.GetHabbo().hugged     = 0;
                                    Session.GetHabbo().hugtime    = 0;
                                    Session.GetHabbo().kisstime   = 0;


                                    Session.GetHabbo().lovedate  = HabboIM.GetUnixTimestamp();
                                    class4.GetHabbo().lovedate   = HabboIM.GetUnixTimestamp();
                                    class4.GetHabbo().boyfriend  = Convert.ToInt32(Session.GetHabbo().Id);
                                    Session.GetHabbo().boyfriend = Convert.ToInt32(class4.GetHabbo().Id);

                                    try
                                    {
                                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                                        {
                                            dbClient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "UPDATE users SET boyfriend = '",
                                                Session.GetHabbo().Id,
                                                "', love_date = '",
                                                class4.GetHabbo().lovedate,
                                                "' WHERE Id = '",
                                                class4.GetHabbo().Id,
                                                "'  LIMIT 1;"
                                            }));

                                            dbClient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "UPDATE users SET boyfriend = '",
                                                class4.GetHabbo().Id,
                                                "', love_date = '",
                                                Session.GetHabbo().lovedate,
                                                "' WHERE Id = '",
                                                Session.GetHabbo().Id,
                                                "'  LIMIT 1;"
                                            }));
                                        }


                                        HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + class4.GetHabbo().Username + ".");
                                        HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehung|Du bist jetzt in einer Beziehung mit " + Session.GetHabbo().Username + ".");
                                    }
                                    catch
                                    {
                                    }
                                }

                                if (args[2] == "2")
                                {
                                    HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt.");
                                    HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Beziehungsanfrage|Die Beziehungsanfrage wurde abgelehnt.");
                                }
                                class4.GetHabbo().sexanfrage  = 0;
                                Session.GetHabbo().sexanfrage = 0;

                                break;
                            }


                        case 74:
                            {
                                try {
                                    using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                                    {
                                        dbClient.ExecuteQuery(string.Concat(new object[]
                                        {
                                            "UPDATE users SET lastkiss_time = '0', lasthug_time = '0', lovepoints = '0', kisses_bf = '0', hugs_bf = '0', boyfriend = '0' WHERE Id = '",
                                            Session.GetHabbo().Id,
                                            "' OR Id = '",
                                            Session.GetHabbo().boyfriend,
                                            "' LIMIT 2;"
                                        }));
                                    }


                                    Session.GetHabbo().lovepoints = 0;
                                    Session.GetHabbo().kissed     = 0;
                                    Session.GetHabbo().lovedate   = 0;
                                    Session.GetHabbo().hugged     = 0;
                                    Session.GetHabbo().hugtime    = 0;
                                    Session.GetHabbo().kisstime   = 0;

                                    GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(Session.GetHabbo().boyfriend));

                                    if (class4 != null)
                                    {
                                        class4.GetHabbo().lovepoints = 0;
                                        class4.GetHabbo().kissed     = 0;
                                        class4.GetHabbo().lovedate   = 0;
                                        class4.GetHabbo().hugged     = 0;
                                        class4.GetHabbo().hugtime    = 0;
                                        class4.GetHabbo().kisstime   = 0;
                                        class4.GetHabbo().boyfriend  = 0;
                                        HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast mit " + class4.GetHabbo().Username + " Schluss gemacht.");
                                        HabboIM.GetWebSocketManager().getWebSocketByName(class4.GetHabbo().Username).Send("textosteron|Trennung|" + Session.GetHabbo().Username + " hat mit dir Schluss gemacht.");
                                    }
                                    Session.GetHabbo().boyfriend = 0;
                                    if (class4 == null)
                                    {
                                        HabboIM.GetWebSocketManager().getWebSocketByName(Session.GetHabbo().Username).Send("textosteron|Trennung|Du hast Schluss gemacht.");
                                    }
                                } catch (Exception x)
                                {
                                }



                                break;
                            }

                        case 6:
                            {
                                try
                                {
                                    room = HabboIM.GetGame().GetRoomManager().GetRoom(uint.Parse(args[1]));
                                    if (Session != null && room != null)
                                    {
                                        ServerMessage Message = new ServerMessage(286u);
                                        Message.AppendBoolean(room.IsPublic);
                                        Message.AppendUInt(room.Id);
                                        Session.SendMessage(Message);
                                    }
                                }
                                catch { }
                                break;
                            }

                        case 9:
                            {
                                try
                                {
                                    if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false))
                                    {
                                        int ItemId  = int.Parse(args[1]);
                                        double newZ = double.Parse(args[2]);
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28((uint)ItemId);
                                        if (ri != null && ri.GetBaseItem().InteractionType == "stackfield")
                                        {
                                            ri.setHeight(newZ);
                                            ri.method_8().method_80(ri);
                                            ServerMessage Message = new ServerMessage(94u);
                                            Message.AppendRawUInt(ri.uint_0);
                                            Message.AppendStringWithBreak("");
                                            Message.AppendBoolean(false);
                                            Session.GetHabbo().CurrentRoom.SendMessage(Message, null);
                                            ServerMessage Message5_ = new ServerMessage(95u);
                                            ri.SerializeStackField(Message5_);
                                            Session.GetHabbo().CurrentRoom.SendMessage(Message5_, null);
                                            ServerMessage Message1_ = new ServerMessage(93u);
                                            ri.SerializeStackField(Message1_);
                                            Session.GetHabbo().CurrentRoom.SendMessage(Message1_, null);
                                        }
                                    }
                                }
                                catch { }
                                break;
                            }

                        case 10:
                            {
                                try
                                {
                                    if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false))
                                    {
                                        uint itemid    = uint.Parse(args[1]);
                                        int handitemId = int.Parse(args[2]);
                                        RoomItem ri    = Session.GetHabbo().CurrentRoom.method_28(itemid);
                                        if (ri != null && ri.GetBaseItem().InteractionType == "wf_cnd_has_handitem")
                                        {
                                            ri.string_2 = handitemId.ToString();
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                }
                                catch { }
                                break;
                            }

                        case 12:
                            {
                                try
                                {
                                    if (Session.GetHabbo().CurrentRoom.CheckRights(Session, false))
                                    {
                                        uint itemid = uint.Parse(args[1]);
                                        string team = args[2];
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(itemid);
                                        if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_actor_in_team" || ri.GetBaseItem().InteractionType == "wf_cnd_not_in_team") && Session.GetHabbo().CurrentRoom.IsValidTeam(team))
                                        {
                                            ri.string_2 = team;
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                }
                                catch { }
                                break;
                            }

                        case 14:
                            {
                                try
                                {
                                    Session.GetHabbo().CurrentRoom.method_56(Session.GetHabbo().Username).CarryItem(int.Parse(args[1]));
                                }
                                catch { }
                                break;
                            }

                        case 32:
                            {
                                if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true))
                                {
                                    try
                                    {
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1]));
                                        if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_yt")
                                        {
                                            string ytlink = args[2].Split('=')[1];
                                            ri.string_2   = ytlink;
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                    catch { }
                                }
                                break;
                            }

                        case 35:
                            {
                                if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true))
                                {
                                    try
                                    {
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1]));
                                        if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_has_purse" || ri.GetBaseItem().InteractionType == "wf_cnd_hasnot_purse"))
                                        {
                                            string currency = Session.GetHabbo().CurrentRoom.IsValidCurrency(args[2]) ? args[2] : "credits";
                                            int number      = 1337;
                                            int.TryParse(args[3], out number);
                                            ri.string_2 = currency + ";" + number;
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                    catch { }
                                }
                                break;
                            }

                        case 36:
                            {
                                if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true))
                                {
                                    try
                                    {
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1]));
                                        if (ri != null && ri.GetBaseItem().InteractionType == "wf_act_img" && IsValidFile(args[2]))
                                        {
                                            ri.string_2 = args[2];
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                    catch { }
                                }
                                break;
                            }

                        case 93076201:
                            {
                                if (HabboIM.zufallsrare == false)
                                {
                                    HabboIM.zufallsrare = true;
                                    uint item           = uint.Parse(args[1]);
                                    uint user           = uint.Parse(args[2]);
                                    uint id             = uint.Parse(args[3]);
                                    uint geschenk       = 169;
                                    var geschenkmsg     = "!HabboIM Zufallsrare - Was hier wohl drin sein mag?";
                                    uint amount         = 1;

                                    using (DatabaseClient dbclient = HabboIM.GetDatabase().GetClient())
                                    {
                                        dbclient.AddParamWithValue("spieler", uint.Parse(args[2]));
                                        dbclient.AddParamWithValue("raum", '0');
                                        dbclient.AddParamWithValue("moebel", uint.Parse(args[1]));
                                        dbclient.AddParamWithValue("geschenk", geschenk);
                                        dbclient.AddParamWithValue("geschenkmsg", geschenkmsg);
                                        dbclient.AddParamWithValue("amount", amount);
                                        StringBuilder StringGetiditem = new StringBuilder();
                                        DataTable Getiditem           = dbclient.ReadDataTable("SELECT * FROM items ORDER BY RAND() LIMIT 1");
                                        foreach (DataRow StaffRow in Getiditem.Rows)
                                        {
                                            uint num5 = HabboIM.GetGame().GetCatalog().method_14();
                                            dbclient.AddParamWithValue("id", num5);
                                            Console.WriteLine(StaffRow["id"]);
                                            dbclient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "INSERT INTO items (Id,user_id,base_item,wall_pos) VALUES ('",
                                                (object)num5,
                                                "','",
                                                uint.Parse(args[2]),
                                                "','169','')"
                                            }));
                                            dbclient.ExecuteQuery(string.Concat(new object[]
                                            {
                                                "INSERT INTO items_extra_data (item_id,extra_data) VALUES ('",
                                                (object)num5,
                                                "','",
                                                "!HabboIM Zufallsrare - Was hier wohl drin sein mag?",
                                                "')"
                                            }));
                                            dbclient.ExecuteQuery(string.Concat(new object[]
                                                                                { "INSERT INTO user_presents (item_id,base_id,amount,extra_data) VALUES ('",
                                                                                  (object)num5,
                                                                                  "','",
                                                                                  uint.Parse(args[1]),
                                                                                  "','1','')" }));

                                            /*
                                             * dbclient.ExecuteQuery("INSERT INTO items (id, user_id, room_id, base_item) VALUES ('" + (object)num5 + "', @spieler, @raum, @geschenk)");
                                             * dbclient.ExecuteQuery("INSERT INTO items_extra_data (item_id, extra_data) VALUES ('" + (object)num5 + "', @geschenkmsg)");
                                             * dbclient.ExecuteQuery("INSERT INTO user_presents (item_id, base_id, amount) VALUES ('" + (object)num5 + "', @moebel, @amount)");*/
                                        }
                                    }
                                    //Staffchat Ausgabe
                                    ServerMessage Logging = new ServerMessage(134u);
                                    Logging.AppendUInt(0u);
                                    Logging.AppendString("INFO: Der Spieler " + args[4] + " hat eine Zufallsrarität erhalten!");
                                    HabboIM.GetGame().GetClientManager().method_16(Logging, Logging);

                                    if (int.Parse(HabboIM.GetConfig().data["habboim.customdesign"]) == 1)
                                    {
                                        string rmessage = "rndrmsg";
                                        HabboIM.GetWebSocketManager().SendMessageToEveryConnection(rmessage);
                                        HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!");
                                    }
                                    else
                                    {
                                        HabboIM.GetGame().GetClientManager().method_WHISPER("Die Zufallsrare wurde soeben verteilt!");
                                        HabboIM.GetGame().GetClientManager().method_WHISPER("Nächste Zufallsrare wird in " + HabboIM.nxt_rr + " Minuten verteilt!");
                                    }

                                    GameClient gameClient = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(args[2]));
                                    if (gameClient != null)
                                    {
                                        gameClient.SendNotification("Überprüfe dein Inventar, denn du hast eine Zufallsrarität erhalten!");
                                        gameClient.GetHabbo().GetInventoryComponent().method_9(true);

                                        ++gameClient.GetHabbo().RandomRares;
                                        gameClient.GetHabbo().CheckRandomRares();
                                    }
                                    return;
                                }
                                break;
                            }

                        case 51:
                            {
                                if (Session.GetHabbo().CurrentRoom.CheckRights(Session, true))
                                {
                                    try
                                    {
                                        RoomItem ri = Session.GetHabbo().CurrentRoom.method_28(uint.Parse(args[1]));
                                        if (ri != null && (ri.GetBaseItem().InteractionType == "wf_cnd_user_count_in" || ri.GetBaseItem().InteractionType == "wfc_cnd_not_user_count") && IsValidFile(args[2]))
                                        {
                                            int min = 1;
                                            int max = 50;
                                            int.TryParse(args[2], out min);
                                            int.TryParse(args[3], out max);
                                            ri.string_3 = min + ";" + max;
                                            ri.UpdateState(true, false);
                                        }
                                    }
                                    catch { }
                                }
                                break;
                            }

                        default:
                            break;
                        }
                    }
                };
            });
        }
예제 #20
0
        public UserDataFactory(string ssoTicket, string ipAddress, bool getAllData)
        {
            if (string.IsNullOrEmpty(ssoTicket))
            {
                this.Validated = false;
            }
            else
            {
                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("auth_ticket", ssoTicket);

                    string str = "";

                    if (ServerConfiguration.EnableSSO)
                    {
                        str = "AND ip_last = '" + ipAddress + "' ";
                    }

                    try
                    {
                        if (int.Parse(HabboIM.GetConfig().data["debug"]) == 1)
                        {
                            str = "";
                        }
                    }
                    catch { }

                    this.UserData = dbClient.ReadDataRow("SELECT * FROM users WHERE auth_ticket = @auth_ticket " + str + " LIMIT 1;");


                    if (this.UserData != null)
                    {
                        this.Validated = true;

                        uint id = (uint)this.UserData["Id"];

                        if (getAllData)
                        {
                            this.Achievements  = dbClient.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + id + "'");
                            this.Favorites     = dbClient.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + id + "'");
                            this.Ignores       = dbClient.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + id + "'");
                            this.Tags          = dbClient.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + id + "'");
                            this.Subscriptions = dbClient.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + id + "'");
                            this.Badges        = dbClient.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + id);
                            this.Items         = dbClient.ReadDataTable("SELECT items.Id,items.base_item,items_extra_data.extra_data FROM items LEFT JOIN items_extra_data ON items_extra_data.item_id = items.Id WHERE room_id = 0 AND user_id = " + id);
                            this.Effects       = dbClient.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id =  " + id);
                            this.Friends       = dbClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "'");
                            this.FriendStream  = dbClient.ReadDataTable("SELECT friend_stream.id, friend_stream.type, friend_stream.userid, friend_stream.gender, friend_stream.look, friend_stream.time, friend_stream.data, friend_stream.data_extra FROM friend_stream JOIN messenger_friendships ON friend_stream.userid = messenger_friendships.user_two_id WHERE ( messenger_friendships.user_one_id = '" + id + "' OR friend_stream.userid = '" + id + "'  ) AND type = '5'  group by friend_stream.id  ORDER BY friend_stream.id DESC LIMIT 15");


                            dbClient.AddParamWithValue("name", (string)this.UserData["username"]);

                            this.Rooms        = dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @name ORDER BY Id ASC LIMIT " + ServerConfiguration.RoomUserLimit);
                            this.Pets         = dbClient.ReadDataTable("SELECT Id, user_id, room_id, name, type, race, color, expirience, energy, nutrition, respect, createstamp, x, y, z FROM user_pets WHERE user_id = " + id + " AND room_id = 0");
                            this.FriendStream = dbClient.ReadDataTable("SELECT friend_stream.id, friend_stream.type, friend_stream.userid, friend_stream.gender, friend_stream.look, friend_stream.time, friend_stream.data, friend_stream.data_extra FROM friend_stream JOIN messenger_friendships ON friend_stream.userid = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "' OR friend_stream.userid = '" + id + "' group by friend_stream.id   ORDER BY friend_stream.id DESC LIMIT 15");

                            Random rnd  = new Random();
                            int    rnd1 = rnd.Next(1000, 9999);
                            int    rnd2 = rnd.Next(1000, 9999);
                            int    rnd3 = rnd.Next(1000, 9999);
                            int    rnd4 = rnd.Next(1000, 9999);
                            int    rnd5 = rnd.Next(1000, 9999);

                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE users SET auth_ticket = CONCAT('HABBOIM-" + rnd1 + "-" + rnd2 + "-" + rnd3 + "-" + rnd4 + "-" + rnd5 + "'), online = '1' WHERE Id = '",
                                id,
                                "' LIMIT 1; UPDATE user_info SET login_timestamp = '",
                                HabboIM.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                id,
                                "' LIMIT 1;"
                            }));
                        }
                    }
                    else
                    {
                        this.Validated = false;
                    }
                }
            }
        }
예제 #21
0
        public void Initialise(DatabaseClient dbClient)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Logging.Write("Lädt bans..");

            this.Bans.Clear();

            DataTable dataTable = dbClient.ReadDataTable("SELECT bantype,value,reason,expire FROM bans WHERE expire > '" + HabboIM.GetUnixTimestamp() + "'");

            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    ModerationBanType Type = ModerationBanType.IP;
                    if ((string)dataRow["bantype"] == "user")
                    {
                        Type = ModerationBanType.USERNAME;
                    }


                    if ((string)dataRow["bantype"] == "static_id")
                    {
                        Type = ModerationBanType.STATICID;
                    }


                    this.Bans.Add(new ModerationBan(Type, (string)dataRow["value"], (string)dataRow["reason"], (double)dataRow["expire"]));
                }

                Logging.WriteLine("Fertig!", ConsoleColor.Green);
            }
        }
예제 #22
0
 public Pet method_11(uint uint_1, string string_0, int int_0, string string_1, string string_2)
 {
     return(new Pet(this.method_14(), uint_1, 0U, string_0, (uint)int_0, string_1, string_2, 0, 100, 100, 0, HabboIM.GetUnixTimestamp(), 0, 0, 0.0)
     {
         DBState = DatabaseUpdateState.NeedsInsert
     });
 }
예제 #23
0
        public bool method_2(GameClient Session)
        {
            double num = (HabboIM.GetUnixTimestamp() - Session.GetHabbo().LastActivityPointsUpdate) / 60.0;

            return(num >= (double)ServerConfiguration.CreditingInterval);
        }