コード例 #1
0
ファイル: item.cs プロジェクト: Wirless/cyclops
        private static void Compile(Object arg, string path)
        {
            FileInfo[]     fileList = new DirectoryInfo(path).GetFiles();
            DynamicCompile dCompile = new DynamicCompile();

            foreach (FileInfo info in fileList)
            {
                dCompile.Compile(path + info.Name, arg);
            }
        }
コード例 #2
0
ファイル: spell.cs プロジェクト: Wirless/cyclops
        private static void Compile(string path, Dictionary <string, SpellInfo> dict)
        {
            FileInfo[]     fileList = new DirectoryInfo(path).GetFiles();
            DynamicCompile dCompile = new DynamicCompile();

            foreach (FileInfo info in fileList)
            {
                SpellInfo spellInfo = new SpellInfo();
                dCompile.Compile(path + info.Name, spellInfo);
                dict.Add(spellInfo.Name.ToLower(), spellInfo);
            }
        }
コード例 #3
0
ファイル: npc.cs プロジェクト: Wirless/cyclops
        /// <summary>
        /// Load all the npcs as specified in the configuration file.
        /// </summary>
        public static void Load()
        {
            string path = Config.GetDataPath() + Config.GetNPCDirectory();

            FileInfo[]     fileList = new DirectoryInfo(path).GetFiles();
            DynamicCompile dCompile = new DynamicCompile();

            foreach (FileInfo info in fileList)
            {
                NPC npc = (NPC)dCompile.Compile(path + info.Name, null);
                NPCDictionary.Add(npc.Name.ToLower(), npc);
            }
        }
コード例 #4
0
ファイル: monster.cs プロジェクト: Wirless/cyclops
        /// <summary>
        /// Loads all the monsters.
        /// </summary>
        public static void Load()
        {
            string path = Config.GetDataPath() + Config.GetMonsterDirectory();

            FileInfo[]     fileList = new DirectoryInfo(path).GetFiles();
            DynamicCompile dCompile = new DynamicCompile();

            foreach (FileInfo info in fileList)
            {
                Monster monster = (Monster)dCompile.Compile(path + info.Name, null);
                masterDictionary.Add(monster.Name.ToLower(), monster);
            }
        }
コード例 #5
0
        /// <summary>
        /// Load the commands.
        /// </summary>
        public static void Load()
        {
            string path = Config.GetDataPath() + Config.GetCommandDirectory();

            FileInfo[]     fileList = new DirectoryInfo(path).GetFiles();
            DynamicCompile dCompile = new DynamicCompile();

            foreach (FileInfo info in fileList)
            {
                CommandInfo commandInfo = new CommandInfo();
                dCompile.Compile(path + info.Name, commandInfo);
                commands.Add(commandInfo.Name.ToLower(), commandInfo);
            }
        }
コード例 #6
0
ファイル: monster.cs プロジェクト: brewsterl/cyclops
 /// <summary>
 /// Loads all the monsters.
 /// </summary>
 public static void Load()
 {
     string path = Config.GetDataPath() + Config.GetMonsterDirectory();
     FileInfo[] fileList = new DirectoryInfo(path).GetFiles();
     DynamicCompile dCompile = new DynamicCompile();
     foreach (FileInfo info in fileList) {
         Monster monster = (Monster)dCompile.Compile(path + info.Name, null);
         masterDictionary.Add(monster.Name.ToLower(), monster);
     }
 }
コード例 #7
0
ファイル: spell.cs プロジェクト: brewsterl/cyclops
 private static void Compile(string path, Dictionary<string, SpellInfo> dict)
 {
     FileInfo[] fileList = new DirectoryInfo(path).GetFiles();
     DynamicCompile dCompile = new DynamicCompile();
     foreach (FileInfo info in fileList) {
         SpellInfo spellInfo = new SpellInfo();
         dCompile.Compile(path + info.Name, spellInfo);
         dict.Add(spellInfo.Name.ToLower(), spellInfo);
     }
 }
コード例 #8
0
ファイル: item.cs プロジェクト: brewsterl/cyclops
 private static void Compile(Object arg, string path)
 {
     FileInfo[] fileList = new DirectoryInfo(path).GetFiles();
     DynamicCompile dCompile = new DynamicCompile();
     foreach (FileInfo info in fileList) {
         dCompile.Compile(path + info.Name, arg);
     }
 }
コード例 #9
0
ファイル: command.cs プロジェクト: brewsterl/cyclops
 /// <summary>
 /// Load the commands.
 /// </summary>
 public static void Load()
 {
     string path = Config.GetDataPath() + Config.GetCommandDirectory();
     FileInfo[] fileList = new DirectoryInfo(path).GetFiles();
     DynamicCompile dCompile = new DynamicCompile();
     foreach (FileInfo info in fileList) {
         CommandInfo commandInfo = new CommandInfo();
         dCompile.Compile(path + info.Name, commandInfo);
         commands.Add(commandInfo.Name.ToLower(), commandInfo);
     }
 }
