forked from elanthia-online/dr-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appraisal.lic
204 lines (180 loc) · 7.95 KB
/
appraisal.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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
=begin
Documentation: https://elanthipedia.play.net/Lich_script_repository#appraisal
=end
custom_require.call(%w[common equipmanager])
class Appraisal
def initialize
arg_definitions = [
[
{ name: 'focus', regex: /focus/i, description: 'Perform appraise focus on an item.' },
{ name: 'item', regex: /\w+/i, description: 'Item to use appraise focus with.' },
{ name: 'script_summary', optional: true, description: 'Trains the Appraisal skill by appraising your gear, zills, bundles, gem pouches, and studying the art in the Crossing art gallery.' }
],
[
{ name: 'nonspecific', regex: /nonspecific/i, optional: true, description: 'Toggle off specific gem_pouch_adjective' },
{ name: 'count', regex: /count/i, optional: true, description: 'Count gem pouches as they are appraised' }
]
]
args = parse_args(arg_definitions)
@equipment_manager = EquipmentManager.new
settings = get_settings
train_list = settings.appraisal_training
if args.nonspecific
pouch_adjective = nil
else
pouch_adjective = settings.gem_pouch_adjective
end
if args.count
@count = true
end
pouch_low_value = settings.gem_pouch_low_value.to_i || 1
if args.focus
if DRSkill.getrank('Appraisal') < 200
echo 'You need at least 200 Appraisal to use Appraise Focus.'
exit
end
appraise_focus(args.item)
else
train_list.each do |task|
break if DRSkill.getxp('Appraisal') >= 30
case task
when 'zills'
assess_zills
when 'pouches'
train_appraisal_with_pouches(settings.full_pouch_container, settings.spare_gem_pouch_container, settings.low_value_gem_pouch_container, pouch_low_value, pouch_adjective, settings.gem_pouch_noun)
when 'gear'
train_appraisal_with_gear
when 'bundle'
train_appraisal_with_bundle
when 'art'
train_appraisal_with_art
else
echo "#{task} is not a valid appraisal_training setting"
end
end
end
end
def train_appraisal_with_art
DRC.wait_for_script_to_complete('study-art', ['appraisal'])
end
def train_appraisal_with_gear
@equipment_manager.wear_equipment_set?('standard')
@equipment_manager.items.each { |item| break unless appraise_item?(item) }
end
def train_appraisal_with_bundle
DRC.bput('appraise my bundle quick', 'Roundtime', 'Appraise what', 'You cannot appraise')
waitrt?
end
def train_appraisal_with_pouches(full_pouch_container, spare_gem_pouch_container, low_value_gem_pouch_container, low_value, gem_pouch_adjective, gem_pouch_noun)
if gem_pouch_adjective
case DRC.bput("appraise my #{gem_pouch_adjective} #{gem_pouch_noun} quick", 'Roundtime', 'You can.t appraise the', 'Appraise what', /You.ll need to open the .* to examine its contents./, /There doesn.t appear to be anything in/)
when /You.ll need to open the .* to examine its contents./
DRC.bput("open my #{gem_pouch_adjective} #{gem_pouch_noun}", /You open your .*./, /That is already open/)
DRC.bput("appraise my #{gem_pouch_adjective} #{gem_pouch_noun} quick", 'Roundtime', 'You can.t appraise the', 'Appraise what')
DRC.bput("close my #{gem_pouch_adjective} #{gem_pouch_noun}", /You close your/, /That is already closed/)
end
waitrt?
end
pause 1
$ORDINALS.each do |ordinal|
gem_pouch_container = full_pouch_container
break unless DRCI.get_item?("#{ordinal} #{gem_pouch_adjective} #{gem_pouch_noun}", gem_pouch_container)
case DRC.bput("appraise my #{gem_pouch_adjective} #{gem_pouch_noun} quick", 'Roundtime', /You.ll need to open the .* to examine its contents./, /There doesn.t appear to be anything in/, /worth a total of about \d+/)
when /worth a total of about (\d+)/
pouch_value = Regexp.last_match(1).to_i
if pouch_value < low_value
DRC.message("Low value pouch found, putting it into low_value_gem_pouch_container")
gem_pouch_container = low_value_gem_pouch_container
end
if @count && (low_value_gem_pouch_container.empty? || low_value_gem_pouch_container.nil?)
DRC.message("\"count\" passed as an argument, but no low_value_gem_pouch_container defined. Skipping counting.")
@count = false
end
if @count
/(\d+)/ =~ DRC.bput("count my #{gem_pouch_adjective} #{gem_pouch_noun}", /You sort through the contents .* and find \d+ gems in it/)
pouch_count = Regexp.last_match(1).to_i
if pouch_count < 500
DRC.message("Pouch not full, putting it into #{low_value_gem_pouch_container}")
gem_pouch_container = low_value_gem_pouch_container
end
end
when /You.ll need to open the .* to examine its contents./
DRC.bput("open my #{gem_pouch_adjective} #{gem_pouch_noun}", /You open your .* ./, /That is already open/)
DRC.bput("appraise my #{gem_pouch_adjective} #{gem_pouch_noun} quick", 'Roundtime')
DRC.bput("close my #{gem_pouch_adjective} #{gem_pouch_noun}", /You close your/, /That is already closed/)
when /There doesn.t appear to be anything in/
DRC.message("Empty pouch found, putting it into spare_gem_pouch_container")
gem_pouch_container = spare_gem_pouch_container
end
waitrt?
DRCI.put_away_item?("#{gem_pouch_adjective} #{gem_pouch_noun}", gem_pouch_container)
pause 1
break if DRSkill.getxp('Appraisal') >= 30
end
end
def appraise_item?(item)
if @equipment_manager.get_item?(item)
DRC.bput("appraise #{item.short_name} quick", 'Roundtime')
waitrt?
pause 1
@equipment_manager.empty_hands
end
DRSkill.getxp('Appraisal') < 30
end
def assess_zills
if DRSkill.getrank('Appraisal') >= 250
echo "Your appraisal skill is above 250. You can remove 'zills' from appraisal_training"
return
end
case DRC.bput('remove my zill', 'You slide', 'Remove what')
when 'Remove what'
return
end
DRC.bput('assess my zill', 'you carefully look them over')
waitrt?
DRC.bput('wear my zill', 'You slide')
pause 1
end
def appraise_focus(item)
focus_concepts = ["defense", "arcane", "recall", "logic", "offense", "magic", "khri", "inner fire"]
if focus_concepts.include?(item)
focus_concept(item)
else
case DRC.bput("get my #{item}", "^You get.*#{item}", '^What were you referring', 'But that is already', 'You are already')
when 'But that is already', '^What were you referring'
echo "Cannot get the #{item} you are trying to focus upon. Exiting..."
exit
end
focus(item)
end
waitrt?
case DRC.bput('appraise focus check', 'You are currently', 'You have completed')
when 'You are currently'
waitfor('Breakthrough')
echo "You have completed focusing on your #{item} and now have increased learning!"
when 'You have completed'
echo 'You already have an active appraise focus boost. Wait a while before trying again.'
end
exit
end
def focus_concept(item)
waitrt?
case DRC.bput("appraise focus #{item}", 'You carefully', 'You are already', 'You currently feel', 'You can\'t seem', 'You cant seem', 'You will lose your progress')
when 'You carefully', 'You are already', 'You currently feel', 'You can\'t seem', 'You cant seem'
return
else
focus_concept(item)
end
end
def focus(item)
waitrt?
case DRC.bput("appraise focus my #{item}", 'You carefully', 'You are already', 'You currently feel', 'You can\'t seem', 'You cant seem', 'You will lose your progress')
when 'You carefully', 'You are already', 'You currently feel', 'You can\'t seem', 'You cant seem'
DRC.bput("stow my #{item}", "You put .*#{item}", 'You easily strap', "You don't seem to be able to move", 'You secure', 'is too small to hold that', 'You hang')
else
focus(item)
end
end
end
# Call this last to avoid the need for forward declarations
Appraisal.new