-
Notifications
You must be signed in to change notification settings - Fork 2
/
TaleofImmortal.ts
88 lines (83 loc) · 2.52 KB
/
TaleofImmortal.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
import { join, basename, dirname } from 'path'
import { ElMessage } from "element-plus";
function handlePlugins(mod: IModInfo, installPath: string, isInstall: boolean) {
let res: IState[] = []
const manager = useManager()
let modStorage = join(manager.modStorage, mod.id.toString())
let gameStorage = join(manager.gameStorage ?? "", installPath)
let folder: string[] = []
mod.modFiles.forEach(item => {
if (basename(item).toLowerCase() == "modexportdata.cache") {
folder.push(dirname(join(modStorage, item)))
}
})
// console.log(folder);
if (folder.length > 0) {
folder.forEach(item => {
let target = join(gameStorage, basename(item))
if (isInstall) {
// console.log(item, target);
FileHandler.createLink(item, target)
// FileHandler.copyFolder(item, target)
} else {
// FileHandler.deleteFolder(target)
FileHandler.removeLink(target)
}
})
}
return res
}
export const supportedGames: ISupportedGames = {
GlossGameId: 248,
steamAppID: 1468810,
NexusMods: {
game_domain_name: "taleofimmortal",
game_id: 4447
},
installdir: "鬼谷八荒",
gameName: "Tale of Immortal",
gameExe: 'guigubahuang.exe',
// https://store.steampowered.com/app/1468810/_/
startExe: [
{
name: "Steam 启动",
cmd: 'steam://rungameid/1468810'
}
],
gameCoverImg: "https://mod.3dmgame.com/static/upload/game/603e05b7aef61.png",
modType: [
{
id: 1,
name: "通用",
installPath: join("ModExportData"),
async install(mod) {
return handlePlugins(mod, this.installPath ?? "", true)
},
async uninstall(mod) {
return handlePlugins(mod, this.installPath ?? "", false)
}
},
{
id: 2,
name: "未知",
installPath: "",
async install(mod) {
ElMessage.warning("未知类型, 请手动安装")
return false
},
async uninstall(mod) {
return true
}
}
],
checkModType(mod) {
let isMod = false
mod.modFiles.forEach(item => {
if (basename(item).toLowerCase() == "modexportdata.cache") {
isMod = true
}
})
if (isMod) return 1
return 2
}
}