-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathL4D2.ts
76 lines (69 loc) · 2.39 KB
/
L4D2.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
/**
* @description 求生之路2 支持
*/
import { extname, basename, join } from 'path'
// console.log(settings.settings.managerGame);
export const supportedGames: ISupportedGames = {
GlossGameId: 12,
steamAppID: 550,
NexusMods: {
game_domain_name: "left4dead2",
game_id: 195
},
installdir: "Left 4 Dead 2",
gameName: "Left 4 Dead 2",
gameExe: 'left4dead2.exe',
startExe: [
{
name: 'Steam 启动',
cmd: 'steam://rungameid/550'
},
{
name: '直接启动',
exePath: 'left4dead2.exe'
}
],
gameCoverImg: "https://mod.3dmgame.com/static/upload/game/12.jpg",
modType: [
{
id: 1,
name: '通用类型',
// installPath: '\\left4dead2\\addons',
installPath: join('left4dead2', 'addons'),
async install(mod) {
const manager = useManager()
let modStorage = join(manager.modStorage, mod.id.toString())
let gameStorage = join(manager.gameStorage ?? "", this.installPath ?? "")
let res: IState[] = []
mod.modFiles.forEach(async file => {
let fileExt = extname(file)
if (fileExt === '.vpk') {
let source = `${modStorage}\\${file}`
let target = `${gameStorage}\\${basename(file)}`
let state = await FileHandler.copyFile(source, target)
res.push({ file: file, state: state })
}
})
return res
},
async uninstall(mod) {
const manager = useManager()
let res: IState[] = []
let gameStorage = join(manager.gameStorage ?? "", this.installPath ?? "")
mod.modFiles.forEach(async file => {
let fileExt = extname(file)
if (fileExt === '.vpk') {
// let source = `${modStorage}\\${file}`
let target = `${gameStorage}\\${basename(file)}`
let state = FileHandler.deleteFile(target)
res.push({ file: file, state: state })
}
})
return res
},
},
],
checkModType(mod) {
return 1
}
}