Пример #1
0
        public void AddItemTemplateAction()
        {
            var itemTemplateBuilder = ItemTemplateBuilder.Create();

            itemTemplateBuilder.WithName(Input.StringValue("Item name:"));
            itemTemplateBuilder.WithDescription(Input.StringValue("Item description:"));
            itemTemplateBuilder.WithItemCategory(Input.EnumValue <ItemCategories>("Item category:"));
            itemTemplateBuilder.WithRarity(Input.EnumValue <RarityTypes>("Item rarity:"));
            _ = Input.BoolValue("Can equip?") ? itemTemplateBuilder.AsEquipable() : null;
            _ = Input.BoolValue("Can use?") ? itemTemplateBuilder.AsUsable() : null;
            _ = Input.BoolValue("Can stack?") ? itemTemplateBuilder.AsStackable() : null;
            _ = Input.BoolValue("Can obtain from gatcha?") ? itemTemplateBuilder.AsGatchaDrop() : null;

            var itemTemplate  = itemTemplateBuilder.Build();
            var isAddBaseStat = Input.BoolValue("Add base stats?");

            while (isAddBaseStat)
            {
                itemTemplate.AddBaseStat(
                    (StatisticsTypes)Input.EnumValue <StatisticsTypes>("Stat type:"),
                    Input.DoubleValue("Stat value:"),
                    Input.DoubleValue("Stat change per level:"),
                    Input.BoolValue("Is percentage?")
                    );

                isAddBaseStat = Input.BoolValue("Add next?");
            }

            var isAddBaseAttribute = Input.BoolValue("Add base attributes: ");

            while (isAddBaseAttribute)
            {
                itemTemplate.AddBaseAttribute(
                    (StatisticsTypes)Input.EnumValue <StatisticsTypes>("Stat type:"),
                    Input.DoubleValue("Stat value:"),
                    Input.DoubleValue("Stat change per level:")
                    );

                isAddBaseAttribute = Input.BoolValue("Add next?");
            }

            var isAddUpgradeMaterial = Input.BoolValue("Add upgrade materials: ");

            while (isAddUpgradeMaterial)
            {
                itemTemplate.AddUpgradeMaterial(
                    Input.NumberValue("Material id:"),
                    Input.NumberValue("Amount needed:"),
                    Input.NumberValue("Needed amount growth per level:")
                    );

                isAddUpgradeMaterial = Input.BoolValue("Add next?");
            }

            ItemTemplateRequestBuilder.Initialize()
            .AsSave()
            .WithItemTemplate(itemTemplate)
            .ExecuteSave();
        }
Пример #2
0
        public void AddItemToPlayerAction()
        {
            var itemTemplate = ItemTemplateRequestBuilder
                               .Initialize()
                               .AsGet(Input.NumberValue("Template id:"))
                               .Execute <ItemTemplate>().data;


            var item = new Item(itemTemplate);
        }
Пример #3
0
        public void ListItemTemplatesAction()
        {
            var itemTemplates = ItemTemplateRequestBuilder
                                .Initialize()
                                .AsGetAll()
                                .Execute <List <ItemTemplate> >().data;

            var tableData = new List <List <object> >();

            foreach (var itemTemplate in itemTemplates)
            {
                tableData.Add(new List <object> {
                    itemTemplate.Id, itemTemplate.Name, itemTemplate.ItemCategory.ToString(), itemTemplate.RarityType.ToString()
                });
            }

            ConsoleTableBuilder
            .From(tableData)
            .WithTitle("Items", ConsoleColor.Green)
            .WithColumn("Id", "Name", "Category", "Rarity")
            .Print();

            Input.AwaitAny();
        }