Skip to content

Commit

Permalink
Merge pull request #1581 from ebkr/develop
Browse files Browse the repository at this point in the history
Develop (3.1.55)
  • Loading branch information
ebkr authored Dec 10, 2024
2 parents a575b87 + 544b5ba commit 197d845
Show file tree
Hide file tree
Showing 17 changed files with 246 additions and 200 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### 3.1.55
#### Games added
- ATLYSS
- STRAFTAT
- Peaks of Yore

### 3.1.54
#### Bug fix
- Fixed profile import issue where entries were not found inside zips
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2modman",
"version": "3.1.54",
"version": "3.1.55",
"description": "A simple and easy to use mod manager for many games using Thunderstore.",
"productName": "r2modman",
"author": "ebkr",
Expand Down
2 changes: 1 addition & 1 deletion src/_managerinf/ManagerInformation.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import VersionNumber from '../model/VersionNumber';

export default class ManagerInformation {
public static VERSION: VersionNumber = new VersionNumber('3.1.54');
public static VERSION: VersionNumber = new VersionNumber('3.1.55');
public static IS_PORTABLE: boolean = false;
public static APP_NAME: string = "r2modman";
}
Binary file added src/assets/images/game_selection/ATLYSS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/assets/images/game_selection/GladioMori.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/images/game_selection/STRAFTAT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions src/components/mixins/DownloadMixin.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<script lang='ts'>
import Vue from 'vue';
import Component from 'vue-class-component';
import ThunderstoreMod from "../../model/ThunderstoreMod";
import Game from "../../model/game/Game";
import Profile from "../../model/Profile";
@Component
export default class DownloadMixin extends Vue {
get activeGame(): Game {
return this.$store.state.activeGame;
}
closeModal() {
this.$store.commit("closeDownloadModModal");
}
get isOpen(): boolean {
return this.$store.state.modals.isDownloadModModalOpen;
}
get thunderstoreMod(): ThunderstoreMod | null {
return this.$store.state.modals.downloadModModalMod;
}
get profile(): Profile {
return this.$store.getters['profile/activeProfile'];
}
}
</script>
146 changes: 7 additions & 139 deletions src/components/views/DownloadModModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,56 +15,7 @@
</div>
<button class="modal-close is-large" aria-label="close" @click="downloadingMod = false;"></button>
</div>
<ModalCard :is-active="isOpen" :can-close="true" v-if="thunderstoreMod !== null" @close-modal="closeModal()">
<template v-slot:header>
<h2 class='modal-title' v-if="thunderstoreMod !== null">
Select a version of {{thunderstoreMod.getName()}} to download
</h2>
</template>
<template v-slot:body>
<p>It's recommended to select the latest version of all mods.</p>
<p>Using outdated versions may cause problems.</p>
<br/>
<div class="columns is-vcentered">
<template v-if="currentVersion !== null">
<div class="column is-narrow">
<select class="select" disabled="true">
<option selected>
{{currentVersion}}
</option>
</select>
</div>
<div class="column is-narrow">
<span class="margin-right margin-right--half-width"><span class="margin-right margin-right--half-width"/> <i class='fas fa-long-arrow-alt-right'></i></span>
</div>
</template>
<div class="column is-narrow">
<select class='select' v-model='selectedVersion'>
<option v-for='(value, index) in versionNumbers' :key='index' v-bind:value='value'>
{{value}}
</option>
</select>
</div>
<div class="column is-narrow">
<span class="tag is-dark" v-if='selectedVersion === null'>
You need to select a version
</span>
<span class="tag is-success" v-else-if='recommendedVersion === selectedVersion'>
{{selectedVersion}} is the recommended version
</span>
<span class="tag is-success" v-else-if='versionNumbers[0] === selectedVersion'>
{{selectedVersion}} is the latest version
</span>
<span class="tag is-danger" v-else-if='versionNumbers[0] !== selectedVersion'>
{{selectedVersion}} is an outdated version
</span>
</div>
</div>
</template>
<template v-slot:footer>
<button class="button is-info" @click="downloadThunderstoreMod()">Download with dependencies</button>
</template>
</ModalCard>
<DownloadModVersionSelectModal @download-mod="downloadHandler" />
<ModalCard :is-active="isOpen" :can-close="true" v-if="thunderstoreMod === null" @close-modal="closeModal()">
<template v-slot:header>
<h2 class='modal-title'>Update all installed mods</h2>
Expand All @@ -90,7 +41,8 @@

