private static Embed GetRefreshedStatus(IEmbed previousEmbed, LavaPlayer player) { EmbedBuilder builder = previousEmbed.ToEmbedBuilder(); AddStatusInfo(builder, player); builder.WithCurrentTimestamp(); return(builder.Build()); }
private static Embed GetRefreshedQueue(IEmbed previousEmbed, LavaQueue queue) { EmbedBuilder builder = previousEmbed.ToEmbedBuilder(); AddQueueInfo(builder, queue); builder.WithCurrentTimestamp(); return(builder.Build()); }
private static Embed GetRefreshedVolume(IEmbed previousEmbed, int volume) { EmbedBuilder builder = previousEmbed.ToEmbedBuilder(); AddVolumeInfo(builder, volume); builder.WithCurrentTimestamp(); return(builder.Build()); }
private static async Task <Embed> GetRefreshedAudioInfo(IEmbed previousEmbed, AudioTrack audioTrack) { EmbedBuilder builder = previousEmbed.ToEmbedBuilder(); await AddAudioTrackInfo(builder, audioTrack); builder.WithCurrentTimestamp(); return(builder.Build()); }
public Embed RefreshMonsterCard(IEmbed mc, SocketGuild guild, SocketGuildUser user) { Random rand = new Random(); // Configuration GuildConfig config = new GuildConfig(guild.Id.ToString()); config.CheckForFile(); config = config.Load() as GuildConfig; // Embed info EmbedBuilder monsterCard = mc.ToEmbedBuilder(); string line = monsterCard.Description.Split('\n')[0]; long currentHealth = Convert.ToInt64(line.Split('/')[0]); long maxHealth = Convert.ToInt64(line.Split('/')[1]); // Channels SocketTextChannel dungeonChannel = guild.GetTextChannel(config.DungeonChannelID); IUserMessage log = dungeonChannel.GetMessageAsync(config.DungeonCombatID).Result as IUserMessage; // Document action // Calculate damage int damage = rand.Next(6) + 1; bool crit = false; int critRoll = rand.Next(6) + 1; if (critRoll == 6) { crit = true; damage *= 2; } currentHealth -= damage; config.DungeonCombatLog += $"\n{DateTime.Now.ToString("HH:mm:ss")}|{user} {(crit ? "crit for" : "dealt")} {damage} damage!"; // Slain monster if (currentHealth <= 0) { // Document action config.DungeonLevel++; config.DungeonCombatLog += $"\n{DateTime.Now.ToString("HH:mm:ss")}|{user} slew the {monsterCard.Title}!"; // Generate new monster long monsterHealth = (long)(Math.Pow(config.DungeonLevel, 1.2) + 5 + rand.Next(10)); string monsterName = MONSTER_NAMES[rand.Next(MONSTER_NAMES.Length)]; EmbedBuilder newMonsterCard = new EmbedBuilder() { Title = monsterName + " lvl " + config.DungeonLevel, Description = $"{monsterHealth} / {monsterHealth}\n```{img}```", Color = new Color(0, 255, 0), }; log.ModifyAsync(x => x.Content = $"```{config.FormatedCombatLog()}```"); config.Save(); return(newMonsterCard.Build()); } log.ModifyAsync(x => x.Content = $"```{config.FormatedCombatLog()}```"); monsterCard.Description = $"{currentHealth} / {maxHealth}\n```{img}```"; // Gradient the color from green to red based on remaining health Color healthColor = new Color(0, 255, 0); float healthRatio = (float)currentHealth / (float)maxHealth; if (healthRatio >= 0.5) { healthColor = new Color((int)(255 * (2 - (2 * healthRatio))), 255, 0); } else { healthColor = new Color(255, (int)(255 * (2 * healthRatio)), 0); } monsterCard.Color = healthColor; // Save and return config.Save(); return(monsterCard.Build()); }