예제 #1
0
        static void Main(string[] args)
        {
            Parser.Default.ParseArguments<Options>(args)
                   .WithParsed<Options>(o =>
                   {

                       if(!string.IsNullOrWhiteSpace(o.CompileDialogue))
                       {
                           var b = new DialogueBuilder();
                           try
                           {
                                var result = b.BuildAndSerialize(new FileInfo(o.CompileDialogue));
                                
                                if(result == null)
                                    Console.WriteLine("No file created");
                                else
                                    Console.WriteLine("Created " + result.FullName);
                           }
                           catch(Exception ex)
                           {
                               Console.WriteLine(ex.Message);
                           }
                           return;
                       }

                       var f = new WorldFactory();
                       if(o.ResourcesDirectory != null)
                            f.ResourcesDirectory = o.ResourcesDirectory;

                       if (o.Validate)
                       {
                           var validator = new WorldValidator();
                            validator.IncludeStackTraces = o.StackTraces;
                            validator.Validate(f);
                            

                            if(validator.Warnings.Length > 0)
                            {
                                Console.WriteLine("WARNINGS:");
                                Console.WriteLine(validator.Warnings);
                            }

                            if(validator.Errors.Length > 0)
                            {
                                Console.WriteLine("ERRORS:");
                                Console.WriteLine(validator.Errors);
                            }


                            Console.WriteLine("Finished Validation:");
                            Console.WriteLine(validator.ErrorCount + " Errors");
                            Console.WriteLine(validator.WarningCount + " Warnings");
                       }
                       else
                       {
                            //Don't log to the console when Console Gui is running 
                            LogManager.Configuration.RemoveTarget("logconsole");

                            Application.Init();
                            var mainWindow = new MainWindow(f);
                            Application.Top.Add(mainWindow);
                            Application.Run();                
                       }
                   });
        }
예제 #2
0
        public GameSession()
        {
            Hero = new Hero("", 1, 5, 5, 5, 5, 5, 5);

            WorldFactory factory = new WorldFactory();

            CurrentWorld    = factory.CreateWorld();
            CurrentLocation = CurrentWorld.LocationAt(0, 0); // Starting position (home)
            Checkpoint      = CurrentWorld.LocationAt(0, 0); // Starting checkpoint

            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.WeaponIDWoodStaff));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.WeaponIDWoodSword));

            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDNoHeadArmor));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDNoBodyArmor));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDNoLegsArmor));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDNoFeetArmor));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDSilkHat));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDSilkRobe));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDSilkPants));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ArmorIDSilkSandals));

            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ItemIDSmallHealingPotion));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ItemIDSmallHealingPotion));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ItemIDSmallManaPotion));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.ItemIDSmallManaPotion));

            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.MaterialIDHealingGrass));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.MaterialIDHealingGrass));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.MaterialIDHealingGrass));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.MaterialIDHealingGrass));

            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.EnemyLootIDRatTail));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.EnemyLootIDRatTail));
            Hero.AddItemToInventory(ItemsFactory.CreateGameItem(World.EnemyLootIDSnakeFang));

            Hero.PlayersGarden.AvailableSeeds.Add(ItemsFactory.CreateGameItem(World.SeedIDHealingGrass));

            Hero.RecipeList.Add(RecipeFactory.RecipeByID(World.AlchemyRecipeIDSmallHealingPotion));
            Hero.RecipeList.Add(RecipeFactory.RecipeByID(World.AlchemyRecipeIDSmallManaPotion));

            Hero.SkillBook.Add(World.SkillByID(World.MagicIDFireball));
            Hero.SkillBook.Add(World.SkillByID(World.MagicIDSmallHeal));

            Hero.SkillBook.Add(World.SkillByID(World.SwordSKillIDFastStrike));

            // Equip starting gear
            Hero.CurrentWeapon    = Hero.Inventory[World.WeaponIDWoodStaff];
            Hero.CurrentHeadArmor = Hero.Inventory[World.ArmorIDNoHeadArmor];
            Hero.CurrentBodyArmor = Hero.Inventory[World.ArmorIDNoBodyArmor];
            Hero.CurrentLegsArmor = Hero.Inventory[World.ArmorIDNoLegsArmor];
            Hero.CurrentFeetArmor = Hero.Inventory[World.ArmorIDNoFeetArmor];

            // Bad way to remove equiped items from inventory, but works for now...
            Hero.Inventory.Remove(Hero.CurrentWeapon);
            Hero.Inventory.Remove(Hero.CurrentHeadArmor);
            Hero.Inventory.Remove(Hero.CurrentBodyArmor);
            Hero.Inventory.Remove(Hero.CurrentLegsArmor);
            Hero.Inventory.Remove(Hero.CurrentFeetArmor);


            for (int i = 0; i < Hero.PlayersGarden.Size; i++)
            {
                if (Hero.PlayersGarden.Slots[i] == null)
                {
                    Hero.PlayersGarden.Slots[i] = new GameItems("Empty Slot", -1, 0, 0, GameItems.TypeOfItem.Seed);
                }
            }

            GetEnemyAtRegion();
        }