mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-12 23:23:20 +00:00
Merge pull request #2051 from IvarK/away-progress-gamedatabase
This commit is contained in:
commit
34754eff32
@ -2,11 +2,19 @@ Vue.component("modal-away-progress", {
|
||||
components: {
|
||||
"away-progress-helper": {
|
||||
props: {
|
||||
item: Object,
|
||||
name: String,
|
||||
playerBefore: Object,
|
||||
playerAfter: Object,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
removed: false,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
item() {
|
||||
return AwayProgressTypes.all[this.name];
|
||||
},
|
||||
before() {
|
||||
return this.item.navigateTo(this.playerBefore);
|
||||
},
|
||||
@ -20,9 +28,12 @@ Vue.component("modal-away-progress", {
|
||||
return this.formatPseudo(this.after);
|
||||
},
|
||||
classObject() {
|
||||
return this.item.classObject;
|
||||
return {
|
||||
[this.item.classObject]: true,
|
||||
"c-modal-away-progress__strikethrough": this.removed,
|
||||
};
|
||||
},
|
||||
name() {
|
||||
formattedName() {
|
||||
return this.item.formatName;
|
||||
},
|
||||
increased() {
|
||||
@ -68,12 +79,29 @@ Vue.component("modal-away-progress", {
|
||||
if (Decimal.lt(number, 1e9)) return formatInt(number);
|
||||
return format(number, 2, 2);
|
||||
},
|
||||
hideEntry() {
|
||||
this.removed = !this.removed;
|
||||
this.item.option = !this.item.option;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div v-if="show" :class="classObject" class="c-modal-away-progress__resources">
|
||||
<span v-if="isBlackHole">Your <b>{{ name }}</b> activated {{ formatBlackHoleActivations }}</span>
|
||||
<div
|
||||
v-if="show"
|
||||
:class="classObject"
|
||||
class="c-modal-away-progress__resources"
|
||||
@click="hideEntry"
|
||||
>
|
||||
<span v-if="isBlackHole">
|
||||
Your
|
||||
<b>{{ formattedName }}</b>
|
||||
activated
|
||||
{{ formatBlackHoleActivations }}
|
||||
</span>
|
||||
<span v-else>
|
||||
<b>{{ name }}</b> <i v-if="isVeryLarge">exponent </i> increased from {{ formatBefore }} to {{ formatAfter }}
|
||||
<b>{{ formattedName }}</b>
|
||||
<i v-if="isVeryLarge"> exponent</i>
|
||||
increased from
|
||||
{{ formatBefore }} to {{ formatAfter }}
|
||||
</span>
|
||||
</div>`
|
||||
},
|
||||
@ -97,7 +125,7 @@ Vue.component("modal-away-progress", {
|
||||
return this.modalConfig.playerAfter;
|
||||
},
|
||||
offlineStats() {
|
||||
return AwayProgressTypes.all;
|
||||
return AwayProgressTypes.appearsInAwayModal;
|
||||
},
|
||||
headerText() {
|
||||
const timeDisplay = TimeSpan.fromSeconds(this.modalConfig.seconds).toString();
|
||||
@ -119,13 +147,14 @@ Vue.component("modal-away-progress", {
|
||||
<div class="c-modal-away-progress__header">{{ headerText }}</div>
|
||||
<div v-if="!nothingHappened" class="c-modal-away-progress__resources">
|
||||
<away-progress-helper
|
||||
v-for="(stat, index) of offlineStats"
|
||||
:key="index"
|
||||
:item="stat"
|
||||
v-for="name of offlineStats"
|
||||
:key="name"
|
||||
:name="name"
|
||||
:playerBefore="before"
|
||||
:playerAfter="after"
|
||||
v-on:something-happened="somethingHappened = true"
|
||||
/>
|
||||
</div>
|
||||
<span v-if="!nothingHappened">Note: Click an entry to hide it in the future.</span>
|
||||
</div>`
|
||||
});
|
||||
|
@ -5,52 +5,54 @@ Vue.component("modal-away-progress-options", {
|
||||
"away-progress-options-helper": {
|
||||
mixins: [modalOptionsMixin],
|
||||
props: {
|
||||
option: String,
|
||||
name: String,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
setting: false,
|
||||
isVisible: false,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
setting(newValue) {
|
||||
AwayProgressTypes[this.option].option = newValue;
|
||||
this.type.option = newValue;
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
type() {
|
||||
return AwayProgressTypes.all[this.name];
|
||||
},
|
||||
text() {
|
||||
return `${AwayProgressTypes[this.option].formatName}:`;
|
||||
return `${this.type.formatName}:`;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
this.setting = AwayProgressTypes[this.option].option;
|
||||
const type = this.type;
|
||||
this.setting = type.option;
|
||||
this.isVisible = type.isUnlocked;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<wide-on-off-button
|
||||
v-if="isVisible"
|
||||
v-model="setting"
|
||||
:text="text"
|
||||
/>`
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
all: Array,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
update() {
|
||||
this.all = AwayProgressTypes.all.filter(type => type.showOption && type.isUnlocked());
|
||||
computed: {
|
||||
all() {
|
||||
return AwayProgressTypes.showOption;
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<modal-options @close="emitClose" style="width: 50rem">
|
||||
<modal-options @close="emitClose" style="width: 75rem">
|
||||
<div class="c-modal-options__button-container">
|
||||
<away-progress-options-helper
|
||||
v-for="(entry, id) of all"
|
||||
:key="id"
|
||||
:option="entry.name"
|
||||
v-for="name of all"
|
||||
:key="name"
|
||||
:name="name"
|
||||
/>
|
||||
</div>
|
||||
Note: Selected resources will only show if they've increased.
|
||||
|
@ -1,17 +1,19 @@
|
||||
import { GameDatabase } from "./secret-formula/game-database";
|
||||
|
||||
class AwayProgress {
|
||||
constructor(config) {
|
||||
this.name = config.name;
|
||||
this.isUnlocked = config.isUnlocked;
|
||||
this.awayOption = config.awayOption === undefined ? this.name : config.awayOption;
|
||||
this.showOption = config.showOption === undefined ? true : config.showOption;
|
||||
this.awayOption = config.awayOption ?? this.name;
|
||||
this.showOption = config.showOption ?? true;
|
||||
// This is an array of strings, each one the name of the next entry in the player object to navigate to
|
||||
// If there is no reference, it is accessed directly by the name through the player object.
|
||||
this.reference = config.reference === undefined ? [this.name] : config.reference;
|
||||
this.reference = config.reference ?? [this.name];
|
||||
// Most of the entries in offline progress are props which can be directly read from the player object, but eg. for
|
||||
// achievements the raw data is an array of bitmasks. This structure allows generic support for indirect values.
|
||||
this.applyFn = config.applyFn === undefined ? x => x : config.applyFn;
|
||||
this.classObjectReference = config.classObjectReference === undefined ? this.name : config.classObjectReference;
|
||||
this.appearsInAwayModal = config.appearsInAwayModal === undefined ? true : config.appearsInAwayModal;
|
||||
this.applyFn = config.applyFn ?? (x => x);
|
||||
this.classObjectReference = config.classObjectReference ?? this.name;
|
||||
this.appearsInAwayModal = config.appearsInAwayModal ?? true;
|
||||
}
|
||||
|
||||
get option() {
|
||||
@ -47,156 +49,17 @@ class AwayProgress {
|
||||
}
|
||||
|
||||
export const AwayProgressTypes = {
|
||||
antimatter: new AwayProgress({
|
||||
name: "antimatter",
|
||||
isUnlocked: () => true,
|
||||
}),
|
||||
dimensionBoosts: new AwayProgress({
|
||||
name: "dimensionBoosts",
|
||||
isUnlocked: () => true,
|
||||
}),
|
||||
antimatterGalaxies: new AwayProgress({
|
||||
name: "antimatterGalaxies",
|
||||
reference: ["galaxies"],
|
||||
isUnlocked: () => true,
|
||||
}),
|
||||
infinities: new AwayProgress({
|
||||
name: "infinities",
|
||||
isUnlocked: () => PlayerProgress.infinityUnlocked(),
|
||||
}),
|
||||
infinityPoints: new AwayProgress({
|
||||
name: "infinityPoints",
|
||||
isUnlocked: () => PlayerProgress.infinityUnlocked(),
|
||||
}),
|
||||
replicanti: new AwayProgress({
|
||||
name: "replicanti",
|
||||
reference: ["replicanti", "amount"],
|
||||
isUnlocked: () => PlayerProgress.replicantiUnlocked() || PlayerProgress.eternityUnlocked(),
|
||||
}),
|
||||
replicantiGalaxies: new AwayProgress({
|
||||
name: "replicantiGalaxies",
|
||||
reference: ["replicanti", "galaxies"],
|
||||
isUnlocked: () => PlayerProgress.replicantiUnlocked() || PlayerProgress.eternityUnlocked(),
|
||||
}),
|
||||
eternities: new AwayProgress({
|
||||
name: "eternities",
|
||||
isUnlocked: () => PlayerProgress.eternityUnlocked(),
|
||||
}),
|
||||
eternityPoints: new AwayProgress({
|
||||
name: "eternityPoints",
|
||||
isUnlocked: () => PlayerProgress.eternityUnlocked(),
|
||||
}),
|
||||
tachyonParticles: new AwayProgress({
|
||||
name: "tachyonParticles",
|
||||
reference: ["dilation", "tachyonParticles"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
dilatedTime: new AwayProgress({
|
||||
name: "dilatedTime",
|
||||
reference: ["dilation", "dilatedTime"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
tachyonGalaxies: new AwayProgress({
|
||||
name: "tachyonGalaxies",
|
||||
reference: ["dilation", "totalTachyonGalaxies"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
achievements: new AwayProgress({
|
||||
name: "achievementCount",
|
||||
reference: ["achievementBits"],
|
||||
applyFn: x => x.map(b => countValuesFromBitmask(b)).sum(),
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
realities: new AwayProgress({
|
||||
name: "realities",
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
realityMachines: new AwayProgress({
|
||||
name: "realityMachines",
|
||||
reference: ["reality", "realityMachines"],
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}),
|
||||
imaginaryMachines: new AwayProgress({
|
||||
name: "imaginaryMachines",
|
||||
reference: ["reality", "imaginaryMachines"],
|
||||
isUnlocked: () => MachineHandler.isIMUnlocked,
|
||||
}),
|
||||
relicShards: new AwayProgress({
|
||||
name: "relicShards",
|
||||
reference: ["celestials", "effarig", "relicShards"],
|
||||
isUnlocked: () => Teresa.has(TERESA_UNLOCKS.EFFARIG),
|
||||
}),
|
||||
celestialMemories: new AwayProgress({
|
||||
name: "celestialMemories",
|
||||
isUnlocked: () => V.has(V_UNLOCKS.RA_UNLOCK),
|
||||
// Functions as the visible option for all Memories, never appears due to having no reference.
|
||||
appearsInAwayModal: false,
|
||||
}),
|
||||
teresaMemories: new AwayProgress({
|
||||
name: "teresaMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "teresa", "memories"],
|
||||
isUnlocked: () => Ra.pets.teresa.isUnlocked && !Ra.pets.teresa.isCapped,
|
||||
showOption: false,
|
||||
}),
|
||||
effarigMemories: new AwayProgress({
|
||||
name: "effarigMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "effarig", "memories"],
|
||||
isUnlocked: () => Ra.pets.effarig.isUnlocked && !Ra.pets.effarig.isCapped,
|
||||
showOption: false,
|
||||
}),
|
||||
enslavedMemories: new AwayProgress({
|
||||
name: "enslavedMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "enslaved", "memories"],
|
||||
isUnlocked: () => Ra.pets.enslaved.isUnlocked && !Ra.pets.enslaved.isCapped,
|
||||
showOption: false,
|
||||
}),
|
||||
vMemories: new AwayProgress({
|
||||
name: "vMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "v", "memories"],
|
||||
isUnlocked: () => Ra.pets.v.isUnlocked && !Ra.pets.v.isCapped,
|
||||
showOption: false,
|
||||
}),
|
||||
darkMatter: new AwayProgress({
|
||||
name: "darkMatter",
|
||||
reference: ["celestials", "laitela", "darkMatter"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
}),
|
||||
darkEnergy: new AwayProgress({
|
||||
name: "darkEnergy",
|
||||
reference: ["celestials", "laitela", "darkEnergy"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
}),
|
||||
singularities: new AwayProgress({
|
||||
name: "singularities",
|
||||
reference: ["celestials", "laitela", "singularities"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
}),
|
||||
blackHole: new AwayProgress({
|
||||
name: "blackHole",
|
||||
isUnlocked: () => BlackHole(1).isUnlocked,
|
||||
// Functions as the visible option for both first & second BHs, never appears due to having no reference.
|
||||
appearsInAwayModal: false,
|
||||
}),
|
||||
firstBlackHole: new AwayProgress({
|
||||
name: "firstBlackHole",
|
||||
awayOption: "blackHole",
|
||||
reference: ["blackHole", "0", "activations"],
|
||||
isUnlocked: () => BlackHole(1).isUnlocked,
|
||||
classObjectReference: "black-hole",
|
||||
showOption: false,
|
||||
}),
|
||||
secondBlackHole: new AwayProgress({
|
||||
name: "secondBlackHole",
|
||||
awayOption: "blackHole",
|
||||
reference: ["blackHole", "1", "activations"],
|
||||
isUnlocked: () => BlackHole(2).isUnlocked,
|
||||
classObjectReference: "black-hole",
|
||||
showOption: false,
|
||||
}),
|
||||
all: {},
|
||||
index: [],
|
||||
showOption: [],
|
||||
appearsInAwayModal: [],
|
||||
};
|
||||
|
||||
AwayProgressTypes.all = Object.values(AwayProgressTypes);
|
||||
for (let index = 0; index < GameDatabase.awayProgressTypes.length; index++) {
|
||||
const entry = new AwayProgress(GameDatabase.awayProgressTypes[index]);
|
||||
const name = entry.name;
|
||||
AwayProgressTypes.all[name] = entry;
|
||||
AwayProgressTypes.index.push(name);
|
||||
if (entry.showOption) AwayProgressTypes.showOption.push(name);
|
||||
if (entry.appearsInAwayModal) AwayProgressTypes.appearsInAwayModal.push(name);
|
||||
}
|
||||
|
127
javascripts/core/secret-formula/away-progress-types.js
Normal file
127
javascripts/core/secret-formula/away-progress-types.js
Normal file
@ -0,0 +1,127 @@
|
||||
import { GameDatabase } from "./game-database.js";
|
||||
|
||||
GameDatabase.awayProgressTypes = [
|
||||
{
|
||||
name: "antimatter",
|
||||
isUnlocked: () => true,
|
||||
}, {
|
||||
name: "dimensionBoosts",
|
||||
isUnlocked: () => true,
|
||||
}, {
|
||||
name: "antimatterGalaxies",
|
||||
reference: ["galaxies"],
|
||||
isUnlocked: () => true,
|
||||
}, {
|
||||
name: "infinities",
|
||||
isUnlocked: () => PlayerProgress.infinityUnlocked(),
|
||||
}, {
|
||||
name: "infinityPoints",
|
||||
isUnlocked: () => PlayerProgress.infinityUnlocked(),
|
||||
}, {
|
||||
name: "replicanti",
|
||||
reference: ["replicanti", "amount"],
|
||||
isUnlocked: () => PlayerProgress.replicantiUnlocked() || PlayerProgress.eternityUnlocked(),
|
||||
}, {
|
||||
name: "replicantiGalaxies",
|
||||
reference: ["replicanti", "galaxies"],
|
||||
isUnlocked: () => PlayerProgress.replicantiUnlocked() || PlayerProgress.eternityUnlocked(),
|
||||
}, {
|
||||
name: "eternities",
|
||||
isUnlocked: () => PlayerProgress.eternityUnlocked(),
|
||||
}, {
|
||||
name: "eternityPoints",
|
||||
isUnlocked: () => PlayerProgress.eternityUnlocked(),
|
||||
}, {
|
||||
name: "tachyonParticles",
|
||||
reference: ["dilation", "tachyonParticles"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "dilatedTime",
|
||||
reference: ["dilation", "dilatedTime"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "tachyonGalaxies",
|
||||
reference: ["dilation", "totalTachyonGalaxies"],
|
||||
isUnlocked: () => PlayerProgress.dilationUnlocked() || PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "achievementAmount",
|
||||
reference: ["achievementBits"],
|
||||
applyFn: x => x.map(b => countValuesFromBitmask(b)).sum(),
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "realities",
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "realityMachines",
|
||||
reference: ["reality", "realityMachines"],
|
||||
isUnlocked: () => PlayerProgress.realityUnlocked(),
|
||||
}, {
|
||||
name: "blackHole",
|
||||
isUnlocked: () => BlackHole(1).isUnlocked,
|
||||
// Functions as the visible option for both first & second BHs, never appears due to having no reference.
|
||||
appearsInAwayModal: false,
|
||||
}, {
|
||||
name: "firstBlackHole",
|
||||
awayOption: "blackHole",
|
||||
reference: ["blackHole", "0", "activations"],
|
||||
isUnlocked: () => BlackHole(1).isUnlocked,
|
||||
classObjectReference: "black-hole",
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "secondBlackHole",
|
||||
awayOption: "blackHole",
|
||||
reference: ["blackHole", "1", "activations"],
|
||||
isUnlocked: () => BlackHole(2).isUnlocked,
|
||||
classObjectReference: "black-hole",
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "relicShards",
|
||||
reference: ["celestials", "effarig", "relicShards"],
|
||||
isUnlocked: () => Teresa.has(TERESA_UNLOCKS.EFFARIG),
|
||||
}, {
|
||||
name: "celestialMemories",
|
||||
isUnlocked: () => V.has(V_UNLOCKS.RA_UNLOCK),
|
||||
// Functions as the visible option for all Memories, never appears due to having no reference.
|
||||
appearsInAwayModal: false,
|
||||
}, {
|
||||
name: "teresaMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "teresa", "memories"],
|
||||
isUnlocked: () => Ra.pets.teresa.isUnlocked && !Ra.pets.teresa.isCapped,
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "effarigMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "effarig", "memories"],
|
||||
isUnlocked: () => Ra.pets.effarig.isUnlocked && !Ra.pets.effarig.isCapped,
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "enslavedMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "enslaved", "memories"],
|
||||
isUnlocked: () => Ra.pets.enslaved.isUnlocked && !Ra.pets.enslaved.isCapped,
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "vMemories",
|
||||
awayOption: "celestialMemories",
|
||||
reference: ["celestials", "ra", "pets", "v", "memories"],
|
||||
isUnlocked: () => Ra.pets.v.isUnlocked && !Ra.pets.v.isCapped,
|
||||
showOption: false,
|
||||
}, {
|
||||
name: "imaginaryMachines",
|
||||
reference: ["reality", "imaginaryMachines"],
|
||||
isUnlocked: () => MachineHandler.isIMUnlocked,
|
||||
}, {
|
||||
name: "darkMatter",
|
||||
reference: ["celestials", "laitela", "darkMatter"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
}, {
|
||||
name: "darkEnergy",
|
||||
reference: ["celestials", "laitela", "darkEnergy"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
}, {
|
||||
name: "singularities",
|
||||
reference: ["celestials", "laitela", "singularities"],
|
||||
isUnlocked: () => Laitela.isUnlocked,
|
||||
},
|
||||
];
|
@ -1,6 +1,7 @@
|
||||
import "./game-database.js";
|
||||
|
||||
import "./tabs.js";
|
||||
import "./away-progress-types.js";
|
||||
import "./tab-notifications.js";
|
||||
import "./news.js";
|
||||
import "./achievements/normal-achievements.js";
|
||||
|
@ -5184,6 +5184,12 @@ screen and (max-width: 480px) {
|
||||
0 0 0.3rem #e67919;
|
||||
}
|
||||
|
||||
.c-modal-away-progress__strikethrough {
|
||||
text-decoration: line-through;
|
||||
color: #303030;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/*#endregion c-modal-away-progress*/
|
||||
|
||||
/*#region c-modal-import*/
|
||||
|
Loading…
Reference in New Issue
Block a user