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.
Experienced Elementalist
Joined
Oct 17, 2008
Messages
293
Reaction score
64
Can anyone help me, the EMU asks me for a licence key what is it?
 
Joined
Apr 28, 2010
Messages
2,794
Reaction score
1,178
Noh, we do understand. Maybe the source could be fixed up, maybe?

I'm not going to waste my time fixing this emulator, All the functions work exception it isn't stable. You can take all the RP features from it because those work, It's just on a bad uber source. I promise you most of this stuff will work on another project flawlessly.
 
Joined
Dec 16, 2011
Messages
1,993
Reaction score
631
I'm not going to waste my time fixing this emulator, All the functions work exception it isn't stable. You can take all the RP features from it because those work, It's just on a bad uber source. I promise you most of this stuff will work on another project flawlessly.

I know, but the functions and all are for blackbird, so It wouldn't be easy?
 
Custom Title Activated
Loyal Member
Joined
Oct 21, 2007
Messages
2,098
Reaction score
464
It was coded good. I was following thoroughly on Msn ^_^
i suggest you port this to that Hang Glider edit if you wanna use this so badly.

The functions itself are not badly coded. Just uber can't handle it.
 
swagggggg
Loyal Member
Joined
Oct 28, 2008
Messages
1,557
Reaction score
368
It was coded good. I was following thoroughly on Msn ^_^
i suggest you port this to that Hang Glider edit if you wanna use this so badly.

The functions itself are not badly coded. Just uber can't handle it.

Indeed, Hang-Glider held 500 odd for me. :rolleyes:

edit:
the emulator coding made the thread sleep for 1000 when it had loaded, so ya'd need to change that.
 

T09

Junior Spellweaver
Joined
Oct 8, 2011
Messages
161
Reaction score
26
as is posted here many times if you can't delete license system your just stupid.I did it in five minutes and got almost none C# experience. But for anyone who is to stupid to do it here's my code:

replace UberEnvironment.cs with:

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

namespace Blackbird
{
    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 Username;
        public static string Password;
        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 = 7;
        public static int Revision = 1;
        public static string Version = Major + "." + Minor + "." + Build;
        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 + " r" + Revision;
            }
        }

       
        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"; }
        }
        public static void Initialize()
        {
            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");
            Program.wBanner();
            if (GetConfig().Data["hotel.time"] == "0")
            {
                GetConfig().WriteConfig("hotel.time", "0", DateTime.Now.ToShortTimeString());
            }
            Logging.IsRunning = true;
            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();

           

            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!");
                }

               
                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;
                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(@"                                                            ");
                TimeSpan Timez = DateTime.Now - ServerStarted;
                Blackbird.GetLogging().WriteLine("Initialized Blackbird environment in " + Math.Round(Timez.TotalSeconds, 2) + " seconds.");
                Console.Beep();
                GC.Collect();
                serverMonitor.Priority = ThreadPriority.Lowest;
                serverMonitor.Start();
                Input.Listen();
            }

            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 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 double CalculateAliveTime
        {
            get
            {
                TimeSpan lol = DateTime.Now - StartedEmulating;
                return Math.Round(lol.TotalMinutes, 2);
            }

        }

        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);
        }
    }
}
 
Status
Not open for further replies.
Back
Top