示例#1
0
            public override async Task Edit(ExploreSet target)
            {
                await AsyncAskList("What should the name change to?", 0, async name =>
                {
                    target.name = name;
                    return(false);
                });

                await AsyncAskList("Name the new ItemSet.", 0, async name =>
                {
                    if (name == ".")
                    {
                        target.itemSet = null;
                    }

                    ItemSet set = ItemSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An ItemSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        target.itemSet = set;

                        return(false);
                    }
                });

                await AsyncAskList("Name the new RecipeSet.", 0, async name =>
                {
                    if (name == ".")
                    {
                        target.recipeSet = null;
                    }

                    RecipeSet set = RecipeSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An RecipeSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        target.recipeSet = set;

                        return(false);
                    }
                });

                await AsyncAskList("Name the new EncounterSet.", 0, async name =>
                {
                    if (name == ".")
                    {
                        target.encounterSet = null;
                    }

                    EncounterSet set = EncounterSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An EncounterSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        target.encounterSet = set;

                        return(false);
                    }
                });

                await ReplyMentionAsync($"Finished editing {target.name}.");
            }
示例#2
0
            public override async Task Add()
            {
                ExploreSet exploreSet = new ExploreSet();

                exploreSet.name = await AsyncAsk("What is the name of the explore set?");


                await AsyncAskList("Name the ItemSet.", 0, async name =>
                {
                    ItemSet set = ItemSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An ItemSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        exploreSet.itemSet = set;

                        return(false);
                    }
                });

                await AsyncAskList("Name the RecipeSet.", 0, async name =>
                {
                    RecipeSet set = RecipeSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An RecipeSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        exploreSet.recipeSet = set;

                        return(false);
                    }
                });

                await AsyncAskList("Name the EncounterSet.", 0, async name =>
                {
                    EncounterSet set = EncounterSet.Find(name);

                    if (set == null)
                    {
                        await ReplyMentionAsync($"An EncounterSet of the name '{name}' could not be found.");

                        return(true);
                    }
                    else
                    {
                        exploreSet.encounterSet = set;

                        return(false);
                    }
                });


                ChatCraft.Instance.State.exploreSets.Add(exploreSet);

                ChatCraft.Instance.Save();

                await ReplyMentionAsync($"Finished adding {exploreSet.name}.");
            }