Fix inconsistencies with master

This commit is contained in:
Andrei Andreev 2023-02-16 20:17:23 +01:00
parent f645068afb
commit 0b048d78e7
19 changed files with 134 additions and 239 deletions

View File

@ -1,2 +1 @@
VUE_APP_DEV=false
VUE_APP_STEAM=true VUE_APP_STEAM=true

View File

@ -2,7 +2,6 @@ import { ProgressChecker } from "../storage/progress-checker";
import CloudInvalidDataModal from "@/components/modals/cloud/CloudInvalidDataModal"; import CloudInvalidDataModal from "@/components/modals/cloud/CloudInvalidDataModal";
import CloudLoadConflictModal from "@/components/modals/cloud/CloudLoadConflictModal"; import CloudLoadConflictModal from "@/components/modals/cloud/CloudLoadConflictModal";
import CloudManualLoginModal from "@/components/modals/cloud/CloudManualLoginModal";
import CloudSaveConflictModal from "@/components/modals/cloud/CloudSaveConflictModal"; import CloudSaveConflictModal from "@/components/modals/cloud/CloudSaveConflictModal";
import EternityChallengeStartModal from "@/components/modals/challenges/EternityChallengeStartModal"; import EternityChallengeStartModal from "@/components/modals/challenges/EternityChallengeStartModal";
import InfinityChallengeStartModal from "@/components/modals/challenges/InfinityChallengeStartModal"; import InfinityChallengeStartModal from "@/components/modals/challenges/InfinityChallengeStartModal";
@ -308,7 +307,6 @@ function getSaveInfo(save) {
Modal.cloudSaveConflict = new Modal(CloudSaveConflictModal); Modal.cloudSaveConflict = new Modal(CloudSaveConflictModal);
Modal.cloudLoadConflict = new Modal(CloudLoadConflictModal); Modal.cloudLoadConflict = new Modal(CloudLoadConflictModal);
Modal.manualCloud = new Modal(CloudManualLoginModal);
Modal.cloudInvalidData = new Modal(CloudInvalidDataModal); Modal.cloudInvalidData = new Modal(CloudInvalidDataModal);
// eslint-disable-next-line max-params // eslint-disable-next-line max-params
Modal.addCloudConflict = function(saveId, saveComparison, cloudSave, localSave, onAccept) { Modal.addCloudConflict = function(saveId, saveComparison, cloudSave, localSave, onAccept) {

View File

@ -92,5 +92,3 @@ export * from "./ui/tab-notifications";
export * from "./speedrun"; export * from "./speedrun";
export * from "./automator/script-templates"; export * from "./automator/script-templates";
export * from "./discord-parser";

View File

@ -460,7 +460,7 @@ GameDatabase.news = [
]; ];
const game = games.randomElement(); const game = games.randomElement();
return `An unidentified developer of Antimatter Dimensions would like to return `An unidentified developer of Antimatter Dimensions would like to
recommend that you play <a href='${game.link}' target='_blank'>${game.name}</a>`; recommend that you play <a href="${game.link}" target="_blank">${game.name}</a>`;
}, },
}, },
{ {
@ -2200,7 +2200,7 @@ GameDatabase.news = [
id: "a346", id: "a346",
text: text:
`Did you know Antimatter Dimensions is also available on Android? <a `Did you know Antimatter Dimensions is also available on Android? <a
href='https://play.google.com/store/apps/details?id=kajfosz.antimatterdimensions' target='_blank'> href="https://play.google.com/store/apps/details?id=kajfosz.antimatterdimensions" target="_blank">
Click here to check it out!<a>` Click here to check it out!<a>`
}, },
{ {

View File

@ -1,3 +1,4 @@
import { STEAM } from "@/env";
import { GameDatabase } from "./game-database"; import { GameDatabase } from "./game-database";
// NOTE: IF ANY COSTS ARE CHANGED HERE, THEY ALSO NEED TO BE CHANGED ON THE BACKEND TOO // 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(), isUnlocked: () => PlayerProgress.realityUnlocked(),
lockText: "Reality", lockText: "Reality",
},/* },
allCosmeticSets: { allCosmeticSets: {
key: "allCosmeticSets", key: "allCosmeticSets",
cost: () => { cost: () => {
@ -121,5 +122,9 @@ GameDatabase.shopPurchases = {
}, },
isUnlocked: () => PlayerProgress.realityUnlocked(), isUnlocked: () => PlayerProgress.realityUnlocked(),
lockText: "Reality", lockText: "Reality",
},*/ },
}; };
if (STEAM) {
delete GameDatabase.shopPurchases.allCosmeticSets;
}

