示例#1
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                if ([email protected])
                {
                    Session.GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("trade_error_roomdisabled"));
                }
                else
                {
                    RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    RoomUser class3 = @class.method_52(Event.PopWiredInt32());
                    if (class2 != null && class3 != null && class3.GetClient().GetHabbo().TradingDisabled)
                    {
                        @class.method_77(class2, class3);
                    }
                    else
                    {
                        Session.GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("trade_error_targetdisabled"));
                    }
                }
            }
        }
示例#2
0
        public void RestoreStatistics(DatabaseClient dbClient, int status)
        {
            Console.BackgroundColor = ConsoleColor.Black;
            Logging.Write(HabboIMEnvironment.GetExternalText("emu_cleandb"));
            bool flag = true;

            try
            {
                if (int.Parse(HabboIM.GetConfig().data["debug"]) == 1)
                {
                    flag = false;
                }
            }
            catch
            {
            }
            if (flag)
            {
                Console.BackgroundColor = ConsoleColor.Black;
                dbClient.ExecuteQuery("UPDATE users SET online = '0' WHERE online != '0'", 30);
                dbClient.ExecuteQuery("UPDATE rooms SET users_now = '0' WHERE users_now != '0'", 30);
                dbClient.ExecuteQuery("UPDATE user_roomvisits SET exit_timestamp = UNIX_TIMESTAMP() WHERE exit_timestamp <= 0", 30);
                dbClient.ExecuteQuery(string.Concat(new object[]
                {
                    "UPDATE server_status SET status = '",
                    status,
                    "', users_online = '0', rooms_loaded = '0', server_ver = '",
                    HabboIM.Version,
                    "', stamp = UNIX_TIMESTAMP() LIMIT 1;"
                }), 30);
            }
            Logging.WriteLine("Fertig!", ConsoleColor.Green);
        }
        public void Handle(GameClient session, ClientMessage message)
        {
            Room room = HabboIM.GetGame().GetRoomManager().GetRoom(session.GetHabbo().CurrentRoomId);

            if (room != null && (room.AllowPet || room.CheckRights(session, true)))
            {
                uint petId = message.PopWiredUInt();

                Pet pet = session.GetHabbo().GetInventoryComponent().GetPetById(petId);

                if (pet != null && !pet.PlacedInRoom)
                {
                    int num  = message.PopWiredInt32();
                    int num2 = message.PopWiredInt32();

                    if (room.method_30(num, num2, 0.0, true, false))
                    {
                        if (room.PetCount >= ServerConfiguration.PetsPerRoomLimit)
                        {
                            session.SendNotification(HabboIMEnvironment.GetExternalText("error_maxpets") + ServerConfiguration.PetsPerRoomLimit);
                        }
                        else
                        {
                            pet.PlacedInRoom = true;
                            pet.RoomId       = room.Id;

                            List <RandomSpeech> list  = new List <RandomSpeech>();
                            List <BotResponse>  list2 = new List <BotResponse>();

                            room.method_4(new RoomBot(pet.PetId, pet.RoomId, AIType.const_0, "freeroam", pet.Name, "", pet.Look, num, num2, 0, 0, 0, 0, 0, 0, ref list, ref list2, 0), pet);

                            if (room.CheckRights(session, true))
                            {
                                session.GetHabbo().GetInventoryComponent().RemovePetById(pet.PetId);
                            }
                        }
                    }
                }
            }
        }
