diff --git a/.env.steam-release b/.env.steam-release index 992125b52..c550d0b7d 100644 --- a/.env.steam-release +++ b/.env.steam-release @@ -1,2 +1 @@ -VUE_APP_DEV=false VUE_APP_STEAM=true diff --git a/javascripts/core/app/modal.js b/javascripts/core/app/modal.js index 5f4c02476..76679878f 100644 --- a/javascripts/core/app/modal.js +++ b/javascripts/core/app/modal.js @@ -2,7 +2,6 @@ import { ProgressChecker } from "../storage/progress-checker"; import CloudInvalidDataModal from "@/components/modals/cloud/CloudInvalidDataModal"; import CloudLoadConflictModal from "@/components/modals/cloud/CloudLoadConflictModal"; -import CloudManualLoginModal from "@/components/modals/cloud/CloudManualLoginModal"; import CloudSaveConflictModal from "@/components/modals/cloud/CloudSaveConflictModal"; import EternityChallengeStartModal from "@/components/modals/challenges/EternityChallengeStartModal"; import InfinityChallengeStartModal from "@/components/modals/challenges/InfinityChallengeStartModal"; @@ -308,7 +307,6 @@ function getSaveInfo(save) { Modal.cloudSaveConflict = new Modal(CloudSaveConflictModal); Modal.cloudLoadConflict = new Modal(CloudLoadConflictModal); -Modal.manualCloud = new Modal(CloudManualLoginModal); Modal.cloudInvalidData = new Modal(CloudInvalidDataModal); // eslint-disable-next-line max-params Modal.addCloudConflict = function(saveId, saveComparison, cloudSave, localSave, onAccept) { @@ -350,4 +348,4 @@ Modal.message = new class extends Modal { this.currPriority = undefined; Modal.hide(); } -}(MessageModal, 2); \ No newline at end of file +}(MessageModal, 2); diff --git a/javascripts/core/globals.js b/javascripts/core/globals.js index 82ced48ca..4280be340 100644 --- a/javascripts/core/globals.js +++ b/javascripts/core/globals.js @@ -92,5 +92,3 @@ export * from "./ui/tab-notifications"; export * from "./speedrun"; export * from "./automator/script-templates"; - -export * from "./discord-parser"; diff --git a/javascripts/core/secret-formula/news.js b/javascripts/core/secret-formula/news.js index 076479be3..ac5048a02 100644 --- a/javascripts/core/secret-formula/news.js +++ b/javascripts/core/secret-formula/news.js @@ -460,7 +460,7 @@ GameDatabase.news = [ ]; const game = games.randomElement(); return `An unidentified developer of Antimatter Dimensions would like to - recommend that you play ${game.name}`; + recommend that you play ${game.name}`; }, }, { @@ -2200,7 +2200,7 @@ GameDatabase.news = [ id: "a346", text: `Did you know Antimatter Dimensions is also available on Android? + href="https://play.google.com/store/apps/details?id=kajfosz.antimatterdimensions" target="_blank"> Click here to check it out!` }, { diff --git a/javascripts/core/secret-formula/shop-purchases.js b/javascripts/core/secret-formula/shop-purchases.js index 473bd2a7b..906718fa2 100644 --- a/javascripts/core/secret-formula/shop-purchases.js +++ b/javascripts/core/secret-formula/shop-purchases.js @@ -1,3 +1,4 @@ +import { STEAM } from "@/env"; import { GameDatabase } from "./game-database"; // NOTE: IF ANY COSTS ARE CHANGED HERE, THEY ALSO NEED TO BE CHANGED ON THE BACKEND TOO @@ -99,7 +100,7 @@ GameDatabase.shopPurchases = { }, isUnlocked: () => PlayerProgress.realityUnlocked(), lockText: "Reality", - },/* + }, allCosmeticSets: { key: "allCosmeticSets", cost: () => { @@ -121,5 +122,9 @@ GameDatabase.shopPurchases = { }, isUnlocked: () => PlayerProgress.realityUnlocked(), lockText: "Reality", - },*/ + }, }; + +if (STEAM) { + delete GameDatabase.shopPurchases.allCosmeticSets; +} diff --git a/javascripts/core/storage/cloud-saving.js b/javascripts/core/storage/cloud-saving.js index dac7ef430..2b087806b 100644 --- a/javascripts/core/storage/cloud-saving.js +++ b/javascripts/core/storage/cloud-saving.js @@ -1,17 +1,23 @@ /* eslint-disable import/extensions */ -import { SteamRuntime } from "@/steam"; +import { STEAM } from "@/env"; import pako from "pako/dist/pako.esm.mjs"; /* eslint-enable import/extensions */ -//import { get, getDatabase, ref, set } from "firebase/database"; -//import { getAuth, GoogleAuthProvider, signInWithPopup, signOut } from "firebase/auth"; +import { + createUserWithEmailAndPassword, + getAuth, + GoogleAuthProvider, + signInWithEmailAndPassword, + signInWithPopup, + signOut +} from "firebase/auth"; +import { get, getDatabase, ref, set } from "firebase/database"; import { initializeApp } from "firebase/app"; -import { getAuth, signInWithPopup, signInWithEmailAndPassword, createUserWithEmailAndPassword, signOut, GoogleAuthProvider } from "firebase/auth"; -import { getDatabase, ref, get, set } from "firebase/database"; import { sha512_256 } from "js-sha512"; import { decodeBase64Binary } from "./base64-binary"; import { ProgressChecker } from "./progress-checker"; +import { SteamRuntime } from "@/steam"; const firebaseConfig = { apiKey: "AIzaSyDuRTTluAFufmvw1zxGH6fsyEHmmbu8IHI", @@ -56,43 +62,24 @@ export const Cloud = { async loginWithSteam(accountId, staticAccountId, screenName) { if (this.loggedIn) { Cloud.user.displayName = screenName; - return true; + return; } const email = `${accountId}@ad.com`; const pass = staticAccountId; try { - await Cloud.manualCloudCreate(email, pass); + await createUserWithEmailAndPassword(this.auth, email, pass); } catch { try { - await Cloud.manualCloudLogin(email, pass); + await signInWithEmailAndPassword(this.auth, email, pass); } catch (error) { // eslint-disable-next-line no-console console.log(`Firebase Login Error: ${error}`); - return false; + return; } } Cloud.user.displayName = screenName; - return true; - }, - - async manualCloudLogin(EmailAddress,Password) { - //try{ - await signInWithEmailAndPassword(this.auth, EmailAddress, Password) - /*}catch(error){ - console.log(`Could Not Login (Error: ${error}`) - Cloud.manualCloudCreate(EmailAddress,Password) - }*/ - }, - - async manualCloudCreate(EmailAddress,Password) { - //try{ - await createUserWithEmailAndPassword(this.auth, EmailAddress, Password); - /*}catch(error){ - console.log(`Could Not Create (Error: ${error}`) - Cloud.manualCloudLogin(EmailAddress,Password) - }*/ }, // NOTE: This function is largely untested due to not being used at any place within web reality code @@ -171,7 +158,14 @@ export const Cloud = { const slot = GameStorage.currentSlot; this.writeToCloudDB(slot, serializedSave); - GameUI.notify.info(`Game saved (slot ${slot + 1}) to cloud as user ${this.user.displayName}`) + + if (STEAM) { + GameUI.notify.info(`Game saved (slot ${slot + 1}) to cloud as user ${this.user.displayName}`); + return; + } + + if (player.options.hideGoogleName) GameUI.notify.info(`Game saved (slot ${slot + 1}) to cloud`); + else GameUI.notify.info(`Game saved (slot ${slot + 1}) to cloud as user ${this.user.displayName}`); }, async loadCheck() { @@ -188,7 +182,14 @@ export const Cloud = { // eslint-disable-next-line no-loop-func const overwriteLocalSave = () => { GameStorage.overwriteSlot(saveId, cloudSave); - GameUI.notify.info(`Cloud save loaded`);/* for user ${this.user.displayName}`);*/ + + if (STEAM) { + GameUI.notify.info(`Cloud save loaded`); + return; + } + + if (player.options.hideGoogleName) GameUI.notify.info(`Cloud save (slot ${saveId + 1}) loaded`); + else GameUI.notify.info(`Cloud save (slot ${saveId + 1}) loaded for user ${this.user.displayName}`); }; // If the comparison fails, we assume the cloud data is corrupted and show the relevant modal @@ -258,12 +259,16 @@ export const Cloud = { if (user) { this.user = { id: user.uid, - displayName: SteamRuntime.isActive + displayName: STEAM ? SteamRuntime.screenName : user.displayName, email: user.email, }; - SteamRuntime.syncIap(); + if (STEAM) { + SteamRuntime.syncIAP(); + } else { + ShopPurchaseData.syncSTD(); + } } else { this.user = null; } diff --git a/javascripts/core/storage/storage.js b/javascripts/core/storage/storage.js index 6a99254ef..66d5863b8 100644 --- a/javascripts/core/storage/storage.js +++ b/javascripts/core/storage/storage.js @@ -1,10 +1,8 @@ -import { SteamRuntime } from "@/steam"; import * as ADNotations from "@antimatter-dimensions/notations"; import { DEV } from "@/env"; import { deepmergeAll } from "@/utility/deepmerge"; -import { Achievement } from "../achievements/normal-achievement"; export const GameStorage = { currentSlot: 0, diff --git a/src/components/modals/StdStoreRow.vue b/src/components/modals/StdStoreRow.vue index f076eb0a6..4936ed4be 100644 --- a/src/components/modals/StdStoreRow.vue +++ b/src/components/modals/StdStoreRow.vue @@ -1,4 +1,5 @@ - - diff --git a/src/components/modals/options/HotkeysModal.vue b/src/components/modals/options/HotkeysModal.vue index 79e180e8a..30945dab7 100644 --- a/src/components/modals/options/HotkeysModal.vue +++ b/src/components/modals/options/HotkeysModal.vue @@ -11,7 +11,8 @@ export default { updateIndicies: [], visible: [], timeStudyUnlocked: false, - glyphSacUnlocked: false + glyphSacUnlocked: false, + isElectron: false }; }, computed: { @@ -57,6 +58,7 @@ export default { const progress = PlayerProgress.current; this.timeStudyUnlocked = progress.isEternityUnlocked; this.glyphSacUnlocked = RealityUpgrade(19).isBought; + this.isElectron = ElectronRuntime.isActive; }, format(x) { switch (x) { @@ -147,22 +149,25 @@ export default { a numpad key with shift will not buy a single Dimension. It may instead, depending on your device, cause the page to scroll or change game tabs. alt will still work as expected. -
-
- Window Zoom - -0+ -
- - To adjust zoom level, hold ctrl and press either - or + to decrease or increase zoom. ctrl0 will reset zoom to 100%. - -
-
- Fullscreen - F10 -
- - To enter or exit fullscreen, press F10. - + diff --git a/src/components/tabs/options-saving/OptionsSavingTab.vue b/src/components/tabs/options-saving/OptionsSavingTab.vue index eb6d8426d..9077156e0 100644 --- a/src/components/tabs/options-saving/OptionsSavingTab.vue +++ b/src/components/tabs/options-saving/OptionsSavingTab.vue @@ -5,6 +5,8 @@ import OptionsButton from "@/components/OptionsButton"; import PrimaryToggleButton from "@/components/PrimaryToggleButton"; import SaveFileName from "./SaveFileName"; +import { STEAM } from "@/env"; + export default { name: "OptionsSavingTab", components: { @@ -38,6 +40,9 @@ export default { return this.forceCloudOverwrite ? `Your local save will always overwrite your cloud save no matter what.` : `Save conflicts will prevent your local save from being saved to the cloud.`; + }, + STEAM() { + return STEAM; } }, watch: { @@ -192,23 +197,33 @@ export default { Cloud Saving has been disabled on this save.
- + +
-import { ElectronRuntime } from "@/steam"; -import SliderComponent from "@/components/SliderComponent"; - -export default { - name: "ZoomLevelSlider", - components: { - SliderComponent - }, - data() { - return { - zoomLevel: 0 - }; - }, - computed: { - sliderProps() { - return { - min: 50, - max: 150, - interval: 10, - width: "100%", - tooltip: false - }; - } - }, - methods: { - update() { - this.zoomLevel = Math.round(ElectronRuntime.zoomFactor * 100); - }, - adjustSliderValue(value) { - this.zoomLevel = value; - ElectronRuntime.zoomLevel = Math.round(value / 10) / 10; - } - } -}; - - - diff --git a/src/components/tabs/shop/ShopTab.vue b/src/components/tabs/shop/ShopTab.vue index 176a3dcd6..3002a0009 100644 --- a/src/components/tabs/shop/ShopTab.vue +++ b/src/components/tabs/shop/ShopTab.vue @@ -30,19 +30,14 @@ export default { }; }, computed: { + STEAM() { + return STEAM; + }, purchases() { return ShopPurchase.all; }, - buySTDText() { - return STEAM ? "Buy More" : "Play Online on Steam to buy STDs"; - } - }, - watch: { - IAPsDisabled(newValue) { - player.IAP.disabled = newValue; - }, enableText() { - return `In-app Purchases: ${player.IAP.enabled ? "Enabled" : "Disabled"}`; + return `In-app Purchases: ${this.IAPsEnabled ? "Enabled" : "Disabled"}`; }, respecText() { if (!this.loggedIn) return "Not logged in!"; @@ -114,30 +109,37 @@ export default { label="Disable in-app-purchases:" @click="toggleEnable()" > - {{ `In-app Purchases: ${IAPsEnabled ? "Enabled" : "Disabled"}` }} + {{ enableText }} - +
- +
- You are logged in as {{ username }}. - + +
} diff --git a/src/steam/bindings/greenworks.js b/src/steam/bindings/greenworks.js index f65396a2a..9c6c188d1 100644 --- a/src/steam/bindings/greenworks.js +++ b/src/steam/bindings/greenworks.js @@ -1,4 +1,4 @@ -import { NodeModule } from "../node-module"; +import { NodeModule } from "./node-module"; /** * @type {NodeModule} diff --git a/src/steam/node-module.js b/src/steam/bindings/node-module.js similarity index 100% rename from src/steam/node-module.js rename to src/steam/bindings/node-module.js diff --git a/src/steam/steam-purchases.js b/src/steam/steam-purchases.js index c2a8e5f5d..644888365 100644 --- a/src/steam/steam-purchases.js +++ b/src/steam/steam-purchases.js @@ -8,7 +8,7 @@ export function hasPendingPurchaseConfirmations() { return MAC && pendingConfirmations.length > 0; } -export async function purchaseIap(std) { +export async function purchaseIAP(std) { const itemId = `${std}STD`; const quantity = 1; const annotation = "Purchased via in-game store"; @@ -51,10 +51,10 @@ async function validatePurchase(orderId) { pendingConfirmations = pendingConfirmations.filter(item => item !== orderId); await PlayFab.AddUserVirtualCurrency(stdsBought, "ST"); GameUI.notify.info(`${stdsBought} STDs Obtained!`); - syncIap(); + syncIAP(); } -export async function syncIap() { +export async function syncIAP() { const userInventory = await PlayFab.GetUserInventory(); ShopPurchaseData.totalSTD = userInventory.VirtualCurrency?.ST ?? 0; for (const key of Object.keys(GameDatabase.shopPurchases)) { @@ -71,7 +71,7 @@ export async function syncIap() { export async function purchaseShopItem(key, cost, cosmeticName) { await PlayFab.PurchaseItem(key, cost, "ST"); await storeCosmetic(cosmeticName); - syncIap(); + syncIAP(); } async function storeCosmetic(name) { diff --git a/src/steam/steam-runtime.js b/src/steam/steam-runtime.js index 1b63d582b..1e38cb34a 100644 --- a/src/steam/steam-runtime.js +++ b/src/steam/steam-runtime.js @@ -3,9 +3,9 @@ import { RichPresenceInfo } from "../../javascripts/core/discord-parser"; import { hasPendingPurchaseConfirmations, - purchaseIap, + purchaseIAP, purchaseShopItem, - syncIap, + syncIAP, validatePurchases } from "./steam-purchases"; @@ -72,12 +72,12 @@ export const SteamRuntime = { Greenworks.activateAchievement(`Achievement${id}`); }, - async purchaseIap(std) { + async purchaseIAP(std) { if (!this.isActive) { return; } - await purchaseIap(std); + await purchaseIAP(std); }, validatePurchases() { @@ -88,12 +88,12 @@ export const SteamRuntime = { validatePurchases(); }, - async syncIap() { + async syncIAP() { if (!this.isActive) { return; } - await syncIap(); + await syncIAP(); }, async purchaseShopItem(key, cost, cosmeticName) { @@ -127,6 +127,7 @@ async function loginPlayFab(steamId) { await PlayFab.LoginWithSteam(ticket.ticket.toString("hex"), screenName); PlayFab.UpdateUserTitleDisplayName(screenName); GameUI.notify.info("Logged in to PlayFab Cloud"); + syncIAP(); } catch (error) { GameUI.notify.error("Couldn't log in to PlayFab Cloud."); throw error; @@ -137,9 +138,7 @@ async function loginFirebase(steamId) { const accountId = steamId.accountId; const staticAccountId = steamId.staticAccountId; const screenName = steamId.screenName; - if (await Cloud.loginWithSteam(accountId, staticAccountId, screenName)) { - syncIap(); - } + await Cloud.loginWithSteam(accountId, staticAccountId, screenName); } function initializeDiscord() {