-
Notifications
You must be signed in to change notification settings - Fork 177
/
charge-holy-weapon.lic
120 lines (99 loc) · 3.67 KB
/
charge-holy-weapon.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#charge-holy-weapon
=end
custom_require.call(%w[common common-travel equipmanager])
class HolyWeapon
def initialize
exit unless DRStats.paladin?
arg_definitions = [
[
{ name: 'force', regex: /(f|force)/i, optional: true, description: 'Force recharge attempt of Holy Weapon, regardless of estimated remaining swings.' }
]
]
args = parse_args(arg_definitions)
settings = get_settings
@hometown = settings.hometown
hw_settings = settings.holy_weapon
@altar_room = get_data('town')[@hometown]['holy_weapon_altar']['id']
@em = EquipmentManager.new(settings)
@force = args.force
unless hw_settings
DRC.message("No Paladin settings found, please check your YAML. Exiting...")
exit
end
check_charge_level(hw_settings)
end
def check_charge_level(hw_settings)
@em.wield_weapon(hw_settings['weapon_name'])
if @force
DRC.message("Skipping the check and forcing a recharge.")
complete_ritual(hw_settings)
else
case DRC.bput("look my #{hw_settings['weapon_name']}", 'barely detectable', 'flickering', 'barely glowing', 'faintly', 'shining', 'emanating', 'blinding')
when 'barely detectable', 'flickering'
complete_ritual(hw_settings)
when 'barely glowing'
DRC.message("200 estimated charges remain, skipping...")
when 'faintly'
DRC.message("350 estimated charges remain, skipping...")
when 'shining'
DRC.message("500 estimated charges remain, skipping...")
when 'emanating'
DRC.message("1000 estimated charges remain, skipping...")
when 'blinding'
DRC.message("1500 estimated charges remain, skipping...")
end
end
@em.stow_weapon(hw_settings['weapon_name'])
end
def complete_ritual(hw_settings)
weapon = hw_settings['weapon_name']
name = hw_settings['icon_name']
container = hw_settings['icon_container']
room = hw_settings['icon_room']
@em.stow_weapon(weapon)
unless name
DRC.message("No icon found, using #{@hometown}'s chapel to complete the ritual!")
altar_room_ritual(weapon, @altar_room)
else
DRC.message("Icon -#{name}- found, moving to room #{room} to complete the ritual!")
icon_ritual(weapon, name, room, container)
end
end
def altar_room_ritual(weapon, room)
DRCT.walk_to(room)
case DRC.bput('pray chadatru', 'not cleared enough to pay proper respect to Chadatru', 'You decide to wait awhile longer')
when 'not cleared enough to pay proper respect to Chadatru'
DRC.message("Waiting for the prayer to finish (should take no longer than 2 minutes)...")
waitfor('soothing sensation washes over your soul.')
glyph_of_renew(weapon)
when 'You decide to wait awhile longer'
DRC.message("You're not ready to recharge yet, exiting!")
end
exit
end
def icon_ritual(weapon, name, room = @altar_room, container)
DRCT.walk_to(room)
DRCI.open_container?(container)
unless DRCI.get_item_if_not_held?(name, container)
DRC.message("Icon not found! Exiting...")
exit
end
icon_routine(name)
DRCI.put_away_item?(name, container)
glyph_of_renew(weapon)
end
def icon_routine(name)
3.times { DRC.bput("clean my #{name}", 'You carefully', 'You turn', 'You inspect') }
DRC.bput("hug my #{name}", 'You drop')
DRC.bput("focus my #{name}", 'Unaware of what')
DRC.bput("pray my #{name}", 'You breathe out')
DRC.fix_standing
end
def glyph_of_renew(weapon)
@em.wield_weapon(weapon)
DRC.bput("glyph renew my #{weapon}", 'You trace')
@em.stow_weapon(weapon)
end
end
HolyWeapon.new