Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Open-Source] Blackbird [RP, r63]

Status
Not open for further replies.
Initiate Mage
Joined
Oct 8, 2011
Messages
1
Reaction score
0
Ah, thanks for releasing this. Planning to try out some stuff with this emulator sooner or later.
 
Joined
Aug 19, 2010
Messages
420
Reaction score
47
Mine doesnt even let me login LOL

---------- Post added at 01:05 PM ---------- Previous post was at 12:28 PM ----------

Error:

Code:
Object reference not set to an instance of an object at Uber.HabboHotel.Users.Authenticator.Autheticator.GenerateHabbo(DataRow Data, string AuthTicket)
 
Web & Interaction Design
Loyal Member
Joined
Dec 18, 2010
Messages
1,506
Reaction score
712
Ooh, my name in 'ze CMS.

Lovely release, Cobe. I'll stick around long enough to see CMSulake.. :')

~Jak
 
Developer
Developer
Joined
Dec 11, 2010
Messages
2,955
Reaction score
2,688
Is it that hard to disable a bloody license! I'll disable it for you. I'll edit this post soon.

---------- Post added at 01:39 PM ---------- Previous post was at 01:29 PM ----------

Replace UberEnvironment.cs with this..

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Net;
using System.Speech.Synthesis;
using Uber.Properties;
using Uber.Utilities.Encoding;
using Uber.Core;
using Uber.Storage;
using Uber.Net;
using Uber.HabboHotel;
using System.Diagnostics;

namespace Uber
{
    class Blackbird
    {
        private static Logging Logging;
        private static readonly Thread serverMonitor = new Thread(monitorServer);
        private static ConfigurationData Configuration;
        private static DatabaseManager DatabaseManager;
        private static TcpConnectionManager ConnectionManager;
        private static Game Game;
        public static DateTime StartedEmulating;
        public static string Beta;
        public static bool inBeta;
        public static string Navi;
        public static bool NavEnabled;
        public static bool Winter; // until proven guilty!
        public static bool Summer;
        public static bool Spring;
        public static bool Fall;
        public static string Season;
        public static int month = DateTime.Now.Month;
        public static int day = DateTime.Now.Day;
        public static int year = DateTime.Now.Year;
        public static string keyName;
        public static string dbKey;
        public static string fantasy;
        public static string lake;
        public static int BL;
        public static DateTime Time;
        public static int RL;
        public static uint MWR;
        public static uint Clothing;
        public static uint Jail;
        public static uint DefaultRoom;
        public static uint Event;
        public static string Update;
        public static DateTime ServerStarted;
        public static int Major = 3;
        public static int Minor;
        public static int Build = 1;
        public static int Revision = 6;
        public static string Version = Major + "." + Minor + "." + Build + "." + Revision;
        public static bool Demo;
        public static bool checkLicense;
        public static bool Expired;
        public static bool foundUpdate;
        public static bool mandatoryUpdate;
        public static DateTime _Now = DateTime.Now.Date;
        public static DateTime _Date = new DateTime(2011, 5, 30);
        public static string Decode(string str)
        {
            byte[] decbuff = Convert.FromBase64String(str);
            return Encoding.UTF8.GetString(decbuff);
        }

        public static String PrettyVersion
        {
            get
            {
                return "Blackbird[" + Version + "]";
            }
        }

