… | |
… | |
164 | |
164 | |
165 | sub analyze { |
165 | sub analyze { |
166 | my ($sk, $chdl, $pl, $input_level) = @_; |
166 | my ($sk, $chdl, $pl, $input_level) = @_; |
167 | |
167 | |
168 | my $hadunid = 0; |
168 | my $hadunid = 0; |
|
|
169 | my $found = 0; |
169 | for ($chdl->grep_by_type (cf::RING, cf::AMULET)) { |
170 | for ($chdl->grep_by_type (cf::RING, cf::AMULET)) { |
170 | if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { |
171 | if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { |
171 | $hadunid = 1; |
172 | $hadunid = 1; |
172 | next; |
173 | next; |
173 | } |
174 | } |
|
|
175 | $found = 1; |
174 | my $r = Jeweler::Object->new (object => $_); |
176 | my $r = Jeweler::Object->new (object => $_); |
175 | my $msg = $r->analyze ($sk, $pl, $input_level); |
177 | my $msg = $r->analyze ($sk, $pl, $input_level); |
176 | $pl->message ($r->to_string . ": " . $msg); |
178 | $pl->message ($r->to_string . ": " . $msg); |
177 | if ($pl->flag (cf::FLAG_WIZ)) { |
179 | if ($pl->flag (cf::FLAG_WIZ)) { |
178 | $r->wiz_analyze ($pl); |
180 | $r->wiz_analyze ($pl); |
179 | } |
181 | } |
180 | } |
182 | } |
181 | $pl->message ("You couldn't identify the other rings and not analyze them!") |
183 | $pl->message ("You couldn't identify the other rings and not analyze them!") |
182 | if $hadunid; |
184 | if $hadunid; |
|
|
185 | $pl->message ("You couldn't find anything in the bench to analyse!") |
|
|
186 | unless $found; |
183 | } |
187 | } |
184 | |
188 | |
185 | # this function converts metals/minerals into a raw ring (of adornment) |
189 | # this function converts metals/minerals into a raw ring (of adornment) |
186 | sub simple_converter { |
190 | sub simple_converter { |
187 | my ($pl, $ingred, $chdl, $conv) = @_; |
191 | my ($pl, $ingred, $chdl, $conv) = @_; |