forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
buff.lic
84 lines (64 loc) · 2.39 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
=begin
Documentation: https://elanthipedia.play.net/Lich_script_development#buff
=end
custom_require.call(%w(common common-arcana events spellmonitor))
class Waggle
include DRC
include DRCA
def initialize
arg_definitions = [
[
{ name: 'spells', regex: /\w+/, optional: true, description: 'spell list to use, otherwise default' }
]
]
args = parse_args(arg_definitions)
@settings = get_settings
waggle_spells = @settings.waggle_sets
spells = args.spells ? waggle_spells[args.spells] : waggle_spells['default']
return unless spells
check_spells(spells)
end
def check_spells(spells)
check_osrel
spells.each do |name, data|
next if DRSpells.active_spells[name] && (data['recast'].nil? || DRSpells.active_spells[name].to_i > data['recast'])
while mana < 40
echo('Waiting on mana...')
pause 15
end
if data['ritual']
ritual(data)
else
cast_spell(data)
end
end
end
def check_osrel
return unless DRSpells.active_spells['Osrel Meraud'] && DRSpells.active_spells['Osrel Meraud'] < 90
infuse_om([email protected]_no_harness, @settings.osrel_amount)
end
def cast_spell(data)
if data['moon']
# Look for a moon that will be up for the next few minutes
unless moon = UserVars.moons.find { |moon_name, moon_data| UserVars.moons['visible'].include?(moon_name) && moon_data['timer'] >= 4 }.first
echo "No moon available to cast #{data['abbrev']}"
unless Script.running? 'moonwatch'
echo 'moonwatch is not running. Starting it now'
custom_require.call('moonwatch')
echo "Run `;e autostart('moonwatch')` to avoid this in the future"
end
unless moon = UserVars.moons.find { |moon_name, moon_data| UserVars.moons['visible'].include?(moon_name) && moon_data['timer'] >= 4 }.first
echo "Couldn't find any moons to cast #{data['abbrev']} with"
return
end
end
data['cast'] = "cast #{moon}"
end
release_cyclics if data['cyclic']
return unless prepare?(data['abbrev'], data['mana'], data['symbiosis'])
find_charge_invoke_stow(@settings.cambrinth, @settings.stored_cambrinth, @settings.cambrinth_cap, @settings.dedicated_camb_use, data['cambrinth'])
waitcastrt?
cast?(data['cast'], data['symbiosis'], data['before'], data['after'])
end
end
Waggle.new