        /// <summary>
        /// An Update Checkar
        /// </summary>
        public static void updateEmulator()
        {
            GetLogging().WriteLine("Checking for Updates...", LogLevel.Warning);
            /*try
            {
                var update = new string[6];
                update[0] = new WebClient().DownloadString(Decode("aHR0cDovL2Rldi1zdHVkaW9zLm5ldC96VVBEQVRFLmtleQ=="));
                //Nasty Hardcoding..

                //Lets start from the.. public static string Version = Major + "." + Minor + "." + Build + "." + Revision; Revision.
                var v = new int[5];
                v[1] = Major + 1;
                v[2] = Minor + 1;
                v[3] = Build + 1;
                v[4] = Revision + 1;
                if (update[0].Contains(v[3] + "." + v[4]) || (update[0].Contains(Build + "." + v[4])) || (update[0].Contains(Minor + "." + v[3])))  { foundUpdate = true; }
                if (update[0].Contains(v[2] + "." + v[3]) || (update[0].Contains(v[1] + "." + v[2])) || (update[0].Contains(Major + "." + v[2]))) {mandatoryUpdate = true;}
            }
            catch (InvalidOperationException)
            {
                throw new Exception("Could not connect to the version checker!");
            }*/
        }
        public void oldUpdate()
        {
           /* var update = new string[6];
            update[0] = new WebClient().DownloadString("YOURLINK!");
            var Website = new WebClient().DownloadString("UPDATEREPO");
            if (update[0].Contains("blackbird_" + (Major + 1) + "." + Minor + "." + Build + "." + Revision))
            {
                GetLogging().WriteLine("Update Found", LogLevel.Success);
                Process.Start("iexplore", Website + (Major + 1) + "." + Minor + "." + Build + "." + Revision + ".rar");
                mandatoryUpdate = true;
            }
            if (update[0].Contains("blackbird_" + Major + "." + (Minor + 1) + "." + Build + "." + Revision))
            {
                GetLogging().WriteLine("Update Found", LogLevel.Success);
                Process.Start("iexplore", Website + Major + "." + (Minor + 1) + "." + Build + "." + Revision + ".rar");
                mandatoryUpdate = true;
            }
            if (update[0].Contains("blackbird_" + Major + "." + Minor + "." + (Build + 1) + "." + Revision))
            {
                GetLogging().WriteLine("Update Found", LogLevel.Success);
                Process.Start("iexplore", Website + Major + "." + Minor + "." + (Build + 1) + "." + Revision + ".rar");
                foundUpdate = true;
            }
            if (update[0].Contains("blackbird_" + Major + "." + Minor + "." + Build + "." + (Revision + 1)))
            {
                GetLogging().WriteLine("Update Found", LogLevel.Success);
                Process.Start("iexplore", Website + Major + "." + Minor + "." + Build + "." + (Revision + 1) + ".rar");
                foundUpdate = true;
            }
            Console.WriteLine("");
            GetLogging().WriteLine("Downloading the newest build..", LogLevel.Success);
            Thread.Sleep(3000);*/
        }

