Skip to content

Commit

Permalink
Merge pull request #1 from wmpedersen/hack-level-not-high-enough
Browse files Browse the repository at this point in the history
Fixes "Hacking Level not high enough" HtheChemist#15
  • Loading branch information
wmpedersen authored Mar 1, 2022
2 parents 8500bc1 + 3c64def commit c8e239c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/Orchestrator/TargetManager/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,8 @@ export async function main(ns) {
}

function checkHost(host: string): boolean {
if (ns.hasRootAccess(host)) {
// Already root
return true;
}
if (ns.getHackingLevel() >= ns.getServerRequiredHackingLevel(host)) {
const requiredPort: number = ns.getServerNumPortsRequired(host);
if (ns.getHackingLevel() >= ns.getServerRequiredHackingLevel(host) && !ns.hasRootAccess(host)) {
const requiredPort = ns.getServerNumPortsRequired(host);
if (requiredPort <= portOpener.length) {
// We have enough port cracker
let portOpen = 0;
Expand All @@ -82,6 +78,9 @@ export async function main(ns) {
// Can be hacked
ns.nuke(host);
return true;
} else if (ns.getHackingLevel() >= ns.getServerRequiredHackingLevel(host) && ns.hasRootAccess(host)) {
// Already root
return true;
} else {
// Not enough hacking level
return false;
Expand Down

0 comments on commit c8e239c

Please sign in to comment.