-
Notifications
You must be signed in to change notification settings - Fork 2
/
TWW3.ts
97 lines (88 loc) · 2.74 KB
/
TWW3.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
94
95
96
97
/**
* @description 全面战争 战锤3 支持
*/
import { basename, join, extname } from "node:path"
import { ElMessage } from "element-plus";
function handlePack(mod: IModInfo, installPath: string, install: boolean) {
const manager = useManager()
const modStorage = join(manager.modStorage ?? "", mod.id.toString())
mod.modFiles.forEach(item => {
if (extname(item) === ".pack") {
let source = join(modStorage, item)
let target = join(manager.gameStorage, installPath ?? "", basename(item))
if (install) FileHandler.copyFile(source, target)
else FileHandler.deleteFile(target)
}
})
return true
}
export const supportedGames: ISupportedGames = {
GlossGameId: 273,
steamAppID: 1142710,
NexusMods: {
game_domain_name: "totalwarwarhammer3",
game_id: 4717
},
installdir: join("Total War WARHAMMER III"),
gameName: "Total War WARHAMMER III",
gameExe: "Warhammer3.exe",
startExe: [
{
name: "Steam 启动",
cmd: "steam://rungameid/1142710"
},
{
name: "直接启动",
exePath: join("Warhammer3.exe")
}
],
archivePath: join(FileHandler.GetAppData(), "Roaming", "The Creative Assembly", "Warhammer3"),
gameCoverImg: "https://mod.3dmgame.com/static/upload/game/61dbfe86987ba.png",
modType: [
{
id: 1,
name: "pack",
installPath: "data",
async install(mod) {
return handlePack(mod, this.installPath ?? "", true)
},
async uninstall(mod) {
return handlePack(mod, this.installPath ?? "", false)
}
},
{
id: 2,
name: "UI",
installPath: join('data', 'UI'),
async install(mod) {
return Manager.installByFolder(mod, this.installPath ?? "", "ui", true, false, true)
},
async uninstall(mod) {
return Manager.installByFolder(mod, this.installPath ?? "", "ui", false, false, true)
}
},
{
id: 99,
name: "未知",
installPath: "",
async install(mod) {
ElMessage.warning("未知类型, 请手动安装")
return false
},
async uninstall(mod) {
return true
}
}
],
checkModType(mod) {
let pack = false
let ui = false
mod.modFiles.forEach(item => {
if (extname(item) === ".pack") pack = true
if (item.toLowerCase().includes('ui')) ui = true
})
if (pack) return 1
if (ui) return 2
return 99
}
}