Skip to content

Commit

Permalink
fix the borkiness on starting up after update
Browse files Browse the repository at this point in the history
  • Loading branch information
onlypuppy7 committed Nov 24, 2024
1 parent b967c3c commit fd96792
Showing 1 changed file with 56 additions and 19 deletions.
75 changes: 56 additions & 19 deletions server-client/src/client-static/src/shellshock.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -2731,22 +2731,40 @@ function setGameTypeSelect() {
// [LS] Load Sequence: Startup
function onPageLoaded () {
alreadyLoaded = true;
devlog("onPageLoaded");
devlog("onPageLoaded", 0);

selectedServer = getStoredNumber("selectedServer", 0);
lastVer = getStoredString("lastVersionPlayed", version);
localStorage.setItem("lastVersionPlayed", version);

devlog("onPageLoaded", 1);

var lastZipTimes = getStoredString("lastZipTimes", 0);
localStorage.setItem("lastZipTimes", latestZipTimes);

devlog("onPageLoaded", 2);

localStorage.uuid = localStorage.uuid || Math.randomInt(1,4294967295);

if (lastVer != version || lastZipTimes != latestZipTimes) return (req = window.indexedDB.deleteDatabase(babylonDB)).onerror = function (event) {
window.location.reload(true)
}, void (req.onsuccess = function (event) {
window.location.reload(true)
});
devlog("onPageLoaded", 3);

var indexedDBdeleteDatabase;

if (lastVer != version || lastZipTimes != latestZipTimes) {
indexedDBdeleteDatabase = true;
var req = window.indexedDB.deleteDatabase(babylonDB)
return req.onerror = function (event) {
window.location.reload(true);
}, void (req.onsuccess = function (event) {
window.location.reload(true)
});
};

setTimeout(()=>{
if (indexedDBdeleteDatabase) window.location.reload(true);
}, 2500);

devlog("onPageLoaded", 4);

// var req;

Expand All @@ -2758,22 +2776,29 @@ function onPageLoaded () {
localStorage || (str += "<li>LocalStorage", missingFeatures++);
void 0 === new KeyboardEvent("").key && (str += "<li>KeyboardEvent.key", missingFeatures++);

devlog("onPageLoaded", 5);

if (0 < missingFeatures) {
str = 1 == missingFeatures ? "Your browser is missing a feature that LegacyShell requires:<br><ul>" + str + "</ul>" : "Your browser is missing features that LegacyShell requires:<br><ul>" + str + "</ul>";
openAlertDialog("Oh, no!", '<div style="text-align: left">' + (str += "Downloading the latest version of your browser of choice will usually correct this. Internet Explorer is not supported.") + "</div>");
} else {
devlog("onPageLoaded", 6);

chatInEl = document.getElementById("chatIn");
chatOutEl = document.getElementById("chatOut");
killEl = document.getElementById("killTicker");
"undefined" != typeof noAdBlock && (adBlock = false);

devlog("onPageLoaded", 7);

// document.getElementById("privacyOptionsLink").style.display = isFromEU ? "block" : "none";
gameType = getStoredNumber("gameType", 0);
devlog("onPageLoaded set gameType to", gameType);

gameTypeSelect.selectedIndex = -1;
setGameTypeSelect();

devlog("onPageLoaded", 8);

(function () {
var container = document.getElementById("bindingsContainer");
Expand All @@ -2791,18 +2816,28 @@ function onPageLoaded () {
var nameCell = document.createElement("span");
nameCell.className = "label", nameCell.innerText = getLocText("ui_settings_bind_" + settingsKeyNames[k]), row.appendChild(nameCell), container.appendChild(row)
};

devlog("onPageLoaded", 9);
}());

devlog("onPageLoaded", 10);

loadSettings();

devlog("onPageLoaded", 11);

refreshMapPool();

devlog("onPageLoaded", 12);

var playerList = document.getElementById("playerList");
var slotTemplate = document.getElementById("playerSlot");
for (i = 0; i < maxServerSlots; i++) {
var slot = slotTemplate.cloneNode(true);
playerList.appendChild(slot)
};

devlog("onPageLoaded", 13);

for (var containerEl = document.getElementById("leaderboard"), team = 0; team < 3; team++) {
var teamEl = document.getElementById("teamSummary").cloneNode(true);
Expand All @@ -2814,6 +2849,8 @@ function onPageLoaded () {
};
containerEl.appendChild(teamEl)
};

devlog("onPageLoaded", 14);

fetchTwitchStreams();
fetchServicesInfo();
Expand Down Expand Up @@ -3495,21 +3532,21 @@ function loadSounds(onComplete) { //6th, loads sounds (who knew?)
};

function loadObjectMeshes (scene, onComplete) { //7th, loads basically all the things in the models/ folder (name from deobf leak)
// loadMeshes(scene, "models.zip", null, onComplete);
loadMeshes(scene, "models.zip?LEGACYSHELLMAPZIPTIMESTAMP", null, onComplete);

//old
loadMeshes(scene, [
"egg",
"gun_eggk47",
"gun_csg1",
"gun_cluck9mm",
"gun_dozenGauge",
"gun_rpegg",
"munitions",
"muzzleFlash",
"items",
"reticle"
], null, onComplete);
// loadMeshes(scene, [
// "egg",
// "gun_eggk47",
// "gun_csg1",
// "gun_cluck9mm",
// "gun_dozenGauge",
// "gun_rpegg",
// "munitions",
// "muzzleFlash",
// "items",
// "reticle"
// ], null, onComplete);
};

//8th is defined below from the import
Expand Down

0 comments on commit fd96792

Please sign in to comment.