import { Company } from "./Company";
import { CompanyPosition } from "./CompanyPosition";
/**
* Returns a string with the given CompanyPosition's stat requirements
*/
export function getJobRequirementText(company: Company, pos: CompanyPosition, tooltiptext = false): string {
let reqText = "";
const offset: number = company.jobStatReqOffset;
const reqHacking: number = pos.requiredHacking > 0 ? pos.requiredHacking + offset : 0;
const reqStrength: number = pos.requiredStrength > 0 ? pos.requiredStrength + offset : 0;
const reqDefense: number = pos.requiredDefense > 0 ? pos.requiredDefense + offset : 0;
const reqDexterity: number = pos.requiredDexterity > 0 ? pos.requiredDexterity + offset : 0;
const reqAgility: number = pos.requiredDexterity > 0 ? pos.requiredDexterity + offset : 0;
const reqCharisma: number = pos.requiredCharisma > 0 ? pos.requiredCharisma + offset : 0;
const reqRep: number = pos.requiredReputation;
if (tooltiptext) {
reqText = "Requires:
";
reqText += reqHacking.toString() + " hacking
";
reqText += reqStrength.toString() + " strength
";
reqText += reqDefense.toString() + " defense
";
reqText += reqDexterity.toString() + " dexterity
";
reqText += reqAgility.toString() + " agility
";
reqText += reqCharisma.toString() + " charisma
";
reqText += reqRep.toString() + " reputation";
} else {
reqText = "(Requires ";
if (reqHacking > 0) {
reqText += reqHacking + " hacking, ";
}
if (reqStrength > 0) {
reqText += reqStrength + " strength, ";
}
if (reqDefense > 0) {
reqText += reqDefense + " defense, ";
}
if (reqDexterity > 0) {
reqText += reqDexterity + " dexterity, ";
}
if (reqAgility > 0) {
reqText += reqAgility + " agility, ";
}
if (reqCharisma > 0) {
reqText += reqCharisma + " charisma, ";
}
if (reqRep > 1) {
reqText += reqRep + " reputation, ";
}
reqText = reqText.substring(0, reqText.length - 2);
reqText += ")";
}
return reqText;
}