Further abt testing

pull/1440/head
tobspr 2 years ago
parent 94253c9370
commit e9e88241b4

@ -17,7 +17,6 @@ export const THIRDPARTY_URLS = {
privacyPolicy: "https://tobspr.io/privacy.html", privacyPolicy: "https://tobspr.io/privacy.html",
standaloneStorePage: "https://store.steampowered.com/app/1318690/shapezio/",
stanaloneCampaignLink: "https://get.shapez.io", stanaloneCampaignLink: "https://get.shapez.io",
puzzleDlcStorePage: "https://store.steampowered.com/app/1625400/shapezio__Puzzle_DLC", puzzleDlcStorePage: "https://store.steampowered.com/app/1625400/shapezio__Puzzle_DLC",

@ -610,20 +610,13 @@ export class RegularGameMode extends GameMode {
} }
get difficultyMultiplicator() { get difficultyMultiplicator() {
switch (this.root.app.gameAnalytics.abtVariant) { if (G_IS_STANDALONE) {
case "0": if (G_IS_STEAM_DEMO) {
return 0.2;
case "1":
return 0.5;
case "2":
return 0.75; return 0.75;
case "3": }
return 1; return 1;
case "4":
return 1.25;
case "5":
return 2;
} }
return 0.5;
} }
/** /**

@ -1,4 +1,4 @@
import { globalConfig } from "../../core/config"; import { globalConfig, THIRDPARTY_URLS } from "../../core/config";
import { createLogger } from "../../core/logging"; import { createLogger } from "../../core/logging";
import { queryParamOptions } from "../../core/query_parameters"; import { queryParamOptions } from "../../core/query_parameters";
import { randomInt } from "../../core/utils"; import { randomInt } from "../../core/utils";
@ -18,8 +18,8 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha
// Be sure to increment the ID whenever it changes // Be sure to increment the ID whenever it changes
const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin"; const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin";
const CURRENT_ABT = "abt_dif"; const CURRENT_ABT = "abt_spl";
const CURRENT_ABT_COUNT = 6; const CURRENT_ABT_COUNT = 2;
export class ShapezGameAnalytics extends GameAnalyticsInterface { export class ShapezGameAnalytics extends GameAnalyticsInterface {
constructor(app) { constructor(app) {
@ -52,29 +52,36 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
} }
fetchABVariant() { fetchABVariant() {
return this.app.storage.readFileAsync("shapez_" + CURRENT_ABT + ".bin").then( return this.app.storage
abt => { .readFileAsync("shapez_" + CURRENT_ABT + ".bin")
if (typeof queryParamOptions.abtVariant === "string") { .then(
this.abtVariant = queryParamOptions.abtVariant; abt => {
logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant);
} else {
this.abtVariant = abt;
logger.log("Read abtVariant:", abt);
}
},
err => {
if (err === FILE_NOT_FOUND) {
if (typeof queryParamOptions.abtVariant === "string") { if (typeof queryParamOptions.abtVariant === "string") {
this.abtVariant = queryParamOptions.abtVariant; this.abtVariant = queryParamOptions.abtVariant;
logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant); logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant);
} else { } else {
this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1)); this.abtVariant = abt;
logger.log("Set", CURRENT_ABT, "to", this.abtVariant); logger.log("Read abtVariant:", abt);
}
},
err => {
if (err === FILE_NOT_FOUND) {
if (typeof queryParamOptions.abtVariant === "string") {
this.abtVariant = queryParamOptions.abtVariant;
logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant);
} else {
this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1));
logger.log("Set", CURRENT_ABT, "to", this.abtVariant);
}
this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant);
} }
this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant);
} }
} )
); .then(() => {
if (this.abtVariant === "1") {
THIRDPARTY_URLS.stanaloneCampaignLink = "https://get.shapez.io/bundle";
}
});
} }
/** /**

Loading…
Cancel
Save