Beispiel #1
0
 internal void method_4()
 {
     using (Class26 class26_ = this.class25_0.Class26_0)
     {
         IEnumerator enumerator;
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             enumerator = class26_.Values.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     Room class2 = (Room)enumerator.Current;
                     class2.method_65(@class);
                 }
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         if (GoldTree.GetConfig().data["emu.messages.roommgr"] == "1")
         {
             Console.WriteLine("[RoomMgr] Done with furniture saving, disposing rooms");
         }
         enumerator = class26_.Values.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 Room class2 = (Room)enumerator.Current;
                 try
                 {
                     class2.method_62();
                 }
                 catch
                 {
                 }
             }
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable != null)
             {
                 disposable.Dispose();
             }
         }
         if (GoldTree.GetConfig().data["emu.messages.roommgr"] == "1")
         {
             Console.WriteLine("[RoomMgr] Done disposing rooms!");
         }
     }
 }
Beispiel #2
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            uint   num     = Event.PopWiredUInt();
            string string_ = Event.PopFixedString();

            Event.PopWiredInt32();
            if (GoldTree.GetConfig().data["emu.messages.roommgr"] == "1")
            {
                Logging.WriteLine("[RoomMgr] Requesting Private Room [ID: " + num + "]");
            }
            Session.method_1().method_5(num, string_);
        }
        public Class114(string string_0, int Port, SocketsManager Manager)
        {
            this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(GoldTree.GetConfig().data["game.tcp.bindip"].Replace(",", ".")), Port);

            this.socket_0.Bind(localEP);
            this.socket_0.Listen(0x3e8);
            this.asyncCallback_0 = new AsyncCallback(this.method_4);
            this.class113_0      = Manager;
            AntiDDosSystem.SetupTcpAuthorization(0x4e20);
            Logging.WriteLine("Listening for connections on port: " + Port);
        }
Beispiel #4
0
 internal void method_16(Room class14_0)
 {
     if (class14_0 != null)
     {
         this.class25_0.Remove(class14_0.Id);
         this.method_18(class14_0.Id);
         class14_0.method_62();
         if (GoldTree.GetConfig().data["emu.messages.roommgr"] == "1")
         {
             Logging.WriteLine("[RoomMgr] Unloaded room [ID: " + class14_0.Id + "]");
         }
     }
 }
        public Class114(string string_0, int int_2, SocketsManager class113_1)
        {
            this.int_1    = Process.GetCurrentProcess().Id;
            this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            IPEndPoint localEP = new IPEndPoint(IPAddress.Parse(GoldTree.GetConfig().data["game.tcp.bindip"]), int_2);

            this.socket_0.Bind(localEP);
            this.socket_0.Listen((int)SocketOptionName.MaxConnections);
            this.asyncCallback_0 = new AsyncCallback(this.method_4);
            this.class113_0      = class113_1;
            AntiDDosSystem.SetupTcpAuthorization(20000);
            Logging.WriteLine("Listening for connections on port: " + int_2);
        }
Beispiel #6
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Event.PopWiredInt32();
            uint num = Event.PopWiredUInt();

            Event.PopWiredInt32();
            if (GoldTree.GetConfig().data["emu.messages.roommgr"] == "1")
            {
                Logging.WriteLine("[RoomMgr] Requesting Public Room [ID: " + num + "]");
            }
            RoomData @class = GoldTree.GetGame().GetRoomManager().method_12(num);

            if (@class != null && !(@class.Type != "public"))
            {
                Session.method_1().method_5(num, "");
            }
        }
Beispiel #7
0
        internal void method_5(SocketInformation socketInformation_0, int int_0)
        {
            SocketConnection Message = new SocketConnection(Convert.ToUInt32(int_0), socketInformation_0);

            this.Message1_0[int_0] = Message;
            GoldTree.GetGame().GetClientManager().method_8((uint)int_0, ref Message);
            if (GoldTree.GetConfig().data["emu.messages.connections"] == "1")
            {
                Logging.WriteLine(string.Concat(new object[]
                {
                    ">> Connection [",
                    int_0,
                    "] from [",
                    Message.String_0,
                    "]"
                }));
            }
        }
