import Utils from "../../../../extensions/快闪-Tab标签王(prefab标签栏)/@types/packages/scene/@types/cce/public/gizmos/utils"; import PogHttp from "../net/PogHttp"; import { GoodsId } from "./GoodsId"; import { GoodInfo } from "./UserM"; export class ConfigGood { id: number; name: string; desc: string; type: number; param1: any; param2: any; param3: any; param4: any; } export class ConfigShopItem { id: number; goodId: number; num: number; storeId: number; usdPrice: number; diamondPrice: number; adPrice: number; total: number; dailyUserLimit: number; userLimit: number; userAdLimit: number; dailyUserAdLimit: number; sort: number; expireTime: number | null; } export class ConfigStore { id: number; name: string; shopList: ConfigShopItem[]; } export class ConfigRecharge { id: number; usd: number; tgStars: number; goodList: GoodInfo[]; bonusList: GoodInfo[]; firstRechargeList: GoodInfo[]; } export class Config { goodList: ConfigGood[]; storeList: ConfigStore[]; rechargeList: ConfigRecharge[]; } export class ClientConfig { static readonly PuzzleToGamePassCount: number = 10; } export class ConfigGrade { id: number; name: string; addition: number; } export default class ConfigM { getGrade(grade: number): ConfigGrade { return this.Grades().find((item) => item.id == grade); } getGoodName(id: number): string { let good = this._config.goodList.find((item) => item.id == id); if (good) { return good.name; } return "Unknown"; } GoodIsBox(id: number): boolean { if (GoodsId.ITEM_BOX == id || GoodsId.POG_BOX == id) { return true; } if (GoodsId.FREE_ITEM_BOX == id || GoodsId.FREE_POG_BOX == id) { return true; } return false; } Grades(): ConfigGrade[] { let r = []; r.push({ id: 1, name: "SUPREME", addition: 12.5, }); r.push({ id: 2, name: "AURORA", addition: 10, }); r.push({ id: 3, name: "DIAMOND", addition: 8.5, }); r.push({ id: 4, name: "TITAN", addition: 7.0, }); r.push({ id: 5, name: "GOLD", addition: 5.0, }); r.push({ id: 6, name: "SILVER", addition: 3.0, }); r.push({ id: 7, name: "BRONZE", addition: 2.0, }); r = r.sort((a, b) => b.id - a.id); return r; } getHelpDesc(type: number): string { switch (type) { case 2: return `Single-use boosters amplify your POG earnings. Get a 100-300% critical bonus on POG, multiplying it 1x-3x!`; case 3: return `Item Box`; case 4: return `Pog Box`; } } // getHelpTitle(type: number) { // switch (type) { // case 1: // return "Title : " + type; // case 2: // return `POG Crit Tickets` // case 3: // return `Item Box` // case 4: // return `Pog Box` // } // } getGamePassAddValue(gamePassCount: number): number { let gamePassAddValue = 0; if (gamePassCount >= 1) { gamePassAddValue += 10; } if (gamePassCount >= 2) { gamePassAddValue += 5; } if (gamePassCount >= 3) { gamePassAddValue += 5; } if (gamePassCount >= 4) { gamePassAddValue += 5; } if (gamePassCount >= 5) { gamePassAddValue += 5; } return gamePassAddValue; } getRechargeItem(id: number): ConfigRecharge { return this._config.rechargeList.find((item) => item.id === id); } private _version: string = "1.0.0"; getVersionText(): string { let versionText = window["pog_init_data"]?.version; if (versionText) { return versionText; } return "Version:" + "local-" + new Date().toLocaleDateString(); } private static _ins: ConfigM; public static get ins(): ConfigM { return (ConfigM._ins ??= new ConfigM()); } private _config: Config; public async loadConfig(): Promise { let config = await PogHttp.ins.allConfig(); console.warn("config", config); if (!config) { return false; } this._config = config; return true; } public getShopListByStoreId(storeId: number): ConfigShopItem[] { return this._config.storeList.find((item) => item.id === storeId)?.shopList; } public getConfigShopIteByShopId( storeId: number, itemId: number ): ConfigShopItem { return this._config.storeList .find((item) => item.id === storeId) ?.shopList.find((item) => item.id === itemId); } }