2021-10-05 04:25:21 +02:00
|
|
|
import { WorkerScript } from "../Netscript/WorkerScript";
|
|
|
|
import { IPlayer } from "../PersonObjects/IPlayer";
|
|
|
|
import { Exploit } from "../Exploits/Exploit";
|
|
|
|
|
|
|
|
export interface INetscriptExtra {
|
|
|
|
heart: {
|
|
|
|
break(): number;
|
|
|
|
};
|
|
|
|
exploit(): void;
|
|
|
|
bypass(doc: Document): void;
|
2021-10-27 05:02:46 +02:00
|
|
|
alterReality(): void;
|
2021-10-05 04:25:21 +02:00
|
|
|
}
|
|
|
|
|
2021-10-11 22:38:50 +02:00
|
|
|
export function NetscriptExtra(player: IPlayer, workerScript: WorkerScript): INetscriptExtra {
|
2021-10-05 04:25:21 +02:00
|
|
|
return {
|
|
|
|
heart: {
|
|
|
|
// Easter egg function
|
|
|
|
break: function (): number {
|
|
|
|
return player.karma;
|
|
|
|
},
|
|
|
|
},
|
|
|
|
exploit: function (): void {
|
|
|
|
player.giveExploit(Exploit.UndocumentedFunctionCall);
|
|
|
|
},
|
|
|
|
bypass: function (doc: any): void {
|
|
|
|
// reset both fields first
|
|
|
|
doc.completely_unused_field = undefined;
|
|
|
|
const real_document: any = document;
|
|
|
|
real_document.completely_unused_field = undefined;
|
|
|
|
// set one to true and check that it affected the other.
|
|
|
|
real_document.completely_unused_field = true;
|
|
|
|
if (doc.completely_unused_field && workerScript.ramUsage === 1.6) {
|
|
|
|
player.giveExploit(Exploit.Bypass);
|
|
|
|
}
|
|
|
|
doc.completely_unused_field = undefined;
|
|
|
|
real_document.completely_unused_field = undefined;
|
|
|
|
},
|
2021-10-27 05:02:46 +02:00
|
|
|
alterReality: function (): void {
|
|
|
|
const x = false;
|
|
|
|
console.warn("I am sure that this variable is false");
|
|
|
|
if (x !== false) {
|
|
|
|
console.warn("Reality has been altered!");
|
|
|
|
player.giveExploit(Exploit.RealityAlteration);
|
|
|
|
}
|
|
|
|
},
|
2021-10-05 04:25:21 +02:00
|
|
|
};
|
|
|
|
}
|