//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();
        }
Ejemplo n.º 2
0
 public ResourcesManager()
 {
     m_vDatabase = new DatabaseManager();
     m_vClients = new ConcurrentDictionary<long,Client>();
     m_vOnlinePlayers = new List<Level>();
     m_vInMemoryLevels = new ConcurrentDictionary<long,Level>();
     m_vTimerCanceled = false;
     System.Threading.TimerCallback TimerDelegate = new System.Threading.TimerCallback(ReleaseOrphans);
     System.Threading.Timer TimerItem = new System.Threading.Timer(TimerDelegate, null, 40000, 40000);
     TimerReference = TimerItem;
 }