示例#4
0
        internal void method_6(string string_0)
        {
            try
            {
                UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().String_0, true);
                if (this.GetConnection().String_0 == "127.0.0.1" && [email protected])
                {
                    @class = new UserDataFactory(string_0, "::1", true);
                }
                if ([email protected])
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = HabboIMEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")";
                    }
                    ServerMessage Message = new ServerMessage(161u);
                    Message.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.method_12();
                    return;
                }
                Habbo class2 = Authenticator.CreateHabbo(string_0, this, @class, @class);
                HabboIM.GetGame().GetClientManager().method_25(class2.Id);
                this.Habbo = class2;
                this.Habbo.method_2(@class);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Logging login error because you are on alpha test!");
                Logging.LogException(ex.ToString());
                if (this != null)
                {
                    this.SendNotification(ex.ToString());
                    this.method_12();
                }
                return;
            }

            try
            {
                HabboIM.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.NotifyBan(gException.Message);
                this.method_12();
                return;
            }

            ServerMessage Message2 = new ServerMessage(2u);

            if (this == null || this.GetHabbo() == null)
            {
                return;
            }

            if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes)
            {
                Message2.AppendInt32(2);
            }
            else
            {
                if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                {
                    Message2.AppendInt32(1);
                }
                else
                {
                    Message2.AppendInt32(0);
                }
            }
            if (this.GetHabbo().HasFuse("acc_anyroomowner"))
            {
                Message2.AppendInt32(7);
            }
            else
            {
                if (this.GetHabbo().HasFuse("acc_anyroomrights"))
                {
                    Message2.AppendInt32(5);
                }
                else
                {
                    if (this.GetHabbo().HasFuse("acc_supporttool"))
                    {
                        Message2.AppendInt32(4);
                    }
                    else
                    {
                        if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                        {
                            Message2.AppendInt32(2);
                        }
                        else
                        {
                            Message2.AppendInt32(0);
                        }
                    }
                }
            }

            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().GetEffectsInventoryComponent().method_6());

            ServerMessage Message3 = new ServerMessage(290u);

            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);

            ServerMessage Message5_ = new ServerMessage(3u);

            this.SendMessage(Message5_);

            if (this.GetHabbo().HasFuse("acc_supporttool"))
            {
                this.SendMessage(HabboIM.GetGame().GetModerationTool().method_0());
                HabboIM.GetGame().GetModerationTool().method_4(this);
            }


            ServerMessage UserLogging = new ServerMessage(517u);

            UserLogging.AppendBoolean(true);
            this.SendMessage(UserLogging);
            if (HabboIM.GetGame().GetPixelManager().method_2(this))
            {
                HabboIM.GetGame().GetPixelManager().method_3(this);
            }

            if (GetHabbo().Rank > 5u)
            {
                HabboIM.GetGame().GetClientManager().method_18ONLINE(GetHabbo().Username);
            }

            ServerMessage Message5 = new ServerMessage(455u);

            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            this.SendMessage(Message5);
            ServerMessage Message6 = new ServerMessage(458u);

            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().list_1.Count);
            foreach (uint current in this.GetHabbo().list_1)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);

            this.GetHabbo().CheckTotalTimeOnlineAchievements();
            this.GetHabbo().CheckHappyHourAchievements();
            this.GetHabbo().CheckTrueHabboAchievements();
            this.GetHabbo().CheckRegularVisitorAchievements();
            this.GetHabbo().CheckFootballGoalHostScoreAchievements();
            this.GetHabbo().CheckStaffPicksAchievement();

            try
            {
                if (HabboIM.UserAdType >= 0 && HabboIM.UserAdType <= 2 && HabboIM.UserAdMessage.Count > 0)
                {
                    if (!(int.Parse(HabboIM.GetConfig().data["ads.disable"]) == 1))
                    {
                        if (!(int.Parse(HabboIM.GetConfig().data["ads.allowedonlyrandomads"]) == 0))
                        {
                            int random = HabboIMEnvironment.GetRandomNumber(1, 100);

                            if (random <= 5)
                            {
                                if (HabboIM.UserAdType == 0)
                                {
                                    this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0);
                                }
                                if (HabboIM.UserAdType == 1)
                                {
                                    this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2);
                                }
                                else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "")
                                {
                                    ServerMessage Message = new ServerMessage(161u);
                                    Message.AppendStringWithBreak(string.Concat(new string[]
                                    {
                                        " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                        "\r\n",
                                        string.Join("\r\n", HabboIM.UserAdMessage),
                                    }));
                                    Message.AppendStringWithBreak(HabboIM.UserAdLink);
                                    this.SendMessage(Message);
                                }
                            }
                        }
                        else
                        {
                            if (HabboIM.UserAdType == 0)
                            {
                                this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0);
                            }
                            if (HabboIM.UserAdType == 1)
                            {
                                this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2);
                            }
                            else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "")
                            {
                                ServerMessage Message = new ServerMessage(161u);
                                Message.AppendStringWithBreak(string.Concat(new string[]
                                {
                                    " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                    "\r\n",
                                    string.Join("\r\n", HabboIM.UserAdMessage),
                                }));
                                Message.AppendStringWithBreak(HabboIM.UserAdLink);
                                this.SendMessage(Message);
                            }
                        }
                    }
                }
            }
            catch
            {
            }

            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)HabboIM.GetGame().GetRoleManager().method_9(); num > 1u; num -= 1u)
            {
                if (HabboIM.GetGame().GetRoleManager().method_8(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, HabboIM.GetGame().GetRoleManager().method_8(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(HabboIM.GetGame().GetRoleManager().method_8(num));
                        }
                    }
                }
            }

            if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                this.GetHabbo().CheckHCAchievements();
            }
            if (this.GetHabbo().IsVIP&& !this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
            {
                this.GetHabbo().GetBadgeComponent().SendBadge(this, "VIP", true);
            }
            else
            {
                if (!this.GetHabbo().IsVIP&& this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
                {
                    this.GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
                }
            }
            if (this.GetHabbo().CurrentQuestId > 0u)
            {
                HabboIM.GetGame().GetQuestManager().method_7(this.GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage Message5_2 = new ServerMessage(573u);
                this.SendMessage(Message5_2);
            }
            this.GetHabbo().Motto = HabboIM.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;

            using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    HabboIM.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
        }
		public void Handle(GameClient Session, ClientMessage Event)
		{
			uint num = Event.PopWiredUInt();
			DataRow dataRow = null;
			using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
			{
				dataRow = @class.ReadDataRow("SELECT state, timestamp, total_price, extra_data, item_id, furni_id FROM catalog_marketplace_offers WHERE offer_id = '" + num + "' LIMIT 1");
			}
			if (dataRow == null || (string)dataRow["state"] != "1" || (double)dataRow["timestamp"] <= HabboIM.GetGame().GetCatalog().method_22().method_3())
			{
				Session.SendNotification(HabboIMEnvironment.GetExternalText("marketplace_error_expired"));
			}
			else
			{
				Item class2 = HabboIM.GetGame().GetItemManager().method_2((uint)dataRow["item_id"]);
				if (class2 != null)
				{
					if ((int)dataRow["total_price"] >= 1)
					{
						if (Session.GetHabbo().Credits < (int)dataRow["total_price"])
						{
							Session.SendNotification(HabboIMEnvironment.GetExternalText("marketplace_error_credits"));
							return;
						}
						Session.GetHabbo().Credits -= (int)dataRow["total_price"];
						Session.GetHabbo().UpdateCredits(true);
					}
					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("UPDATE catalog_marketplace_offers SET state = '2' WHERE offer_id = '" + num + "' LIMIT 1");
						int num2 = 0;
						try
						{
							num2 = @class.ReadInt32("SELECT Id FROM catalog_marketplace_data WHERE daysago = 0 AND sprite = " + class2.Sprite + " LIMIT 1;");
						}
						catch
						{
						}
						if (num2 > 0)
						{
							@class.ExecuteQuery(string.Concat(new object[]
							{
								"UPDATE catalog_marketplace_data SET sold = sold + 1, avgprice = (avgprice + ",
								(int)dataRow["total_price"],
								") WHERE Id = ",
								num2,
								" LIMIT 1;"
							}));
						}
						else
						{
							@class.ExecuteQuery(string.Concat(new object[]
							{
								"INSERT INTO catalog_marketplace_data (sprite, sold, avgprice, daysago) VALUES ('",
								class2.Sprite,
								"', 1, ",
								(int)dataRow["total_price"],
								", 0)"
							}));
						}
						if (HabboIM.GetGame().GetCatalog().method_22().dictionary_0.ContainsKey(class2.Sprite) && HabboIM.GetGame().GetCatalog().method_22().dictionary_1.ContainsKey(class2.Sprite))
						{
							int num3 = HabboIM.GetGame().GetCatalog().method_22().dictionary_1[class2.Sprite];
							int num4 = HabboIM.GetGame().GetCatalog().method_22().dictionary_0[class2.Sprite];
							num4 += (int)dataRow["total_price"];
							HabboIM.GetGame().GetCatalog().method_22().dictionary_0.Remove(class2.Sprite);
							HabboIM.GetGame().GetCatalog().method_22().dictionary_0.Add(class2.Sprite, num4);
							HabboIM.GetGame().GetCatalog().method_22().dictionary_1.Remove(class2.Sprite);
							HabboIM.GetGame().GetCatalog().method_22().dictionary_1.Add(class2.Sprite, num3 + 1);
						}
						else
						{
							if (!HabboIM.GetGame().GetCatalog().method_22().dictionary_0.ContainsKey(class2.Sprite))
							{
								HabboIM.GetGame().GetCatalog().method_22().dictionary_0.Add(class2.Sprite, (int)dataRow["total_price"]);
							}
							if (!HabboIM.GetGame().GetCatalog().method_22().dictionary_1.ContainsKey(class2.Sprite))
							{
								HabboIM.GetGame().GetCatalog().method_22().dictionary_1.Add(class2.Sprite, 1);
							}
						}
					}
					ServerMessage Message = new ServerMessage(67u);
					Message.AppendUInt(class2.UInt32_0);
					Message.AppendStringWithBreak(class2.Name);
					Message.AppendInt32((int)dataRow["total_price"]);
					Message.AppendInt32(0);
					Message.AppendInt32(0);
					Message.AppendInt32(1);
					Message.AppendStringWithBreak(class2.Type.ToString());
					Message.AppendInt32(class2.Sprite);
					Message.AppendStringWithBreak("");
					Message.AppendInt32(1);
					Message.AppendInt32(-1);
					Message.AppendStringWithBreak("");
					Session.SendMessage(Message);
					Session.SendMessage(HabboIM.GetGame().GetCatalog().method_22().method_5(-1, -1, "", 1));
				}
			}
		}
示例#6
0
        public override void OnTimerTick()
        {
            if (this.SpeechTimer <= 0)
            {
                RoomUser @class = base.GetRoomUser();
                string[] array  = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array2 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_cat1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_cat2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_cat3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_cat4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_cat5")
                };
                string[] array3 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_croc1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_croc2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_croc3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_croc4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_croc5")
                };
                string[] array4 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dog5")
                };
                string[] array5 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_bear1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_bear2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_bear3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_bear4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_bear5")
                };
                string[] array6 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_pig1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_pig2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_pig3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_pig4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_pig5")
                };
                string[] array7 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_lion1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_lion2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_lion3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_lion4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_lion5")
                };
                string[] array8 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_rhino1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_rhino2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_rhino3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_rhino4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_rhino5")
                };
                string[] array9 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_spider1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_spider2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_spider3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_spider4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_spider5")
                };
                string[] array10 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_turtle1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_turtle2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_turtle3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_turtle4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_turtle5")
                };
                string[] array11 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_chic1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_chic2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_chic3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_chic4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_chic5")
                };
                string[] array12 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_frog1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_frog2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_frog3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_frog4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_frog5")
                };
                string[] array13 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_dragon1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dragon2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dragon3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dragon4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_dragon5")
                };
                string[] array14 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_horse1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_horse2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_horse3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_horse4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_horse5")
                };
                string[] array15 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_monkey1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_monkey2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_monkey3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_monkey4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_monkey5")
                };
                string[] array16 = new string[]
                {
                    HabboIMEnvironment.GetExternalText("pet_chatter_generic1"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_generic2"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_generic3"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_generic4"),
                    HabboIMEnvironment.GetExternalText("pet_chatter_generic5")
                };
                string[] array17 = new string[]
                {
                    "sit",
                    "lay",
                    "snf",
                    "ded",
                    "jmp",
                    "snf",
                    "sit",
                    "snf"
                };
                string[] array18 = new string[]
                {
                    "sit",
                    "lay"
                };
                string[] array19 = new string[]
                {
                    "wng",
                    "grn",
                    "flm",
                    "std",
                    "swg",
                    "sit",
                    "lay",
                    "snf",
                    "plf",
                    "jmp",
                    "flm",
                    "crk",
                    "rlx",
                    "flm"
                };
                if (@class != null)
                {
                    Random random = new Random();
                    int    num    = HabboIM.smethod_5(1, 4);
                    if (num == 2)
                    {
                        @class.Statusses.Clear();
                        if (base.GetRoomUser().RoomBot.RoomUser_0 == null)
                        {
                            if (@class.PetData.Type == 13u)
                            {
                                @class.Statusses.Add(array18[random.Next(0, array18.Length - 1)], @class.double_0.ToString());
                            }
                            else
                            {
                                if (@class.PetData.Type != 12u)
                                {
                                    @class.Statusses.Add(array17[random.Next(0, array17.Length - 1)], @class.double_0.ToString());
                                }
                                else
                                {
                                    @class.Statusses.Add(array19[random.Next(0, array19.Length - 1)], @class.double_0.ToString());
                                }
                            }
                        }
                    }
                    switch (@class.PetData.Type)
                    {
                    case 0u:
                        @class.HandleSpeech(null, array[random.Next(0, array.Length - 1)], false);
                        break;

                    case 1u:
                        @class.HandleSpeech(null, array2[random.Next(0, array2.Length - 1)], false);
                        break;

                    case 2u:
                        @class.HandleSpeech(null, array3[random.Next(0, array3.Length - 1)], false);
                        break;

                    case 3u:
                        @class.HandleSpeech(null, array4[random.Next(0, array4.Length - 1)], false);
                        break;

                    case 4u:
                        @class.HandleSpeech(null, array5[random.Next(0, array5.Length - 1)], false);
                        break;

                    case 5u:
                        @class.HandleSpeech(null, array6[random.Next(0, array6.Length - 1)], false);
                        break;

                    case 6u:
                        @class.HandleSpeech(null, array7[random.Next(0, array7.Length - 1)], false);
                        break;

                    case 7u:
                        @class.HandleSpeech(null, array8[random.Next(0, array8.Length - 1)], false);
                        break;

                    case 8u:
                        @class.HandleSpeech(null, array9[random.Next(0, array9.Length - 1)], false);
                        break;

                    case 9u:
                        @class.HandleSpeech(null, array10[random.Next(0, array10.Length - 1)], false);
                        break;

                    case 10u:
                        @class.HandleSpeech(null, array11[random.Next(0, array11.Length - 1)], false);
                        break;

                    case 11u:
                        @class.HandleSpeech(null, array12[random.Next(0, array12.Length - 1)], false);
                        break;

                    case 12u:
                        @class.HandleSpeech(null, array13[random.Next(0, array13.Length - 1)], false);
                        break;

                    case 13u:
                        @class.HandleSpeech(null, array14[random.Next(0, array14.Length - 1)], false);
                        break;

                    case 14u:
                        @class.HandleSpeech(null, array15[random.Next(0, array15.Length - 1)], false);
                        break;

                    default:
                        @class.HandleSpeech(null, array16[random.Next(0, array16.Length - 1)], false);
                        break;
                    }
                }
                this.SpeechTimer = HabboIM.smethod_5(30, 120);
            }
            else
            {
                this.SpeechTimer--;
            }
            if (this.ActionTimer <= 0)
            {
                base.GetRoomUser().PetData.PetEnergy(10);
                if (base.GetRoomUser().RoomBot.RoomUser_0 == null)
                {
                    this.method_5(0, 0, true);
                }
                this.ActionTimer = 30;
                this.FollowType  = FollowType.None;
                this.FollowUser  = null;
            }
            else
            {
                this.ActionTimer--;

                if (this.FollowType != FollowType.None && this.FollowUser != null)
                {
                    this.PetFollowUser(this.FollowUser, base.GetRoomUser(), this.FollowType);
                }
            }
        }
