Exemplo n.º 1
0
        /// <summary>
        ///     Loader of the ObjectManager class, which is neccessary for all UCS functionality.
        /// </summary>
        public ObjectManager()
        {
            m_vTimerCanceled = false;
            m_vDatabase      = new DatabaseManager();
            NpcLevels        = new Dictionary <int, string>();
            DataTables       = new DataTables();
            m_vAlliances     = new Dictionary <long, Alliance>();
            LoadFingerPrint();

            using (var sr = new StreamReader(@"Gamefiles/starting_home.json"))
                m_vHomeDefault = sr.ReadToEnd();

            m_vDatabase.CheckConnection();
            m_vAvatarSeed   = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            LoadGameFiles();
            LoadNpcLevels();

            var TimerItem = new Timer(Save, null, 30000, 15000);

            TimerReference = TimerItem;
            Console.WriteLine("[UCS]    Database Sync started successfully");
            m_vRandomSeed = new Random();
            GetAllAlliancesFromDB();
        }
        //private static ConcurrentDictionary<long, Level> m_vInMemoryPlayers { get; set; }

        public ObjectManager()
        {
            m_vTimerCanceled = false;
            m_vDatabase = new DatabaseManager();
            NpcLevels = new Dictionary<int, string>();
            DataTables = new DataTables();
            m_vAlliances = new Dictionary<long, Alliance>();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
            {
                LoadFingerPrint();
            }

            using (StreamReader sr = new StreamReader(@"gamefiles/default/home.json"))
            {
                m_vHomeDefault = sr.ReadToEnd();
            }

            m_vAvatarSeed = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            LoadGameFiles();
            LoadNpcLevels();

            System.Threading.TimerCallback TimerDelegate = new System.Threading.TimerCallback(Save);
            System.Threading.Timer TimerItem = new System.Threading.Timer(TimerDelegate, null, 60000, 60000);
            TimerReference = TimerItem;

            Console.WriteLine("Database Sync started");
            m_vRandomSeed = new Random();
        }
