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

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

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

@ -102,6 +102,7 @@ import { exceptionAlert } from "../utils/helpers/exceptionAlert";
import { removeLoadingScreen } from "../utils/uiHelpers/removeLoadingScreen";
import { KEY } from "../utils/helpers/keyCodes";
import "./Exploits/tampering";
import "./Exploits/unclickable";
import React from "react";
import ReactDOM from "react-dom";

@ -603,6 +603,8 @@ if (htmlWebpackPlugin.options.googleAnalytics.trackingId) { %>
<p>If the game fails to load, consider <a href="?noScripts">killing all scripts</a></p>
</div>
</div>
<div id="unclickable" style="display: none">Click on this to upgrade your Source-File -1!</div>
</body>
<!-- Misc Scripts -->

@ -78,7 +78,7 @@ export function CharacterInfo(p: IPlayer): React.ReactElement {
if(SourceFileFlags[5] > 0 && r.length > 2 && r[1] != r[2]) {
return <td key='2' style={{textAlign: 'right'}}> ({numeralWrapper.formatPercentage(r[2])})</td>
}
return undefined;
return <></>;
}
return <>
<table>