<script lang="ts">
import { Component, Vue, Watch } from 'vue-property-decorator';
import { mixins } from "vue-class-component";
import { Component } from 'vue-property-decorator';
import ThunderstoreMod from '../../model/ThunderstoreMod';
import ManifestV2 from '../../model/ManifestV2';
import ThunderstoreVersion from '../../model/ThunderstoreVersion';
Expand All @@ -102,12 +54,11 @@ import ProfileInstallerProvider from '../../providers/ror2/installing/ProfileIns
import ProfileModList from '../../r2mm/mods/ProfileModList';
import Profile from '../../model/Profile';
import { Progress } from '../all';
import Game from '../../model/game/Game';
import ConflictManagementProvider from '../../providers/generic/installing/ConflictManagementProvider';
import { MOD_LOADER_VARIANTS } from '../../r2mm/installing/profile_installers/ModLoaderVariantRecord';
import ModalCard from '../ModalCard.vue';
import * as PackageDb from '../../r2mm/manager/PackageDexieStore';
import { installModsToProfile } from '../../utils/ProfileUtils';
import DownloadMixin from "../mixins/DownloadMixin.vue";
import DownloadModVersionSelectModal from "../../components/views/DownloadModVersionSelectModal.vue";
interface DownloadProgress {
assignId: number;
Expand All @@ -121,29 +72,18 @@ let assignId = 0;
@Component({
components: {
DownloadModVersionSelectModal,
ModalCard,
Progress
}
})
export default class DownloadModModal extends Vue {
export default class DownloadModModal extends mixins(DownloadMixin) {
versionNumbers: string[] = [];
recommendedVersion: string | null = null;
downloadObject: DownloadProgress | null = null;
downloadingMod: boolean = false;
selectedVersion: string | null = null;
currentVersion: string | null = null;
static allVersions: [number, DownloadProgress][] = [];
get activeGame(): Game {
return this.$store.state.activeGame;
}
get profile(): Profile {
return this.$store.getters['profile/activeProfile'];
}
get ignoreCache(): boolean {
const settings = this.$store.getters['settings'];
return settings.getContext().global.ignoreCache;
Expand Down Expand Up @@ -212,78 +152,6 @@ let assignId = 0;
});
}
get thunderstoreMod(): ThunderstoreMod | null {
return this.$store.state.modals.downloadModModalMod;
}
get isOpen(): boolean {
return this.$store.state.modals.isDownloadModModalOpen;
}
@Watch('$store.state.modals.downloadModModalMod')
async getModVersions() {
this.currentVersion = null;
if (this.thunderstoreMod !== null) {
this.selectedVersion = this.thunderstoreMod.getLatestVersion();
this.recommendedVersion = null;
this.versionNumbers = await PackageDb.getPackageVersionNumbers(
this.activeGame.internalFolderName,
this.thunderstoreMod.getFullName()
);
const foundRecommendedVersion = MOD_LOADER_VARIANTS[this.activeGame.internalFolderName]
.find(value => value.packageName === this.thunderstoreMod!.getFullName());
if (foundRecommendedVersion && foundRecommendedVersion.recommendedVersion) {
this.recommendedVersion = foundRecommendedVersion.recommendedVersion.toString();
// Auto-select recommended version if it's found.
const recommendedVersion = this.versionNumbers.find(
(ver) => ver === foundRecommendedVersion.recommendedVersion!.toString()
);
if (recommendedVersion) {
this.selectedVersion = recommendedVersion;
}
}
const modListResult = await ProfileModList.getModList(this.profile.asImmutableProfile());
if (!(modListResult instanceof R2Error)) {
const manifestMod = modListResult.find((local: ManifestV2) => local.getName() === this.thunderstoreMod!.getFullName());
if (manifestMod !== undefined) {
this.currentVersion = manifestMod.getVersionNumber().toString();
}
}
}
}
closeModal() {
this.$store.commit("closeDownloadModModal");
}
async downloadThunderstoreMod() {
const refSelectedThunderstoreMod: ThunderstoreMod | null = this.thunderstoreMod;
const refSelectedVersion: string | null = this.selectedVersion;
if (refSelectedThunderstoreMod === null || refSelectedVersion === null) {
// Shouldn't happen, but shouldn't throw an error.
return;
}
let version: ThunderstoreVersion;
try {
version = await PackageDb.getVersionAsThunderstoreVersion(
this.activeGame.internalFolderName,
refSelectedThunderstoreMod.getFullName(),
refSelectedVersion
);
} catch {
return;
}
this.downloadHandler(refSelectedThunderstoreMod, version);
}
async downloadLatest() {
this.closeModal();
const modsWithUpdates: ThunderstoreCombo[] = await this.$store.dispatch('profile/getCombosWithUpdates');
Expand Down
144 changes: 144 additions & 0 deletions src/components/views/DownloadModVersionSelectModal.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
<template>
<ModalCard :is-active="isOpen" :can-close="true" v-if="thunderstoreMod !== null" @close-modal="closeModal()">
<template v-slot:header>
<h2 class='modal-title' v-if="thunderstoreMod !== null">
Select a version of {{thunderstoreMod.getName()}} to download
</h2>
</template>
<template v-slot:body>
<p>It's recommended to select the latest version of all mods.</p>
<p>Using outdated versions may cause problems.</p>
<br/>
<div class="columns is-vcentered">
<template v-if="currentVersion !== null">
<div class="column is-narrow">
<select class="select" disabled="true">
<option selected>
{{currentVersion}}
</option>
</select>
</div>
<div class="column is-narrow">
<span class="margin-right margin-right--half-width"><span class="margin-right margin-right--half-width"/> <i class='fas fa-long-arrow-alt-right'></i></span>
</div>
</template>
<div class="column is-narrow">
<select class='select' v-model="selectedVersion">
<option v-for='(value, index) in versionNumbers' :key='index' :value='value'>
{{value}}
</option>
</select>
</div>
<div class="column is-narrow">
<span class="tag is-dark" v-if='selectedVersion === null'>
You need to select a version
</span>
<span class="tag is-success" v-else-if='recommendedVersion === selectedVersion'>
{{selectedVersion}} is the recommended version
</span>
<span class="tag is-success" v-else-if='versionNumbers[0] === selectedVersion'>
{{selectedVersion}} is the latest version
</span>
<span class="tag is-danger" v-else-if='versionNumbers[0] !== selectedVersion'>
{{selectedVersion}} is an outdated version
</span>
</div>
</div>
</template>
<template v-slot:footer>
<button class="button is-info" @click="downloadMod">Download with dependencies</button>
</template>
</ModalCard>
</template>

<script lang="ts">
import { mixins } from "vue-class-component";
import { Component, Watch } from "vue-property-decorator";
import ModalCard from "../ModalCard.vue";
import DownloadMixin from "../../components/mixins/DownloadMixin.vue";
import R2Error from "../../model/errors/R2Error";
import ManifestV2 from "../../model/ManifestV2";
import ThunderstoreMod from "../../model/ThunderstoreMod";
import ThunderstoreVersion from "../../model/ThunderstoreVersion";
import { MOD_LOADER_VARIANTS } from "../../r2mm/installing/profile_installers/ModLoaderVariantRecord";
import * as PackageDb from "../../r2mm/manager/PackageDexieStore";
import ProfileModList from "../../r2mm/mods/ProfileModList";
@Component({
components: {
ModalCard
},
})
export default class DownloadModVersionSelectModal extends mixins(DownloadMixin) {
versionNumbers: string[] = [];
recommendedVersion: string | null = null;
selectedVersion: string | null = null;
currentVersion: string | null = null;
@Watch("$store.state.modals.downloadModModalMod")
async updateModVersionState() {
this.currentVersion = null;
if (this.thunderstoreMod !== null) {
this.selectedVersion = this.thunderstoreMod.getLatestVersion();
this.recommendedVersion = null;
this.versionNumbers = await PackageDb.getPackageVersionNumbers(
this.activeGame.internalFolderName,
this.thunderstoreMod.getFullName()
);
const foundRecommendedVersion = MOD_LOADER_VARIANTS[this.activeGame.internalFolderName]
.find(value => value.packageName === this.thunderstoreMod!.getFullName());
if (foundRecommendedVersion && foundRecommendedVersion.recommendedVersion) {
this.recommendedVersion = foundRecommendedVersion.recommendedVersion.toString();
// Auto-select recommended version if it's found.
const recommendedVersion = this.versionNumbers.find(
(ver) => ver === foundRecommendedVersion.recommendedVersion!.toString()
);
if (recommendedVersion) {
this.selectedVersion = recommendedVersion;
}
}
const modListResult = await ProfileModList.getModList(this.profile.asImmutableProfile());
if (!(modListResult instanceof R2Error)) {
const manifestMod = modListResult.find((local: ManifestV2) => local.getName() === this.thunderstoreMod!.getFullName());
if (manifestMod !== undefined) {
this.currentVersion = manifestMod.getVersionNumber().toString();
}
}
}
}
async downloadMod() {
const mod = this.thunderstoreMod;
const versionString = this.selectedVersion;
if (mod === null || versionString === null) {
// Shouldn't happen, but shouldn't throw an error.
console.log(`Download initiated with null mod [${mod}] or version [${versionString}]`);
return;
}
let version: ThunderstoreVersion;
try {
version = await PackageDb.getVersionAsThunderstoreVersion(
this.activeGame.internalFolderName,
mod.getFullName(),
versionString
);
} catch {
console.log(`Failed to get version [${versionString}] for mod [${mod.getFullName()}]`);
return;
}
this.$emit("download-mod", mod, version); // Delegate to DownloadModModal.
}
}
</script>
Loading

0 comments on commit 197d845

Please sign in to comment.