Exemplo n.º 3
0
        // private static ConcurrentDictionary<long, Level> m_vInMemoryPlayers { get; set; }
        public ObjectManager()
        {
            this.m_vTimerCanceled = false;
            m_vDatabase           = new DatabaseManager();

            // NpcLevels = new Dictionary<int, string>();
            DataTables   = new DataTables();
            m_vAlliances = new Dictionary <long, Clan>();

            if (Convert.ToBoolean(Constants.Patching))
            {
                LoadFingerPrint();
            }

            using (StreamReader sr = new StreamReader(@"gamefiles/level/starting_home_backup.json"))
            {
                m_vHomeDefault = sr.ReadToEnd();
            }

            m_vAvatarSeed   = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            LoadGameFiles();

            // LoadNpcLevels();
            TimerCallback TimerDelegate = new TimerCallback(this.Save);
            Timer         TimerItem     = new Timer(TimerDelegate, null, 60000, 60000);

            this.TimerReference = TimerItem;

            Console.WriteLine("Database Sync started");
            m_vRandomSeed = new Random();
        }
        public ObjectManager()
        {
            m_vTimerCanceled = false;

            m_vDatabase = new DatabaseManager();

            NpcLevels      = new Dictionary <int, string>();
            m_vRandomBases = new Dictionary <int, string>();
            FingerPrint    = new FingerPrint();

            MaxPlayerID   = Convert.ToInt32(m_vDatabase.GetMaxPlayerId() + 1);
            MaxAllianceID = Convert.ToInt32(m_vDatabase.GetMaxAllianceId() + 1);

            m_vAvatarSeed   = MaxPlayerID;
            m_vAllianceSeed = MaxAllianceID;

            using (StreamReader sr = new StreamReader(@"Gamefiles/starting_home.json"))
            {
                m_vHomeDefault = sr.ReadToEnd();
            }

            LoadNpcLevels();
            //LoadRandomBase(); // Useless atm

            TimerReference = new Timer(Save, null, 10000, 60000);
            Say("UCS Database has been succesfully loaded. (" + Convert.ToInt32(MaxAllianceID + MaxPlayerID) + "_Tables)");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loader of the ObjectManager class, which is neccessary for all UCS functionality.
        /// </summary>
        public ObjectManager()
        {
            m_vTimerCanceled = false;
            m_vDatabase      = new DatabaseManager();
            NpcLevels        = new Dictionary <int, string>();
            DataTables       = new DataTables();
            m_vAlliances     = new Dictionary <long, Alliance>();

            if (!File.Exists("banned-ip.txt"))
            {
                File.Create("banned-ip.txt");
            }

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
            {
                LoadFingerPrint();
            }

            using (var sr = new StreamReader(@"gamefiles/starting_home.json"))
                m_vHomeDefault = sr.ReadToEnd();

            m_vAvatarSeed   = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            GetAllAlliancesFromDB();
            LoadGameFiles();
            LoadBannedIPs();

            TimerCallback TimerDelegate = Save;
            var           TimerItem     = new Timer(TimerDelegate, null, 30000, 15000);

            TimerReference = TimerItem;

            Console.WriteLine("[UCR]    Database Sync started successfully");
            m_vRandomSeed = new Random();
        }
Exemplo n.º 6
0
        //private static ConcurrentDictionary<long, Level> m_vInMemoryPlayers { get; set; }

        public ObjectManager()
        {
            m_vTimerCanceled = false;
            m_vDatabase      = new DatabaseManager();
            NpcLevels        = new Dictionary <int, string>();
            DataTables       = new DataTables();
            m_vAlliances     = new Dictionary <long, Alliance>();

            if (Convert.ToBoolean(ConfigurationManager.AppSettings["useCustomPatch"]))
            {
                LoadFingerPrint();
            }

            using (StreamReader sr = new StreamReader(@"gamefiles/default/home.json"))
            {
                m_vHomeDefault = sr.ReadToEnd();
            }

            m_vAvatarSeed   = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            LoadGameFiles();
            LoadNpcLevels();

            System.Threading.TimerCallback TimerDelegate = new System.Threading.TimerCallback(Save);
            System.Threading.Timer         TimerItem     = new System.Threading.Timer(TimerDelegate, null, 60000, 60000);
            TimerReference = TimerItem;

            Console.WriteLine("Database Sync started");
            m_vRandomSeed = new Random();
        }
Exemplo n.º 7
0
        public ObjectManager()
        {
            m_vTimerCanceled = false;

            m_vDatabase    = new DatabaseManager();
            NpcLevels      = new Dictionary <int, string>();
            m_vRandomBases = new Dictionary <int, string>();
            FingerPrint    = new FingerPrint();

            m_vAvatarSeed   = m_vDatabase.GetMaxPlayerId() + 1;
            m_vAllianceSeed = m_vDatabase.GetMaxAllianceId() + 1;
            m_vHomeDefault  = File.ReadAllText(@"Gamefiles/starting_home.json");

            //m_vDatabase.CheckConnection();

            LoadNpcLevels();
            LoadRandomBase();

            TimerReference = new Timer(Save, null, 0, 5000);
            Say("UCS Database has been succesfully loaded.");
        }
Exemplo n.º 8
0
        public ObjectManager()
        {
            m_vTimerCanceled = false;

            m_vDatabase = new DatabaseManager();

            NpcLevels   = new Dictionary <int, string>();
            FingerPrint = new FingerPrint();

            MaxPlayerID   = (int)m_vDatabase.GetMaxPlayerId() + 1;
            MaxAllianceID = (int)m_vDatabase.GetMaxAllianceId() + 1;

            m_vAvatarSeed   = MaxPlayerID;
            m_vAllianceSeed = MaxAllianceID;

            HomeDefault = File.ReadAllText("Gamefiles/starting_home.json");

            //LoadNpcLevels();

            TimerReferenceRedis = new Timer(SaveRedis, null, 10000, 40000);
            TimerReferenceMysql = new Timer(SaveMysql, null, 40000, 27000);
            Say($"UBS Database has been succesfully loaded. ({Convert.ToInt32(MaxAllianceID + MaxPlayerID)} Rows)");
        }