mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
Added the "Unclickable" Exploit.
This commit is contained in:
@@ -12,10 +12,11 @@ Source-File minus 1 is extremely weak because it can be fully level up quickly.
|
||||
|
||||
export enum Exploit {
|
||||
UndocumentedFunctionCall = 'UndocumentedFunctionCall',
|
||||
Unclickable = 'Unclickable',
|
||||
PrototypeTampering = 'PrototypeTampering',
|
||||
// To the players reading this. Yes you're supposed to add EditSaveFile by
|
||||
// editing your save file, yes you could add them all, no we don't care
|
||||
// that's not the point
|
||||
// that's not the point.
|
||||
EditSaveFile = 'EditSaveFile'
|
||||
}
|
||||
|
||||
@@ -25,6 +26,7 @@ const names: {
|
||||
'UndocumentedFunctionCall': 'by looking beyond the documentation.',
|
||||
'EditSaveFile': 'by editing your save file.',
|
||||
'PrototypeTampering': 'by tampering with Numbers prototype.',
|
||||
'Unclickable': 'by clicking the unclickable.',
|
||||
}
|
||||
|
||||
|
||||
|
||||
24
src/Exploits/unclickable.ts
Normal file
24
src/Exploits/unclickable.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { Player } from "../Player";
|
||||
import { Exploit } from "./Exploit";
|
||||
|
||||
(function() {
|
||||
function clickTheUnclickable(event: MouseEvent) {
|
||||
if(!event.target || !(event.target instanceof Element)) return;
|
||||
const display = window.getComputedStyle(event.target as Element).display;
|
||||
if(display === 'none' && event.isTrusted)
|
||||
Player.giveExploit(Exploit.Unclickable);
|
||||
}
|
||||
|
||||
|
||||
function targetElement() {
|
||||
const elem = document.getElementById('unclickable');
|
||||
if(elem == null) {
|
||||
console.error('Could not find the unclickable elem for the related exploit.');
|
||||
return;
|
||||
}
|
||||
elem.addEventListener("click", clickTheUnclickable);
|
||||
document.removeEventListener('DOMContentLoaded', targetElement);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', targetElement);
|
||||
})();
|
||||
Reference in New Issue
Block a user