Add mods download

This commit is contained in:
Thoronium 2023-04-07 02:15:17 -06:00
parent 3356bddb42
commit d7b2aa25cc
17 changed files with 116 additions and 14 deletions

View File

@ -44,7 +44,9 @@
"resources": "下载 Grasscutter 资源",
"game": "下载游戏",
"aio_header": "多合一下载:",
"individual_header": "个别部分下载:"
"individual_header": "个别部分下载:",
"mods_header": "Mods:",
"migoto": "下载 GIMI 3dmigoto"
},
"download_status": {
"downloading": "下载中",

View File

@ -44,7 +44,9 @@
"resources": "下載Grasscutter資源Resources",
"game": "下載遊戲",
"aio_header": "多合一下載:",
"individual_header": "個別部分下載:"
"individual_header": "個別部分下載:",
"mods_header": "Mods:",
"migoto": "下載GIMI 3dmigoto"
},
"download_status": {
"downloading": "下載中",

View File

@ -43,7 +43,9 @@
"resources": "Grasscutter Ressourcen herunterladen",
"game": "Spiel herunterladen",
"aio_header": "Alles in Einem herunterladen",
"individual_header": "Einzelne Teile herunterladen:"
"individual_header": "Einzelne Teile herunterladen:",
"mods_header": "Mods:",
"migoto": "GIMI 3dmigoto herunterladen"
},
"download_status": {
"downloading": "Lädt herunter",

View File

@ -44,7 +44,9 @@
"resources": "Download Grasscutter Resources",
"game": "Download Game",
"aio_header": "All-in-One Downloads:",
"individual_header": "Individual downloads:"
"individual_header": "Individual downloads:",
"mods_header": "Mods:",
"migoto": "Download GIMI 3dmigoto"
},
"download_status": {
"downloading": "Downloading",
@ -77,7 +79,8 @@
"emergency_rsa": "In case something went wrong, force delete RSA patch.",
"use_proxy": "Use the Cultivation internal proxy. You should have this enabled unless you use something like Fiddler",
"patch_rsa": "Patch and unpatch your game RSA automatically. Unless playing with old/non-official versions (3.0 and older), this should be enabled.",
"add_delay": "Set delay in 3dmigoto loader! \nThis should fix loading issues, but will add a small delay to when 3dmigoto is loaded upon launching the game. \nYou can now launch with 3dmigoto again."
"add_delay": "Set delay in 3dmigoto loader! \nThis should fix loading issues, but will add a small delay to when 3dmigoto is loaded upon launching the game. \nYou can now launch with 3dmigoto again.",
"migoto": "For importing models from GameBanana"
},
"swag": {
"akebi_name": "Akebi",

View File

@ -44,7 +44,9 @@
"resources": "Descargar Recursos de Grasscutter",
"game": "Descarga el juego",
"aio_header": "Descargas todo en uno:",
"individual_header": "Descargas de piezas individuales:"
"individual_header": "Descargas de piezas individuales:",
"mods_header": "Mods:",
"migoto": "Descargar GIMI 3dmigoto"
},
"download_status": {
"downloading": "Descargando",

View File

@ -43,7 +43,9 @@
"grasscutter_latest_update": "Mettre a jour Grasscutter (derniere version)",
"resources": "Telecharger les ressources logicielles de Grasscutter",
"aio_header": "Telechargements tout-en-un:",
"individual_header": "Telechargements de pièces individuelles:"
"individual_header": "Telechargements de pièces individuelles:",
"mods_header": "Mods:",
"migoto": "Telecharger GIMI 3dmigoto"
},
"download_status": {
"downloading": "Telechargement",

View File

@ -42,7 +42,9 @@
"grasscutter_latest_update": "Sedang MengUpdate Grasscutter Terbaru",
"resources": "Mendownload Grasscutter Resources",
"aio_header": "Unduhan Semua Dalam Satu:",
"individual_header": "Unduhan Bagian Individual:"
"individual_header": "Unduhan Bagian Individual:",
"mods_header": "Mods:",
"migoto": "Sedang Mendownload GIMI 3dmigoto"
},
"download_status": {
"downloading": "Sedang Mendownload",

View File

@ -44,7 +44,9 @@
"resources": "리소스 다운로드",
"game": "게임 다운로드",
"aio_header": "올인원 다운로드",
"individual_header": "개별 부품 다운로드:"
"individual_header": "개별 부품 다운로드:",
"mods_header": "Mods:",
"migoto": "GIMI 3dmigoto 다운로드"
},
"download_status": {
"downloading": "다운로드 중",

View File

@ -41,7 +41,9 @@
"grasscutter_latest_update": "Atjauniet Grasscutter jaunāko",
"resources": "Lejupielādējiet Grasscutter resursi",
"aio_header": "Lejupielādes viss vienā",
"individual_header": "Atsevišķu daļu lejupielādes:"
"individual_header": "Atsevišķu daļu lejupielādes:",
"mods_header": "Mods:",
"migoto": "Lejupielādēt GIMI 3dmigoto"
},
"download_status": {
"downloading": "Notiek lejupielāde",

View File

@ -43,7 +43,9 @@
"resources": "Download Grasscutter bronnen",
"game": "Download Spel",
"aio_header": "Alles-in-één Downloads:",
"individual_header": "Downloads van afzonderlijke onderdelen:"
"individual_header": "Downloads van afzonderlijke onderdelen:",
"mods_header": "Mods:",
"migoto": "Download GIMI 3dmigoto"
},
"download_status": {
"downloading": "Aan Het Downloading",

View File

@ -44,7 +44,9 @@
"resources": "Baixar os Recursos do Grasscutter ",
"game": "Baixar o Jogo",
"aio_header": "Downloads Tudo-em-Um:",
"individual_header": "Downloads Individuais:"
"individual_header": "Downloads Individuais:",
"mods_header": "Mods:",
"migoto": "Baixar o GIMI 3dmigoto"
},
"download_status": {
"downloading": "Baixando",

View File

@ -43,7 +43,9 @@
"resources": "Скачать ресурсы Grasscutter",
"game": "Скачать Игру",
"aio_header": "Все в одной загрузке:",
"individual_header": "загрузка отдельных частей:"
"individual_header": "загрузка отдельных частей:",
"mods_header": "Mods:",
"migoto": "Скачать GIMI 3dmigoto"
},
"download_status": {
"downloading": "Скачивание",

View File

@ -44,7 +44,9 @@
"resources": "Tải tài nguyên Grasscutter",
"game": "Tải game",
"aio_header": "Tải xuống tất cả trong một:",
"individual_header": "Tải xuống từng phần:"
"individual_header": "Tải xuống từng phần:",
"mods_header": "Mods:",
"migoto": "Tải GIMI 3dmigoto"
},
"download_status": {
"downloading": "Đang tải",

View File

@ -103,6 +103,12 @@ pub fn unzip(
.unwrap();
}
if zipfile.contains("3dmigoto") {
window
.emit("migoto_extracted", destpath.to_string() + "3DMigoto Loader.exe")
.unwrap();
}
// Delete zip file
match std::fs::remove_file(&zipfile) {
Ok(_) => {

View File

@ -65,6 +65,14 @@ export class Main extends React.Component<IProps, IState> {
setConfigOption('grasscutter_path', payload)
})
listen('migoto_extracted', ({ payload }: { payload: string }) => {
setConfigOption('migoto_path', payload)
invoke('set_migoto_target', {
migotoPath: payload,
})
})
// Emitted for rsa replacing-purposes
listen('game_closed', async () => {
const wasPatched = await getConfigOption('patch_rsa')

View File

@ -19,6 +19,7 @@ const DEV_REPO_DOWNLOAD = 'https://github.com/Grasscutters/Grasscutter/archive/r
const STABLE_DOWNLOAD = 'https://nightly.link/Grasscutters/Grasscutter/workflows/build/stable/Grasscutter.zip'
const DEV_DOWNLOAD = 'https://nightly.link/Grasscutters/Grasscutter/workflows/build/development/Grasscutter.zip'
const RESOURCES_DOWNLOAD = 'https://gitlab.com/YuukiPS/GC-Resources/-/archive/3.5/GC-Resources-3.5.zip' // Use Yuuki res as grasscutter crepe res are broken
const MIGOTO_DOWNLOAD = 'https://github.com/SilentNightSound/GI-Model-Importer/releases/download/V6.0/3dmigoto-GIMI-for-playing-mods.zip'
interface IProps {
closeFn: () => void
@ -30,8 +31,10 @@ interface IState {
grasscutter_downloading: boolean
resources_downloading: boolean
repo_downloading: boolean
migoto_downloading: boolean
grasscutter_set: boolean
resources_exist: boolean
swag: boolean
}
export default class Downloads extends React.Component<IProps, IState> {
@ -43,8 +46,10 @@ export default class Downloads extends React.Component<IProps, IState> {
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
resources_downloading: this.props.downloadManager.downloadingResources(),
repo_downloading: this.props.downloadManager.downloadingRepo(),
migoto_downloading: this.props.downloadManager.downloadingMigoto(),
grasscutter_set: false,
resources_exist: false,
swag: false,
}
this.getGrasscutterFolder = this.getGrasscutterFolder.bind(this)
@ -54,11 +59,17 @@ export default class Downloads extends React.Component<IProps, IState> {
this.downloadGrasscutterStable = this.downloadGrasscutterStable.bind(this)
this.downloadGrasscutterLatest = this.downloadGrasscutterLatest.bind(this)
this.downloadResources = this.downloadResources.bind(this)
this.downloadMigoto = this.downloadMigoto.bind(this)
this.toggleButtons = this.toggleButtons.bind(this)
}
async componentDidMount() {
const gc_path = await getConfigOption('grasscutter_path')
const swag = await getConfigOption('swag_mode')
this.setState({
swag: swag || false,
})
listen('jar_extracted', () => {
this.setState({ grasscutter_set: true }, this.forceUpdate)
@ -113,6 +124,13 @@ export default class Downloads extends React.Component<IProps, IState> {
return folderPath
}
async getCultivationFolder() {
const folderPath = await dataDir() + 'cultivation'
return folderPath
}
async downloadGrasscutterFullBuild() {
const folder = await this.getGrasscutterFolder()
this.props.downloadManager.addDownload(FULL_BUILD_DOWNLOAD, folder + '\\GrasscutterCulti.zip', async () => {
@ -201,6 +219,20 @@ export default class Downloads extends React.Component<IProps, IState> {
this.toggleButtons()
}
async downloadMigoto() {
const folder = await this.getCultivationFolder() + '\\3dmigoto'
await invoke('dir_create', {
path: folder
})
this.props.downloadManager.addDownload(MIGOTO_DOWNLOAD, folder + '\\GIMI-3dmigoto.zip', async () => {
await unzip(folder + '\\GIMI-3dmigoto.zip', folder + '\\', true)
this.toggleButtons()
})
this.toggleButtons()
}
async toggleButtons() {
const gc_path = await getConfigOption('grasscutter_path')
@ -210,6 +242,7 @@ export default class Downloads extends React.Component<IProps, IState> {
grasscutter_downloading: this.props.downloadManager.downloadingJar(),
resources_downloading: this.props.downloadManager.downloadingResources(),
repo_downloading: this.props.downloadManager.downloadingRepo(),
migoto_downloading: this.props.downloadManager.downloadingMigoto(),
grasscutter_set: gc_path !== '',
})
}
@ -336,6 +369,30 @@ export default class Downloads extends React.Component<IProps, IState> {
</BigButton>
</div>
</div>
{this.state.swag && (
<>
<Divider />
<div className="HeaderText" id="downloadMenuModsHeader">
<Tr text="downloads.mods_header" />
</div>
<div className="DownloadMenuSection" id="downloadMenuContainerMigoto">
<div className="DownloadLabel" id="downloadMenuLabelMigoto">
<Tr text={'downloads.migoto'} />
<HelpButton contents="help.migoto" />
</div>
<div className="DownloadValue" id="downloadMenuButtonMigoto">
<BigButton
disabled={this.state.migoto_downloading}
onClick={this.downloadMigoto}
id="migotoBtn"
>
<Tr text="components.download" />
</BigButton>
</div>
</div>
</>
)}
</Menu>
)
}

View File

@ -117,6 +117,10 @@ export default class DownloadHandler {
downloadingRepo() {
return this.downloads.some((d) => d.path.includes('grasscutter_repo.zip'))
}
downloadingMigoto() {
return this.downloads.some((d) => d.path.includes('3dmigoto'))
}
addDownload(url: string, path: string, onFinish?: () => void) {
// Begin download from rust backend, don't add if the download addition fails