forked from valkyr1e-tera/auto-vanguard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
34 lines (29 loc) · 868 Bytes
/
index.js
File metadata and controls
34 lines (29 loc) · 868 Bytes
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
module.exports = function AutoVanguard(mod) {
mod.command.add(['vanguard', 'vg'], {
$default: () => {
mod.settings.enabled = !mod.settings.enabled
mod.command.message((mod.settings.enabled ? 'en' : 'dis') + 'abled')
},
'this': () => {
const name = mod.game.me.name
mod.settings.players[name] = !charConfig(name)
mod.command.message((mod.settings.players[name] ? 'en' : 'dis') + 'abled for this character')
}
})
mod.hook('S_COMPLETE_EVENT_MATCHING_QUEST', 1, (event) => {
if (!mod.settings.enabled)
return
if (!charConfig(mod.game.me.name))
return
setTimeout(() => {
mod.send('C_COMPLETE_DAILY_EVENT', 1, {
id: event.id
})
}, mod.settings.complete_delay)
return false
})
function charConfig(name) {
const config = mod.settings.players[name]
return typeof config === 'undefined' ? true : !!config
}
}