… | |
… | |
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) = @_; |
… | |
… | |
715 | if (defined $costs) { |
719 | if (defined $costs) { |
716 | my $desc = ""; |
720 | my $desc = ""; |
717 | my $lvl = $self->power_to_level (\$desc); |
721 | my $lvl = $self->power_to_level (\$desc); |
718 | my $scosts = $self->calc_value_from_cost ($costs); |
722 | my $scosts = $self->calc_value_from_cost ($costs); |
719 | |
723 | |
720 | $pl->message ("costs: " . (join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)) . " (".($scosts / 5000)." royalties)"); |
724 | $pl->message ("costs: " |
|
|
725 | . (join ', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs) |
|
|
726 | . " (" |
|
|
727 | . ($scosts / "royalty"->cf::arch::find->value) |
|
|
728 | . " royalties)"); |
721 | $pl->message ("level: " . $desc); |
729 | $pl->message ("level: $desc"); |
722 | } else { |
730 | } else { |
723 | $pl->message ("level: impossible to make, due to impossible resistancy configuration"); |
731 | $pl->message ("level: impossible to make, due to impossible resistancy configuration"); |
724 | } |
732 | } |
725 | } |
733 | } |
726 | |
734 | |