Added the "Unclickable" Exploit.

This commit is contained in:
Olivier Gagnon
2021-03-22 14:48:48 -04:00
parent ae4b8228f7
commit 29abffd464
5 changed files with 31 additions and 2 deletions

View File

@@ -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.',
}

View 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);
})();