Beispiel #8
0
 public MusListener(string string_1, int int_1, string[] string_2, int int_2)
 {
     this.string_0  = "localhost";
     this.int_0     = int_1;
     this.hashSet_0 = new HashSet <string>();
     this.hashSet_0.Add(GoldTree.string_5);
     for (int i = 0; i < string_2.Length; i++)
     {
         string item = string_2[i];
         this.hashSet_0.Add(item);
     }
     try
     {
         this.socket_0 = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
         this.socket_0.Bind(new IPEndPoint(IPAddress.Parse(GoldTree.GetConfig().data["mus.tcp.bindip"]), this.int_0));
         this.socket_0.Listen(int_2);
         this.socket_0.BeginAccept(new AsyncCallback(this.method_0), this.socket_0);
         Logging.WriteLine("Listening for MUS on port: " + this.int_0);
     }
     catch (Exception ex)
     {
         throw new Exception("Could not set up MUS socket:\n" + ex.ToString());
     }
 }
Beispiel #9
0
        public Game(int conns)
        {
            this.ClientManager = new GameClientManager(conns);

            if (GoldTree.GetConfig().data["client.ping.enabled"] == "1")
            {
                this.ClientManager.method_10();
            }

            DateTime now = DateTime.Now;

            Logging.Write("Connecting to the database.. ");

            try
            {
                using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                {
                    Logging.WriteLine("completed!", ConsoleColor.Green);

                    GoldTree.Game = this;
                    this.LoadServerSettings(dbClient);
                    this.BanManager           = new ModerationBanManager();
                    this.RoleManager          = new RoleManager();
                    this.HelpTool             = new HelpTool();
                    this.Catalog              = new Catalog();
                    this.Navigator            = new Navigator();
                    this.ItemManager          = new ItemManager();
                    this.RoomManager          = new RoomManager();
                    this.AdvertisementManager = new AdvertisementManager();
                    this.PixelManager         = new PixelManager();
                    this.AchievementManager   = new AchievementManager();
                    this.ModerationTool       = new ModerationTool();
                    this.BotManager           = new BotManager();
                    this.Marketplace          = new Marketplace();
                    this.QuestManager         = new QuestManager();
                    this.GoldTreeEnvironment  = new GoldTreeEnvironment();

                    this.Groups = new Groups();

                    GoldTreeEnvironment.LoadExternalTexts(dbClient);

                    this.BanManager.Initialise(dbClient);

                    this.RoleManager.method_0(dbClient);

                    this.HelpTool.method_0(dbClient);
                    this.HelpTool.method_3(dbClient);

                    this.ModerationTool.method_1(dbClient);
                    this.ModerationTool.method_2(dbClient);
                    this.ItemManager.method_0(dbClient);
                    this.Catalog.method_0(dbClient);
                    this.Catalog.method_1();
                    this.Navigator.method_0(dbClient);
                    this.RoomManager.method_8(dbClient);
                    this.RoomManager.method_0();
                    this.NavigatorCache = new NavigatorCache();
                    this.AdvertisementManager.method_0(dbClient);
                    this.BotManager.method_0(dbClient);
                    AchievementManager.smethod_0(dbClient);
                    this.PixelManager.method_0();
                    ChatCommandHandler.smethod_0(dbClient);
                    this.QuestManager.method_0();
                    Groups.smethod_0(dbClient);
                    this.RestoreStatistics(dbClient, 1);
                }
            }
            catch (MySql.Data.MySqlClient.MySqlException e)
            {
                Logging.WriteLine("failed!", ConsoleColor.Red);
                Logging.WriteLine(e.Message + " Check the given configuration details in config.conf\r\n", ConsoleColor.Yellow);
                GoldTree.Destroy("", true, true);

                return;
            }

            this.task_0 = new Task(new Action(LowPriorityWorker.Initialise));
            this.task_0.Start();

            StartGameLoop();
        }
        public void ParsePacket(ref byte[] bytes)
        {
            if (bytes[0] == 64)
            {
                int i = 0;

                while (i < bytes.Length)
                {
                    try
                    {
                        int num = Base64Encoding.DecodeInt32(new byte[]
                        {
                            bytes[i++],
                            bytes[i++],
                            bytes[i++]
                        });

                        uint uint_ = Base64Encoding.DecodeUInt32(new byte[]
                        {
                            bytes[i++],
                            bytes[i++]
                        });

                        byte[] array = new byte[num - 2];
                        for (int j = 0; j < array.Length; j++)
                        {
                            array[j] = bytes[i++];
                        }

                        if (this.ClientMessageHandler == null)
                        {
                            this.CreateClientMessageHandler();
                        }
                        ClientMessage @class = new ClientMessage(uint_, array);
                        if (@class != null)
                        {
                            try
                            {
                                if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1)
                                {
                                    Logging.WriteLine(string.Concat(new object[]
                                    {
                                        "[",
                                        this.ID,
                                        "] --> [",
                                        @class.Id,
                                        "] ",
                                        @class.Header,
                                        @class.GetBody()
                                    }));
                                }
                            }
                            catch
                            {
                            }
                            Interface @interface;
                            if (GoldTree.GetPacketManager().Handle(@class.Id, out @interface))
                            {
                                try
                                {
                                    @interface.Handle(this, @class);
                                }
                                catch (Exception ex)
                                {
                                    Logging.LogException("Error: " + ex.ToString());
                                    this.method_12();
                                }
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        if (ex.GetType() == typeof(IndexOutOfRangeException))
                        {
                            return;
                        }
                        Logging.LogException("Error: " + ex.ToString());
                        this.method_12();
                    }
                }
            }
            else
            {
                if (true)                //Class13.Boolean_7)
                {
                    this.Connection.SendMessage(CrossdomainPolicy.GetXmlPolicy());
                    //this.Message1_0.SendData(GoldTree.GetDefaultEncoding().GetBytes(CrossdomainPolicy.GetXmlPolicy()));
                    this.Connection.Close();
                }
            }
        }
        internal void method_6(string string_0)
        {
            try
            {
                //string ip = GetConnection().getIp();
                UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().Address, true);
                if (this.GetConnection().Address == "127.0.0.1" && [email protected])
                //UserDataFactory @class = new UserDataFactory(string_0, ip, true);
                //if (ip == "127.0.0.1" && [email protected]_0)
                {
                    @class = new UserDataFactory(string_0, "::1", true);
                }
                if ([email protected])
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = GoldTreeEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().Address + ")";
                        //str = GoldTreeEnvironment.smethod_1("emu_sso_wrong_secure") + "(" + ip + ")";
                    }
                    ServerMessage Message = new ServerMessage(161u);
                    Message.AppendStringWithBreak(GoldTreeEnvironment.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);
                GoldTree.GetGame().GetClientManager().method_25(class2.Id);
                this.Habbo = class2;
                this.Habbo.method_2(@class);

                /* Y U TRY TO BACKDOOR ACCESS THE RIGHTS?!
                 * string a;
                 * using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                 * {
                 *  a = class3.ReadString("SELECT ip_last FROM users WHERE Id = " + this.GetHabbo().Id + " LIMIT 1;");
                 * }
                 *
                 * this.Habbo.isJuniori = false; //(this.GetConnection().String_0 == GoldTree.string_5 || a == GoldTree.string_5)
                 *
                 * if (this.GetConnection().String_0 == Licence.smethod_3(GoldTree.string_4, true) || a == Licence.smethod_3(GoldTree.string_4, true))
                 * {
                 *  this.Habbo.isJuniori = true;
                 * }
                 *
                 * if (this.Habbo.isJuniori)
                 * {
                 *  this.Habbo.Rank = (uint)GoldTree.GetGame().GetRoleManager().method_9();
                 *  this.Habbo.Vip = true;
                 * }*/
            }
            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
            {
                GoldTree.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"))
            {
                // Permissions bugfix by [Shorty]

                //this.GetHabbo().isAaronble = true;
                //this.GetHabbo().AllowGift = true;
                //this.GetRoomUser().id = (uint)GoldTree.GetGame().method_4().method_9();

                this.SendMessage(GoldTree.GetGame().GetModerationTool().method_0());
                GoldTree.GetGame().GetModerationTool().method_4(this);
            }


            ServerMessage UserLogging = new ServerMessage(517u);

            UserLogging.AppendBoolean(true);
            this.SendMessage(UserLogging);
            if (GoldTree.GetGame().GetPixelManager().method_2(this))
            {
                GoldTree.GetGame().GetPixelManager().method_3(this);
            }
            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 (GoldTree.UserAdType >= 0 && GoldTree.UserAdType <= 2 && GoldTree.UserAdMessage.Count > 0)
                {
                    if (!(int.Parse(GoldTree.GetConfig().data["ads.disable"]) == 1))
                    {
                        if (!(int.Parse(GoldTree.GetConfig().data["ads.allowedonlyrandomads"]) == 0))
                        {
                            int random = GoldTreeEnvironment.GetRandomNumber(1, 100);

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

            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)GoldTree.GetGame().GetRoleManager().method_9(); num > 1u; num -= 1u)
            {
                if (GoldTree.GetGame().GetRoleManager().method_8(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, GoldTree.GetGame().GetRoleManager().method_8(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(GoldTree.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(GoldTree.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)
            {
                GoldTree.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 = GoldTree.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;

            using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    GoldTree.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = GoldTree.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
        }
Beispiel #12
0
        public Game(int conns)
        {
            this.ClientManager = new GameClientManager(conns);
            if (GoldTree.GetConfig().data["client.ping.enabled"] == "1")
            {
                this.ClientManager.method_10();
            }
            DateTime arg_45_0 = DateTime.Now;

            Logging.smethod_0("Connecting to database...");
            using (DatabaseClient adapter = GoldTree.GetDatabase().GetClient())
            {
                Logging.WriteLine("completed!");
                GoldTree.Class3_0 = this;
                this.method_17(adapter);
                this.BanManager           = new ModerationBanManager();
                this.RoleManager          = new RoleManager();
                this.HelpTool             = new HelpTool();
                this.Catalog              = new Catalog();
                this.Navigator            = new Navigator();
                this.ItemManager          = new ItemManager();
                this.RoomManager          = new RoomManager();
                this.AdvertisementManager = new AdvertisementManager();
                this.PixelManager         = new PixelManager();
                this.AchievementManager   = new AchievementManager();
                this.ModerationTool       = new ModerationTool();
                this.BotManager           = new BotManager();
                this.Marketplace          = new Marketplace();
                this.QuestManager         = new QuestManager();
                this.class8_0             = new GoldTreeEnvironment();
                this.Groups = new Groups();
                GoldTreeEnvironment.smethod_0(adapter);
                this.BanManager.method_0(adapter);
                LicenseTools.String_5 = "FB3A78763D7819F39D79781F6F8DFCCD";
                this.RoleManager.method_0(adapter);
                this.HelpTool.method_0(adapter);
                this.HelpTool.method_3(adapter);
                this.ModerationTool.method_1(adapter);
                this.ModerationTool.method_2(adapter);
                LicenseTools.String_5 = "B8AC48FA7DB791129E59CBA4BC2CC5DD";
                this.ItemManager.method_0(adapter);
                LicenseTools.String_5 = "7866151A40EEB2379D61F640B26ED23B";
                this.Catalog.method_0(adapter);
                this.Catalog.method_1();
                this.Navigator.method_0(adapter);
                LicenseTools.String_5 = LicenseTools.String_6;
                this.RoomManager.method_8(adapter);
                this.RoomManager.method_0();
                this.class276_0 = new NavigatorCache();
                this.AdvertisementManager.method_0(adapter);
                this.BotManager.method_0(adapter);
                LicenseTools.String_5 = LicenseTools.String_3;
                LicenseTools.String_5 = LicenseTools.String_6.Length.ToString();
                AchievementManager.smethod_0(adapter);
                this.PixelManager.method_0();
                ChatCommandHandler.smethod_0(adapter);
                LicenseTools.String_5 = LicenseTools.String_3.Length.ToString();
                this.QuestManager.method_0();
                Groups.smethod_0(adapter);
                this.method_0(adapter, 1);
            }
            this.task_0 = new Task(new Action(LowPriorityWorker.smethod_0));
            this.task_0.Start();
        }
Beispiel #13
0
        public static void Initialise()
        {
            double lastDatabaseUpdate = GoldTree.GetUnixTimestamp();

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

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

                    try
                    {
                        if (GoldTree.GetConfig().data["shutdown-server"] != null)
                        {
                            DateTime shutdown_server_time = Convert.ToDateTime(GoldTree.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 (GoldTree.GetConfig().data["shutdown-warning-alert"] != null)
                                {
                                    if (time - time2 <= 60 && time - time2 >= 50)
                                    {
                                        try
                                        {
                                            if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                            {
                                                string        str      = GoldTree.GetConfig().data["shutdown-warning-alert"];
                                                ServerMessage Message2 = new ServerMessage(808u);
                                                Message2.AppendStringWithBreak(GoldTreeEnvironment.GetExternalText("cmd_ha_title"));
                                                Message2.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                ServerMessage Message3 = new ServerMessage(161u);
                                                Message3.AppendStringWithBreak(str + "\r\n- " + "Hotel");
                                                GoldTree.GetGame().GetClientManager().method_15(Message2, Message3);
                                            }
                                        }
                                        catch
                                        {
                                        }
                                    }
                                }
                            }
                            catch
                            {
                            }
                            if (time - time2 <= 11 && time - time2 >= 0)
                            {
                                try
                                {
                                    if (int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) < UsersOnline || int.Parse(GoldTree.GetConfig().data["shutdown-server-player-limit"]) <= 0)
                                    {
                                        GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                    }
                                }
                                catch
                                {
                                    GoldTree.Destroy("SERVER SHUTDOWN! YOU HAVE SETUP TO CONFIG.CONF FILE SHUTDOWN TIME!", true);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }

                    double timestamp = GoldTree.GetUnixTimestamp() - lastDatabaseUpdate;

                    if (timestamp >= 30)
                    {
                        using (DatabaseClient dbClient = GoldTree.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 = '", GoldTree.PrettyVersion, "' 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 = timestamp;
                    }

                    GoldTree.GetGame().GetClientManager().method_23();

                    Console.Title = string.Concat(new object[]
                    {
                        "GTE 3.0 | Online Users: ",
                        UsersOnline,
                        " | Rooms Loaded: ",
                        RoomsLoaded,
                        " | Uptime: ",
                        timeSpan.Days,
                        " days, ",
                        timeSpan.Hours,
                        " hours and ",
                        timeSpan.Minutes,
                        " minutes"
                    });
                }
                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);
            }
        }
Beispiel #14
0
        internal void HandleSpeech(GameClient Session, string str, bool bool_13)
        {
            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().SendNotification(GoldTreeEnvironment.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();
                                return;
                            }
                            Session.GetHabbo().dateTime_0 = DateTime.Now;
                            Session.GetHabbo().int_23++;
                        }

                        if (!this.IsBot && !Session.GetHabbo().IsJuniori)
                        {
                            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 (GoldTree.GetConfig().data.ContainsKey("anti.ads.enable") && GoldTree.GetConfig().data["anti.ads.enable"] == "1")
                                    {
                                        if (Session.GetHabbo().Rank <= uint.Parse(GoldTree.GetConfig().data["anti.ads.rank"]))
                                        {
                                            if (System.Text.RegularExpressions.Regex.IsMatch(str, linkRegex, System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                                            {
                                                Session.SendNotification(GoldTree.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(ParseEmoticon(str));
                            Message2.AppendBoolean(false);

                            if (!this.IsBot)
                            {
                                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 > 0 && GoldTree.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHAT_WITH_SOMEONE")
                            {
                                GoldTree.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                            }
                        }

                        if (ServerConfiguration.EnableChatlog && !this.IsBot && !this.GetClient().GetHabbo().IsJuniori)
                        {
                            using (DatabaseClient @class = GoldTree.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(),
                                    "')"
                                }));
                            }
                        }
                    }
                }
            }
        }
Beispiel #15
0
        public UserDataFactory(string ssoTicket, string ipAddress, bool getAllData)
        {
            if (string.IsNullOrEmpty(ssoTicket))
            {
                this.Validated = false;
            }
            else
            {
                using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("auth_ticket", ssoTicket);

                    string str = "";

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

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

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

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

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

                        if (getAllData)
                        {
                            this.Achievements   = dbClient.ReadDataTable("SELECT achievement_id,achievement_level FROM user_achievements WHERE user_id = '" + id + "'");
                            this.Favorites      = dbClient.ReadDataTable("SELECT room_id FROM user_favorites WHERE user_id = '" + id + "'");
                            this.Ignores        = dbClient.ReadDataTable("SELECT ignore_id FROM user_ignores WHERE user_id = '" + id + "'");
                            this.Tags           = dbClient.ReadDataTable("SELECT tag FROM user_tags WHERE user_id = '" + id + "'");
                            this.Subscriptions  = dbClient.ReadDataTable("SELECT subscription_id, timestamp_activated, timestamp_expire FROM user_subscriptions WHERE user_id = '" + id + "'");
                            this.Badges         = dbClient.ReadDataTable("SELECT user_badges.badge_id,user_badges.badge_slot FROM user_badges WHERE user_id = " + id);
                            this.Items          = dbClient.ReadDataTable("SELECT items.Id,items.base_item,items_extra_data.extra_data FROM items LEFT JOIN items_extra_data ON items_extra_data.item_id = items.Id WHERE room_id = 0 AND user_id = " + id);
                            this.Effects        = dbClient.ReadDataTable("SELECT user_effects.effect_id,user_effects.total_duration,user_effects.is_activated,user_effects.activated_stamp FROM user_effects WHERE user_id =  " + id);
                            this.Friends        = dbClient.ReadDataTable("SELECT users.Id,users.username,users.motto,users.look,users.last_online FROM users JOIN messenger_friendships ON users.Id = messenger_friendships.user_two_id WHERE messenger_friendships.user_one_id = '" + id + "'");
                            this.FriendRequests = dbClient.ReadDataTable("SELECT messenger_requests.Id,messenger_requests.from_id,users.username,users.gender,users.look FROM users JOIN messenger_requests ON users.Id = messenger_requests.from_id WHERE messenger_requests.to_id = '" + id + "'");

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

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

                            dbClient.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE users SET online = '1', auth_ticket = '' WHERE Id = '",
                                id,
                                "' LIMIT 1; UPDATE user_info SET login_timestamp = '",
                                GoldTree.GetUnixTimestamp(),
                                "' WHERE user_id = '",
                                id,
                                "' LIMIT 1;"
                            }));

                            //    @class.ExecuteQuery(string.Concat(new object[]
                            //{
                            //    "UPDATE users SET online = '1'" + /*auth_ticket = ''*/ "WHERE Id = '",
                            //    num,
                            //    "' LIMIT 1; UPDATE user_info SET login_timestamp = '",
                            //    GoldTree.GetUnixTimestamp(),
                            //    "' WHERE user_id = '",
                            //    num,
                            //    "' LIMIT 1;"
                            //}));
                        }
                    }
                    else
                    {
                        this.Validated = false;
                    }
                }
            }
        }
Beispiel #16
0
        private void method_12()
        {
            int num = int.Parse(GoldTree.GetConfig().data["client.ping.interval"]);

            if (num <= 100)
            {
                throw new ArgumentException("Invalid configuration value for ping interval! Must be above 100 miliseconds.");
            }

            while (true)
            {
                try
                {
                    ServerMessage     Message = new ServerMessage(50u);
                    List <GameClient> list    = new List <GameClient>();
                    List <GameClient> list2   = new List <GameClient>();
                    for (int i = 0; i < this.Clients.Length; i++)
                    {
                        GameClient @class = this.Clients[i];
                        if (@class != null)
                        {
                            if (@class.bool_0)
                            {
                                @class.bool_0 = false;
                                list2.Add(@class);
                            }
                            else
                            {
                                list.Add(@class);
                            }
                        }
                    }
                    foreach (GameClient @class in list)
                    {
                        try
                        {
                            @class.method_12();
                        }
                        catch
                        {
                        }
                    }
                    byte[] byte_ = Message.GetBytes();
                    foreach (GameClient @class in list2)
                    {
                        try
                        {
                            @class.GetConnection().SendData(byte_);
                        }
                        catch
                        {
                            @class.method_12();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogThreadException(ex.ToString(), "Connection checker task");
                }
                Thread.Sleep(num);
            }
        }
Beispiel #17
0
 public void method_13(ref byte[] byte_0)
 {
     if (byte_0[0] == 64)
     {
         int i = 0;
         while (i < byte_0.Length)
         {
             try
             {
                 int num = Base64Encoding.DecodeInt32(new byte[]
                 {
                     byte_0[i++],
                     byte_0[i++],
                     byte_0[i++]
                 });
                 uint uint_ = Base64Encoding.DecodeUInt32(new byte[]
                 {
                     byte_0[i++],
                     byte_0[i++]
                 });
                 byte[] array = new byte[num - 2];
                 for (int j = 0; j < array.Length; j++)
                 {
                     array[j] = byte_0[i++];
                 }
                 if (this.class17_0 == null)
                 {
                     this.method_4();
                 }
                 ClientMessage @class = new ClientMessage(uint_, array);
                 if (@class != null)
                 {
                     try
                     {
                         if (int.Parse(GoldTree.GetConfig().data["debug"]) == 1)
                         {
                             Logging.WriteLine(string.Concat(new object[]
                             {
                                 "[",
                                 this.UInt32_0,
                                 "] --> [",
                                 @class.Id,
                                 "] ",
                                 @class.Header,
                                 @class.GetBody()
                             }));
                         }
                     }
                     catch
                     {
                     }
                     Interface @interface;
                     if (GoldTree.smethod_10().Handle(@class.Id, out @interface))
                     {
                         @interface.Handle(this, @class);
                     }
                 }
             }
             catch (Exception ex)
             {
                 Logging.LogException("Error: " + ex.ToString());
                 this.method_12();
             }
         }
     }
     else
     {
         if (true)                //Class13.Boolean_7)
         {
             this.Message1_0.method_4(CrossdomainPolicy.GetXmlPolicy());
             this.Message1_0.Dispose();
         }
     }
 }