示例#7
0
        public override void OnUserSay(RoomUser RoomUser, string string_0)
        {
            RoomUser Pet = base.GetRoomUser();

            if (Pet.RoomBot.RoomUser_0 == null)
            {
                if (string_0.ToLower().Equals(Pet.PetData.Name.ToLower()))
                {
                    Pet.method_9(Class107.smethod_0(Pet.X, Pet.Y, RoomUser.X, RoomUser.Y));
                }
                else
                {
                    if (string_0.ToLower().StartsWith(Pet.PetData.Name.ToLower() + " ") && RoomUser.GetClient().GetHabbo().Username.ToLower() == base.GetRoomUser().PetData.OwnerName.ToLower())
                    {
                        string key = string_0.Substring(Pet.PetData.Name.ToLower().Length + 1);
                        if ((Pet.PetData.Energy >= 10 && this.method_4() < 6) || Pet.PetData.Level >= 15)
                        {
                            Pet.Statusses.Clear();
                            if (!HabboIM.GetGame().GetRoleManager().dictionary_5.ContainsKey(key))
                            {
                                string[] array = new string[]
                                {
                                    HabboIMEnvironment.GetExternalText("pet_response_confused1"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused2"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused3"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused4"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused5"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused6"),
                                    HabboIMEnvironment.GetExternalText("pet_response_confused7")
                                };
                                Random random = new Random();
                                Pet.HandleSpeech(null, array[random.Next(0, array.Length - 1)], false);
                            }
                            else
                            {
                                switch (HabboIM.GetGame().GetRoleManager().dictionary_5[key])
                                {
                                case 0:
                                    // Remove Status
                                    RemovePetStatus();

                                    this.SpeechTimer = 0;
                                    this.ActionTimer = 0;
                                    this.FollowType  = FollowType.None;

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 1:
                                    this.ActionTimer = 25;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(10, -10);     // Give XP

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 2:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(10, -10);     // Give XP

                                    // Add Status
                                    Pet.Statusses.Add("lay", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 3:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    RemovePetStatus();

                                    int NewX = RoomUser.X;
                                    int NewY = RoomUser.Y;

                                    #region Rotation
                                    if (RoomUser.BodyRotation == 4)
                                    {
                                        NewY = RoomUser.Y + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 0)
                                    {
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 6)
                                    {
                                        NewX = RoomUser.X - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 2)
                                    {
                                        NewX = RoomUser.X + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 3)
                                    {
                                        NewX = RoomUser.X + 1;
                                        NewY = RoomUser.Y + 1;
                                    }
                                    else if (RoomUser.BodyRotation == 1)
                                    {
                                        NewX = RoomUser.X + 1;
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 7)
                                    {
                                        NewX = RoomUser.X - 1;
                                        NewY = RoomUser.Y - 1;
                                    }
                                    else if (RoomUser.BodyRotation == 5)
                                    {
                                        NewX = RoomUser.X - 1;
                                        NewY = RoomUser.Y + 1;
                                    }
                                    #endregion

                                    Pet.PetData.AddExpirience(11, -10);     // Give XP

                                    Pet.MoveTo(NewX, NewY);
                                    break;

                                case 4:
                                    this.ActionTimer = 10;
                                    this.FollowType  = FollowType.None;

                                    //Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(15, -13);     // Give XP

                                    Pet.Statusses.Add("beg", TextHandling.GetString(Pet.double_0));
                                    break;

                                case 5:
                                    this.ActionTimer = 30;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("ded", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(20, -18);     // Give XP
                                    break;

                                case 6:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("sit", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(20, -18);     // Give XP

                                    Pet.MoveTo(Pet.X, Pet.Y);
                                    break;

                                case 7:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.Normal;
                                    this.FollowUser  = RoomUser;

                                    Pet.PetData.AddExpirience(30, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Normal);
                                    break;

                                case 8:
                                    //Stand
                                    break;

                                case 9:
                                    this.ActionTimer = 5;
                                    this.FollowType  = FollowType.None;

                                    // Remove Status
                                    RemovePetStatus();

                                    // Add Status
                                    Pet.Statusses.Add("jmp", TextHandling.GetString(Pet.double_0));

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP
                                    break;

                                case 10:
                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.SpeechTimer = 2;
                                    this.FollowType  = FollowType.None;
                                    break;

                                case 11:
                                    //Play
                                    break;

                                case 12:
                                    // Remove Status
                                    RemovePetStatus();

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.SpeechTimer = 120;
                                    this.FollowType  = FollowType.None;
                                    break;

                                case 13:
                                    //Nest
                                    break;

                                case 14:
                                    //Drink
                                    break;

                                case 15:
                                    this.ActionTimer = 120;
                                    this.FollowType  = FollowType.Left;
                                    this.FollowUser  = RoomUser;

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Left);
                                    break;

                                case 16:
                                    this.FollowType = FollowType.Right;
                                    this.FollowUser = RoomUser;

                                    Pet.PetData.AddExpirience(35, -30);     // Give XP

                                    this.PetFollowUser(RoomUser, Pet, FollowType.Right);
                                    break;

                                case 17:
                                    //Play football
                                    break;

                                case 24:
                                    //Move forwar
                                    break;

                                case 25:
                                    //Turn left
                                    break;

                                case 26:
                                    //Turn right
                                    break;

                                case 43:
                                    //Eat
                                    break;
                                }
                            }
                        }
                        else
                        {
                            string[] array2 = new string[]
                            {
                                HabboIMEnvironment.GetExternalText("pet_response_sleeping1"),
                                HabboIMEnvironment.GetExternalText("pet_response_sleeping2"),
                                HabboIMEnvironment.GetExternalText("pet_response_sleeping3"),
                                HabboIMEnvironment.GetExternalText("pet_response_sleeping4"),
                                HabboIMEnvironment.GetExternalText("pet_response_sleeping5")
                            };
                            string[] array3 = new string[]
                            {
                                HabboIMEnvironment.GetExternalText("pet_response_refusal1"),
                                HabboIMEnvironment.GetExternalText("pet_response_refusal2"),
                                HabboIMEnvironment.GetExternalText("pet_response_refusal3"),
                                HabboIMEnvironment.GetExternalText("pet_response_refusal4"),
                                HabboIMEnvironment.GetExternalText("pet_response_refusal5")
                            };
                            Pet.int_10 = Pet.int_12;
                            Pet.int_11 = Pet.int_13;
                            Pet.Statusses.Clear();
                            if (Pet.PetData.Energy < 10)
                            {
                                Random random2 = new Random();
                                Pet.HandleSpeech(null, array2[random2.Next(0, array2.Length - 1)], false);
                                if (Pet.PetData.Type != 13u)
                                {
                                    Pet.Statusses.Add("lay", Pet.double_0.ToString());
                                }
                                else
                                {
                                    Pet.Statusses.Add("lay", (Pet.double_0 - 1.0).ToString());
                                }
                                this.SpeechTimer = 25;
                                this.ActionTimer = 20;
                                base.GetRoomUser().PetData.PetEnergy(25);
                            }
                            else
                            {
                                Random random2 = new Random();
                                Pet.HandleSpeech(null, array3[random2.Next(0, array3.Length - 1)], false);
                            }
                        }
                        Pet.UpdateNeeded = true;
                    }
                }
            }
        }
示例#8
0
        public void ParsePacket(string data)
        {
            string text = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];
            string text2 = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];
            GameClient client  = null;
            DataRow    dataRow = null;
            string     text3   = text.ToLower();

            if (text3 != null)
            {
                if (MusCommands.dictionary_0 == null)
                {
                    MusCommands.dictionary_0 = new Dictionary <string, int>(29)
                    {
                        {
                            "update_items",
                            0
                        },
                        {
                            "update_catalogue",
                            1
                        },
                        {
                            "update_catalog",
                            2
                        },
                        {
                            "updateusersrooms",
                            3
                        },
                        {
                            "senduser",
                            4
                        },
                        {
                            "updatevip",
                            5
                        },
                        {
                            "giftitem",
                            6
                        },
                        {
                            "giveitem",
                            7
                        },
                        {
                            "unloadroom",
                            8
                        },
                        {
                            "roomalert",
                            9
                        },
                        {
                            "updategroup",
                            10
                        },
                        {
                            "updateusersgroups",
                            11
                        },
                        {
                            "shutdown",
                            12
                        },
                        {
                            "update_filter",
                            13
                        },
                        {
                            "refresh_filter",
                            14
                        },
                        {
                            "updatecredits",
                            15
                        },
                        {
                            "updatesettings",
                            16
                        },
                        {
                            "updatepixels",
                            17
                        },
                        {
                            "updatepoints",
                            18
                        },
                        {
                            "reloadbans",
                            19
                        },
                        {
                            "update_bots",
                            20
                        },
                        {
                            "signout",
                            21
                        },
                        {
                            "exe",
                            22
                        },
                        {
                            "alert",
                            23
                        },
                        {
                            "sa",
                            24
                        },
                        {
                            "ha",
                            25
                        },
                        {
                            "hal",
                            26
                        },
                        {
                            "updatemotto",
                            27
                        },
                        {
                            "updatelook",
                            28
                        },
                        {
                            "infobuspoll",
                            29
                        },
                        {
                            "givebadge",
                            30
                        },
                        {
                            "addroom",
                            31
                        },
                        {
                            "updatescmd",
                            32
                        },
                        {
                            "whisperall",
                            33
                        }
                    };
                }
                int num;
                if (MusCommands.dictionary_0.TryGetValue(text3, out num))
                {
                    uint   uint_2;
                    string text5;
                    switch (num)
                    {
                    case 0:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetItemManager().method_0(class2);
                            goto IL_1379;
                        }
                        break;

                    case 1:
                    case 2:
                        break;

                    case 3:
                    {
                        Habbo class3 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                            {
                                class3.method_1(class2);
                            }
                        }
                        goto IL_1379;
                    }

                    case 4:
                    {
                        uint num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(num2);
                        Room       class5 = HabboIM.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            ServerMessage Message7 = new ServerMessage(286u);
                            Message7.AppendBoolean(class5.IsPublic);
                            Message7.AppendUInt(num3);
                            class4.SendMessage(Message7);
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 5:
                    {
                        Habbo class3 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.UpdateRights();
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 6:
                    case 7:
                    {
                        uint num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint uint_ = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        int int_ = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[2]);
                        string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);
                        HabboIM.GetGame().GetCatalog().method_7(string_, num2, uint_, int_);
                        goto IL_1379;
                    }

                    case 8:
                    {
                        uint_2 = uint.Parse(text2);
                        Room class5 = HabboIM.GetGame().GetRoomManager().GetRoom(uint_2);
                        HabboIM.GetGame().GetRoomManager().method_16(class5);
                        goto IL_1379;
                    }

                    case 9:
                    {
                        uint num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        Room class5 = HabboIM.GetGame().GetRoomManager().GetRoom(num3);
                        if (class5 != null)
                        {
                            string string_2 = text2.Substring(num3.ToString().Length + 1);
                            for (int i = 0; i < class5.RoomUsers.Length; i++)
                            {
                                RoomUser class6 = class5.RoomUsers[i];
                                if (class6 != null)
                                {
                                    class6.GetClient().SendNotification(string_2);
                                }
                            }
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 10:
                    {
                        int int_2 = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            Groups.smethod_3(class2, int_2);
                            goto IL_1379;
                        }
                        goto IL_5BF;
                    }

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_119A;

                    case 13:
                    case 14:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            ChatCommandHandler.InitWords(class2);
                            goto IL_1379;
                        }
                        goto IL_5F7;

                    case 15:
                        goto IL_5F7;

                    case 16:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().LoadServerSettings(class2);
                            goto IL_1379;
                        }
                        goto IL_62F;

                    case 17:
                        goto IL_62F;

                    case 18:
                        client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                        if (client != null)
                        {
                            client.GetHabbo().UpdateVipPoints(true, false);
                            goto IL_1379;
                        }
                        goto IL_1379;

                    case 19:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetBanManager().Initialise(class2);
                        }
                        HabboIM.GetGame().GetClientManager().method_28();
                        goto IL_1379;

                    case 20:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetBotManager().method_0(class2);
                            goto IL_1379;
                        }
                        goto IL_6F1;

                    case 21:
                        goto IL_6F1;

                    case 22:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(text2, 30);
                            goto IL_1379;
                        }
                        goto IL_727;

                    case 23:
                        goto IL_727;

                    case 24:
                    {
                        ServerMessage Message8 = new ServerMessage(134u);
                        Message8.AppendUInt(0u);
                        Message8.AppendString("System: " + text2);
                        HabboIM.GetGame().GetClientManager().method_16(Message8, Message8);
                        goto IL_1379;
                    }

                    case 25:
                    {
                        ServerMessage Message9 = new ServerMessage(808u);
                        Message9.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("mus_ha_title"));
                        Message9.AppendStringWithBreak(text2);
                        ServerMessage Message10 = new ServerMessage(161u);
                        Message10.AppendStringWithBreak(text2);
                        HabboIM.GetGame().GetClientManager().method_15(Message9, Message10);
                        goto IL_1379;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message11 = new ServerMessage(161u);
                        Message11.AppendStringWithBreak(string.Concat(new string[]
                            {
                                HabboIMEnvironment.GetExternalText("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                HabboIMEnvironment.GetExternalText("mus_hal_tail")
                            }));
                        Message11.AppendStringWithBreak(text4);
                        HabboIM.GetGame().GetClientManager().BroadcastMessage(Message11);
                        goto IL_1379;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        client = HabboIM.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30);
                        }
                        client.GetHabbo().Figure          = (string)dataRow["look"];
                        client.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        client.GetHabbo().Motto           = HabboIM.FilterString((string)dataRow["motto"]);
                        client.GetHabbo().BlockNewFriends = HabboIM.StringToBoolean(dataRow["block_newfriends"].ToString());
                        ServerMessage Message12           = new ServerMessage(266u);
                        Message12.AppendInt32(-1);
                        Message12.AppendStringWithBreak(client.GetHabbo().Figure);
                        Message12.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                        Message12.AppendStringWithBreak(client.GetHabbo().Motto);
                        client.SendMessage(Message12);
                        if (client.GetHabbo().InRoom)
                        {
                            Room          class5    = HabboIM.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class7    = class5.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message13 = new ServerMessage(266u);
                            Message13.AppendInt32(class7.VirtualId);
                            Message13.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message13.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message13.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message13.AppendInt32(client.GetHabbo().AchievementScore);
                            Message13.AppendStringWithBreak("");
                            class5.SendMessage(Message13, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_1379;
                        }
                        if (text3 == "updatemotto")
                        {
                            client.GetHabbo().MottoAchievementsCompleted();
                            goto IL_1379;
                        }
                        if (text3 == "updatelook")
                        {
                            client.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 33:
                    {
                        HabboIM.GetGame().GetClientManager().method_WHISPER(text2);



                        goto IL_1379;
                    }

                    case 29:
                    {
                        int QuestionID = int.Parse(text2);
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            DataRow   QuestionRow  = dbClient.ReadDataRow("SELECT * FROM infobus_questions WHERE id='" + QuestionID + "' LIMIT 1", 30);
                            string    Question     = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionID + "' LIMIT 1", 30);
                            DataTable AnswersTable = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id='" + QuestionID + "'", 30);
                            Room      PollRoom     = HabboIM.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().CurrentRoom;
                            PollRoom.CurrentPollId = QuestionID;
                            GameClient TargetUser = HabboIM.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString());
                            if (PollRoom.Owner == QuestionRow["owner"].ToString())
                            {
                                ServerMessage InfobusQuestion = new ServerMessage(79u);
                                InfobusQuestion.AppendStringWithBreak(Question);
                                InfobusQuestion.AppendInt32(AnswersTable.Rows.Count);
                                if (AnswersTable != null)
                                {
                                    foreach (DataRow Row in AnswersTable.Rows)
                                    {
                                        InfobusQuestion.AppendInt32((int)Row["id"]);
                                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                                    }
                                }
                                PollRoom.SendMessage(InfobusQuestion, null);
                                Thread Infobus = new Thread(delegate()
                                    {
                                        Room.ShowResults(PollRoom, QuestionID, TargetUser);
                                    });
                                Infobus.Start();
                            }
                        }
                        goto IL_1379;
                    }

                    case 30:
                    {
                        uint UserId = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        string BadgeCode = text2.Split(new char[]
                            {
                                ' '
                            })[1];
                        GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(HabboIM.GetGame().GetClientManager().GetNameById(UserId));
                        Session.GetHabbo().GetBadgeComponent().SendBadge(Session, BadgeCode, true);
                        goto IL_1379;
                    }

                    case 31:
                    {
                        uint UserId = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        string RoomModel = text2.Split(new char[]
                            {
                                ' '
                            })[1];
                        string Caption = text2.Split(new char[]
                            {
                                ' '
                            })[2];
                        GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(HabboIM.GetGame().GetClientManager().GetNameById(UserId));
                        uint       uint_   = 0u;
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.AddParamWithValue("caption", Caption);
                            dbClient.AddParamWithValue("model", RoomModel);
                            dbClient.AddParamWithValue("username", Session.GetHabbo().Username);
                            dbClient.ExecuteQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)", 30);
                            Session.GetHabbo().GetUserDataFactory().SetRooms(dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @username ORDER BY Id ASC", 30));
                            uint_ = (uint)dbClient.ReadDataRow("SELECT Id FROM rooms WHERE owner = @username AND caption = @caption ORDER BY Id DESC", 30)[0];
                            Session.GetHabbo().method_1(dbClient);
                        }
                        RoomData result = HabboIM.GetGame().GetRoomManager().method_12(uint_);
                        if (result != null)
                        {
                            ServerMessage Message8 = new ServerMessage(59u);
                            Message8.AppendUInt(result.Id);
                            Message8.AppendStringWithBreak(result.Name);
                            Session.SendMessage(Message8);
                        }
                        goto IL_1379;
                    }

                    case 32:
                        uint_2 = uint.Parse(text2);
                        client = HabboIM.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT gc,block_newfriends,accept_trading,raumalert,werbercmd,changename FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30);
                        }
                        client.GetHabbo().Raumalert       = HabboIM.StringToBoolean(dataRow["raumalert"].ToString());
                        client.GetHabbo().WerberCmd       = HabboIM.StringToBoolean(dataRow["werbercmd"].ToString());
                        client.GetHabbo().BlockNewFriends = HabboIM.StringToBoolean(dataRow["block_newfriends"].ToString());
                        client.GetHabbo().TradingDisabled = HabboIM.StringToBoolean(dataRow["accept_trading"].ToString());
                        client.GetHabbo().ChangeName      = HabboIM.StringToBoolean(dataRow["changename"].ToString());
                        client.GetHabbo().gc = (int)dataRow["gc"];
                        goto IL_1379;

                    default:
                        goto IL_1379;
                    }
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        HabboIM.GetGame().GetCatalog().method_0(class2);
                    }
                    HabboIM.GetGame().GetCatalog().method_1();
                    HabboIM.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(441u));
                    goto IL_1379;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        HabboIM.GetGame().GetClientManager().method_2(uint_2).GetHabbo().method_0(class2);
                        goto IL_1379;
                    }
                    goto IL_119A;
