コード例 #1
0
        public static async Task ReplyWithLegalizedSetAsync(this ISocketMessageChannel channel, ITrainerInfo sav, ShowdownSet set)
        {
            if (set.Species <= 0)
            {
                await channel.SendMessageAsync("Oops! I wasn't able to interpret your message! If you intended to convert something, please double check what you're pasting!").ConfigureAwait(false);

                return;
            }

            var template = AutoLegalityWrapper.GetTemplate(set);
            var pkm      = sav.GetLegal(template, out var result);

            if (SysCordInstance.Self.Hub.Config.Trade.EggTrade && pkm.Nickname == "Egg")
            {
                TradeModule.EggTrade((PK8)pkm);
            }

            if (SysCordInstance.Self.Hub.Config.Trade.DittoTrade && set.Species == 132)
            {
                TradeModule.DittoTrade(pkm);
            }

            pkm.OT_Name = !OT.Equals(string.Empty) && !pkm.FatefulEncounter ? OT : pkm.OT_Name;
            OT          = string.Empty;
            var la   = new LegalityAnalysis(pkm);
            var spec = GameInfo.Strings.Species[template.Species];

            var msg = la.Valid
                ? $"Here's your ({result}) legalized PKM for {spec} ({la.EncounterOriginal.Name})!"
                : $"Oops! I wasn't able to create something from that. Here's my best attempt for that {spec}!";
            await channel.SendPKMAsync(pkm, msg + $"\n{ReusableActions.GetFormattedShowdownText(pkm)}").ConfigureAwait(false);
        }
コード例 #2
0
 public async Task ConvertShowdown([Remainder][Summary("Showdown Set")] string content)
 {
     TradeModule.SpecifyOT(content, out string specifyOT);
     if (specifyOT != string.Empty)
     {
         AutoLegalityExtensionsDiscord.OT = specifyOT;
     }
     await Context.Channel.ReplyWithLegalizedSetAsync(content).ConfigureAwait(false);
 }