static List <Awards.Award> GetAwards(string plName) { if (plName == "") { return(Awards.AwardsList); } List <Awards.Award> awards = new List <Awards.Award>(); foreach (string s in Awards.GetPlayerAwards(plName)) { Awards.Award award = new Awards.Award(); award.Name = s; award.Description = Awards.GetDescription(s); awards.Add(award); } return(awards); }
public override void Use(Player p, string message, CommandData data) { string[] args = message.SplitSpaces(); if (args.Length > 2) { Help(p); return; } int offset = 0; string name = p.name; if (args.Length == 2 || (message.Length > 0 && !IsListModifier(args[0]))) { offset = 1; name = PlayerInfo.FindMatchesPreferOnline(p, args[0]); if (name == null) { return; } } List <Awards.Award> awards = Awards.AwardsList; if (awards.Count == 0) { p.Message("This server has no awards yet."); return; } List <string> playerAwards = Awards.GetPlayerAwards(name); StringFormatter <Awards.Award> formatter = (award) => FormatPlayerAward(award, playerAwards); string cmd = name.Length == 0 ? "awards" : "awards " + name; string modifier = args.Length > offset ? args[offset] : ""; MultiPageOutput.Output(p, awards, formatter, cmd, "Awards", modifier, true); }
static List <Awards.Award> AwardsHas(string name) { List <Awards.Award> awards = new List <Awards.Award>(); List <string> playerAwards = Awards.GetPlayerAwards(name); if (playerAwards == null) { return(awards); } foreach (string awardName in playerAwards) { Awards.Award award = new Awards.Award(); award.Name = awardName; Awards.Award match = Awards.FindExact(awardName); if (match != null) { award.Description = match.Description; } awards.Add(award); } return(awards); }