Exemplo n.º 1
0
 private PotionFactory GetPotionFactory(PotionDescriptor p, DungeonMasterParser.Support.ItemDescriptor itemDescriptor)
 {
     return(new PotionFactory(
                p.Name,
                p.Weight,
                builder.ActionCombos[itemDescriptor.AttackCombo],
                builder.GetStorageTypes(itemDescriptor.CarryLocation),
                builder.RenderersSource.GetItemRenderer(ResourceProvider.Instance.Content.Load <Texture2D>(p.TexturePath))));
 }
Exemplo n.º 2
0
 private DrinkablePotionFactory <T> GetDrinkablePotionFactory <T>(PotionDescriptor potionDescriptor, ItemDescriptor itemDescriptor) where T : DrinkablePotion, new()
 {
     return(new DrinkablePotionFactory <T>(
                potionDescriptor.Name,
                potionDescriptor.Weight,
                builder.ActionCombos[itemDescriptor.AttackCombo],
                builder.GetStorageTypes(itemDescriptor.CarryLocation),
                builder.RenderersSource.GetItemRenderer(ResourceProvider.Instance.Content.Load <Texture2D>(potionDescriptor.TexturePath))));
 }
Exemplo n.º 3
0
        private PotionFactory SortPotion(PotionDescriptor p, ItemDescriptor itemDescriptor)
        {
            switch (itemDescriptor.InCategoryIndex)
            {
            case 6:
                return(GetDrinkablePotionFactory <RosPotion>(p, itemDescriptor));

            case 7:
                return(GetDrinkablePotionFactory <KuPotion>(p, itemDescriptor));

            case 8:
                return(GetDrinkablePotionFactory <DanePotion>(p, itemDescriptor));

            case 9:
                return(GetDrinkablePotionFactory <NetaPotion>(p, itemDescriptor));

            case 10:
                return(GetDrinkablePotionFactory <BroPotion>(p, itemDescriptor));

            case 11:
                return(GetDrinkablePotionFactory <MaPotion>(p, itemDescriptor));

            case 12:
                return(GetDrinkablePotionFactory <YaPotion>(p, itemDescriptor));

            case 13:
                return(GetDrinkablePotionFactory <EePotion>(p, itemDescriptor));

            case 14:
                return(GetDrinkablePotionFactory <ViPotion>(p, itemDescriptor));

            case 15:
                return(GetDrinkablePotionFactory <WaterPotion>(p, itemDescriptor));

            //case 20: empty flask
            default:
                return(GetPotionFactory(p, itemDescriptor));
            }
        }
Exemplo n.º 4
0
        private IList<PotionDescriptor> ParsePotionDescriptors()
        {
            var documet = new HtmlDocument();
            documet.LoadHtml(File.ReadAllText("Data/potions.html"));

            return documet.DocumentNode.SelectSingleNode("//table")
                .Descendants("tr")
                .Skip(1)//skipp header
                .Select(tr =>
                {
                    var columns = tr.Elements("td").Select(td => td.InnerText).ToArray();
                    var res = new PotionDescriptor()
                    {
                        Name = columns[0].Trim(),
                        Weight = float.Parse(columns[1].Trim(), CultureInfo.InvariantCulture),
                    };
                    descriptorMaping.Add(GetKey(res.Name), res);
                    return res;
                })
                .ToArray();
        }