        public static void seasonCheck()
        {
            int doy = DateTime.Now.DayOfYear - Convert.ToInt32((DateTime.IsLeapYear(DateTime.Now.Year)) && DateTime.Now.DayOfYear > 59);
            if ((doy < 80 || doy >= 355)) { Winter = true; Season = "Winter"; }
            if ((doy >= 80 && doy < 172)) { Spring = true; Season = "Spring"; }
            if ((doy >= 172 && doy < 266)) { Summer = true; Season = "Summer"; }
            else { Fall = true; Season = "Fall"; }
            //Season = String.Format("{0}.css", ((doy < 80 || doy >= 355) ? "winter" : ((doy >= 80 && doy < 172) ? "spring" : ((doy >= 172 && doy < 266) ? "summer" : "fall"))));
            //if (Season = "winter") { Winter = true; }
        }
        /// <summary>
        /// Check's if the user is running a demo version of Blackbird ;]
        /// </summary>
        private static void checkDemo()
        {
            //DEVE-LOPM-ENTS-TUDIO
            if (dbKey.Equals("DEVE-LOPM-ENTS-TUDO") && keyName.Equals("Dev-Studios"))
            {
                Demo = true;
            }
            else
            { Demo = false; }
        }
        /// <summary>
        /// Check's whether Blackbird should should check the license ;3
        /// </summary>
        private static void checkType()
        {
            if (Major > 2)
            { checkLicense = true; }
        }
        /// <summary>
        /// Check if they're license is expired.
        /// </summary>
        private static void checkDate()
        {
            if (DateTime.Compare(_Date, _Now) < 0)
            { Expired = true; }
        }
        public static void Initialize()
        {
            /*var Form = new Blackbird_GUI_();
            Form.Show();
            Application.Run();*/
            Console.Title = PrettyVersion;
            Console.WindowHeight = 20;
            Console.WindowWidth = 85;

            ServerStarted = DateTime.Now;

            Logging = new Logging {MinimumLogLevel = LogLevel.Debug};
            Console.ForegroundColor = ConsoleColor.Green;
            ConfigurationData.InstallConfig();
            SpeechSynthesizer speaker = new SpeechSynthesizer();
            Configuration = new ConfigurationData("config.conf");
            GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
            GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
            GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
            GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
            GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
            GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
            GetLogging().WriteLine("                                                                         " + Version);
            GetLogging().WriteLine("                                                                                  ");
            GetLogging().WriteLine("----------------------------------------------------------------------------------");
            GetLogging().WriteLine("                                                                                  ");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine(@"                                                                                    ");
            Logging.ResetLogColor();
            Console.WriteLine(@"                                                                                    ");
            if (GetConfig().Data["hotel.time"] == "0")
            {
                GetConfig().WriteConfig("hotel.time", "0", DateTime.Now.ToShortTimeString());
            }
            Logging.IsRunning = true;
            dbKey = GetConfig().Data["license.key"];
            //keyName = GetConfig().data["license.name"];
            Navi = GetConfig().Data["hotel.navi"];
            Beta = GetConfig().Data["hotel.beta"];
            fantasy = GetConfig().Data["plugins.fantasy"];
            lake = GetConfig().Data["plugins.lake"];
            Clothing = Convert.ToUInt32(GetConfig().Data["rp.clothingshop"]);
            Jail = Convert.ToUInt32(GetConfig().Data["rp.jail"]);
            DefaultRoom = Convert.ToUInt32(GetConfig().Data["rp.default"]);
            BL = Convert.ToInt32(GetConfig().Data["rp.mwbl"]);
            RL = Convert.ToInt32(GetConfig().Data["rp.mwrl"]);
            MWR = Convert.ToUInt32(GetConfig().Data["rp.mw"]);
            Event = Convert.ToUInt32(GetConfig().Data["rp.event"]);
            if (GetConfig().Data["hotel.time"] != "0")
            {
                Time = Convert.ToDateTime(GetConfig().Data["hotel.time"]);
            }
            seasonCheck();

            {
                //updateEmulator();

                if (foundUpdate && GetConfig().Data["extra.fb"] == "false")
                {
                    GetLogging().WriteLine("An update has been found, would you like to update?", LogLevel.Success);
                    string Choice = Console.ReadLine();
                    switch (Choice)
                    {
                        case "yes":
                            {
                                try
                                {
                                    string Website = Decode("aHR0cDovL3d3dy5kZXYtc3R1ZGlvcy5uZXQvYmIvYmJf");
                                    Process.Start("iexplore", Website + "Release.rar");
                                }
                                catch (InvalidOperationException)
                                {
                                    throw new Exception("Couldn't connect to the update repo");
                                }
                                break;
                            }
                        case "no":
                            {
                                break;
                            }
                        default:
                            {
                                Logging.WriteLine("Please say either Yes or No", LogLevel.Blackbird);
                                break;
                            }
                    }
                }
                if (mandatoryUpdate)
                {
                    {
                        try
                        {
                            string Website = Decode("aHR0cDovL3d3dy5kZXYtc3R1ZGlvcy5uZXQvYmIvYmJf");
                            GetLogging().WriteLine("A MANDATORY UPDATE WAS FOUND.. DOWNLOADING NOW...", LogLevel.Success);
                            Process.Start("iexplore", Website + "Release.rar");
                        }
                        catch (InvalidOperationException)
                        {
                            throw new Exception("Couldn't connect to the update repo");
                        }

                    }
                }
            }

            { checkType(); }

            try
            {
                if (GetConfig().Data["rp.mwbl"].Length == 0 || BL == 0)
                {
                    BL = 1;
                }
                if (BL > 5)
                {
                    BL = 5;
                }
                if (GetConfig().Data["rp.mwrl"].Length == 0 || RL == 0)
                {
                    RL = 1;
                }
                if (RL > 5)
                {
                    RL = 5;
                }
                if (GetConfig().Data["db.password"].Length == 0)
                {
                    throw new Exception("For security reasons, your MySQL password cannot be left blank. Please change your password to start the server.");
                }

                if (GetConfig().Data["db.password"] == "changeme")
                {
                    throw new Exception("Your MySQL password may not be 'changeme'.\nPlease change your password to start the server.");
                }

                if (int.Parse(GetConfig().Data["db.pool.minsize"]) >= 25)
                {
                    throw new Exception("DB Pool Error\n\nYour MySQL minimum pool size must be lower than 25, you will flood MySQL.\n\nEven a value of 25 should only be used on very heavily loaded servers!");
                }
                checkDemo();
                if (Demo)
                {
                    //GetLogging().WriteLine("Test");
                    checkDate();
                }
                if (Expired)
                {
                    GetLogging().WriteLine("Your license has expired, contact [ me@hubbainn.co.cc ] to extend it");
                    Destroy(10);
                }
                /*
                if (checkLicense)
                {
                    if (GetConfig().Data["license.key"].Length != 19)
                    {
                        GetLogging().WriteLine("Your license is invalid");
                        Destroy(10);
                    }
                    else
                    {
                        string[] splitKey = dbKey.Split('-');
                        if (!dbKey.Contains(splitKey[0]) && !dbKey.Contains(splitKey[1]) && !dbKey.Contains(splitKey[2]) && !dbKey.Contains(splitKey[3]) || splitKey[0].Length != 4 || splitKey[1].Length != 4 || splitKey[2].Length != 4 || splitKey[3].Length != 4)
                        {
                            GetLogging().WriteLine("Your license isn't in the correct format", LogLevel.Error);
                            Destroy(7);
                        }
                        if (Demo == false)
                        {
                            var license = new string[6];
                            license[0] = dbKey;
                            if (Licensing.LicenseCheck(license[0]))
                            {
                                GetLogging().WriteLine("License Key [ ****-****-****-**** ] Accepted", LogLevel.Success);
                            }
                            else
                            {
                                GetLogging().WriteLine("Your license is invalid", LogLevel.Error);
                                Destroy(15);
                            }
                        }
                        if (Demo)
                        {
                            GetLogging().WriteLine("You're running a DEMO of Blackbird, the license will expire in " + _Date);
                        }
                    }
                }*/

                var dbServer = new DatabaseServer(
                    GetConfig().Data["db.hostname"],
                    uint.Parse(GetConfig().Data["db.port"]),
                    GetConfig().Data["db.username"],
                    GetConfig().Data["db.password"]);

                var db = new Database(
                    GetConfig().Data["db.name"],
                    uint.Parse(GetConfig().Data["db.pool.minsize"]),
                    uint.Parse(GetConfig().Data["db.pool.maxsize"]));

                DatabaseManager = new DatabaseManager(dbServer, db);


                Game = new Game();

                ConnectionManager = new TcpConnectionManager(
                    GetConfig().Data["game.tcp.bindip"],
                    int.Parse(GetConfig().Data["game.tcp.port"]), 100);

                ConnectionManager.GetListener().Start();
                if (Navi.Length == 0 || Navi != "enabled" && Navi != "disabled")
                {
                    Logging.WriteLine("YOU MUST choose either 'enabled' or 'disabled' for 'hotel.navi' in your Config File", LogLevel.Error);
                    Destroy(10);
                }
                else { Logging.WriteLine("The navigator is " + Navi, LogLevel.Success); }
                if (Beta.Length == 0 || Beta != "enabled" && Beta != "disabled")
                {
                    Logging.WriteLine("YOU MUST choose either 'enabled' or 'disabled' for 'hotel.beta' in your Config File", LogLevel.Error);
                    Destroy(10);
                }
                else { Logging.WriteLine("BETA MODE: " + Beta, LogLevel.Success); }
                seasonCheck();
                GetLogging().WriteLine("The hotel's season is: " + Season, LogLevel.Success);
                GetGame().GetClientManager().Blue = 0;
                GetGame().GetClientManager().Red = 0;
                StartedEmulating = DateTime.Now;
                serverMonitor.Priority = ThreadPriority.Lowest;
                serverMonitor.Start();
                if (Time.ToString().Contains("PM")) { Logging.WriteLine("The hotel is in PM mode", LogLevel.Blackbird); } if (Time.ToString().Contains("AM")) { Logging.WriteLine("The hotel is in AM mode", LogLevel.Blackbird); }
                if (Environment.MachineName.Contains("Blackbird")|| Environment.UserName.Contains("Blackbird")) { Logging.WriteLine("I see you're a Blackbird supporter!", LogLevel.Blackbird); }// Easter Egg
                Console.WriteLine(@"                                                            ");
                Console.Beep();
            }

            catch (KeyNotFoundException)
            {
                Logging.WriteLine("Please check your configuration file - some values appear to be missing.", LogLevel.Error);
                Logging.WriteLine("Press any key to shut down ...", LogLevel.Error);

                Console.ReadKey(true);
                Destroy(10);

                return;
            }

            catch (InvalidOperationException e)
            {
                Logging.WriteLine("Failed to initialize: " + e.Message, LogLevel.Error);
                Logging.WriteLine("Press any key to shut down ...", LogLevel.Error);

                Console.ReadKey(true);
                Destroy(10);

                return;
            }
        }

