static void Main(string[] args)
    {
        // Set console title.
        Console.Title = "Epic Dragon World - Game Server";

        // Keep start time for later.
        DateTime serverLoadStart = DateTime.Now;

        // Initialize async write to disk task.
        Task.Run(() => LogManager.Init());

        Config.Load();
        DatabaseManager.Init();
        WorldManager.Init();

        SkillData.Load();
        ItemData.Load();
        NpcData.Load();
        SpawnData.Load();

        // Post info.
        Util.PrintSection("Info");
        LogManager.Log("Server loaded in " + Math.Round((DateTime.Now - serverLoadStart).TotalSeconds, 2) + " seconds.");

        // Initialize async network listening.
        Task.Run(() => GameClientNetworkListener.Init());

        // Wait.
        Console.CancelKeyPress += (sender, eArgs) =>
        {
            QUIT_EVENT.Set();
            eArgs.Cancel = true;
        };
        QUIT_EVENT.WaitOne();
    }
Exemplo n.º 2
0
        private void LoadNpcs()
        {
            using (FileStream stream = File.Open(Path.Combine(Config.Instance.Binary, "Npcs.bin"), FileMode.Open, FileAccess.Read))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    int count = reader.ReadInt32();

                    this.Npcs = new Dictionary <int, NpcData>(count);

                    while (count-- > 0)
                    {
                        NpcData npc = new NpcData();

                        npc.Load(reader);

                        this.Npcs.Add(npc.MapleID, npc);
                    }
                }
            }
        }