IL_5F7:
                    client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30)[0];
                        }
                        client.GetHabbo().Credits = int_3;
                        client.GetHabbo().UpdateCredits(false);
                        goto IL_1379;
                    }
                    goto IL_1379;
IL_62F:
                    client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30)[0];
                        }
                        client.GetHabbo().ActivityPoints = int_4;
                        client.GetHabbo().UpdateActivityPoints(false);
                        goto IL_1379;
                    }
                    goto IL_1379;
IL_6F1:
                    HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2)).method_12();
                    goto IL_1379;
IL_727:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);
                    ServerMessage Message14 = new ServerMessage(808u);
                    Message14.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("mus_alert_title"));
                    Message14.AppendStringWithBreak(text5);
                    HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text6)).SendMessage(Message14);
                    goto IL_1378;
IL_119A:
                    HabboIM.Close();
                }
                IL_1378 :;
            }
            IL_1379 :
            ServerMessage Message15 = new ServerMessage(1u);

            Message15.AppendString("Hallo Housekeeping :)");
            this.ClientSocket.Send(Message15.GetBytes());
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            try
            {
                Room     @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);
                uint     uint_  = Event.PopWiredUInt();
                RoomItem class2 = @class.method_28(uint_);
                string   text   = class2.GetBaseItem().InteractionType.ToLower();
                switch (text)
                {
                case "wf_act_give_phx":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = HabboIM.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.smethod_4(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (HabboIM.GetGame().GetRoleManager().method_12(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_cnd_phx":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = HabboIM.DoFilter(text2, false, true);
                    text2 = ChatCommandHandler.smethod_4(text2);
                    if (!(text2 == class2.string_2))
                    {
                        string string_ = text2.Split(new char[]
                            {
                                ':'
                            })[0].ToLower();
                        if (HabboIM.GetGame().GetRoleManager().method_11(string_, Session))
                        {
                            class2.string_2 = text2;
                        }
                        else
                        {
                            Session.GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("wired_error_permissions"));
                        }
                    }
                    break;
                }

                case "wf_act_saymsg":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = HabboIM.DoFilter(text2, false, true);
                    if (text2.Length > 100)
                    {
                        text2 = text2.Substring(0, 100);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_act_kick_user":
                {
                    Event.PopWiredBoolean();
                    string text2 = Event.PopFixedString();
                    text2 = HabboIM.DoFilter(text2, false, true);
                    if (text2.Length > 200)
                    {
                        text2 = text2.Substring(0, 200);
                    }
                    class2.string_2 = text2;
                    break;
                }

                case "wf_trg_furnistate":
                case "wf_trg_onfurni":
                case "wf_trg_offfurni":
                case "wf_act_moveuser":
                case "wf_act_togglefurni":
                {
                    Event.PopWiredBoolean();
                    Event.PopFixedString();
                    class2.string_2 = Event.ToString().Substring(Event.Length - (Event.RemainingLength - 2));
                    class2.string_2 = class2.string_2.Substring(0, class2.string_2.Length - 2);
                    Event.ResetPointer();
                    class2 = @class.method_28(Event.PopWiredUInt());
                    Event.PopWiredBoolean();
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_3 = "";
                    for (int i = 0; i < num2; i++)
                    {
                        class2.string_3 = class2.string_3 + "," + Convert.ToString(Event.PopWiredUInt());
                    }
                    if (class2.string_3.Length > 0)
                    {
                        class2.string_3 = class2.string_3.Substring(1);
                    }
                    break;
                }

                case "wf_act_givepoints":
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    break;

                case "wf_act_moverotate":
                {
                    Event.PopWiredInt32();
                    class2.string_2 = Convert.ToString(Event.PopWiredInt32());
                    class2.string_3 = Convert.ToString(Event.PopWiredInt32());
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }

                case "wf_act_matchfurni":
                {
                    Event.PopWiredInt32();
                    class2.string_3 = "";
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_4A8 = class2;
                        expr_4A8.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_4C0 = class2;
                        expr_4C0.string_3 += "H";
                    }
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_4E1 = class2;
                        expr_4E1.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_4F9 = class2;
                        expr_4F9.string_3 += "H";
                    }
                    if (Event.PopWiredBoolean())
                    {
                        RoomItem expr_51A = class2;
                        expr_51A.string_3 += "I";
                    }
                    else
                    {
                        RoomItem expr_532 = class2;
                        expr_532.string_3 += "H";
                    }
                    Event.PopFixedString();
                    int num2 = Event.PopWiredInt32();
                    class2.string_2 = "";
                    class2.string_4 = "";
                    class2.string_5 = "";
                    if (num2 > 0)
                    {
                        class2.string_5 = OldEncoding.encodeVL64(num2);
                        for (int i = 0; i < num2; i++)
                        {
                            int num3 = Event.PopWiredInt32();
                            class2.string_5 += OldEncoding.encodeVL64(num3);
                            class2.string_4  = class2.string_4 + "," + Convert.ToString(num3);
                            RoomItem class3   = @class.method_28(Convert.ToUInt32(num3));
                            RoomItem expr_5E6 = class2;
                            object   string_2 = expr_5E6.string_2;
                            expr_5E6.string_2 = string.Concat(new object[]
                                {
                                    string_2,
                                    ";",
                                    class3.Int32_0,
                                    ",",
                                    class3.Int32_1,
                                    ",",
                                    class3.Double_0,
                                    ",",
                                    class3.int_3,
                                    ",",
                                    class3.ExtraData
                                });
                        }
                        class2.string_4 = class2.string_4.Substring(1);
                        class2.string_2 = class2.string_2.Substring(1);
                    }
                    class2.string_6 = Convert.ToString(Event.PopWiredInt32());
                    break;
                }
                }
                class2.UpdateState(true, false);
            }
            catch
            {
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && Session != null)
            {
                if (Session.GetHabbo().IsMuted)
                {
                    Session.SendNotification(HabboIMEnvironment.GetExternalText("error_muted"));
                }
                else if (Session.GetHabbo().HasFuse("ignore_roommute") || [email protected]_4)
                {
                    string text  = HabboIM.FilterString(Event.PopFixedString());
                    string text2 = text.Split(new char[]
                    {
                        ' '
                    })[0];
                    string text3           = text.Substring(text2.Length + 1);
                    string antiweberstring = text3;
                    text3 = ChatCommandHandler.smethod_4(text3);
                    RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    RoomUser class3 = @class.method_56(text2);
                    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 > 5 && !class2.IsBot)
                        {
                            ServerMessage Message = new ServerMessage(27u);
                            Message.AppendInt32(Session.GetHabbo().method_4());
                            Session.SendMessage(Message);
                            Session.GetHabbo().IsMuted = true;
                            Session.GetHabbo().int_4   = Session.GetHabbo().method_4();
                            return;
                        }
                        Session.GetHabbo().dateTime_0 = DateTime.Now;
                        Session.GetHabbo().int_23++;
                    }
                    ServerMessage Message2 = new ServerMessage(25u);
                    Message2.AppendInt32(class2.VirtualId);
                    Message2.AppendStringWithBreak(text3);
                    Message2.AppendBoolean(false);
                    if (class2 != null && !class2.IsBot)
                    {
                        class2.GetClient().SendMessage(Message2);
                        try {
                            var class266 = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            for (int i = 0; i < class266.RoomUsers.Length; i++)
                            {
                                try {
                                    RoomUser class5 = class266.RoomUsers[i];
                                    if (class5 != null && class3 != null)
                                    {
                                        if (class5.GetClient().GetHabbo().whisperlog == true && class5.GetClient().GetHabbo().Rank >= 6 && class5.GetClient().GetHabbo().Id != Session.GetHabbo().Id&& class5.GetClient().GetHabbo().Id != class3.GetClient().GetHabbo().Id)
                                        {
                                            class5.GetClient().GetHabbo().Whisper(" < " + Session.GetHabbo().Username + " flüstert zu " + class3.GetClient().GetHabbo().Username + " > " + text.Substring(text2.Length + 1));
                                        }
                                    }
                                } catch { }
                            }
                        }  catch { }
                        //HabboIM.GetGame().GetClientManager().method_StaffWhisper("<" + Session.GetHabbo().Username + " flüstert zu " + class3.GetClient().GetHabbo().Username + "> " + text3);
                    }
                    class2.Unidle();
                    if (class3 != null && !class3.IsBot && (class3.GetClient().GetHabbo().list_2.Count <= 0 || !class3.GetClient().GetHabbo().list_2.Contains(Session.GetHabbo().Id)))
                    {
                        class3.GetClient().SendMessage(Message2);
                        if (ServerConfiguration.EnableChatlog)
                        {
                            using (DatabaseClient class4 = HabboIM.GetDatabase().GetClient())
                            {
                                class4.AddParamWithValue("message", "<Whisper to " + class3.GetClient().GetHabbo().Username + ">: " + text3);
                                class4.ExecuteQuery(string.Concat(new object[]
                                {
                                    "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                    Session.GetHabbo().Id,
                                    "','",
                                    @class.Id,
                                    "','",
                                    DateTime.Now.Hour,
                                    "','",
                                    DateTime.Now.Minute,
                                    "',UNIX_TIMESTAMP(),@message,'",
                                    Session.GetHabbo().Username,
                                    "','",
                                    DateTime.Now.ToLongDateString(),
                                    "')"
                                }), 30);
                            }
                        }
                        if (HabboIM.GetGame().AntiWerberStatus)
                        {
                            string textaw = ChatCommandHandler.smethod_4b(Session, antiweberstring, "Raum");
                        }
                    }
                }
            }
        }
        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);
            }
        }
