public async Task PrayCommand() { Player player = Context.Player; if (player.IsEncounter("Combat")) { await ReplyAsync("It is not the time for this, my child."); } else { int index = -1; //jewelry index of a god's sigil for (int i = 0; i < player.equipment.jewelry.Length; i++) { Item jewel = player.equipment.jewelry[i]; if (jewel != null && jewel.isUnique && Faith.Sigils.ContainsKey(jewel.name)) { if (index > -1) { throw NeitsilliaError.ReplyError("A divided faith is a useless faith"); } index = i; } } if (index <= -1) { await ReplyAsync("You show no faith to pray to."); } else { await ReplyAsync(player.Faith.Pray(player, player.equipment.jewelry[index].name)); } } }
internal static async Task ViewSchems(Player player, ISocketMessageChannel chan, int displayPage = 1) { int count = player.schematics.Count; if (count == 0) { throw NeitsilliaError.ReplyError("No known schematics."); } const int itemPerPage = 15; int pages = NumbersM.CeilParse <int>(count / (double)itemPerPage); displayPage = Verify.MinMax(displayPage, pages, 1); int start = (displayPage - 1) * itemPerPage; string desc = string.Join(Environment.NewLine, player.schematics.GetRange( start, start + itemPerPage > count ? count - start : itemPerPage)); EmbedBuilder schems = DUtils.BuildEmbed($"{player.name}'s Schematics", desc, $"Page {displayPage}/{pages}", player.userSettings.Color); await player.NewUI(await chan.SendMessageAsync(embed: schems.Build()), MsgType.Schems, displayPage.ToString()); }