public virtual ILocalisable <string> GetString() { var builder = GetBaseString(); AddFields(builder); AddFooter(builder); return(LocalisedString.Join("\n", builder.Cast <object>().ToArray())); }
protected override void AddFields(LocalisedEmbedBuilder builder) { var grouped = GroupEquipment(); if (grouped == null) { builder.WithDescription(EquipmentText.LIST_DESCRIPTION_NONE, LocalisedString.Join("\n", Enum.GetValues(typeof(EquipmentClass)).Cast <EquipmentClass>().Select(c => c.ToLocalisable()).ToArray()), Context.Prefix, Context.CommandText); } else { foreach (var group in GroupEquipment()) { builder.AddInlineField(f => f.WithName(group.Key).WithValues("\n", group.Value)); } } }
public ILocalisable <string> GetString() { var entries = new List <LocalisedString> { new LocalisedString(LIST_TITLE, ReplyType.Info), new LocalisedString(LIST_DESCRIPTION, Prefix, string.Join("\", \"", AcceptedPrefixes)), (RawString)"```prolog" }; var groups = Commands.GroupBy(c => c.Group); foreach (var group in groups) { entries.Add(new LocalisedString(LIST_COMMAND, group.Key.ToTitleCase(), string.Join(", ", group.GroupBy(g => g.Name).Select(g => g.Key.ToLower())))); } entries.Add((RawString)"```"); return(LocalisedString.Join("\n", entries.ToArray())); }
async Task PrestigeStatsAsync(int stage, [CallFlag('b', "bos", Flag.PRESTIGE_B)] int bosLevel = -1, [CallFlag('c', "clan", Flag.PRESTIGE_C)] int clanLevel = -1, [CallFlag('i', "ip", Flag.PRESTIGE_I)] int ipLevel = -1) { ipLevel = Math.Min(62, ipLevel); var startingStage = Math.Max(1, stage * Calculator.AdvanceStart(clanLevel.Clamp(0, int.MaxValue)) - 1); var totalRelics = Calculator.RelicsEarned(stage, bosLevel.Clamp(0, int.MaxValue)); var baseRelics = Calculator.RelicsEarned(stage, 0); var enemiesToKill = Enumerable.Range(startingStage, stage - startingStage).Sum(s => Calculator.TitansOnStage(s, ipLevel.Clamp(0, int.MaxValue))); var timeTaken = Calculator.RunTime(startingStage, stage, ipLevel.Clamp(0, int.MaxValue), 1); var timeTakenSplash = Calculator.RunTime(startingStage, stage, ipLevel.Clamp(0, int.MaxValue), 4); List <LocalisedString> description = new List <LocalisedString>(); if (bosLevel > 0) { description.Add(new LocalisedString(PrestigeText.DESCRIPTION_BOS, bosLevel)); } if (clanLevel > 0) { description.Add(new LocalisedString(PrestigeText.DESCRIPTION_CLAN, clanLevel)); } if (ipLevel > 0) { description.Add(new LocalisedString(PrestigeText.DESCRIPTION_IP, ipLevel)); } var builder = new LocalisedEmbedBuilder { Description = LocalisedString.Join("\n", description.ToArray()), Color = System.Drawing.Color.Gold.ToDiscord(), Footer = new LocalisedFooterBuilder().WithText(PrestigeText.FOOTER).WithRawIconUrl(BotUser.GetAvatarUrl()) } .WithTitle(PrestigeText.TITLE, stage) .AddInlineField(f => f.WithName(PrestigeText.FIELD_STARTINGSTAGE).WithValue(startingStage)) .AddInlineField(f => f.WithName(PrestigeText.FIELD_RELICS).WithValue(PrestigeText.FIELD_RELICS_VALUE, baseRelics, totalRelics - baseRelics, totalRelics)) .AddInlineField(f => f.WithName(PrestigeText.FIELD_ENEMIES).WithValue(PrestigeText.FIELD_ENEMIES_VALUE, enemiesToKill, stage - startingStage)) .AddInlineField(f => f.WithName(PrestigeText.FIELD_TIME).WithValue(PrestigeText.FIELD_TIME_VALUE, timeTaken, timeTakenSplash)); await ReplyAsync(builder); }
public LocalisedFieldBuilder WithValues <T>(string separator, T[] values) => WithValue(LocalisedString.Join(separator, values.Cast <object>().ToArray()));