forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buff.lic
62 lines (52 loc) · 1.75 KB
/
buff.lic
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
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#buff
=end
custom_require.call(%w[common common-arcana])
class Waggle
def initialize
arg_definitions = [
[
{ name: 'set', regex: /(set=(\w+))/, optional: true, description: 'list of defined spell sets' },
{ name: 'list', regex: /list/, optional: true, description: 'list of defined spell sets' },
{ name: 'spells', regex: /\w+/, optional: true, description: 'Spell list to use, otherwise default' },
{ name: 'force', regex: /force/i, optional: true, description: 'Recast spells even if currently active' },
{ name: 'strict', regex: /strict/i, optional: true, description: 'Keep trying to cast buffs until they stick. BE CAREFUL' }
]
]
args = parse_args(arg_definitions)
settings = get_settings
if (args.set)
set = args.set.split('=')[1]
DRC.message("Spells under Waggle set \"#{set}\"")
settings.waggle_sets[set].each_key do |key|
DRC.message(" - #{key}")
end
exit
end
if (args.list)
DRC.message("Waggle Sets Available")
settings.waggle_sets.each_key do |key|
DRC.message(" - #{key}")
end
exit
end
setname = args.spells || 'default'
unless settings.waggle_sets[setname]
DRC.message("No waggle set found for name: #{setname}")
exit
end
if args.force
settings.waggle_sets[setname].values.each do |spell_data|
spell_data['recast'] = 99 # force spell to be recast
end
end
if args.strict
until (settings.waggle_sets[setname].keys - DRSpells.active_spells.keys).empty?
DRCA.do_buffs(settings, setname)
end
else
DRCA.do_buffs(settings, setname)
end
end
end
Waggle.new