Skip to content

Commit

Permalink
chore: generate build and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xShadowBlade committed Apr 11, 2024
1 parent 6734f13 commit 62fccb1
Show file tree
Hide file tree
Showing 112 changed files with 785 additions and 748 deletions.
30 changes: 21 additions & 9 deletions dist/game/eMath.game.js
Original file line number Diff line number Diff line change
Expand Up @@ -5586,6 +5586,7 @@ var UpgradeStatic = class _UpgradeStatic {

// src/classes/currency.ts
var Currency = class {
// public upgrades: UpgradeData<string>[];
// /** A boost object that affects the currency gain. */
// @Expose()
// public boost: boost;
Expand Down Expand Up @@ -5739,17 +5740,15 @@ var CurrencyStatic = class {
addUpgrade(upgrades, runEffectInstantly = true) {
if (!Array.isArray(upgrades))
upgrades = [upgrades];
console.log(upgrades);
const addedUpgradeList = {};
for (const upgrade of upgrades) {
const addedUpgradeData = this.pointerAddUpgrade(upgrade);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => addedUpgradeData);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => this.pointerGetUpgrade(upgrade.id));
if (addedUpgradeStatic.effect && runEffectInstantly)
addedUpgradeStatic.effect(addedUpgradeStatic.level, addedUpgradeStatic);
addedUpgradeList[upgrade.id] = addedUpgradeStatic;
this.upgrades[upgrade.id] = addedUpgradeStatic;
}
console.log(addedUpgradeList);
return Object.values(addedUpgradeList);
}
/**
Expand Down Expand Up @@ -6411,6 +6410,12 @@ var DataManager = class {
compileDataRaw(data = this.data) {
const gameDataString = (0, import_class_transformer5.instanceToPlain)(data);
const hasedData = md5(`${this.gameRef.config.name.id}/${JSON.stringify(gameDataString)}`);
let version;
try {
version = "8.0.0-rc.0";
} catch (error) {
version = "8.0.0";
}
const saveMetadata = {
hash: hasedData,
game: {
Expand All @@ -6419,8 +6424,7 @@ var DataManager = class {
version: this.gameRef.config.name.version
},
emath: {
// @ts-expect-error - Replaced by esbuild
version: "8.0.0-rc.0"
version
}
};
return [saveMetadata, gameDataString];
Expand Down Expand Up @@ -6530,8 +6534,7 @@ var DataManager = class {
out[key] = sourcePlain[key];
}
if (source[key] instanceof Currency) {
console.log("Merging currency: ", source[key], target[key]);
const sourceCurrency = source[key];
const sourceCurrency = sourcePlain[key];
const targetCurrency = target[key];
if (Array.isArray(targetCurrency.upgrades)) {
const upgrades = targetCurrency.upgrades;
Expand All @@ -6540,8 +6543,6 @@ var DataManager = class {
targetCurrency.upgrades[upgrade.id] = upgrade.level;
}
}
console.log("Merging upgrades: ");
console.log({ source: sourceCurrency.upgrades, target: targetCurrency.upgrades, combined: { ...sourceCurrency.upgrades, ...targetCurrency.upgrades } });
targetCurrency.upgrades = { ...sourceCurrency.upgrades, ...targetCurrency.upgrades };
out[key] = targetCurrency;
} else if (isPlainObject(sourcePlain[key]) && isPlainObject(target[key])) {
Expand Down Expand Up @@ -6594,8 +6595,19 @@ var DataManager = class {
function compareArrays(arr1, arr2) {
return arr1.length === arr2.length && arr1.every((val) => arr2.includes(val));
}
const upgradeDataProperties = Object.getOwnPropertyNames(new UpgradeData({ id: "", level: E(0) }));
function convertTemplateClass(templateClassToConvert, plain) {
const out = (0, import_class_transformer5.plainToInstance)(templateClassToConvert.class, plain);
if (out instanceof Currency) {
for (const upgradeName in out.upgrades) {
const upgrade = out.upgrades[upgradeName];
if (!upgrade || !upgradeDataProperties.every((prop) => Object.getOwnPropertyNames(upgrade).includes(prop))) {
delete out.upgrades[upgradeName];
continue;
}
out.upgrades[upgradeName] = (0, import_class_transformer5.plainToInstance)(UpgradeData, upgrade);
}
}
if (!out)
throw new Error(`Failed to convert ${templateClassToConvert.name} to class instance.`);
return out;
Expand Down
2 changes: 1 addition & 1 deletion dist/game/eMath.game.min.js

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions dist/main/eMath.js
Original file line number Diff line number Diff line change
Expand Up @@ -5118,6 +5118,7 @@ var UpgradeStatic = class _UpgradeStatic {
var import_reflect_metadata2 = require("reflect-metadata");
var import_class_transformer3 = require("class-transformer");
var Currency = class {
// public upgrades: UpgradeData<string>[];
// /** A boost object that affects the currency gain. */
// @Expose()
// public boost: boost;
Expand Down Expand Up @@ -5271,17 +5272,15 @@ var CurrencyStatic = class {
addUpgrade(upgrades, runEffectInstantly = true) {
if (!Array.isArray(upgrades))
upgrades = [upgrades];
console.log(upgrades);
const addedUpgradeList = {};
for (const upgrade of upgrades) {
const addedUpgradeData = this.pointerAddUpgrade(upgrade);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => addedUpgradeData);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => this.pointerGetUpgrade(upgrade.id));
if (addedUpgradeStatic.effect && runEffectInstantly)
addedUpgradeStatic.effect(addedUpgradeStatic.level, addedUpgradeStatic);
addedUpgradeList[upgrade.id] = addedUpgradeStatic;
this.upgrades[upgrade.id] = addedUpgradeStatic;
}
console.log(addedUpgradeList);
return Object.values(addedUpgradeList);
}
/**
Expand Down
2 changes: 1 addition & 1 deletion dist/main/eMath.min.js

Large diffs are not rendered by default.

30 changes: 21 additions & 9 deletions dist/pixiGame/eMath.pixiGame.js
Original file line number Diff line number Diff line change
Expand Up @@ -5590,6 +5590,7 @@ var UpgradeStatic = class _UpgradeStatic {

// src/classes/currency.ts
var Currency = class {
// public upgrades: UpgradeData<string>[];
// /** A boost object that affects the currency gain. */
// @Expose()
// public boost: boost;
Expand Down Expand Up @@ -5743,17 +5744,15 @@ var CurrencyStatic = class {
addUpgrade(upgrades, runEffectInstantly = true) {
if (!Array.isArray(upgrades))
upgrades = [upgrades];
console.log(upgrades);
const addedUpgradeList = {};
for (const upgrade of upgrades) {
const addedUpgradeData = this.pointerAddUpgrade(upgrade);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => addedUpgradeData);
const addedUpgradeStatic = new UpgradeStatic(upgrade, () => this.pointerGetUpgrade(upgrade.id));
if (addedUpgradeStatic.effect && runEffectInstantly)
addedUpgradeStatic.effect(addedUpgradeStatic.level, addedUpgradeStatic);
addedUpgradeList[upgrade.id] = addedUpgradeStatic;
this.upgrades[upgrade.id] = addedUpgradeStatic;
}
console.log(addedUpgradeList);
return Object.values(addedUpgradeList);
}
/**
Expand Down Expand Up @@ -6410,6 +6409,12 @@ var DataManager = class {
compileDataRaw(data = this.data) {
const gameDataString = (0, import_class_transformer5.instanceToPlain)(data);
const hasedData = md5(`${this.gameRef.config.name.id}/${JSON.stringify(gameDataString)}`);
let version;
try {
version = "8.0.0-rc.0";
} catch (error) {
version = "8.0.0";
}
const saveMetadata = {
hash: hasedData,
game: {
Expand All @@ -6418,8 +6423,7 @@ var DataManager = class {
version: this.gameRef.config.name.version
},
emath: {
// @ts-expect-error - Replaced by esbuild
version: "8.0.0-rc.0"
version
}
};
return [saveMetadata, gameDataString];
Expand Down Expand Up @@ -6529,8 +6533,7 @@ var DataManager = class {
out[key] = sourcePlain[key];
}
if (source[key] instanceof Currency) {
console.log("Merging currency: ", source[key], target[key]);
const sourceCurrency = source[key];
const sourceCurrency = sourcePlain[key];
const targetCurrency = target[key];
if (Array.isArray(targetCurrency.upgrades)) {
const upgrades = targetCurrency.upgrades;
Expand All @@ -6539,8 +6542,6 @@ var DataManager = class {
targetCurrency.upgrades[upgrade.id] = upgrade.level;
}
}
console.log("Merging upgrades: ");
console.log({ source: sourceCurrency.upgrades, target: targetCurrency.upgrades, combined: { ...sourceCurrency.upgrades, ...targetCurrency.upgrades } });
targetCurrency.upgrades = { ...sourceCurrency.upgrades, ...targetCurrency.upgrades };
out[key] = targetCurrency;
} else if (isPlainObject(sourcePlain[key]) && isPlainObject(target[key])) {
Expand Down Expand Up @@ -6593,8 +6594,19 @@ var DataManager = class {
function compareArrays(arr1, arr2) {
return arr1.length === arr2.length && arr1.every((val) => arr2.includes(val));
}
const upgradeDataProperties = Object.getOwnPropertyNames(new UpgradeData({ id: "", level: E(0) }));
function convertTemplateClass(templateClassToConvert, plain) {
const out = (0, import_class_transformer5.plainToInstance)(templateClassToConvert.class, plain);
if (out instanceof Currency) {
for (const upgradeName in out.upgrades) {
const upgrade = out.upgrades[upgradeName];
if (!upgrade || !upgradeDataProperties.every((prop) => Object.getOwnPropertyNames(upgrade).includes(prop))) {
delete out.upgrades[upgradeName];
continue;
}
out.upgrades[upgradeName] = (0, import_class_transformer5.plainToInstance)(UpgradeData, upgrade);
}
}
if (!out)
throw new Error(`Failed to convert ${templateClassToConvert.name} to class instance.`);
return out;
Expand Down
46 changes: 23 additions & 23 deletions dist/types/E/new/eMain.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,30 @@ type E = Decimal;
declare const formats: {
toSubscript: (value: number) => string;
toSuperscript: (value: number) => string;
formatST: (ex: import("index").ESource, acc?: number, max?: number, type?: FormatType) => string;
format: (ex: import("index").ESource, acc?: number, max?: number, type?: FormatType) => string;
formatGain: (amt: import("index").ESource, gain: import("index").ESource, type?: FormatType, acc?: number | undefined, max?: number | undefined) => string;
formatTime: (ex: import("index").ESource, acc?: number, type?: string) => string;
formatTimeLong: (ex: import("index").ESource, ms?: boolean, acc?: number, max?: number, type?: FormatType) => string;
formatReduction: (ex: import("index").ESource) => string;
formatPercent: (ex: import("index").ESource) => string;
formatMult: (ex: import("index").ESource, acc?: number) => string;
expMult: (a: import("index").ESource, b: import("index").ESource, base?: number) => import("E/e").Decimal;
metric: (num: import("index").ESource, type: 0 | 1 | 2 | 3) => string;
ev: (num: import("index").ESource, c2?: boolean) => string;
formatST: (ex: import("../e").DecimalSource, acc?: number, max?: number, type?: FormatType) => string;
format: (ex: import("../e").DecimalSource, acc?: number, max?: number, type?: FormatType) => string;
formatGain: (amt: import("../e").DecimalSource, gain: import("../e").DecimalSource, type?: FormatType, acc?: number | undefined, max?: number | undefined) => string;
formatTime: (ex: import("../e").DecimalSource, acc?: number, type?: string) => string;
formatTimeLong: (ex: import("../e").DecimalSource, ms?: boolean, acc?: number, max?: number, type?: FormatType) => string;
formatReduction: (ex: import("../e").DecimalSource) => string;
formatPercent: (ex: import("../e").DecimalSource) => string;
formatMult: (ex: import("../e").DecimalSource, acc?: number) => string;
expMult: (a: import("../e").DecimalSource, b: import("../e").DecimalSource, base?: number) => import("../e").Decimal;
metric: (num: import("../e").DecimalSource, type: 0 | 1 | 2 | 3) => string;
ev: (num: import("../e").DecimalSource, c2?: boolean) => string;
omega: {
config: {
greek: string;
infinity: string;
};
format(value: import("index").ESource): string;
format(value: import("../e").DecimalSource): string;
};
omega_short: {
config: {
greek: string;
infinity: string;
};
format(value: import("index").ESource): string;
format(value: import("../e").DecimalSource): string;
};
elemental: {
config: {
Expand All @@ -223,36 +223,36 @@ declare const formats: {
getAbbreviation(group: number, progress: number): string;
beyondOg(x: number): string;
abbreviationLength(group: number): number;
getAbbreviationAndValue(x: import("E/e").Decimal): (string | import("E/e").Decimal)[];
formatElementalPart(abbreviation: string, n: import("E/e").Decimal): string;
format(value: import("E/e").Decimal, acc?: number): string;
getAbbreviationAndValue(x: import("../e").Decimal): (string | import("../e").Decimal)[];
formatElementalPart(abbreviation: string, n: import("../e").Decimal): string;
format(value: import("../e").Decimal, acc?: number): string;
};
old_sc: {
format(ex: import("index").ESource, acc: number): string;
format(ex: import("../e").DecimalSource, acc: number): string;
};
eng: {
format(ex: import("index").ESource, acc?: number): string;
format(ex: import("../e").DecimalSource, acc?: number): string;
};
mixed_sc: {
format(ex: import("index").ESource, acc?: number | undefined, max?: number): string;
format(ex: import("../e").DecimalSource, acc?: number | undefined, max?: number): string;
};
layer: {
layers: string[];
format(ex: import("index").ESource, acc?: number, max?: number | undefined): string;
format(ex: import("../e").DecimalSource, acc?: number, max?: number | undefined): string;
};
standard: {
tier1(x: number): string;
tier2(x: number): string;
};
inf: {
format(ex: import("index").ESource, acc?: number | undefined, max?: number | undefined): string;
format(ex: import("../e").DecimalSource, acc?: number | undefined, max?: number | undefined): string;
};
alphabet: {
config: {
alphabet: string;
};
getAbbreviation(ex: import("index").ESource, start?: import("index").ESource, startDouble?: boolean, abbStart?: number): string;
format(ex: import("index").ESource, acc?: number, max?: number, type?: FormatType, start?: import("index").ESource, startDouble?: boolean, abbStart?: number | undefined): string;
getAbbreviation(ex: import("../e").DecimalSource, start?: import("../e").DecimalSource, startDouble?: boolean, abbStart?: number): string;
format(ex: import("../e").DecimalSource, acc?: number, max?: number, type?: FormatType, start?: import("../e").DecimalSource, startDouble?: boolean, abbStart?: number | undefined): string;
};
};
export { ST_NAMES, FormatTypeList } from "../format";
Expand Down
6 changes: 3 additions & 3 deletions dist/types/classes/numericalAnalysis.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ type MeanMode = "arithmetic" | "geometric" | 1 | 2;
* @returns An object containing the approximate inverse value `"value"` (defaults to the lower bound), the lower bound `"lowerBound"`, and the upper bound `"upperBound"`.
*/
declare function inverseFunctionApprox(f: (x: E) => E, n: ESource, mode?: MeanMode, iterations?: number): {
value: import("E/e").Decimal;
lowerBound: import("E/e").Decimal;
upperBound: import("E/e").Decimal;
value: import("../E/e").Decimal;
lowerBound: import("../E/e").Decimal;
upperBound: import("../E/e").Decimal;
};
/**
* Calculates the sum of `f(n)` from `a` to `b` using a basic loop until the sum is less than or equal to `epsilon` geometrically.
Expand Down
2 changes: 1 addition & 1 deletion dist/types/classes/skillTree.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ declare class skillNode implements ISkill {
description: string;
cost: [currency: CurrencyStatic<string[]>, cost: (level: E, context: ISkill) => E];
required: ISkill[];
maxLevel: import("E/e").Decimal;
maxLevel: import("../E/e").Decimal;
effect: ((level: E, context: ISkill) => void) | undefined;
/**
* Represents a skill tree node.
Expand Down
14 changes: 7 additions & 7 deletions dist/types/game/hookGame.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ declare const eMathGameWeb: {
eventManager: typeof EventManager;
dataManager: typeof DataManager;
};
E: ((x?: import("index").ESource | undefined) => import("E/e").Decimal) & typeof import("E/e").Decimal;
E: ((x?: import("..").ESource | undefined) => import("../E/e").Decimal) & typeof import("../E/e").Decimal;
classes: {
boost: typeof import("index").Boost;
currency: typeof import("index").Currency;
currencyStatic: typeof import("index").CurrencyStatic;
attribute: typeof import("index").Attribute;
grid: typeof import("index").Grid;
gridCell: typeof import("index").GridCell;
boost: typeof import("..").Boost;
currency: typeof import("..").Currency;
currencyStatic: typeof import("..").CurrencyStatic;
attribute: typeof import("..").Attribute;
grid: typeof import("..").Grid;
gridCell: typeof import("..").GridCell;
};
};
/**
Expand Down
Loading

0 comments on commit 62fccb1

Please sign in to comment.