コード例 #10
0
ファイル: server.cs プロジェクト: brewsterl/cyclops
        public void Run(string[] args)
        {
            // TODO: Print version information
            #if DEBUG
            // TODO: Print "DEBUGGING ON"-message
            Log.WriteDebug("Debugging on.");
            #endif
            // Load configuration
            // Remove configuration asm/
            if (Directory.Exists("asm"))
                Directory.Delete("asm", true);

            string configFile = "config.cs";

            // Read config file in command line argument
            if (args.Length > 0)
            {
                if (!File.Exists(args[0]))
                {
                    Console.WriteLine("Usage: mono cyclops.exe [config file]");
                    Console.WriteLine();

                    return;
                }
                else
                {
                    configFile = args[0];
                }
            }

            if (!File.Exists(configFile))
            {
                // TODO: Create new template config file
                configFile = "config.cs";
            }

            Log.WriteBegin("Loading config file (" + configFile + ")...");

            try
            {
                DynamicCompile compiler = new DynamicCompile();
                Dictionary<string, string> values = (Dictionary<string, string>) compiler.Compile(configFile, null);

                Config.Load(values);
            }
            catch (Exception e)
            {
                Log.WriteError(e.ToString());

                return;
            }

            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading items...");
            Item.LoadItems();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading spells...");
            Spell.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading monsters...");
            Monster.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading commands...");
            Command.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading map...");
            Map map = Map.Load();
            world = new GameWorld(map);
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading non-person characters...");
            NPC.Load();
            List<NPC> allNPCs = NPC.GetAllNPCs();

            foreach (NPC npc in allNPCs)
                world.SendAddNPC(npc, npc.CurrentPosition);

            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading monster spawns...");
            Respawn.Load(world);
            Log.WriteEnd();

            // TODO: Write load-message (listener)
            Log.WriteBegin("Starting TCP listener...");
            listener = new TcpListener(IPAddress.Any, Config.GetPort());
            listener.Start();
            Log.WriteEnd();

            Log.WriteLine("Server is now running.");
            // TODO: Write message: SERVER NOW RUNNING

            AcceptConnections();
        }
コード例 #11
0
ファイル: server.cs プロジェクト: Wirless/cyclops
        public void Run(string[] args)
        {
            // TODO: Print version information
#if DEBUG
            // TODO: Print "DEBUGGING ON"-message
            Log.WriteDebug("Debugging on.");
#endif
            // Load configuration
            // Remove configuration asm/
            if (Directory.Exists("asm"))
            {
                Directory.Delete("asm", true);
            }

            string configFile = "config.cs";

            // Read config file in command line argument
            if (args.Length > 0)
            {
                if (!File.Exists(args[0]))
                {
                    Console.WriteLine("Usage: mono cyclops.exe [config file]");
                    Console.WriteLine();

                    return;
                }
                else
                {
                    configFile = args[0];
                }
            }

            if (!File.Exists(configFile))
            {
                // TODO: Create new template config file
                configFile = "config.cs";
            }

            Log.WriteBegin("Loading config file (" + configFile + ")...");

            try
            {
                DynamicCompile compiler            = new DynamicCompile();
                Dictionary <string, string> values = (Dictionary <string, string>)compiler.Compile(configFile, null);

                Config.Load(values);
            }
            catch (Exception e)
            {
                Log.WriteError(e.ToString());

                return;
            }

            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading items...");
            Item.LoadItems();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading spells...");
            Spell.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading monsters...");
            Monster.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading commands...");
            Command.Load();
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading map...");
            Map map = Map.Load();
            world = new GameWorld(map);
            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading non-person characters...");
            NPC.Load();
            List <NPC> allNPCs = NPC.GetAllNPCs();

            foreach (NPC npc in allNPCs)
            {
                world.SendAddNPC(npc, npc.CurrentPosition);
            }

            Log.WriteEnd();

            // TODO: Write load-message
            Log.WriteBegin("Loading monster spawns...");
            Respawn.Load(world);
            Log.WriteEnd();

            // TODO: Write load-message (listener)
            Log.WriteBegin("Starting TCP listener...");
            listener = new TcpListener(IPAddress.Any, Config.GetPort());
            listener.Start();
            Log.WriteEnd();

            Log.WriteLine("Server is now running.");
            // TODO: Write message: SERVER NOW RUNNING

            AcceptConnections();
        }