Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Swarmsim saved game editor by 60secs --> <html> <head> <meta charset="utf-8"> <meta http-equiv='cache-control' content='no-cache'> <meta http-equiv='expires' content='0'> <meta http-equiv='pragma' content='no-cache'>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script src="https://cdn.rawgit.com/pieroxy/lz-string/master/libs/lz-string.js"></script> <script type="text/javascript">
- var VERSION_DELIM = '|';
- var PREFIX = btoa("Cheater :(\n\n"); var version;
- function clear() {
- document.getElementById('originalSavedGame').value = ''; document.getElementById('decoded').value = ''; document.getElementById('newSavedGame').value = ''; originalSavedGame }
- function debug( val ) { var isDebug = false;
- if (isDebug) {
- alert(val);
- }
- } function decode() {
- var originalSavedGame=document.getElementById('originalSavedGame').value
- debug('originalSavedGame: ' + originalSavedGame);
- var split = originalSavedGame.split(VERSION_DELIM);
- debug('split: ' + split);
- version = split[0];
- var splitData = split[1];
- debug('splitData: ' + splitData);
- var encoded = splitData.substring(PREFIX.length);
- debug('encoded: ' + encoded);
- var decoded = LZString.decompressFromBase64(encoded.trim());
- debug('decoded: ' + decoded);
- //var jsonPretty = JSON.stringify(JSON.parse(decoded),null,2);
- //debug('jsonPretty: ' + jsonPretty);
- document.getElementById('decoded').value = decoded;
- }
- function encode() {
- var decoded = document.getElementById("decoded").value;
- debug('decoded: ' + decoded);
- var encoded = LZString.compressToBase64(decoded);
- debug('encoded: ' + encoded);
- debug("version=" + version);
- debug("prefix=" + PREFIX);
- version
- prefixedEncoded = PREFIX + encoded;
- debug('prefixedEncoded: ' + prefixedEncoded);
- debug('decoded: ' + decoded);
- var newSavedGame = version + VERSION_DELIM + prefixedEncoded;
- debug('newSavedGame: ' + newSavedGame);
- document.getElementById('newSavedGame').value = newSavedGame;
- } </script
- </head>
- <body onload="clear()"> <h1>Swarmsim saved game editor</h1>
- <h2>Setup</h2> <ol> <li>Save this as a file to your computer, e.g. swarmedit.html</li> <li>Open the file in a browser (tested on firefox, no guarantee for other browsers) </ol>
- <h2>How to use</h2> <ol> <li>Refresh the page to clear any existing values</li> <li>Copy the saved game from under options</li> <li>Paste the saved game in the first box</li> <li>Click the Decode button</li> <li>Edit the values you want to change. For large values, use exponent format, e.g. 1e+100. To highlight a value to edit, doubleclick</li> <li>When done editing values, click the Encode button</li> <li>Copy modified saved game from bottom box to your clipboard and paste back into swarmsim saved game under options</li> <li>If import is successful, you will see a green checkbox. If import fails, you will see a red X and your game was not modified. You will have to repeat process starting at step 1. </ol>
- <label for="originalSavedGame">Paste encoded saved game here<label><br/> <textarea rows="5" cols="100" id="originalSavedGame"> </textarea> <br/> <label for="decoded">Decoded Saved Game<label> <button type="button" onclick='decode();'>Decode</button><br/><br/>
- <textarea rows="20" cols="100" id="decoded"> </textarea> <br/>
- <label for="originalSavedGame">Encode saved game<label><br/> <button type="button" onclick="encode()">Encode</button> <br/> <br/>
- <label for="newSavedGame">Copy modified saved game to your clipboard and paste back into swarmsim saved game under options<label><br/> <textarea rows="5" cols="100" id="newSavedGame"> </textarea>
- </body> </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement