This commit is contained in:
ZXMushroom63 2024-09-29 18:08:58 +08:00
commit 15d5ac69da
2 changed files with 18 additions and 1 deletions

View File

@ -91,7 +91,8 @@
> >
<br /> <br />
<span><label>Minify:&nbsp;</label><input type="checkbox" oninput="globalThis.doShronk = this.checked">&nbsp;&nbsp;&nbsp; <span><label>Minify:&nbsp;</label><input type="checkbox" oninput="globalThis.doShronk = this.checked">&nbsp;&nbsp;&nbsp;
<label>EaglerForge:&nbsp;</label><input checked type="checkbox" oninput="globalThis.doEaglerforge = this.checked"> <label>EaglerForge:&nbsp;</label><input checked type="checkbox" oninput="globalThis.doEaglerforge = this.checked">&nbsp;&nbsp;&nbsp;
<label>Optimize PI:&nbsp;</label><input checked type="checkbox" oninput="globalThis.optimizePi= this.checked">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code id="status">Awaiting input...</code></span> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<code id="status">Awaiting input...</code></span>
<br /><br /> <br /><br />
<button class="btn btn-primary" id="giveme">Make modded client</button> <button class="btn btn-primary" id="giveme">Make modded client</button>

View File

@ -1,4 +1,5 @@
globalThis.doEaglerforge = true; globalThis.doEaglerforge = true;
globalThis.optimizePi = true;
function wait(ms) { function wait(ms) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
setTimeout(() => { resolve(); }, ms); setTimeout(() => { resolve(); }, ms);
@ -135,6 +136,19 @@ var main;(function(){`
); );
} }
); );
if(globalThis.optimizePi){
patchedFile = patchedFile.replaceAll(
"3.1415927410125732 / 180",
"0.01745"
);
patchedFile = patchedFile.replaceAll(
"3.1415927410125732",
"3.14159"
);
}
const extractInstanceMethodRegex = const extractInstanceMethodRegex =
/^[\t ]*function \S+?_\S+?_\S+?\((\$this)?/gm; // /^[\t ]*function \S+?_\S+?_\S+?\(\$this/gm /^[\t ]*function \S+?_\S+?_\S+?\((\$this)?/gm; // /^[\t ]*function \S+?_\S+?_\S+?\(\$this/gm
const extractInstanceMethodFullNameRegex = /function (\S*?)\(/gm; // /function (\S*?)\(\$this/gm const extractInstanceMethodFullNameRegex = /function (\S*?)\(/gm; // /function (\S*?)\(\$this/gm
@ -197,6 +211,8 @@ var main;(function(){`
); );
//Edge cases. sigh //Edge cases. sigh
//Done: add support for static properties on classes with constructors like this: function nmcg_GuiMainMenu() { //Done: add support for static properties on classes with constructors like this: function nmcg_GuiMainMenu() {
patchedFile = patchedFile.replaceAll( patchedFile = patchedFile.replaceAll(
/function [a-z]+?_([a-zA-Z\$]+?)\(\) \{/gm, /function [a-z]+?_([a-zA-Z\$]+?)\(\) \{/gm,
(match) => { (match) => {