css/html CrimeMonitor
This commit is contained in:
@@ -3,7 +3,7 @@ import { GetCrimeStat } from "./Library";
|
||||
/** @param {NS} ns */
|
||||
export async function main(ns) {
|
||||
ns.tail();
|
||||
ns.resizeTail(1876, 412);
|
||||
ns.resizeTail(2005, 412);
|
||||
ns.disableLog("sleep");
|
||||
|
||||
let aCrimes = [
|
||||
@@ -26,9 +26,9 @@ export async function main(ns) {
|
||||
ns.clearLog();
|
||||
|
||||
// Header with ASCII box
|
||||
ns.printRaw("╔══════════════════╦════════════╦═════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════╦════════════╗");
|
||||
ns.printRaw("║ Crime ║ Chance ║ $/%/s ║ Hack w/xp ║ Str w/xp ║ Def w/xp ║ Dex w/xp ║ Agi w/xp ║ Cha w/xp ║ Money/s ║ Karma/s ║");
|
||||
ns.printRaw("╠══════════════════╬════════════╬═════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════╬════════════╣");
|
||||
ns.printRaw("╔══════════════════╦════════════╦═════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════════════╦════════════╦════════════╦════════════╗");
|
||||
ns.printRaw("║ Crime ║ Chance ║ $/%/s ║ Hack w/xp ║ Str w/xp ║ Def w/xp ║ Dex w/xp ║ Agi w/xp ║ Cha w/xp ║ IntXP /s ║ Money/s ║ Karma/s ║");
|
||||
ns.printRaw("╠══════════════════╬════════════╬═════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════════════╬════════════╬════════════╬════════════╣");
|
||||
|
||||
// Loop through each crime and display stats
|
||||
for (let i = 0; i < aCrimes.length; i++) {
|
||||
@@ -42,6 +42,7 @@ export async function main(ns) {
|
||||
let dexterityExpPerSecond = await GetCrimeStat(ns, crime, "dexterity_exp") / (await GetCrimeStat(ns, crime, "time") / 1000);
|
||||
let agilityExpPerSecond = await GetCrimeStat(ns, crime, "agility_exp") / (await GetCrimeStat(ns, crime, "time") / 1000);
|
||||
let charismaExpPerSecond = await GetCrimeStat(ns, crime, "charisma_exp") / (await GetCrimeStat(ns, crime, "time") / 1000);
|
||||
let IntelligenceExpPerSecond = await GetCrimeStat(ns, crime, "intelligence_exp") / (await GetCrimeStat(ns, crime, "time") / 1000);
|
||||
|
||||
// Success weights for each attribute
|
||||
let hackingSuccessWeight = await GetCrimeStat(ns, crime, "hacking_success_weight");
|
||||
@@ -70,15 +71,16 @@ export async function main(ns) {
|
||||
let dexterityDisplay = `${dexteritySuccessWeight.toFixed(2)} / ${dexterityExpPerSecond.toFixed(4)}`.padEnd(19, " ");
|
||||
let agilityDisplay = `${agilitySuccessWeight.toFixed(2)} / ${agilityExpPerSecond.toFixed(4)}`.padEnd(19, " ");
|
||||
let charismaDisplay = `${charismaSuccessWeight.toFixed(2)} / ${charismaExpPerSecond.toFixed(4)}`.padEnd(19, " ");
|
||||
let IntelligenceDisplay = `${IntelligenceExpPerSecond.toFixed(4)}`.padEnd(11, " ");
|
||||
|
||||
let moneyDisplay = moneyPerSecond.toFixed(2).padEnd(11, " ");
|
||||
let karmaDisplay = karmaPerSecond.toFixed(4).padEnd(11, " ");
|
||||
|
||||
ns.printRaw(`║ ${crimeDisplay}║ ${chanceDisplay}║ ${nMoneyPerChancePerSecondDisplay}║ ${hackingDisplay}║ ${strengthDisplay}║ ${defenseDisplay}║ ${dexterityDisplay}║ ${agilityDisplay}║ ${charismaDisplay}║ ${moneyDisplay}║ ${karmaDisplay}║`);
|
||||
ns.printRaw(`║ ${crimeDisplay}║ ${chanceDisplay}║ ${nMoneyPerChancePerSecondDisplay}║ ${hackingDisplay}║ ${strengthDisplay}║ ${defenseDisplay}║ ${dexterityDisplay}║ ${agilityDisplay}║ ${charismaDisplay}║ ${IntelligenceDisplay}║ ${moneyDisplay}║ ${karmaDisplay}║`);
|
||||
}
|
||||
|
||||
// Footer with ASCII box
|
||||
ns.printRaw("╚══════════════════╩════════════╩═════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════╩════════════╝");
|
||||
ns.printRaw("╚══════════════════╩════════════╩═════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════════════╩════════════╩════════════╩════════════╝");
|
||||
|
||||
// Wait for 1 second before updating the display again
|
||||
await ns.sleep(1000);
|
||||
|
||||
Reference in New Issue
Block a user