Skip to content

Instantly share code, notes, and snippets.

@KrunoSaho
KrunoSaho / hack-all-the-servers.js
Created December 19, 2021 12:57
Bitburner script
/** @param {NS} ns
***/
function collect_server_names(ns) {
let fromServers = ['home'];
let checkedServers = [];
let serverConnections = new Map();
for (let i = 0; i < 10000; i++) { // 'infinite' loop
if (fromServers.length == 0) {
break;
@KrunoSaho
KrunoSaho / gist:38b584a63b776c27b398cab1e4d8bd14
Last active June 28, 2023 17:14
MasterHackerController.ts
import { NS } from "../NetscriptDefinitions";
import { getThreadCount, getAllServers, breakServers } from "./Util";
type SubscriptPaths = { Path: string; Cost: number };
type ScriptInformation = { Hack: SubscriptPaths; Grow: SubscriptPaths; Weaken: SubscriptPaths };
type Operations = "hack" | "grow" | "weaken";
type Operation = (
operation: Operations,
srcServer: string,
targetServer: string,
@KrunoSaho
KrunoSaho / batcher.ts
Last active June 30, 2023 04:16
Bitburner batcher
import { NS } from "../NetscriptDefinitions";
import { getThreadCount, getAllServers, breakServers, ColorsForPrint } from "./Util";
type SubscriptPaths = { Path: string; Cost: number };
type ScriptInformation = { Hack: SubscriptPaths; Grow: SubscriptPaths; Weaken: SubscriptPaths };
type Operations = "hack" | "grow" | "weaken";
type Operation = (
operation: Operations,
srcServer: string,
targetServer: string,
@KrunoSaho
KrunoSaho / batcher.ts
Last active June 30, 2023 08:59
new batcher
import { NS, Server } from "../NetscriptDefinitions";
import { getThreadCount, getAllServers, breakServers, makeColour } from "./Util";
type SubscriptPaths = { Path: string; Cost: number };
type ScriptInformation = { Hack: SubscriptPaths; Grow: SubscriptPaths; Weaken: SubscriptPaths };
type Operations = "hack" | "grow" | "weaken";
type Operation = (
operation: Operations,
srcServer: string,
targetServer: string,
@KrunoSaho
KrunoSaho / batcher.ts
Created July 1, 2023 05:38
Bitburner scheduler
import { NS, Player, Server } from "@ns";
import {
getThreadCountForSimpleOps,
makeColour,
getTargetServersForHack,
getPurchasedServers,
} from "Util";
type SubscriptPaths = { Path: string; Cost: number };
type ScriptInformation = { Hack: SubscriptPaths; Grow: SubscriptPaths; Weaken: SubscriptPaths };
@KrunoSaho
KrunoSaho / automate.ts
Created July 5, 2023 13:23
bug report
import { NS } from "@ns";
import { buyAllTorStuff, buyServers, getServers, spendHashes } from "./Util";
import { getMostProfitableCrime } from "./util/Crime";
function upgradeHome(ns: NS) {
ns.singularity.upgradeHomeRam();
ns.singularity.upgradeHomeCores();
}
async function* serialBehaviour(ns: NS) {
@KrunoSaho
KrunoSaho / bbb.ts
Created July 10, 2023 01:55
bitburner batcher
import { NS, Server } from "@ns";
import { Task, getMyServers, getThreadCountForSimpleOps, makeColour } from "Util";
type ServerWithThreads = { server: Server; task: Task; threads: number };
function interleave(hack: ServerWithThreads[], grow: ServerWithThreads[], weaken: ServerWithThreads[]) {
const result = [] as ServerWithThreads[];
const max = Math.max(hack.length, grow.length, weaken.length);
@KrunoSaho
KrunoSaho / Util.ts
Created July 10, 2023 02:09
BB Util
import { NS, Server } from "@ns";
import { copyHackFilesToServers } from "util/CopyFiles";
export enum Task {
Hack = "hacks/SimpleHack.js",
Grow = "hacks/SimpleGrow.js",
Weaken = "hacks/SimpleWeaken.js",
}
export enum PortMessages {
@KrunoSaho
KrunoSaho / CollectHgwData.js
Last active July 10, 2023 02:25
Batcher Total JS
import { Task, getMyServers, getThreadCountForSimpleOps, makeColour } from "Util";
function interleave(hack, grow, weaken) {
const result = [];
const max = Math.max(hack.length, grow.length, weaken.length);
for (let i = 0; i < max; i++) {
if (i < weaken.length)
result.push(weaken[i]);
if (i < grow.length)
result.push(grow[i]);
if (i < hack.length)
@KrunoSaho
KrunoSaho / gist:be2cff52b95a4eedf5446a8e3912613f
Last active February 22, 2024 04:53
Last Epoch Summoner Filter
<?xml version="1.0" encoding="utf-8"?>
<ItemFilter xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<name>Necrodancer</name>
<filterIcon>1</filterIcon>
<filterIconColor>17</filterIconColor>
<description />
<lastModifiedInVersion>1.0.0.1</lastModifiedInVersion>
<lootFilterVersion>2</lootFilterVersion>
<rules>
<Rule>