-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathRimWorld.ts
93 lines (85 loc) · 2.62 KB
/
RimWorld.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
// 边缘世界 MOD
import { join, basename } from 'path'
import { ElMessage } from "element-plus";
async function handleMod(mod: IModInfo, installPath: string, isInstall: boolean) {
let manager = useManager()
let modBaseFolder: string[] = []
mod.modFiles.forEach(item => {
let path = join(manager.modStorage, mod.id.toString(), item)
if (basename(path).toLowerCase() == "about.xml") {
// modBaseFolder = join(path, '..', '..')
modBaseFolder.push(join(path, '..', '..'));
}
})
if (modBaseFolder.length > 0) {
// console.log(modBaseFolder);
modBaseFolder.forEach(item => {
let destPath = join(manager.gameStorage, installPath, basename(item))
if (isInstall) {
FileHandler.createLink(item, destPath)
} else {
FileHandler.removeLink(destPath)
}
})
return true
} else {
ElMessage.error("未找到 about.xml 文件, 无法安装!")
return false
}
}
export const supportedGames: ISupportedGames = {
GlossGameId: 19,
steamAppID: 294100,
NexusMods: {
game_domain_name: 'rimworld',
game_id: 424
},
installdir: join("RimWorld"),
gameName: "RimWorld",
startExe: [
{
name: "Steam 启动",
cmd: "steam://rungameid/294100"
},
{
name: "直接启动",
exePath: join("RimWorldWin64.exe")
}
],
gameExe: "RimWorldWin64.exe",
archivePath: join(FileHandler.GetAppData(), "LocalLow", "Ludeon Studios", "RimWorld by Ludeon Studios"),
gameCoverImg: "https://mod.3dmgame.com/static/upload/game/19.jpg",
modType: [
{
id: 1,
name: "通用类型",
installPath: "Mods",
async install(mod) {
return handleMod(mod, this.installPath ?? "", true)
},
async uninstall(mod) {
return handleMod(mod, this.installPath ?? "", false)
}
},
{
id: 99,
name: '未知',
installPath: '\\',
async install(mod) {
ElMessage.warning("该mod类型未知, 无法自动安装, 请手动安装!")
return false
},
async uninstall(mod) {
return true
}
}
],
checkModType(mod) {
let modType = 99
mod.modFiles.forEach(item => {
let filename = basename(item)
if (filename.toLowerCase() == "about.xml") modType = 1
})
return modType
}
}