/// <summary> /// Get the HTML listing for a given skill /// </summary> /// <param name="skill">The skill to get the listing for</param> /// <returns>String of HTML represting the skill listing</returns> private string GetSkillListingHtml(SMSkill skill) { string guid = Guid.NewGuid().ToString(); string template = Utils.GetHtmlTemplate("SkillTemplate"); template = template.Replace("{panelId}", guid); template = template.Replace("{SkillName}", skill.SkillName); template = template.Replace("{Description}", skill.SkillDescription); template = template.Replace("{BaseStat}", Utils.noneIfNull(this.GetStatName(skill.BaseStat))); template = template.Replace("{SkillPrerequisites}", Utils.noneIfNull(this.GetSkillPrerequisitesHtml(skill))); template = template.Replace("{SkillNotes}", Utils.noneIfNull(this.GetSkillNotesHtml(skill))); return(template); }
/// <summary> /// Gets the HTML for any notes relating to a given skill /// </summary> /// <param name="skill">The skill to get notes for</param> /// <returns>String of HTML notes or null</returns> private string GetSkillNotesHtml(SMSkill skill) { List <string> notes = new List <string>(); if (skill.ActivityType.ToLower() == "passive") { notes.Add("This skill is passive, you cannot use it directly."); } if (skill.CanUseWithoutLearning == false) { notes.Add("You must learn this skill before you can use it."); } if (!notes.Any()) { return(null); } return(String.Join("<br/>", notes.ToArray())); }
/// <summary> /// Gets the HTML for a given skills prerequisites /// </summary> /// <param name="skill">The skill to get prerequisites for</param> /// <returns>String of HTML represting the skill prerequisites</returns> private string GetSkillPrerequisitesHtml(SMSkill skill) { if (skill.Prerequisites == null || !skill.Prerequisites.Any()) { return(null); } List <string> prereqs = new List <string>(); foreach (SMSkillPrerequisite prereq in skill.Prerequisites) { if (prereq.IsSkill) { prereqs.Add($"Skill: {prereq.SkillStatName}, Lvl {prereq.PreReqLevel}"); } else { prereqs.Add($"Attribute: {this.GetStatName(prereq.SkillStatName)}, Lvl {prereq.PreReqLevel}"); } } return(String.Join("<br/>", prereqs.OrderBy(p => p).ToArray())); }