// Displays character info on a given element. This is used to create & update // the 'Stats' page from the main menu import { BitNodes } from "../BitNode/BitNode"; import { IPlayer } from "../PersonObjects/IPlayer"; import { numeralWrapper } from "../ui/numeralFormat"; import { MoneySourceTracker } from "../utils/MoneySourceTracker"; import { dialogBoxCreate } from "../../utils/DialogBox"; import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { createElement } from "../../utils/uiHelpers/createElement"; import { removeChildrenFromElement } from "../../utils/uiHelpers/removeChildrenFromElement"; export function displayCharacterInfo(elem: HTMLElement, p: IPlayer) { removeChildrenFromElement(elem); let companyPosition = ""; if (p.companyName !== "") { companyPosition = p.jobs[p.companyName]; } var intText = ""; if (p.intelligence > 0) { intText = 'Intelligence: ' + (p.intelligence).toLocaleString() + '
'; } let bitNodeTimeText = ""; if(p.sourceFiles.length > 0) { bitNodeTimeText = 'Time played since last Bitnode destroyed: ' + convertTimeMsToTimeElapsedString(p.playtimeSinceLastBitnode) + '
'; } const unlockedBitnodes: boolean = p.sourceFiles.length !== 0; // General info elem.appendChild(createElement("pre", { display: "block", innerHTML: 'General

' + 'Current City: ' + p.city + '

' + `Employer at which you last worked: ${p.companyName}
` + `Job you last worked: ${companyPosition}
` + `All Employers: ${Object.keys(p.jobs).join(", ")}

