forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
carve-bead.lic
168 lines (142 loc) · 5.26 KB
/
carve-bead.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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
=begin
Carves a prayer bead from scratch.
ARGS:
debug - Forces on debug mode
primer - Forces on using a primer
aspect - Forces a particular animal aspect to carve (i.e. boar, ram, etc.)
YAML:
theurgy_supply_container
immortal_aspect
water_holder
crafting_container
crafting_items_in_container
engineering_belt
carve-bead:
debug: true | false
primer: true | false
=end
custom_require.call(%w[common common-arcana common-crafting common-theurgy events])
class CarveBead
def initialize
arg_definitions = [
[
{ name: 'debug', regex: /debug/i, optional: true, description: 'Turn on debug logging' },
{ name: 'primer', regex: /primer/i, optional: true, description: 'Force primer use, regardless of settings' },
{ name: 'aspect', regex: /^[A-z0-9\s\-\'\.]+$/i, optional: true, description: 'Aspect to use, regardless of settings' }
],
[
{ name: 'help', regex: /help/i, description: 'Display help text and exit' }
]
]
args = parse_args(arg_definitions)
display_help_and_exit if args.help
@settings = get_settings
@debug = args.debug || @settings['carve-bead']['debug']
@theurgy_supply_container = @settings.theurgy_supply_container
@immortal_aspect = args.aspect || @settings.immortal_aspect
@crafting_container = @settings.crafting_container
@crafting_container_items = @settings.crafting_items_in_container
@belt = @settings.engineering_belt
@water_holder = @settings.water_holder
@use_primer = args.primer || @settings['carve-bead']['primer'] || false
@knife_adjective = @settings['carve-bead']['knife-adjective'] || 'carving'
all_theurgy_data = get_data('theurgy')
@hometown_theurgy_data = all_theurgy_data[@hometown]
@use_held_block = false
@training_spells = @settings.crafting_training_spells
if @debug
DRC.message(
"carve-bead-debug:\n" +
"- immortal_aspect: #{@immortal_aspect}\n" +
"- use_primer: #{@use_primer}\n" +
"- knife_adjective: #{@knife_adjective}"
)
end
main
end
def display_help_and_exit
DRC.message(
'carve-bead:\n' +
' Carves a prayer bead from a foraged and carved block, or an existing one if held when called\n' +
'args:\n' +
' debug : forces on debug output\n' +
' primer : forces on usage of a carving primer\n' +
' <aspect> : name of the animal to carve (i.e. boar, panther, etc.)'
)
exit
end
def main
if DRCI.in_right_hand?('block')
@use_held_block = true
DRCI.stow_hand('left') if DRC.left_hand
elsif DRCI.in_left_hand?('block')
@use_held_block = true
DRC.bput('swap', 'You move a')
DRCI.stow_hand('left') if DRC.left_hand
else
DRCI.stow_hands
end
read_primer if @use_primer
if !@use_held_block
make_block
end
carve_bead
end
def read_primer
DRCI.get_item?("#{@immortal_aspect} primer", @theurgy_supply_container)
open_primer
keep_reading = true
while keep_reading
case DRC.bput('study my primer', 'Roundtime:', 'You have already studied this page', 'You should start on the first page', "You've too recently been studying how to carve a")
when 'You should start on the first page'
reset_primer
next
when "You've too recently been studying how to carve a"
DRC.message('You cannot switch between primers that fast. Try again later.')
DRCI.put_away_item?("#{@immortal_aspect} primer", @theurgy_supply_container)
exit
end
keep_reading = turn_primer?
end
DRCI.put_away_item?("#{@immortal_aspect} primer", @theurgy_supply_container)
end
def open_primer
DRC.bput('open my primer', 'You open the cover of', 'The primer is already open')
end
def close_primer
DRC.bput('close my primer', '.*')
end
def reset_primer
close_primer
open_primer
end
def turn_primer?
DRC.bput('turn my primer', 'You flip forward a page', 'You flip to the end of your primer') == 'You flip forward a page'
end
def make_block
return false unless DRCTH.has_holy_water?(@theurgy_supply_container, @water_holder)
DRCT.walk_to(@hometown_theurgy_data['limb_foraging']['id'])
DRCA.prepare?('bless', 1)
DRC.forage?('limb')
DRCI.get_item?(@water_holder, @theurgy_supply_container)
DRC.bput("sprinkle #{@water_holder} on my limb", 'You sprinkle')
DRCI.put_away_item?(@water_holder, @theurgy_supply_container)
pause 1
DRCA.cast?('cast my limb')
DRCC.get_crafting_item("#{@knife_adjective} knife", @crafting_container, @crafting_container_items, @belt)
while DRC.right_hand.include?('limb')
DRC.bput('carve my limb with my knife', 'You begin to hack', 'With fluid strokes, you', 'You continue to whittle', 'narrowing the connection', 'With a final deep cut')
waitrt?
end
DRCC.stow_crafting_item("#{@knife_adjective} knife", @crafting_container, @belt)
end
def carve_bead
DRCC.get_crafting_item('shaper', @crafting_container, @crafting_container_items, @belt)
while DRC.right_hand.include?('block')
DRC.bput("shape my block to #{@immortal_aspect}", "block suddenly cracks and breaks", "Roundtime")
waitrt?
end
DRCC.stow_crafting_item('shaper', @crafting_container, @belt)
end
end
CarveBead.new