public void ColorTokenService_TokenStart_ShouldReturnColorMap() { ColorTokenService service = new ColorTokenService(); string result = service.TokenStart(20, 30, 40); Assert.AreEqual("<c%>", result); }
private string BuildMainPageHeader(NWPlayer player) { Player playerEntity = DataService.Single <Player>(x => x.ID == player.GlobalID); var association = DataService.Get <Association>(playerEntity.AssociationID); int totalSkillCount = DataService.Where <PCSkill>(x => { var skill = DataService.Get <Skill>(x.SkillID); return(x.PlayerID == player.GlobalID && skill.ContributesToSkillCap); }).Sum(s => s.Rank); string header = ColorTokenService.Green("Name: ") + player.Name + "\n"; header += ColorTokenService.Green("Association: ") + association.Name + "\n\n"; header += ColorTokenService.Green("Skill Points: ") + totalSkillCount + " / " + SkillService.SkillCap + "\n"; header += ColorTokenService.Green("Unallocated SP: ") + playerEntity.UnallocatedSP + "\n"; header += ColorTokenService.Green("Roleplay XP: ") + playerEntity.RoleplayXP + "\n"; header += ColorTokenService.Green("FP: ") + (playerEntity.MaxFP > 0 ? MenuService.BuildBar(playerEntity.CurrentFP, playerEntity.MaxFP, 100, ColorTokenService.TokenStart(32, 223, 219)) : "N/A") + "\n"; return(header); }
private string CreateSkillDetailsHeader(PCSkill pcSkill, int req) { Player player = DataService.Player.GetByID(pcSkill.PlayerID); Skill skill = SkillService.GetSkill(pcSkill.SkillID); string title; if (pcSkill.Rank <= 3) { title = "Untrained"; } else if (pcSkill.Rank <= 7) { title = "Neophyte"; } else if (pcSkill.Rank <= 13) { title = "Novice"; } else if (pcSkill.Rank <= 20) { title = "Apprentice"; } else if (pcSkill.Rank <= 35) { title = "Journeyman"; } else if (pcSkill.Rank <= 50) { title = "Expert"; } else if (pcSkill.Rank <= 65) { title = "Adept"; } else if (pcSkill.Rank <= 80) { title = "Master"; } else if (pcSkill.Rank <= 100) { title = "Grandmaster"; } else { title = "Unknown"; } title += " (" + pcSkill.Rank + ")"; string decayLock = ColorTokenService.Green("Decay Lock: ") + ColorTokenService.White("Unlocked"); if (pcSkill.IsLocked) { decayLock = ColorTokenService.Green("Decay Lock: ") + ColorTokenService.Red("Locked"); } // Skills which don't contribute to the cap cannot be locked (there's no reason for it.) // Display a message explaining this to the player instead. string noContributeMessage = string.Empty; if (!skill.ContributesToSkillCap) { decayLock = string.Empty; noContributeMessage = ColorTokenService.Green("This skill does not contribute to your cumulative skill cap.") + "\n\n"; } string rpXP = ColorTokenService.Green("Roleplay XP: ") + player.RoleplayXP + "\n"; Attribute primaryAttribute = DataService.Attribute.GetByID(skill.Primary); Attribute secondaryAttribute = DataService.Attribute.GetByID(skill.Secondary); Attribute tertiaryAttribute = DataService.Attribute.GetByID(skill.Tertiary); string primary = ColorTokenService.Green("Primary (+" + PlayerStatService.PrimaryIncrease + "): ") + primaryAttribute.Name + "\n"; string secondary = ColorTokenService.Green("Secondary (+" + PlayerStatService.SecondaryIncrease + "): ") + secondaryAttribute.Name + "\n"; string tertiary = ColorTokenService.Green("Tertiary (+" + PlayerStatService.TertiaryIncrease + "): ") + tertiaryAttribute.Name + "\n"; return (ColorTokenService.Green("Skill: ") + skill.Name + "\n" + ColorTokenService.Green("Rank: ") + title + "\n" + ColorTokenService.Green("Exp: ") + MenuService.BuildBar(pcSkill.XP, req, 100, ColorTokenService.TokenStart(255, 127, 0)) + "\n" + rpXP + primary + secondary + tertiary + noContributeMessage + decayLock + "\n\n" + ColorTokenService.Green("Description: ") + skill.Description + "\n"); }
private string BuildMainPageHeader(NWPlayer player) { Player playerEntity = DataService.Player.GetByID(player.GlobalID); var association = DataService.Association.GetByID(playerEntity.AssociationID); // Get all player skills and then sum them up by the rank. int totalSkillCount = DataService.PCSkill .GetAllByPlayerID(player.GlobalID) .Where(x => DataService.Skill.GetByID(x.SkillID).ContributesToSkillCap) .Sum(s => s.Rank); string header = ColorTokenService.Green("Name: ") + player.Name + "\n"; header += ColorTokenService.Green("Association: ") + association.Name + "\n\n"; header += ColorTokenService.Green("Skill Points: ") + totalSkillCount + " / " + SkillService.SkillCap + "\n"; header += ColorTokenService.Green("Unallocated SP: ") + playerEntity.UnallocatedSP + "\n"; header += ColorTokenService.Green("Roleplay XP: ") + playerEntity.RoleplayXP + "\n"; header += ColorTokenService.Green("FP: ") + (playerEntity.MaxFP > 0 ? MenuService.BuildBar(playerEntity.CurrentFP, playerEntity.MaxFP, 100, ColorTokenService.TokenStart(32, 223, 219)) : "N/A") + "\n"; return(header); }