        #region ShitLoader
        public static void BootLoader(int Percentage)
        {
            Console.Clear();
            if (Percentage == 10)
            {
                GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
                GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
                GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
                GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
                GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
                GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
                GetLogging().WriteLine("                                                                         " + Version);
                GetLogging().WriteLine("                                                                                  ");
                GetLogging().WriteLine("----------------------------------------------------------------------------------");
                GetLogging().WriteLine("                                                                                  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(@"                                                                                    ");
                GetLogging().WriteLine("                         Blackbird Loading...                            ");
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("      |»»»»»»                                                  |  ", LogLevel.Success);// 57 IN ALL
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("                      Blackbird is pretty cheap!                         ");
                //GetLogging().WriteLine(Message);
                Thread.Sleep(2000);
                BootLoader(25);
            }
            if (Percentage == 25)
            {
                GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
                GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
                GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
                GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
                GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
                GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
                GetLogging().WriteLine("                                                                         " + Version);
                GetLogging().WriteLine("                                                                                  ");
                GetLogging().WriteLine("----------------------------------------------------------------------------------");
                GetLogging().WriteLine("                                                                                  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(@"                                                                                    ");
                GetLogging().WriteLine("                         Blackbird Loading...                            ");
                GetLogging().WriteLine("      ----------------------------------------------------------         ");                
                GetLogging().WriteLine("      |»»»»»»»»»»»»»»»                                         |  " , LogLevel.Success);// 57 IN ALL
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("                    Scott wrote Blackbird partly!                        ");
                Thread.Sleep(2000);
                BootLoader(50);
            }
            if (Percentage == 50)
            {
                GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
                GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
                GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
                GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
                GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
                GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
                GetLogging().WriteLine("                                                                         " + Version);
                GetLogging().WriteLine("                                                                                  ");
                GetLogging().WriteLine("----------------------------------------------------------------------------------");
                GetLogging().WriteLine("                                                                                  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(@"                                                                                    ");
                GetLogging().WriteLine("                         Blackbird Loading...                            ");
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("      |»»»»»»»»»»»»»»»»»»»»»»»»»»»»                            |  ", LogLevel.Success);// 57 IN ALL
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("                Makarov coded most of the new features!                  ");
                Thread.Sleep(2000);
                BootLoader(75);
            }
            if (Percentage == 75)
            {
                GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
                GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
                GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
                GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
                GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
                GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
                GetLogging().WriteLine("                                                                         " + Version);
                GetLogging().WriteLine("                                                                                  ");
                GetLogging().WriteLine("----------------------------------------------------------------------------------");
                GetLogging().WriteLine("                                                                                  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(@"                                                                                    ");
                GetLogging().WriteLine("                         Blackbird Loading...                            ");
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("      |»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»             |", LogLevel.Success);// 57 IN ALL
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("                          Dev-Studios FTW!                               ");
                Thread.Sleep(2000);
                BootLoader(100);
            }
            if (Percentage == 100)
            {
                GetLogging().WriteLine("__________.__                 __   __________.__           .___", LogLevel.Title);
                GetLogging().WriteLine("\\______   \\  | _____    ____ |  | _\\______   \\__|______  __| _/", LogLevel.Title);
                GetLogging().WriteLine(" |    |  _/  | \\__  \\ _/ ___\\|  |/ /|    |  _/  \\_  __ \\/ __ |", LogLevel.Title);
                GetLogging().WriteLine(" |    |   \\  |__/ __ \\  \\___|     < |    |   \\  ||  | \\/ /_/ | ", LogLevel.Title);
                GetLogging().WriteLine(" |______  /____(____  /\\___  >__|_ \\|______  /__||__|  \\____ | ", LogLevel.Title);
                GetLogging().WriteLine("        \\/          \\/     \\/     \\/       \\/               \\/ ", LogLevel.Title);
                GetLogging().WriteLine("                                                                         " + Version);
                GetLogging().WriteLine("                                                                                  ");
                GetLogging().WriteLine("----------------------------------------------------------------------------------");
                GetLogging().WriteLine("                                                                                  ");
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine(@"                                                                                    ");
                GetLogging().WriteLine("                         Blackbird Loading...                            ");
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("      |»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»|", LogLevel.Success);// 57 IN ALL
                GetLogging().WriteLine("      ----------------------------------------------------------         ");
                GetLogging().WriteLine("                         Loading Complete!                               ");
                Thread.Sleep(2000);
            }
        }
        #endregion

        public static bool EnumToBool(string Enum)
        {
            return (Enum == "1");
        }

        public static string BoolToEnum(bool Bool)
        {
            if (Bool)
            {
                return "1";
            }

            return "0";
        }

        public static int GetRandomNumber(int Min, int Max)
        {
            RandomBase Quick = new Quick();
            return Quick.Next(Min, Max);
        }

        public static Double GetUnixTimestamp()
        {
            TimeSpan ts = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
            return ts.TotalSeconds;
        }

        public static string FilterInjectionChars(string Input)
        {
            return FilterInjectionChars(Input, false);
        }

        public static string FilterInjectionChars(string Input, bool AllowLinebreaks)
        {
            Input = Input.Replace(Convert.ToChar(1), ' ');
            Input = Input.Replace(Convert.ToChar(2), ' ');
            Input = Input.Replace(Convert.ToChar(3), ' ');
            Input = Input.Replace(Convert.ToChar(9), ' ');

            if (!AllowLinebreaks)
            {
                Input = Input.Replace(Convert.ToChar(13), ' ');
            }

            return Input;
        }

        public static bool IsValidAlphaNumeric(string inputStr)
        {
            if (string.IsNullOrEmpty(inputStr))
            {
                return false;
            }

            return inputStr.All(t => (char.IsLetter(t)) || ((char.IsNumber(t))));
        }

        public static ConfigurationData GetConfig()
        {
            return Configuration;
        }

        public static Logging GetLogging()
        {
            return Logging;
        }
        public static void GUI()
        {
            //return Blackbird_GUI_.InitializeComponent();
        }
        public static DatabaseManager GetDatabase()
        {
            return DatabaseManager;
        }

        public static Encoding GetDefaultEncoding()
        {
            return Encoding.Default;
        }

        public static TcpConnectionManager GetConnectionManager()
        {
            return ConnectionManager;
        }

        public static Game GetGame()
        {
            return Game;
        }
        public void Restart(int seconds)
        {
            int time = seconds * 1000;
            Thread.Sleep(time);
            Console.Clear();
            Initialize();
        }

        /// <summary>
        /// Threaded void. Ran on background thread at lowest priority, interval = 10000 ms. Updates console title and online users count, active rooms count, peak connections count and peak online users count in database.
        /// </summary>
        private static void monitorServer()
        {
            while (true)
            {
                Console.Title = PrettyVersion + Resources.Blackbird_monitorServer____ + Resources.Blackbird_monitorServer_Online_Users__ + GetGame().GetClientManager().ClientCount +Resources.Blackbird_monitorServer____ + Resources.Blackbird_monitorServer_RAM_USAGE__ + (GC.GetTotalMemory(false) / 1024);
                GetConfig().WriteConfig("hotel.time", GetConfig().Data["hotel.time"], DateTime.Now.ToShortTimeString());
                Thread.Sleep(10000);
            }
        }
        public static void Destroy(int second)
        {
            var time = second * 1000;
            GetLogging().WriteLine("Server is shutting down in " + second + " seconds", LogLevel.Error);
            Thread.Sleep(time);
            if (GetGame() != null)
            {
                GetGame().Destroy();
            }

            if (GetConnectionManager() != null)
            {
                GetLogging().WriteLine("Destroying connection manager.");
                GetConnectionManager().GetListener().Stop();
                GetConnectionManager().DestroyManager();
            }

            if (GetDatabase() != null)
            {
                GetLogging().WriteLine("Destroying database manager.");
                GetDatabase().StopClientMonitor();
                GetDatabase().DestroyClients();
                GetDatabase().DestroyDatabaseManager();
            }

            Logging.WriteLine("Uninitialized successfully. Closing.");

            Environment.Exit(0);
        }
    }
}


---------- Post added at 01:39 PM ---------- Previous post was at 01:39 PM ----------

I just commented the parts that are no longer needed.
 
Initiate Mage
Joined
Oct 3, 2011
Messages
2
Reaction score
0
What is the link to download a cms compatible with this emulator???
 
Junior Spellweaver
Joined
Oct 9, 2011
Messages
187
Reaction score
25
Makarov - [Open-Source] Blackbird [RP, r63] - RaGEZONE Forums


Quite good coded! But very massive.
 
Last edited:
Banned
Banned
Joined
Aug 4, 2011
Messages
852
Reaction score
331
OMFG, CMS Keeps saying: Could not connect to database.
 
Junior Spellweaver
Joined
Oct 9, 2011
Messages
187
Reaction score
25
Mine doesnt even let me login LOL

---------- Post added at 01:05 PM ---------- Previous post was at 12:28 PM ----------

Error:

Code:
Object reference not set to an instance of an object at Uber.HabboHotel.Users.Authenticator.Autheticator.GenerateHabbo(DataRow Data, string AuthTicket)

Database isnt compitable?

---------- Post added at 06:40 PM ---------- Previous post was at 06:39 PM ----------

What is the link to download a cms compatible with this emulator???

You can't read?
 
Status
Not open for further replies.
Back
Top