multiple save slots, improved cloud save space, new cloud save UI

This commit is contained in:
Omsi 2018-05-03 23:58:21 -07:00
parent ea7b29bb0f
commit 6c170fecc8
5 changed files with 526 additions and 290 deletions

View File

@ -42,14 +42,14 @@
<div>
<p>You have <span id="coinAmount" style="font-size:25px; color: black">0</span> antimatter.</p>
</div>
<div style="position: relative">
<button id="postInfinityButton" class="postinfcrunch">Big Crunch for x Infinity Points</button>
<button id="newDimensionButton" class="newdim" onclick="newDimension()">Get x antimatter to unlock a new Dimension.</button>
<button id="eternitybtn" class="eternitybtn" onclick="eternity()">Other times await.. I need to become Eternal</button>
</div>
<div id="coinsPerSec">You are getting 0 antimatter per second.</div>
<tr id="tickSpeedRow" style="visibility: hidden">
<div id="tickLabel" style="visibility: hidden">Make the game 10% faster.</div>
<button id="tickSpeed" style="color:black; visibility: hidden; height: 25px;width: 170px; font-size: 12px" class="storebtn">Cost: 1000</button>
@ -326,7 +326,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -853,7 +853,7 @@
<p id="totaltickgained">You've gained 0 tickspeed upgrades.</p>
<p>You have <span id="timeShardAmount" style="font-size:35px; color: black">0</span> time shards. Next tickspeed upgrade at <span id="tickThreshold" style="font-size:35px; color: black">0</span></p>
</div>
<div id="timeShardsPerSec">You are getting 0 Timeshards per second.</div>
<button id="maxTimeDimensions" class="storebtn" style="font-size: 12px" onclick="buyMaxTimeDimensions()">Max all</Button>
<table class="table" >
@ -962,7 +962,7 @@
<div id="progressbar"><span id="progresspercent" ach-tooltip="Percentage until Infinity">0%</span></div>
</div>
<div id="footercontainer">
<table id="footer">
<tr>
<td>
@ -972,7 +972,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -988,14 +988,14 @@
<td><div><button id="newsbtn" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Hide/show the news</button></div></td>
</tr>
<tr>
<td><div><button id="save" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">Save</button></div></td>
<td><div><button id="retry" onclick="toggleChallengeRetry()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Automatically retry challenges</button></div></td>
<td><div><button id="exportbtn" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">Export</button></div></td>
<td><div><button id="importbtn" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">Import</button></div></td>
</tr>
<tr>
<td><div><button id="challengeconfirmation" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 15px">Challenge confirmation ON</button></div></td>
<td><div><button id="retry" onclick="toggleChallengeRetry()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Automatically retry challenges</button></div></td>
<td><div><button id="commas" onclick="toggleCommas()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Commas on large exponents ON</button></div></td>
<td><div><button id="save" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">Save</button></div></td>
<td><div><button id="load" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">Load</button></div></td>
</tr>
<tr id="cloudOptions">
<td><div><button onclick="playFabSaveCheck()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Cloud save</button></div></td>
@ -1004,21 +1004,21 @@
</tr>
<tr>
<td><div><button id="hotkeys" onclick="toggleHotkeys()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Disable hotkeys</button></div></td>
<td><div><button id="reset" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">RESET THE GAME</button></div></td>
<td><div><button id="eternityconf" onclick="toggleEternityConf()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%; display: none">Eternity confirmation ON</button></div></td>
<td><div><button id="reset" class="storebtn" style="color:black; width: 200px; height: 55px; font-size: 20px">RESET THE GAME</button></div></td>
<td><div><button id="commas" onclick="toggleCommas()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%">Commas on large exponents ON</button></div></td>
</tr>
<tr>
<td><div><button class="storebtn" style="width: 200px; height: 55px; opacity: 0;"></button></div></td>
<td><div><button id="eternityconf" onclick="toggleEternityConf()" class="storebtn" style="color:black; width: 200px; height: 55px; font-size:120%; display: none">Eternity confirmation ON</button></div></td>
<td><div class="storebtn" style="color:black; width: 198px; height: 55px; font-size:130%; text-align: center;"><b id="updaterate">Update Rate: 50ms</b><input id="updaterateslider" style="width: 170px;" type="range" min="33" max="200" value="50" class="slider" ></div></td>
<td><div><button class="storebtn" style="width: 200px; height: 55px; opacity: 0;"></button></div></td>
</tr>
<tr>
</tr>
</table>
<div style="display: none;"><textarea id="exportOutput" style="color:black; width: 200px; height: 55px;"></textarea></div>
<p>Hotkeys: 1-8 for buy 10 dimension, shift+1-8 for buy 1 dimension, T to buy max tickspeed, shift+T to buy one tickspeed, M for max all<br>S for sacrifice, D for dimension boost, G for galaxy, C for crunch, A for toggle autobuyers, R for replicanti galaxies, E for eternity.<br>You can hold shift while buying time studies to buy all up until that point and see each study's number.<br>Hotkeys do not work while holding control.</p>
@ -1032,7 +1032,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -1135,7 +1135,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -1183,7 +1183,7 @@
<div id="To infinity!" class="achievement achievementlocked" style="background-image: url(images/9.png)" ach-tooltip="Reach Infinite antimatter. Reward: Start with 100 antimatter."><br></div>
</td>
<td>
<div id="Fake News" class="achievement achievementlocked" style="background-image: url(images/25.png)" ach-tooltip="Encounter 50 different news messages."><br></div>
<div id="Fake News" class="achievement achievementlocked" style="background-image: url(images/25.png)" ach-tooltip="Encounter 50 different news messages."><br></div>
</td>
<td>
<div id="The 9th Dimension is a lie" class="achievement achievementlocked" style="background-image: url(images/11.png)" ach-tooltip="Have exactly 99 Eighth Dimensions. Reward: Eighth Dimensions are 10% stronger."><br></div>
@ -1218,7 +1218,7 @@
<div id="You didn't need it anyway" class="achievement achievementlocked" style="background-image: url(images/20.png)" ach-tooltip="Reach Infinite antimatter without having any 8th Dimensions. Reward: Dimensions 1-7 are 2% stronger."><br></div>
</td>
<td>
<div id="Don't you dare to sleep" class="achievement achievementlocked" style="background-image: url(images/10.png)" ach-tooltip="Be offline for over 6 hours in a row."><br></div>
<div id="Don't you dare to sleep" class="achievement achievementlocked" style="background-image: url(images/10.png)" ach-tooltip="Be offline for over 6 hours in a row."><br></div>
</td>
<td>
<div id="Claustrophobic" class="achievement achievementlocked" style="background-image: url(images/22.png)" ach-tooltip="Go Infinite with just 1 Antimatter Galaxy. Reward: Reduces starting tick interval by 2%."><br></div>
@ -1232,7 +1232,7 @@
</tr>
<tr id="achRow4">
<td>
<div id="Spreading Cancer" class="achievement achievementlocked" style="background-image: url(images/46.png)" ach-tooltip="Buy ten Galaxies in total while using cancer notation."><br></div>
<div id="Spreading Cancer" class="achievement achievementlocked" style="background-image: url(images/46.png)" ach-tooltip="Buy ten Galaxies in total while using cancer notation."><br></div>
</td>
<td>
<div id="Supersanic" class="achievement achievementlocked" style="background-image: url(images/26.png)" ach-tooltip="Have antimatter/sec exceed your current antimatter above 1 Tg (1e63)."><br></div>
@ -1325,7 +1325,7 @@
<div id="NEW DIMENSIONS???" class="achievement achievementlocked" style="background-image: url(images/45.png)" ach-tooltip="Unlock the 4th Infinity Dimension. Reward: Your achievement bonus affects Infinity Dimensions."><br></div>
</td>
<td>
<div id="One for each dimension" class="achievement achievementlocked" style="background-image: url(images/21.png)" ach-tooltip="Play for 8 days. Reward: Extremely small time multiplier."><br></div>
<div id="One for each dimension" class="achievement achievementlocked" style="background-image: url(images/21.png)" ach-tooltip="Play for 8 days. Reward: Extremely small time multiplier."><br></div>
</td>
<td>
<div id="How the antitables have turned" class="achievement achievementlocked" style="background-image: url(images/47.png)" ach-tooltip="Get 8th Dimension multiplier to be highest, 7th Dimension multiplier second highest etc. Reward: Each dimension gains a boost proportional to tier (8th dimension gets 8%, 7th gets 7%, etc.)"><br></div>
@ -1558,16 +1558,16 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
</table>
</div>
</div>
<div id="challenges" class="tab">
<br>
<button class="storebtn" style="font-size: 100%; width:200px" onclick="exitChallenge()">Exit Challenge</button><br><br>
@ -1599,9 +1599,9 @@
<span style="font-size: 110%">Buying anything halts your production, gradually coming back over 3 minutes.</span>
<br>
<br>
<div class="outer">
<button id="challenge2" class="challengesbtn">Start</button>
<br>
<span>Reward: Second Dimension autobuyer</span>
@ -1615,9 +1615,9 @@
<span style="font-size: 110%">First dimension is heavily weakened but gets an exponentially increasing bonus that resets on reset.</span>
<br>
<br>
<div class="outer">
<button id="challenge3" class="challengesbtn">Start</button>
<br>
<span>Reward: Third Dimension autobuyer</span>
@ -1629,9 +1629,9 @@
<span style="font-size: 110%">Buying a dimension automatically erases all lower tier dimensions, like a sacrifice without the boost.</span>
<br>
<br>
<div class="outer">
<button id="challenge8" class="challengesbtn">Start</button>
<br>
<span>Reward: Fourth Dimension autobuyer</span>
@ -1645,9 +1645,9 @@
<span style="font-size: 110%">Tickspeed starts at 7%.</span>
<br>
<br>
<div class="outer">
<button id="challenge6" class="challengesbtn">Start</button>
<br>
<span>Reward: Fifth Dimension autobuyer</span>
@ -1659,9 +1659,9 @@
<span style="font-size: 110%">Each dimension costs the dimension 2 before it, with modified prices</span>
<br>
<br>
<div class="outer">
<button id="challenge10" class="challengesbtn">Start</button>
<br>
<span>Reward: Sixth Dimension autobuyer</span>
@ -1675,9 +1675,9 @@
<span style="font-size: 110%">Multiplier per 10 dimensions is random from 0.30 and 10</span>
<br>
<br>
<div class="outer">
<button id="challenge9" class="challengesbtn">Start</button>
<br>
<span>Reward: Seventh Dimension autobuyer</span>
@ -1689,9 +1689,9 @@
<span style="font-size: 110%">Dimension Boost and galaxies are useless, sacrifice resets everything but is immensely more powerful</span>
<br>
<br>
<div class="outer">
<button id="challenge11" class="challengesbtn">Start</button>
<br>
<span>Reward: Eighth Dimension autobuyer</span>
@ -1705,9 +1705,9 @@
<span style="font-size: 110%">Whenever you buy 10 of a dimension or tickspeed, everything else of equal cost will increase to its next cost step.</span>
<br>
<br>
<div class="outer">
<button id="challenge5" class="challengesbtn">Start</button>
<br>
<span>Reward: Tickspeed autobuyer</span>
@ -1719,9 +1719,9 @@
<span style="font-size: 110%">There are only 6 dimensions, with dimension boost and antimatter galaxy costs modified.</span>
<br>
<br>
<div class="outer">
<button id="challenge4" class="challengesbtn">Start</button>
<br>
<span>Reward: Automated Dimension Boosts</span>
@ -1735,9 +1735,9 @@
<span style="font-size: 110%">There's normal matter which rises. If it exceeds your antimatter, it will dimension boost without giving the bonus.</span>
<br>
<br>
<div class="outer">
<button id="challenge12" class="challengesbtn">Start</button>
<br>
<span>Reward: Automated Galaxies</span>
@ -1749,15 +1749,15 @@
<span style="font-size: 110%">Each dimension produces the dimension 2 below it; first dimensions produce reduced antimatter.</span>
<br>
<br>
<div class="outer">
<button id="challenge7" class="challengesbtn">Start</button>
<br>
<span>Reward: Automated Big Crunches</span>
</div>
</div>
</td>
</td>
</tr>
</table>
</div>
@ -1790,7 +1790,7 @@
</div>
</div>
</td>
</tr>
<tr>
<td>
@ -1818,7 +1818,7 @@
<span>Reward: All normal dimension multipliers become multiplier^1.05</span>
</div>
</div>
</td>
</td>
</tr>
<tr>
<td>
@ -1846,7 +1846,7 @@
<span>Reward: Tickspeed affects Infinity Dimensions with reduced effect</span>
</div>
</div>
</td>
</td>
</tr>
<tr>
<td>
@ -1874,7 +1874,7 @@
<span>Reward: You get a multiplier to dimensions 2-7 based on 1st and 8th dimension multipliers.</span>
</div>
</div>
</td>
</td>
</tr>
</table>
@ -2082,10 +2082,10 @@
</tr>
</table>
</div>
<div id="infinity" class="tab" align="center" style="display: none">
<br>
<div id="infinityPoints1" style="color: black; font-size: 15px; width: 40%; margin: 0 auto">You have made x Infinity points.</div>
@ -2178,7 +2178,7 @@
</table>
</div>
</div>
<div id="autobuyers" class="inftab">
<br>
<table class="table" style="margin: 0 auto">
@ -2246,7 +2246,7 @@
</td>
</tr>
<tr>
</tr>
<tr>
<td>
@ -2471,7 +2471,7 @@
<span style="font-size: 80%">Is active</span>
<input type="checkbox" onchange="updateAutobuyers()" id="13ison"></input>
</div>
<div>
<table id="footer">
<tr>
@ -2482,7 +2482,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -2537,7 +2537,7 @@
<td>
<button id="postinfi33" class="infinistorebtn1" onclick="buyInfinityUpgrade('autoBuyerUpgrade',1e15)">Autobuyers work twice as fast <br>Cost: 1 Qa IP</button>
</td>
</tr>
<tr>
<td>
@ -2561,7 +2561,7 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
@ -2599,26 +2599,16 @@
<a href="changelog.html" target="_newtab">Changelog </a> |
<a href="https://discord.gg/ST9NaXa" target="_newtab">Discord</a> |
<a href="https://www.reddit.com/r/AntimatterDimensions/" target="_newtab">Subreddit</a> | <a href="https://ivark.github.io/savefixer/index.html" target="_newtab">Savefixer</a>
</div>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<div class="popup" id="loadCloud">
<div id="loadPopup">You have a cloud save with 69 infinities. Do you want to download it?</div>
<button class="storebtn" style="font-size: 15px" onclick="tooltipLoad()" style="display: inline">Yes</button>
<button class="storebtn" style="font-size: 15px" onclick="closeToolTip()" style="display: inline">No</button>
</div>
<div class="popup" id="saveCloud">
<div id="savePopup">You have a cloud save with 69 infinities. Do you want to overwrite it?</div>
<button class="storebtn" style="font-size: 15px" onclick="tooltipSave()" style="display: inline">Yes</button>
<button class="storebtn" style="font-size: 15px" onclick="closeToolTip()" style="display: inline">No</button>
</div>
<div class="popup" id="update">
<div id="updatePopup">The last test.</div>
<button class="storebtn" style="font-size: 15px" onclick="closeToolTip()" style="display: inline">Okay</button>
@ -2630,7 +2620,56 @@
<div class="popup" id="offlineprogress" style="width: 450px; height: 200px;">
<div id="offlinePopup" style="height: 150px">You made X antimatter and stuff</div>
<button class="storebtn" style="font-size: 15px" onclick="closeToolTip()" style="display: inline">Okay</button>
</div>
</div>
<div class="popup savemenu" id="loadmenu">
<button class="closebtn storebtn" onclick="closeToolTip()">&times;</button>
<div id="save1">
<strong>Save #1: <span class="save_selected">(selected)</span></strong>
<span class="save_antimatter"></span>
<button class="storebtn" style="font-size: 15px" onclick="change_save(0)" style="display: inline">Load</button>
</div>
<div id="save2">
<strong>Save #2: <span class="save_selected">(selected)</span></strong>
<span class="save_antimatter"></span>
<button class="storebtn" style="font-size: 15px" onclick="change_save(1)" style="display: inline">Load</button>
</div>
<div id="save3">
<strong>Save #3: <span class="save_selected">(selected)</span></strong>
<span class="save_antimatter"></span>
<button class="storebtn" style="font-size: 15px" onclick="change_save(2)" style="display: inline">Load</button>
</div>
</div>
<div class="popup savemenu" id="cloudloadconflict">
<strong>Your cloud save appears to be older than your local save. Please select which one you would like to keep.</strong>
<div id="local">
<strong>Save #<span class="save_id"></span> (local):</strong>
<span>Infinities: <span class="save_infinities"></span></span>
<span>Eternities: <span class="save_eternities"></span></span>
<button class="storebtn" style="font-size: 15px" style="display: inline">Load local</button>
</div>
<div id="cloud">
<strong>Save #<span class="save_id"></span> (cloud):</strong>
<span>Infinities: <span class="save_infinities"></span></span>
<span>Eternities: <span class="save_eternities"></span></span>
<button class="storebtn" style="font-size: 15px" style="display: inline">Load cloud</button>
</div>
</div>
<div class="popup savemenu" id="cloudsaveconflict">
<strong>Your local save appears to be older than your cloud save. Would you like to overwrite the cloud save?</strong>
<div id="local">
<strong>Save #<span class="save_id"></span> (local):</strong>
<span>Infinities: <span class="save_infinities"></span></span>
<span>Eternities: <span class="save_eternities"></span></span>
</div>
<div id="cloud">
<strong>Save #<span class="save_id"></span> (cloud):</strong>
<span>Infinities: <span class="save_infinities"></span></span>
<span>Eternities: <span class="save_eternities"></span></span>
</div>
<button class="storebtn yes" style="font-size: 15px" style="display: inline">Yes</button>
<button class="storebtn no" style="font-size: 15px" style="display: inline">No</button>
</div>
<div id="TTbuttons" style="display:none;">
<button class="timetheorembtn" onclick="maxTheorems()" style="margin-left:-266px; width:130px; height: 30px; font-size: 0.75rem; bottom: 77px;">Buy max Theorems</button>
<button class="timetheorembtn" onclick="studyTreeSaveButton(1)" style="margin-left:166px; width:30px; height: 30px; font-size: 0.75rem; bottom: 77px;">1</button>