示例#12
0
        internal void HandleSpeech(GameClient Session, string str, bool bool_13)
        {
            if (!this.IsBot)
            {
                if (Session.GetHabbo().jail == 1 && Session.GetHabbo().jailtime > 10 * 60)
                {
                    Session.GetHabbo().Whisper("Du bist mehr als 10 Minuten gebannt und kannst deswegen nicht chatten!");

                    return;
                }
            }

            string object_   = str;
            string linkRegex = "((http|https):\\/\\/|www.)?[a-zA-Z0-9\\-\\.]+\\b(com|co\\.uk|org|net|eu|cf|info|ml|nl|ca|es|fi)\\b";

            if (Session == null || Session.GetHabbo().HasFuse("ignore_roommute") || !this.GetRoom().bool_4)
            {
                this.Unidle();
                if (!this.IsBot && this.GetClient().GetHabbo().IsMuted)
                {
                    this.GetClient().GetHabbo().Whisper(HabboIMEnvironment.GetExternalText("error_muted"));
                }
                else if (!str.StartsWith(":") || Session == null || !ChatCommandHandler.smethod_5(Session, str.Substring(1)))
                {
                    uint num = 24u;
                    if (bool_13)
                    {
                        num = 26u;
                    }
                    if (!this.IsBot && 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 > 5 && !this.IsBot)
                        {
                            ServerMessage Message = new ServerMessage(27u);
                            Message.AppendInt32(Session.GetHabbo().method_4());
                            this.GetClient().SendMessage(Message);
                            this.GetClient().GetHabbo().IsMuted = true;
                            this.GetClient().GetHabbo().int_4   = Session.GetHabbo().method_4();
                            this.GetClient().GetHabbo().GetEffectsInventoryComponent().method_2(620, true);
                            this.GetClient().GetHabbo().Whisper("Du wurdest stumm geschaltet, da du zu schnell getippt hast!");

                            return;
                        }
                        Session.GetHabbo().dateTime_0 = DateTime.Now;
                        Session.GetHabbo().int_23++;
                    }
                    bool aws = false;
                    if (!this.IsBot && HabboIM.GetGame().AntiWerberStatus)
                    {
                        str = ChatCommandHandler.smethod_4b(Session, object_, "Raum");
                        str = ChatCommandHandler.amina_zikki(Session, str, "Raum");
                        if (str != object_)
                        {
                            aws = true;
                        }
                    }
                    if (!this.IsBot)
                    {
                        str = ChatCommandHandler.smethod_4(str);
                    }
                    if (!this.GetRoom().method_9(this, str))
                    {
                        ServerMessage Message2 = new ServerMessage(num);
                        Message2.AppendInt32(this.VirtualId);
                        if (!this.IsBot && !this.IsPet)
                        {
                            try
                            {
                                if (HabboIM.GetConfig().data.ContainsKey("anti.ads.enable") && HabboIM.GetConfig().data["anti.ads.enable"] == "1")
                                {
                                    if (Session.GetHabbo().Rank <= uint.Parse(HabboIM.GetConfig().data["anti.ads.rank"]))
                                    {
                                        if (Regex.IsMatch(str, linkRegex, RegexOptions.IgnoreCase))
                                        {
                                            Session.SendNotification(HabboIM.GetConfig().data["anti.ads.msg"]);
                                            return;
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                        }
                        if (str.Contains("http://") || str.Contains("www.") || str.Contains("https://"))
                        {
                            string[] array = str.Split(new char[]
                            {
                                ' '
                            });
                            int      num2   = 0;
                            string   text   = "";
                            string   text2  = "";
                            string[] array2 = array;
                            for (int i = 0; i < array2.Length; i++)
                            {
                                string text3 = array2[i];
                                if (ChatCommandHandler.InitLinks(text3))
                                {
                                    if (num2 > 0)
                                    {
                                        text += ",";
                                    }
                                    text += text3;
                                    object obj = text2;
                                    text2 = string.Concat(new object[]
                                    {
                                        obj,
                                        " {",
                                        num2,
                                        "}"
                                    });
                                    num2++;
                                }
                                else
                                {
                                    text2 = text2 + " " + text3;
                                }
                            }
                            text = text2;
                            string[] array3 = text.Split(new char[]
                            {
                                ','
                            });
                            Message2.AppendStringWithBreak(text);
                            if (array3.Length > 0)
                            {
                                Message2.AppendBoolean(false);
                                Message2.AppendInt32(num2);
                                array2 = array3;
                                for (int i = 0; i < array2.Length; i++)
                                {
                                    string text4 = array2[i];
                                    string text5 = ChatCommandHandler.smethod_3(text4.Replace("http://", "").Replace("https://", ""));
                                    Message2.AppendStringWithBreak(text5.Replace("http://", "").Replace("https://", ""));
                                    Message2.AppendStringWithBreak(text4);
                                    Message2.AppendBoolean(false);
                                }
                            }
                        }
                        else
                        {
                            Message2.AppendStringWithBreak(str);
                        }
                        Message2.AppendInt32(this.ParseEmoticon(str));

                        try
                        {
                            if (this.ParseSmileys(str) != 0 && Session.GetHabbo().GetEffectsInventoryComponent().int_0 == 0)
                            {
                                Session.GetHabbo().GetEffectsInventoryComponent().method_2(this.ParseSmileys(str), true);


                                Thread thread = new Thread(delegate()
                                {
                                    try
                                    {
                                        Thread.Sleep(3000);
                                        Session.GetHabbo().GetEffectsInventoryComponent().method_2(0, true);
                                    }
                                    catch
                                    {
                                    }
                                });

                                thread.Start();
                            }
                        } catch
                        {
                            Console.WriteLine("Error in Smiley to Enable Function.");
                        }


                        Message2.AppendBoolean(false);
                        if (!this.IsBot)
                        {
                            if (aws == false)
                            {
                                this.GetRoom().method_58(Message2, Session.GetHabbo().list_2, Session.GetHabbo().Id);
                            }
                        }
                        else
                        {
                            this.GetRoom().SendMessage(Message2, null);
                        }
                    }
                    else if (!this.IsBot)
                    {
                        Session.GetHabbo().Whisper(str);
                    }
                    if (!this.IsBot)
                    {
                        this.GetRoom().method_7(this, str, bool_13);
                        if (Session.GetHabbo().CurrentQuestId > 0u && HabboIM.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHAT_WITH_SOMEONE")
                        {
                            HabboIM.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                        }
                    }
                    if (ServerConfiguration.EnableChatlog && !this.IsBot)
                    {
                        using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                        {
                            @class.AddParamWithValue("message", object_);
                            @class.ExecuteQuery(string.Concat(new object[]
                            {
                                "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                Session.GetHabbo().Id,
                                "','",
                                this.GetRoom().Id,
                                "','",
                                DateTime.Now.Hour,
                                "','",
                                DateTime.Now.Minute,
                                "',UNIX_TIMESTAMP(),@message,'",
                                Session.GetHabbo().Username,
                                "','",
                                DateTime.Now.ToLongDateString(),
                                "')"
                            }), 30);
                        }
                    }
                }
            }
        }
示例#13
0
 public override void OnSelfEnterRoom()
 {
     base.GetRoomUser().HandleSpeech(null, HabboIMEnvironment.GetExternalText("guidebot_welcome1"), true);
     base.GetRoomUser().HandleSpeech(null, HabboIMEnvironment.GetExternalText("guidebot_welcome2"), false);
 }
示例#14
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            ServerMessage Message = new ServerMessage(827u);
            string        text    = Event.ToString().Split(new char[]
            {
                ' '
            })[1];

            if (text.ToLower().Contains("pet"))
            {
                int num = Convert.ToInt32(text.Substring(3));
                Message.AppendStringWithBreak("a0 pet" + num);
                switch (num)
                {
                case 0:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_0"));
                    break;

                case 1:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_1"));
                    break;

                case 2:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_2"));
                    break;

                case 3:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_3"));
                    break;

                case 4:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_4"));
                    break;

                case 5:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_5"));
                    break;

                case 6:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_6"));
                    break;

                case 7:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_7"));
                    break;

                case 8:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_8"));
                    break;

                case 9:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_9"));
                    break;

                case 10:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_10"));
                    break;

                case 11:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_11"));
                    break;

                case 12:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_12"));
                    break;

                case 13:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_13"));
                    break;

                case 14:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_14"));
                    break;

                case 15:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_15"));
                    break;

                case 16:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_16"));
                    break;

                case 17:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_17"));
                    break;

                case 18:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_18"));
                    break;

                case 19:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_19"));
                    break;

                case 20:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_20"));
                    break;

                case 21:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_21"));
                    break;

                case 22:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_22"));
                    break;

                case 23:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_23"));
                    break;

                case 24:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_24"));
                    break;

                case 25:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_25"));
                    break;

                case 26:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_26"));
                    break;

                case 27:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_27"));
                    break;

                case 28:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_28"));
                    break;

                case 29:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_29"));
                    break;

                case 30:
                    Message.AppendString(HabboIMEnvironment.GetExternalText("pet_breeds_30"));
                    break;
                }
                Session.SendMessage(Message);
            }
        }