Skip to content

Commit

Permalink
emergency hotfix
Browse files Browse the repository at this point in the history
geode and mystery boxes better handle not having any player IDs now
  • Loading branch information
MouseyPounds committed Apr 18, 2024
1 parent d8664b6 commit cecbc9a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ <h3>Mystery Boxes</h3>
<p>Golden Mystery Boxes have a slightly different drop pool if the player has unlocked the farming mastery perk. Because of the order of the random rolls, this results in the item chosen usually being different. In this case we handle the difference by having 2 separate Golden Mystery Box result lists.</p>
<p>If the result is "Seasonal Seeds" the type of seed is an unpredictable roll based on current season (with all possible in winter). Possibilities include Cauliflower, Green Bean, Parsnip, Potato, Pepper, Radish, Wheat, Corn, Eggplant, Artichoke, and Pumpkin.</p>
<p>If the result is "Raccoon Seeds" the type of seed is the same as you would get from seed dig spots on that day. Possibilities include Carrot, Summer Squash, Broccoli, and Powdermelon.</p>
<p class="note" id="mystery-note"></p>
<fieldset id="mystery-player">
Select Player: <select id="mystery-player-select" class="player">
</select><br />
Expand Down
36 changes: 30 additions & 6 deletions stardew-predictor.js
Original file line number Diff line number Diff line change
Expand Up @@ -5906,8 +5906,14 @@ window.onload = function () {
// their content roll happens at the same time as the rng.NextDouble() < 0.5 check. Unfortunately, that also
// means we have to do all the warmups on both RNGs.
if (compareSemVer(save.version, "1.6") >= 0) {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
if (typeof(save.mp_ids) !== 'undefined') {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
} else {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, 0));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, 0));
$('#geode-note').html('Note: No players found; predictions will not be reliable for game version >= 1.6');
}
} else {
rng = new CSRandom(numCracked + save.gameID / 2);
rngTrove = new CSRandom(numCracked + save.gameID / 2);
Expand Down Expand Up @@ -6156,8 +6162,14 @@ window.onload = function () {
item = ['Stone', 'Stone', 'Stone', 'Stone'];
itemQty = [1, 1, 1, 1];
if (compareSemVer(save.version, "1.6") >= 0) {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
if (typeof(save.mp_ids) !== 'undefined') {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
} else {
rng = new CSRandom(getRandomSeed(numCracked, save.gameID/2, 0));
rngTrove = new CSRandom(getRandomSeed(numCracked, save.gameID/2, 0));
$('#geode-note').html('Note: No players found; predictions will not be reliable for game version >= 1.6');
}
} else {
rng = new CSRandom(numCracked + save.gameID / 2);
rngTrove = new CSRandom(numCracked + save.gameID / 2);
Expand Down Expand Up @@ -6434,7 +6446,12 @@ window.onload = function () {
for (c = 0; c < numColumns; c++) {
var rareMod = (c === 0 ? 1 : 2);
var extraBookChance = save.gotMysteryBook ? 0 : 0.0004 * numOpened;
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
if (typeof(save.mp_ids) !== 'undefined') {
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
} else {
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, 0));
$('#mystery-note').html('Note: No players found; predictions will not be reliable for game version >= 1.6');
}
var i, j, prewarm_amount2 = rng.Next(1,10);
for (j = 0; j < prewarm_amount2; j++) {
rng.NextDouble();
Expand Down Expand Up @@ -6697,7 +6714,13 @@ window.onload = function () {
for (c = 0; c < numColumns; c++) {
var rareMod = (c === 0 ? 1 : 2);
var extraBookChance = save.gotMysteryBook ? 0 : 0.0004 * numOpened;
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
if (typeof(save.mp_ids) !== 'undefined') {
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, bigIntToSigned32(save.mp_ids[whichPlayer])/2));
} else {
rng = new CSRandom(getRandomSeed(numOpened, save.gameID/2, 0));
$('#mystery-note').html('Note: No players found; predictions will not be reliable for game version >= 1.6');
}

var i, j, prewarm_amount2 = rng.Next(1,10);
for (j = 0; j < prewarm_amount2; j++) {
rng.NextDouble();
Expand Down Expand Up @@ -9217,4 +9240,5 @@ Object.keys(test).forEach(function(key, index) { if (test[key].s > 0 && test[key
} else if ($.QueryString.hasOwnProperty("id")) {
updateOutput();
}

};

0 comments on commit cecbc9a

Please sign in to comment.