View File

@ -1,17 +1,23 @@
/* eslint-disable import/extensions */ /* eslint-disable import/extensions */
import { SteamRuntime } from "@/steam"; import { STEAM } from "@/env";
import pako from "pako/dist/pako.esm.mjs"; import pako from "pako/dist/pako.esm.mjs";
/* eslint-enable import/extensions */ /* eslint-enable import/extensions */
//import { get, getDatabase, ref, set } from "firebase/database"; import {
//import { getAuth, GoogleAuthProvider, signInWithPopup, signOut } from "firebase/auth"; createUserWithEmailAndPassword,
getAuth,
GoogleAuthProvider,
signInWithEmailAndPassword,
signInWithPopup,
signOut
} from "firebase/auth";
import { get, getDatabase, ref, set } from "firebase/database";
import { initializeApp } from "firebase/app"; 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 { sha512_256 } from "js-sha512";
import { decodeBase64Binary } from "./base64-binary"; import { decodeBase64Binary } from "./base64-binary";
import { ProgressChecker } from "./progress-checker"; import { ProgressChecker } from "./progress-checker";
import { SteamRuntime } from "@/steam";
const firebaseConfig = { const firebaseConfig = {
apiKey: "AIzaSyDuRTTluAFufmvw1zxGH6fsyEHmmbu8IHI", apiKey: "AIzaSyDuRTTluAFufmvw1zxGH6fsyEHmmbu8IHI",
@ -56,43 +62,24 @@ export const Cloud = {
async loginWithSteam(accountId, staticAccountId, screenName) { async loginWithSteam(accountId, staticAccountId, screenName) {
if (this.loggedIn) { if (this.loggedIn) {
Cloud.user.displayName = screenName; Cloud.user.displayName = screenName;
return true; return;
} }
const email = `${accountId}@ad.com`; const email = `${accountId}@ad.com`;
const pass = staticAccountId; const pass = staticAccountId;
try { try {
await Cloud.manualCloudCreate(email, pass); await createUserWithEmailAndPassword(this.auth, email, pass);
} catch { } catch {
try { try {
await Cloud.manualCloudLogin(email, pass); await signInWithEmailAndPassword(this.auth, email, pass);
} catch (error) { } catch (error) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.log(`Firebase Login Error: ${error}`); console.log(`Firebase Login Error: ${error}`);
return false; return;
} }
} }
Cloud.user.displayName = screenName; 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 // 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; const slot = GameStorage.currentSlot;
this.writeToCloudDB(slot, serializedSave); 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() { async loadCheck() {
@ -188,7 +182,14 @@ export const Cloud = {
// eslint-disable-next-line no-loop-func // eslint-disable-next-line no-loop-func
const overwriteLocalSave = () => { const overwriteLocalSave = () => {
GameStorage.overwriteSlot(saveId, cloudSave); 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 // 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) { if (user) {
this.user = { this.user = {
id: user.uid, id: user.uid,
displayName: SteamRuntime.isActive displayName: STEAM
? SteamRuntime.screenName ? SteamRuntime.screenName
: user.displayName, : user.displayName,
email: user.email, email: user.email,
}; };
SteamRuntime.syncIap(); if (STEAM) {
SteamRuntime.syncIAP();
} else {
ShopPurchaseData.syncSTD();
}
} else { } else {
this.user = null; this.user = null;
} }

View File

@ -1,10 +1,8 @@
import { SteamRuntime } from "@/steam";
import * as ADNotations from "@antimatter-dimensions/notations"; import * as ADNotations from "@antimatter-dimensions/notations";
import { DEV } from "@/env"; import { DEV } from "@/env";
import { deepmergeAll } from "@/utility/deepmerge"; import { deepmergeAll } from "@/utility/deepmerge";
import { Achievement } from "../achievements/normal-achievement";
export const GameStorage = { export const GameStorage = {
currentSlot: 0, currentSlot: 0,

View File

@ -1,4 +1,5 @@
<script> <script>
import { STEAM } from "@/env";
import { SteamRuntime } from "@/steam"; import { SteamRuntime } from "@/steam";
import Payments from "../../../javascripts/core/payments"; import Payments from "../../../javascripts/core/payments";
@ -16,7 +17,11 @@ export default {
}, },
methods: { methods: {
purchase() { purchase() {
SteamRuntime.purchaseIap(this.amount); if (STEAM) {
SteamRuntime.purchaseIAP(this.amount);
} else {
Payments.buyMoreSTD(this.amount, this.cost);
}
} }
}, },

View File

@ -1,88 +0,0 @@
<script>
import ModalWrapperChoice from "@/components/modals/ModalWrapperChoice";
import PrimaryButton from "@/components/PrimaryButton";
export default {
name: "CloudManualLoginModal",
components: {
ModalWrapperChoice,
PrimaryButton
},
data() {
return {
email: "",
pass: "",
error: false,
errorMessage: ""
};
},
computed: {
inputIsValid(){
return /\S+@\S+\.\S+/.test(this.email) && this.pass.length >= 6
}
},
methods: {
textEntry(){
this.error = false;
this.errorMessage = "";
},
async login(){
try{
await Cloud.manualCloudCreate(this.email,this.pass);
}catch(e){
console.log(e);
try{
await Cloud.manualCloudLogin(this.email, this.pass)
}catch(LoginError){
this.error = true;
this.errorMessage = "Unable to login, please recheck email/password";
return;
}
}
this.emitClose();
}
},
};
</script>
<template>
<ModalWrapperChoice
:show-cancel="!inputIsValid"
:show-confirm="false"
>
<template #header>
Cloud Login/Create
</template>
<div style="text-align:right">
<span>Email Address: </span>
<input
ref="email"
v-model="email"
type="text"
@keypress="textEntry"
@keyup.esc="emitClose"
><br>
<span>Password: </span>
<input
ref="pass"
v-model="pass"
type="password"
@keypress="textEntry"
@keyup.esc="emitClose"
>
</div>
<div
ref="showError"
v-if="error"
>
{{errorMessage}}
</div>
<PrimaryButton
v-if="inputIsValid"
class="o-primary-btn--width-medium c-modal-message__okay-btn c-modal__confirm-btn"
@click="login"
>
Login/Join
</PrimaryButton>
</ModalWrapperChoice>
</template>

View File

@ -11,7 +11,8 @@ export default {
updateIndicies: [], updateIndicies: [],
visible: [], visible: [],
timeStudyUnlocked: false, timeStudyUnlocked: false,
glyphSacUnlocked: false glyphSacUnlocked: false,
isElectron: false
}; };
}, },
computed: { computed: {
@ -57,6 +58,7 @@ export default {
const progress = PlayerProgress.current; const progress = PlayerProgress.current;
this.timeStudyUnlocked = progress.isEternityUnlocked; this.timeStudyUnlocked = progress.isEternityUnlocked;
this.glyphSacUnlocked = RealityUpgrade(19).isBought; this.glyphSacUnlocked = RealityUpgrade(19).isBought;
this.isElectron = ElectronRuntime.isActive;
}, },
format(x) { format(x) {
switch (x) { switch (x) {
@ -147,13 +149,15 @@ export default {
a numpad key with <kbd>shift</kbd> will not buy a single Dimension. It may instead, depending on your device, a numpad key with <kbd>shift</kbd> will not buy a single Dimension. It may instead, depending on your device,
cause the page to scroll or change game tabs. <kbd>alt</kbd> will still work as expected. cause the page to scroll or change game tabs. <kbd>alt</kbd> will still work as expected.
</span> </span>
<template v-if="isElectron">
<br> <br>
<div class="l-modal-hotkeys-row"> <div class="l-modal-hotkeys-row">
<span class="c-modal-hotkeys-row__name l-modal-hotkeys-row__name">Window Zoom</span> <span class="c-modal-hotkeys-row__name l-modal-hotkeys-row__name">Window Zoom</span>
<kbd>-</kbd><kbd>0</kbd><kbd>+</kbd> <kbd>-</kbd><kbd>0</kbd><kbd>+</kbd>
</div> </div>
<span class="c-modal-hotkeys__shift-description"> <span class="c-modal-hotkeys__shift-description">
To adjust zoom level, hold <kbd>ctrl</kbd> and press either <kbd>-</kbd> or <kbd>+</kbd> to decrease or increase zoom. <kbd>ctrl</kbd><kbd>0</kbd> will reset zoom to 100%. To adjust zoom level, hold <kbd>ctrl</kbd> and press either <kbd>-</kbd> or <kbd>+</kbd> to decrease or
increase zoom. <kbd>ctrl</kbd><kbd>0</kbd> will reset zoom to 100%.
</span> </span>
<br> <br>
<div class="l-modal-hotkeys-row"> <div class="l-modal-hotkeys-row">
@ -163,6 +167,7 @@ export default {
<span class="c-modal-hotkeys__shift-description"> <span class="c-modal-hotkeys__shift-description">
To enter or exit fullscreen, press <kbd>F10</kbd>. To enter or exit fullscreen, press <kbd>F10</kbd>.
</span> </span>
</template>
</div> </div>
</span> </span>
</ModalWrapper> </ModalWrapper>

View File

@ -5,6 +5,8 @@ import OptionsButton from "@/components/OptionsButton";
import PrimaryToggleButton from "@/components/PrimaryToggleButton"; import PrimaryToggleButton from "@/components/PrimaryToggleButton";
import SaveFileName from "./SaveFileName"; import SaveFileName from "./SaveFileName";
import { STEAM } from "@/env";
export default { export default {
name: "OptionsSavingTab", name: "OptionsSavingTab",
components: { components: {
@ -38,6 +40,9 @@ export default {
return this.forceCloudOverwrite return this.forceCloudOverwrite
? `Your local save will always overwrite your cloud save no matter what.` ? `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.`; : `Save conflicts will prevent your local save from being saved to the cloud.`;
},
STEAM() {
return STEAM;
} }
}, },
watch: { watch: {
@ -192,23 +197,33 @@ export default {
<span v-else>Cloud Saving has been disabled on this save.</span> <span v-else>Cloud Saving has been disabled on this save.</span>
</div> </div>
<div class="l-options-grid"> <div class="l-options-grid">
<!--div <div
v-if="!STEAM"
class="l-options-grid__row" class="l-options-grid__row"
> >
<OptionsButton <OptionsButton
v-if="loggedIn" v-if="loggedIn"
onclick="GameOptions.logout()" onclick="GameOptions.logout()"
> >
Disconnect Steam Account and disable Cloud Saving Disconnect Google Account and disable Cloud Saving
</OptionsButton> </OptionsButton>
<OptionsButton <OptionsButton
v-else v-else
v-tooltip="'This will connect your Google Account to your Antimatter Dimensions savefiles'" v-tooltip="'This will connect your Google Account to your Antimatter Dimensions savefiles'"
onclick="Modal.manualCloud.show()" :class="{ 'o-pelle-disabled-pointer': creditsClosed }"
onclick="GameOptions.login()"
> >
Login with Google to enable Cloud Saving Login with Google to enable Cloud Saving
</OptionsButton> </OptionsButton>
</div--> <PrimaryToggleButton
v-if="loggedIn"
v-model="hideGoogleName"
v-tooltip="'This will hide your Google Account name from the UI for privacy. Saving/loading is unaffected.'"
class="o-primary-btn--option l-options-grid__button"
:class="{ 'o-pelle-disabled-pointer': creditsClosed }"
label="Hide Google Account name:"
/>
</div>
<div <div
v-if="loggedIn" v-if="loggedIn"
class="l-options-grid__row" class="l-options-grid__row"

View File

@ -1,48 +0,0 @@
<script>
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;
}
}
};
</script>
<template>
<div class="o-primary-btn o-primary-btn--option o-primary-btn--slider l-options-grid__button">
<b>Zoom Level: {{ formatInt(zoomLevel) }}%</b>
<SliderComponent
class="o-primary-btn--slider__slider"
v-bind="sliderProps"
:value="zoomLevel"
@input="adjustSliderValue($event)"
/>
</div>
</template>

View File

@ -30,19 +30,14 @@ export default {
}; };
}, },
computed: { computed: {
STEAM() {
return STEAM;
},
purchases() { purchases() {
return ShopPurchase.all; return ShopPurchase.all;
}, },
buySTDText() {
return STEAM ? "Buy More" : "Play Online on Steam to buy STDs";
}
},
watch: {
IAPsDisabled(newValue) {
player.IAP.disabled = newValue;
},
enableText() { enableText() {
return `In-app Purchases: ${player.IAP.enabled ? "Enabled" : "Disabled"}`; return `In-app Purchases: ${this.IAPsEnabled ? "Enabled" : "Disabled"}`;
}, },
respecText() { respecText() {
if (!this.loggedIn) return "Not logged in!"; if (!this.loggedIn) return "Not logged in!";
@ -114,30 +109,37 @@ export default {
label="Disable in-app-purchases:" label="Disable in-app-purchases:"
@click="toggleEnable()" @click="toggleEnable()"
> >
{{ `In-app Purchases: ${IAPsEnabled ? "Enabled" : "Disabled"}` }} {{ enableText }}
</PrimaryButton> </PrimaryButton>
<!--PrimaryButton <PrimaryButton
v-if="!STEAM"
v-tooltip="respecText" v-tooltip="respecText"
:class="respecClass()" :class="respecClass()"
@click="respec()" @click="respec()"
> >
Respec Shop Respec Shop
</PrimaryButton--> </PrimaryButton>
</div> </div>
<!--div v-if="loggedIn && !canRespec"> <div v-if="loggedIn && !canRespec && !STEAM">
Time until respec available: {{ respecTimeStr }} Time until respec available: {{ respecTimeStr }}
</div--> </div>
<div <div
v-if="loggedIn" v-if="loggedIn"
class="c-login-info" class="c-login-info"
> >
<template v-if="STEAM">
You are logged in as {{ username }}. You are logged in as {{ username }}.
<!--button </template>
<template v-else>
<span v-if="hiddenName">You are logged in. <i>(name hidden)</i></span>
<span v-else>You are logged in as {{ username }}.</span>
<button
class="o-shop-button-button" class="o-shop-button-button"
onclick="GameOptions.logout()" onclick="GameOptions.logout()"
> >
Disconnect Google Account Disconnect Google Account
</button--> </button>
</template>
</div> </div>
<div <div
v-else v-else

View File

@ -80,7 +80,9 @@ export default {
window.openNewsLink = openExternalLink; window.openNewsLink = openExternalLink;
text = text text = text
.replace(/href='/gu, `onClick='window.openNewsLink("`) .replace(/href='/gu, `onClick='window.openNewsLink("`)
.replace(/' target='_blank'/gu, `")'`); .replace(/' target='_blank'/gu, `")'`)
.replace(/href="/gu, `onClick='window.openNewsLink("`)
.replace(/" target="_blank"/gu, `")'`);
} }
line.innerHTML = text; line.innerHTML = text;

View File

@ -1,4 +1,4 @@
import { NodeModule } from "../node-module"; import { NodeModule } from "./node-module";
/** /**
* @type {NodeModule<any>} * @type {NodeModule<any>}

View File

@ -1,4 +1,4 @@
import { NodeModule } from "../node-module"; import { NodeModule } from "./node-module";
/** /**
* @type {NodeModule<Greenworks.NodeModule>} * @type {NodeModule<Greenworks.NodeModule>}

View File

@ -8,7 +8,7 @@ export function hasPendingPurchaseConfirmations() {
return MAC && pendingConfirmations.length > 0; return MAC && pendingConfirmations.length > 0;
} }
export async function purchaseIap(std) { export async function purchaseIAP(std) {
const itemId = `${std}STD`; const itemId = `${std}STD`;
const quantity = 1; const quantity = 1;
const annotation = "Purchased via in-game store"; const annotation = "Purchased via in-game store";
@ -51,10 +51,10 @@ async function validatePurchase(orderId) {
pendingConfirmations = pendingConfirmations.filter(item => item !== orderId); pendingConfirmations = pendingConfirmations.filter(item => item !== orderId);
await PlayFab.AddUserVirtualCurrency(stdsBought, "ST"); await PlayFab.AddUserVirtualCurrency(stdsBought, "ST");
GameUI.notify.info(`${stdsBought} STDs Obtained!`); GameUI.notify.info(`${stdsBought} STDs Obtained!`);
syncIap(); syncIAP();
} }
export async function syncIap() { export async function syncIAP() {
const userInventory = await PlayFab.GetUserInventory(); const userInventory = await PlayFab.GetUserInventory();
ShopPurchaseData.totalSTD = userInventory.VirtualCurrency?.ST ?? 0; ShopPurchaseData.totalSTD = userInventory.VirtualCurrency?.ST ?? 0;
for (const key of Object.keys(GameDatabase.shopPurchases)) { for (const key of Object.keys(GameDatabase.shopPurchases)) {
@ -71,7 +71,7 @@ export async function syncIap() {
export async function purchaseShopItem(key, cost, cosmeticName) { export async function purchaseShopItem(key, cost, cosmeticName) {
await PlayFab.PurchaseItem(key, cost, "ST"); await PlayFab.PurchaseItem(key, cost, "ST");
await storeCosmetic(cosmeticName); await storeCosmetic(cosmeticName);
syncIap(); syncIAP();
} }
async function storeCosmetic(name) { async function storeCosmetic(name) {

View File

@ -3,9 +3,9 @@ import { RichPresenceInfo } from "../../javascripts/core/discord-parser";
import { import {
hasPendingPurchaseConfirmations, hasPendingPurchaseConfirmations,
purchaseIap, purchaseIAP,
purchaseShopItem, purchaseShopItem,
syncIap, syncIAP,
validatePurchases validatePurchases
} from "./steam-purchases"; } from "./steam-purchases";
@ -72,12 +72,12 @@ export const SteamRuntime = {
Greenworks.activateAchievement(`Achievement${id}`); Greenworks.activateAchievement(`Achievement${id}`);
}, },
async purchaseIap(std) { async purchaseIAP(std) {
if (!this.isActive) { if (!this.isActive) {
return; return;
} }
await purchaseIap(std); await purchaseIAP(std);
}, },
validatePurchases() { validatePurchases() {
@ -88,12 +88,12 @@ export const SteamRuntime = {
validatePurchases(); validatePurchases();
}, },
async syncIap() { async syncIAP() {
if (!this.isActive) { if (!this.isActive) {
return; return;
} }
await syncIap(); await syncIAP();
}, },
async purchaseShopItem(key, cost, cosmeticName) { async purchaseShopItem(key, cost, cosmeticName) {
@ -127,6 +127,7 @@ async function loginPlayFab(steamId) {
await PlayFab.LoginWithSteam(ticket.ticket.toString("hex"), screenName); await PlayFab.LoginWithSteam(ticket.ticket.toString("hex"), screenName);
PlayFab.UpdateUserTitleDisplayName(screenName); PlayFab.UpdateUserTitleDisplayName(screenName);
GameUI.notify.info("Logged in to PlayFab Cloud"); GameUI.notify.info("Logged in to PlayFab Cloud");
syncIAP();
} catch (error) { } catch (error) {
GameUI.notify.error("Couldn't log in to PlayFab Cloud."); GameUI.notify.error("Couldn't log in to PlayFab Cloud.");
throw error; throw error;
@ -137,9 +138,7 @@ async function loginFirebase(steamId) {
const accountId = steamId.accountId; const accountId = steamId.accountId;
const staticAccountId = steamId.staticAccountId; const staticAccountId = steamId.staticAccountId;
const screenName = steamId.screenName; const screenName = steamId.screenName;
if (await Cloud.loginWithSteam(accountId, staticAccountId, screenName)) { await Cloud.loginWithSteam(accountId, staticAccountId, screenName);
syncIap();
}
} }
function initializeDiscord() { function initializeDiscord() {