` })); // Money, and a button to show money breakdown elem.appendChild(createElement("pre", { display: "inline-block", innerHTML: 'Money: ' + numeralWrapper.formatMoney(p.money.toNumber()) + '


', margin: "6px", })); function convertMoneySourceTrackerToString(src: MoneySourceTracker): string { let parts: string[] = [`Total: ${numeralWrapper.formatMoney(src.total)}`]; if (src.bladeburner) { parts.push(`Bladeburner: ${numeralWrapper.formatMoney(src.bladeburner)}`) }; if (src.codingcontract) { parts.push(`Coding Contracts: ${numeralWrapper.formatMoney(src.codingcontract)}`) }; if (src.work) { parts.push(`Company Work: ${numeralWrapper.formatMoney(src.work)}`) }; if (src.corporation) { parts.push(`Corporation: ${numeralWrapper.formatMoney(src.corporation)}`) }; if (src.crime) { parts.push(`Crimes: ${numeralWrapper.formatMoney(src.crime)}`) }; if (src.gang) { parts.push(`Gang: ${numeralWrapper.formatMoney(src.gang)}`) }; if (src.hacking) { parts.push(`Hacking: ${numeralWrapper.formatMoney(src.hacking)}`) }; if (src.hacknetnode) { parts.push(`Hacknet Nodes: ${numeralWrapper.formatMoney(src.hacknetnode)}`) }; if (src.hospitalization) { parts.push(`Hospitalization: ${numeralWrapper.formatMoney(src.hospitalization)}`) }; if (src.infiltration) { parts.push(`Infiltration: ${numeralWrapper.formatMoney(src.infiltration)}`) }; if (src.stock) { parts.push(`Stock Market: ${numeralWrapper.formatMoney(src.stock)}`) }; return parts.join("
"); } elem.appendChild(createElement("button", { class: "popup-box-button", display: "inline-block", float: "none", innerText: "Money Statistics & Breakdown", clickListener: () => { let txt: string = "Money earned since you last installed Augmentations:
" + convertMoneySourceTrackerToString(p.moneySourceA); if (unlockedBitnodes) { txt += "

Money earned in this BitNode:
" + convertMoneySourceTrackerToString(p.moneySourceB); } dialogBoxCreate(txt, false); } })); // Stats and multiplier elem.appendChild(createElement("pre", { display: "block", innerHTML: 'Stats

' + 'Hacking Level: ' + (p.hacking_skill).toLocaleString() + ' (' + numeralWrapper.format(p.hacking_exp, '(0.000a)') + ' experience)
' + 'Strength: ' + (p.strength).toLocaleString() + ' (' + numeralWrapper.format(p.strength_exp, '(0.000a)') + ' experience)
' + 'Defense: ' + (p.defense).toLocaleString() + ' (' + numeralWrapper.format(p.defense_exp, '(0.000a)') + ' experience)
' + 'Dexterity: ' + (p.dexterity).toLocaleString() + ' (' + numeralWrapper.format(p.dexterity_exp, '(0.000a)') + ' experience)
' + 'Agility: ' + (p.agility).toLocaleString() + ' (' + numeralWrapper.format(p.agility_exp, '(0.000a)') + ' experience)
' + 'Charisma: ' + (p.charisma).toLocaleString() + ' (' + numeralWrapper.format(p.charisma_exp, '(0.000a)') + ' experience)
' + intText + '

' + 'Multipliers

' + 'Hacking Chance multiplier: ' + numeralWrapper.formatPercentage(p.hacking_chance_mult) + '
' + 'Hacking Speed multiplier: ' + numeralWrapper.formatPercentage(p.hacking_speed_mult) + '
' + 'Hacking Money multiplier: ' + numeralWrapper.formatPercentage(p.hacking_money_mult) + '
' + 'Hacking Growth multiplier: ' + numeralWrapper.formatPercentage(p.hacking_grow_mult) + '

' + 'Hacking Level multiplier: ' + numeralWrapper.formatPercentage(p.hacking_mult) + '
' + 'Hacking Experience multiplier: ' + numeralWrapper.formatPercentage(p.hacking_exp_mult) + '

' + 'Strength Level multiplier: ' + numeralWrapper.formatPercentage(p.strength_mult) + '
' + 'Strength Experience multiplier: ' + numeralWrapper.formatPercentage(p.strength_exp_mult) + '

' + 'Defense Level multiplier: ' + numeralWrapper.formatPercentage(p.defense_mult) + '
' + 'Defense Experience multiplier: ' + numeralWrapper.formatPercentage(p.defense_exp_mult) + '

' + 'Dexterity Level multiplier: ' + numeralWrapper.formatPercentage(p.dexterity_mult) + '
' + 'Dexterity Experience multiplier: ' + numeralWrapper.formatPercentage(p.dexterity_exp_mult) + '

' + 'Agility Level multiplier: ' + numeralWrapper.formatPercentage(p.agility_mult) + '
' + 'Agility Experience multiplier: ' + numeralWrapper.formatPercentage(p.agility_exp_mult) + '

' + 'Charisma Level multiplier: ' + numeralWrapper.formatPercentage(p.charisma_mult) + '
' + 'Charisma Experience multiplier: ' + numeralWrapper.formatPercentage(p.charisma_exp_mult) + '

' + 'Hacknet Node production multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_money_mult) + '
' + 'Hacknet Node purchase cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_purchase_cost_mult) + '
' + 'Hacknet Node RAM upgrade cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_ram_cost_mult) + '
' + 'Hacknet Node Core purchase cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_core_cost_mult) + '
' + 'Hacknet Node level upgrade cost multiplier: ' + numeralWrapper.formatPercentage(p.hacknet_node_level_cost_mult) + '

' + 'Company reputation gain multiplier: ' + numeralWrapper.formatPercentage(p.company_rep_mult) + '
' + 'Faction reputation gain multiplier: ' + numeralWrapper.formatPercentage(p.faction_rep_mult) + '
' + 'Salary multiplier: ' + numeralWrapper.formatPercentage(p.work_money_mult) + '
' + 'Crime success multiplier: ' + numeralWrapper.formatPercentage(p.crime_success_mult) + '
' + 'Crime money multiplier: ' + numeralWrapper.formatPercentage(p.crime_money_mult) + '


' + 'Misc

' + 'Servers owned: ' + p.purchasedServers.length + '
' + 'Hacknet Nodes owned: ' + p.hacknetNodes.length + '
' + 'Augmentations installed: ' + p.augmentations.length + '
' + 'Time played since last Augmentation: ' + convertTimeMsToTimeElapsedString(p.playtimeSinceLastAug) + '
' + bitNodeTimeText + 'Time played: ' + convertTimeMsToTimeElapsedString(p.totalPlaytime), })); // BitNode information, if player has gotten that far if (unlockedBitnodes) { var index = "BitNode" + p.bitNodeN; elem.appendChild(createElement("p", { width:"60%", innerHTML: "
Current BitNode: " + p.bitNodeN + " (" + BitNodes[index].name + ")

", })); elem.appendChild(createElement("p", { width:"60%", fontSize: "13px", marginLeft:"4%", innerHTML:BitNodes[index].info, })) } }