View File

@ -1,3 +1,10 @@
var currentSave = 0;
var saves = {
0: null,
1: null,
2: null
};
function onLoad() {
if (player.totalmoney === undefined || isNaN(player.totalmoney)) player.totalmoney = player.money;
if (player.options === undefined) {
@ -548,33 +555,79 @@ if (player.version < 5) {
}
function load_cloud_save(saveId, cloudPlayer) {
saves[saveId] = cloudPlayer;
if (window.location.href.split("//")[1].length > 20) set_save('dimensionTestSave', saveId, cloudPlayer);
else set_save('dimensionSave', saveId, cloudPlayer);
function loadFromString(string) {
var save = LZString.decompressFromEncodedURIComponent(string)
console.log("Save length: "+save.length)
if (save == "") player = JSON.parse(atob(string))
else player = JSON.parse(save)
onLoad()
if (currentSave == saveId) {
load_game();
updateChallenges();
transformSaveToDecimal();
}
}
function load_game(root) {
if (!root) {
if (window.location.href.split("//")[1].length > 20) var root = get_save('dimensionTestSave');
else var root = get_save('dimensionSave');
}
// Start: Migration for old save format
if (root && !root.saves) {
var _root = getRootSaveObject();
_root.saves[currentSave] = root;
root = _root;
player = root.saves[currentSave];
save_game();
}
// End: Migration
// If there's no save, insert default root object
if (!root) root = getRootSaveObject();
currentSave = root.current;
saves = root.saves;
if (saves[currentSave]) player = saves[currentSave];
onLoad();
}
function load_game() {
if (window.location.href.split("//")[1].length > 20) var save_data = get_save('dimensionTestSave');
else var save_data = get_save('dimensionSave');
if (!save_data) return;
player = save_data;
onLoad()
function save_game(changed, silent) {
if (window.location.href.split("//")[1].length > 20) set_save('dimensionTestSave', currentSave, player);
else set_save('dimensionSave', currentSave, player);
if (!silent) $.notify(changed ? "Game loaded" : "Game saved", "info")
}
function change_save(saveId) {
// Save previous save to make sure no changes are lost
save_game(false, true);
function save_game() {
if (window.location.href.split("//")[1].length > 20) set_save('dimensionTestSave', player);
else set_save('dimensionSave', player);
$.notify("Game saved", "info")
currentSave = saveId;
saved = 0;
totalMult = 1
currentMult = 1
infinitiedMult = 1
achievementMult = 1
challengeMult = 1
unspentBonus = 1
infDimPow = 1
postc8Mult = new Decimal(0)
mult18 = new Decimal(1)
ec10bonus = new Decimal(1)
player = saves[saveId] || defaultStart;
save_game(true);
load_game();
updateChallenges()
transformSaveToDecimal()
closeToolTip();
}
function transformSaveToDecimal() {
player.infinityPoints = new Decimal(player.infinityPoints)
@ -710,16 +763,22 @@ function loadAutoBuyerSettings() {
}
function set_save(name, value) {
localStorage.setItem(name, btoa(JSON.stringify(value, function(k, v) { return (v === Infinity) ? "Infinity" : v; })));
function set_save(name, saveId, value) {
saves[saveId] = value;
localStorage.setItem(name, btoa(JSON.stringify(getRootSaveObject(), function(k, v) { return (v === Infinity) ? "Infinity" : v; })));
}
function get_save(name) {
try {
if (localStorage.getItem("dimensionSave") !== null) {
return JSON.parse(atob(localStorage.getItem(name), function(k, v) { return (v === Infinity) ? "Infinity" : v; }));
}
} catch(e) { console.log("Fuck IE"); }
return JSON.parse(atob(localStorage.getItem(name)), function(k, v) { return (v === Infinity) ? "Infinity" : v; });
} catch(e) { console.log("Fuck IE", e); }
}
function getRootSaveObject() {
return {
current: currentSave,
saves: saves
};
}
setTimeout(onLoad, 100)

View File

@ -1,189 +1,276 @@
function playFabLogin(){
try {
var authTicket = kongregate.services.getGameAuthToken();
var requestData = {
TitleId: "5695",
KongregateId: kongregate.services.getUserId(),
AuthTicket: authTicket,
CreateAccount: true
}
try {
PlayFab.ClientApi.LoginWithKongregate(requestData, playFabLoginCallback);
}
catch (e){
console.log("Unable to send login request to PlayFab.");
}
} catch (e) {console.log(e)}
}
var playFabId = -1
function playFabLoginCallback(data, error){
if (error){
console.log(error.errorMessage);
$.notify("Couldn't log in to PlayFab Cloud. You need to be logged in to Kongregate.", "error")
document.getElementById("cloudOptions").style.display = "none"
document.getElementById("cloud").style.display = "none"
return;
}
if (data){
//NOTE: SAVE 'playFabId' to a global variable somewhere, I just declare mine at the start of the playfab stuff. Use this variable to tell if your player is logged in to playfab or not.
playFabId = data.data.PlayFabId;
$.notify("Logged in to PlayFab Cloud", "info")
if (player.options.cloud) playFabLoadCheck()
console.log("Logged in to playFab")
}
}
function playFabSaveCheck(){
if (playFabId == -1) return false;
if (typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined'){
//Should never get this far without the api
console.log(error);
return;
}
function playFabLogin() {
try {
var authTicket = kongregate.services.getGameAuthToken();
var requestData = {
Keys: ["infinitied", "eternities"],
PlayFabId: playFabId
TitleId: titleId,
KongregateId: kongregate.services.getUserId(),
AuthTicket: authTicket,
CreateAccount: true
}
try {
PlayFab.ClientApi.GetUserData(requestData, playFabSaveCheckCallback);
PlayFab.ClientApi.LoginWithKongregate(requestData, playFabLoginCallback);
} catch (e) {
console.log("Unable to send login request to PlayFab.");
}
catch (e){console.log(e);}
/*
// Dev playfab login
titleId = "144";
var requestData = {
TitleId: titleId,
CustomId: "GettingStartedGuide",
CreateAccount: true
}
try {
PlayFab.ClientApi.LoginWithCustomID(requestData, playFabLoginCallback);
} catch (e) {
console.log("Unable to send login request to PlayFab.");
}
*/
} catch (e) {
console.log(e)
}
function playFabSaveCheckCallback(data, error){
if (error){
console.log("error checking existing PlayFab data");
console.log(error);
playFabLogin()
return;
}
var titleId = "5695";
var playFabId = -1
function playFabLoginCallback(data, error) {
if (error) {
console.log(error.errorMessage);
$.notify("Couldn't log in to PlayFab Cloud. You need to be logged in to Kongregate.", "error")
document.getElementById("cloudOptions").style.display = "none"
document.getElementById("cloud").style.display = "none"
return;
}
if (data) {
//NOTE: SAVE 'playFabId' to a global variable somewhere, I just declare mine at the start of the playfab stuff. Use this variable to tell if your player is logged in to playfab or not.
playFabId = data.data.PlayFabId;
$.notify("Logged in to PlayFab Cloud", "info")
if (player.options.cloud) playFabLoadCheck()
console.log("Logged in to playFab")
}
}
function saveToPlayFab(root) {
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined') return false;
// Cut compressed root object into strings of 10,000 bytes for PlayFab
var chunks = LZString.compressToEncodedURIComponent(JSON.stringify(root)).match(/.{1,10000}/g);
if (chunks.length > 10) {
$.notify("Error saving to cloud: size limit exceeded", "error");
}
var requestData = {
TitleId: titleId,
PlayFabId: playFabId,
// convert array into object with numbers as keys
Data: $.extend({}, chunks)
}
try {
PlayFab.ClientApi.UpdateUserData(requestData, saveToPlayFabCallback);
} catch (e) {
console.log(e);
}
}
function saveToPlayFabCallback(data, error) {
if (error) {
console.log(error);
return false;
}
if (data) {
console.log("Game Saved!");
$.notify("Game saved to cloud", "info")
save_game()
return true;
}
}
function loadFromPlayFab(callback) {
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined') {
console.log(playFabId, PlayFab);
return false;
}
var requestData = {
Keys: ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "save"],
PlayFabId: playFabId
}
try {
console.log('attempting to send load request');
PlayFab.ClientApi.GetUserData(requestData, loadFromPlayFabCallback.bind(this, callback));
console.log('sent load request');
} catch (e) {
console.log(e);
}
}
function loadFromPlayFabCallback(callback, data, error) {
console.log('loading callback fired');
console.log(data, error);
if (error) {
console.log(error);
return;
}
if (data) {
// Start: Migration
if (data.data.Data.save) {
var oldSave = JSON.parse(LZString.decompressFromEncodedURIComponent(data.data.Data.save.Value));
var requestData = {
TitleId: titleId,
PlayFabId: playFabId,
// convert array into object with numbers as keys
Data: {
save: null,
infinitied: null,
eternities: null
}
}
try {
PlayFab.ClientApi.UpdateUserData(requestData, function(_, error) {
if (error) alert("Error migrating cloud saves, please report this.");
var newRoot = {
current: 0,
saves: {
0: oldSave,
1: null,
2: null
}
};
saveToPlayFab(newRoot);
callback(newRoot);
});
} catch (e) {
console.log(e);
}
} else {
var root = getRootFromChunks(data.data.Data);
callback(root);
}
if (data){
var playFabInfinitied = (data.data.Data.infinitied) ? parseInt(data.data.Data.infinitied.Value) : 0;
var playFabEternities = (data.data.Data.eternities) ? parseInt(data.data.Data.eternities.Value) : 0;
if (playFabEternities > player.eternities){
document.getElementById("saveCloud").style.display = "block";
document.getElementById("savePopup").innerHTML = "You have a cloud save with "+playFabInfinitied+ " Infinities and "+playFabEternities+" Eternities your local save has "+player.infinitied+" Infinities and "+player.eternities+" Eternities. Do you want to overwrite the cloud save?"
return;
}
else if (playFabEternities == player.eternities && playFabInfinitied > player.infinitied){
document.getElementById("saveCloud").style.display = "block";
document.getElementById("savePopup").innerHTML = "You have a cloud save with "+playFabInfinitied+ " Infinities and "+playFabEternities+" Eternities your local save has "+player.infinitied+" Infinities and "+player.eternities+" Eternities. Do you want to overwrite the cloud save?"
// End: Migration
}
}
function getRootFromChunks(chunks) {
// merge chunks back together
return JSON.parse(LZString.decompressFromEncodedURIComponent(
Object.values(chunks)
.map(function(val) {
return val.Value;
})
.join("")
));
}
function playFabLoadCheck() {
var cloudconflict = document.getElementById("cloudloadconflict");
loadFromPlayFab(function(cloudRoot) {
$.notify("Loaded from cloud", "info")
for (var i = 0; i < 3; i++) {
let saveId = i;
if (!cloudRoot.saves[saveId] || !saves[saveId]) {
return;
}
else saveToPlayFab();
}
}
function saveToPlayFab(){
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined') return false;
var requestData = {
TitleId: "5695",
PlayFabId: playFabId,
Data: {
save: LZString.compressToEncodedURIComponent(JSON.stringify(player)),
infinitied: player.infinitied,
eternities: player.eternities
}
}
try{
PlayFab.ClientApi.UpdateUserData(requestData, saveToPlayFabCallback);
}
catch(e){console.log(e);}
}
function saveToPlayFabCallback(data, error){
if (error){
console.log(error);
return false;
}
if (data){
console.log("Game Saved!");
$.notify("Game saved to cloud", "info")
save_game()
return true;
}
}
function loadFromPlayFab(){
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined'){
console.log(playFabId, PlayFab);
return false;
}
var requestData = {
Keys: ["save"],
PlayFabId: playFabId
}
try{
console.log('attempting to send load request');
PlayFab.ClientApi.GetUserData(requestData, loadFromPlayFabCallback);
console.log('sent load request');
}
catch(e){console.log(e);}
}
function loadFromPlayFabCallback(data, error){
console.log('loading callback fired');
console.log(data, error);
if (error){
console.log(error);
return;
}
if (data){
console.log(data)
$.notify("Loaded from cloud", "info")
var id = playFabId;
loadFromString(data.data.Data.save.Value);
}
}
function playFabLoadCheck() {
if (!playFabId || typeof PlayFab === 'undefined' || typeof PlayFab.ClientApi === 'undefined'){
console.log(playFabId, PlayFab);
return false;
}
var requestData = {
Keys: ["infinitied", "eternities"],
PlayFabId: playFabId
}
try{
console.log('attempting to send load request');
PlayFab.ClientApi.GetUserData(requestData, playFabLoadCheckCallback);
console.log('sent load request');
}
catch(e){console.log(e);}
}
function playFabLoadCheckCallback(data, error) {
if (error){
console.log("error checking existing PlayFab data");
console.log(error);
return;
}
if (data){
var playFabInfinitied = (data.data.Data.infinitied) ? parseInt(data.data.Data.infinitied.Value) : 0;
var playFabEternities = (data.data.Data.eternities) ? parseInt(data.data.Data.eternities.Value) : 0;
if (playFabInfinitied <= player.infinitied && playFabEternities <= player.eternities){
document.getElementById("loadCloud").style.display = "block";
document.getElementById("loadPopup").innerHTML = "You have a cloud save with "+playFabInfinitied+ " Infinities and "+playFabEternities+" Eternities your local save has "+player.infinitied+" Infinities and "+player.eternities+" Eternities. Do you want to load the cloud save?"
return;
}
else loadFromPlayFab();
}
}
function toggleCloud() {
if (player.options.cloud) {
player.options.cloud = false
document.getElementById("cloud").innerHTML = "Automatic cloud saving/loading OFF"
var cloudInfinitied = cloudRoot.saves[saveId].infinitied;
var cloudEternities = cloudRoot.saves[saveId].eternities;
var localInfinitied = saves[saveId].infinitied;
var localEternities = saves[saveId].eternities;
if (cloudEternities < localEternities || (cloudEternities == localEternities && cloudInfinitied < localInfinitied)) {
let el = cloudconflict.cloneNode(true);
el.style.display = "flex";
var localEl = el.querySelector("#local");
var cloudEl = el.querySelector("#cloud");
localEl.querySelector(".save_id").textContent = saveId + 1;
localEl.querySelector(".save_infinities").textContent = localInfinitied;
localEl.querySelector(".save_eternities").textContent = localEternities;
localEl.querySelector(".storebtn").onclick = function() {
el.remove();
};
cloudEl.querySelector(".save_id").textContent = saveId + 1;
cloudEl.querySelector(".save_infinities").textContent = cloudInfinitied;
cloudEl.querySelector(".save_eternities").textContent = cloudEternities;
cloudEl.querySelector(".storebtn").onclick = function() {
load_cloud_save(saveId, cloudRoot.saves[saveId]);
el.remove();
};
document.body.appendChild(el);
} else {
player.options.cloud = true
document.getElementById("cloud").innerHTML = "Automatic cloud saving/loading ON"
load_cloud_save(saveId, cloudRoot.saves[saveId]);
}
}
}
});
}
function playFabSaveCheck() {
var cloudconflict = document.getElementById("cloudsaveconflict");
loadFromPlayFab(function(cloudRoot) {
let popupsWaiting = 0;
function decreaseWaiting() {
popupsWaiting--;
if (popupsWaiting <= 0) {
saveToPlayFab(cloudRoot);
}
}
for (var i = 0; i < 3; i++) {
let saveId = i;
var cloudInfinitied = cloudRoot.saves[saveId].infinitied;
var cloudEternities = cloudRoot.saves[saveId].eternities;
var localInfinitied = saves[saveId].infinitied;
var localEternities = saves[saveId].eternities;
if (cloudEternities > localEternities || (cloudEternities == localEternities && cloudInfinitied > localInfinitied)) {
popupsWaiting++;
let el = cloudconflict.cloneNode(true);
el.style.display = "flex";
var localEl = el.querySelector("#local");
var cloudEl = el.querySelector("#cloud");
localEl.querySelector(".save_id").textContent = saveId + 1;
localEl.querySelector(".save_infinities").textContent = localInfinitied;
localEl.querySelector(".save_eternities").textContent = localEternities;
cloudEl.querySelector(".save_id").textContent = saveId + 1;
cloudEl.querySelector(".save_infinities").textContent = cloudInfinitied;
cloudEl.querySelector(".save_eternities").textContent = cloudEternities;
el.querySelector(".no").onclick = function() {
decreaseWaiting();
el.remove();
};
el.querySelector(".yes").onclick = function() {
cloudRoot.saves[saveId] = saves[saveId];
decreaseWaiting();
el.remove();
};
document.body.appendChild(el);
} else {
cloudRoot.saves[saveId] = saves[saveId];
}
}
if (popupsWaiting === 0) decreaseWaiting();
});
}
function toggleCloud() {
if (player.options.cloud) {
player.options.cloud = false
document.getElementById("cloud").innerHTML = "Automatic cloud saving/loading OFF"
} else {
player.options.cloud = true
document.getElementById("cloud").innerHTML = "Automatic cloud saving/loading ON"
}
}

View File

@ -1786,6 +1786,23 @@ document.getElementById("save").onclick = function () {
save_game();
};
document.getElementById("load").onclick = function () {
for (var i = 0; i < 3; i++) {
var _break = player.break;
player.break = true;
document.querySelector("#save" + (i + 1) + " .save_antimatter").textContent = "Antimatter: " + shortenMoney(saves[i] ? new Decimal(saves[i].money) : 10);
player.break = _break;
}
document.querySelectorAll(".save_selected").forEach(function(el) {
el.style.display = "none";
});
document.querySelector("#save" + (currentSave + 1) + " .save_selected").style.display = "inline";
document.getElementById("loadmenu").style.display = "flex";
};
function verify_save(obj) {
if (typeof obj != 'object') return false;
@ -1794,7 +1811,7 @@ function verify_save(obj) {
}
document.getElementById("importbtn").onclick = function () {
var save_data = prompt("Input your save.");
var save_data = prompt("Input your save. (your current save file will be overwritten!)");
if (save_data.constructor !== String) save_data = "";
if (sha512_256(save_data.replace(/\s/g, '').toUpperCase()) === "80b7fdc794f5dfc944da6a445a3f21a2d0f7c974d044f2ea25713037e96af9e3") {
document.getElementById("body").style.animation = "barrelRoll 5s 1";
@ -1824,7 +1841,8 @@ document.getElementById("importbtn").onclick = function () {
alert('could not load the save..');
load_custom_game();
return;
}
}
saved = 0;
totalMult = 1
currentMult = 1
@ -1849,8 +1867,8 @@ document.getElementById("importbtn").onclick = function () {
document.getElementById("reset").onclick = function () {
if (confirm("Do you really want to erase all your progress?")) {
if (window.location.href.split("//")[1].length > 20) set_save('dimensionSave', defaultStart);
else set_save('dimensionTestSave', defaultStart);
if (window.location.href.split("//")[1].length > 20) set_save('dimensionTestSave', currentSave, defaultStart);
else set_save('dimensionSave', currentSave, defaultStart);
player = defaultStart
infDimPow = 1;
save_game();

View File

@ -33,7 +33,7 @@ button {
#TTbuttons {
font-family: Typewriter;
}
#news {
color: #000000;
/*transition: transform 1s;*/
@ -46,7 +46,7 @@ button {
}
.challengesbtn {
width:150px;
height: 30px;
color: black;
@ -86,7 +86,7 @@ button {
left: 0;
bottom: 5px;
}
.challengediv {
display:table;
text-align:center;
@ -438,7 +438,7 @@ button {
position: absolute;
font-size: 12px;
width: 150px;
}
}
.EPAmount2 {
font-weight: bold;
@ -631,7 +631,7 @@ button {
position: relative;
top: 50%;
left: 40%;
}
.crunchbtn:hover {
@ -644,9 +644,10 @@ button {
}
.popup {
position: absolute;
left: 33%;
top: 33%;
position: absolute;
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
border: 3px solid black;
width: 300px;
height: 120px;
@ -661,6 +662,38 @@ button {
display: none;
}
.savemenu {
flex-direction: column;
justify-content: center;
align-items: center;
height: 300px;
}
.savemenu div {
display: flex;
flex-direction: column;
align-items: center;
margin: 10px;
}
.savemenu .closebtn {
width: 30px;
height: 30px;
font-size: 1.5rem;
line-height: 1.5rem;
position: absolute;
top: 5px;
right: 5px;
}
.savemenu .storebtn {
margin: 5px;
}
.save_selected {
display: none;
}
#footercontainer {
bottom: 0;
position: fixed;
@ -950,7 +983,7 @@ button {
font-size: 0.85rem;
position: fixed;
left: 50%;
bottom: 5px;
z-index: 1;
}