… | |
… | |
177 | $pl->message ($r->to_string . ": " . $msg); |
177 | $pl->message ($r->to_string . ": " . $msg); |
178 | if ($pl->flag (cf::FLAG_WIZ)) { |
178 | if ($pl->flag (cf::FLAG_WIZ)) { |
179 | $r->wiz_analyze ($pl); |
179 | $r->wiz_analyze ($pl); |
180 | } |
180 | } |
181 | } |
181 | } |
182 | if ($hadunid) { |
|
|
183 | $pl->message ("You couldn't identify the other rings and not analyze them!"); |
182 | $pl->message ("You couldn't identify the other rings and not analyze them!") |
184 | } |
183 | if $hadunid; |
185 | } |
184 | } |
186 | |
185 | |
187 | # this function converts metals/minerals into a raw ring (of adornment) |
186 | # this function converts metals/minerals into a raw ring (of adornment) |
188 | sub simple_converter { |
187 | sub simple_converter { |
189 | my ($pl, $ingred, $chdl, $conv) = @_; |
188 | my ($pl, $ingred, $chdl, $conv) = @_; |
… | |
… | |
203 | warn "ERROR: Conversion for '$outarch' has only " . (@conv_cfg) . " arguments!"; |
202 | warn "ERROR: Conversion for '$outarch' has only " . (@conv_cfg) . " arguments!"; |
204 | return; |
203 | return; |
205 | } |
204 | } |
206 | |
205 | |
207 | unless ($xp_gain > 0) { |
206 | unless ($xp_gain > 0) { |
208 | warn "WARNING: xp gain isn't > 0 in convesion '$outarch'\n"; |
207 | warn "WARNING: xp gain isn't > 0 in conversion '$outarch'\n"; |
209 | return; |
208 | return; |
210 | } |
209 | } |
211 | |
210 | |
212 | unless ($outarchvalfact) { |
211 | unless ($outarchvalfact) { |
213 | warn "ERROR: source-arch-value-multiplier == 0 in conversion '$outarch'\n"; |
212 | warn "ERROR: source-arch-value-multiplier == 0 in conversion '$outarch'\n"; |
… | |
… | |
221 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
220 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
222 | $ingred->remove ($ingr_grp, $srcarchname); |
221 | $ingred->remove ($ingr_grp, $srcarchname); |
223 | |
222 | |
224 | my $outarchval = cf::arch::find ($outarch)->value; |
223 | my $outarchval = cf::arch::find ($outarch)->value; |
225 | |
224 | |
226 | my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); |
225 | my $nrof = int $archvalsum / (($outarchval || 1000) * $outarchvalfact); |
227 | if ($nrof) { |
226 | if ($nrof) { |
228 | # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) |
227 | # XXX: yes, I know what I'm doing here, I don't set nrof, but it didn't work somehow (pls. check sometimes) |
229 | for (1..$nrof) { |
228 | for (1 .. $nrof) { |
230 | $chdl->put (my $ob = cf::object::new $outarch); |
229 | $chdl->put (my $ob = cf::object::new $outarch); |
231 | $ob->set_animation (cf::rndm $ob->num_animations) |
230 | $ob->set_animation (cf::rndm $ob->num_animations) |
232 | if ($ob->type == cf::RING); |
231 | if ($ob->type == cf::RING); |
233 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
232 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
234 | } |
233 | } |
235 | |
234 | |
236 | my $xp_sum = ($xp_gain * $nrof); |
235 | my $xp_sum = $xp_gain * $nrof; |
237 | |
236 | |
238 | if ($xp_sum) { |
237 | if ($xp_sum) { |
239 | $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s"); |
238 | $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s"); |
240 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); |
239 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); |
241 | } |
240 | } |
… | |
… | |
477 | } |
476 | } |
478 | |
477 | |
479 | sub improve_ring_by_plan { |
478 | sub improve_ring_by_plan { |
480 | my ($self, $plan, $ring) = @_; |
479 | my ($self, $plan, $ring) = @_; |
481 | |
480 | |
482 | $ring = dclone ($ring); |
481 | $ring = do { my $guard = Coro::Storable::guard; dclone $ring }; |
483 | |
482 | |
484 | my $ingred = $self->{ingredients}; |
483 | my $ingred = $self->{ingredients}; |
485 | my $impr = {}; |
484 | my $impr = {}; |
486 | |
485 | |
487 | if ($plan =~ m/^stat_(\S+)$/) { |
486 | if ($plan =~ m/^stat_(\S+)$/) { |
… | |
… | |
571 | } |
570 | } |
572 | |
571 | |
573 | sub check_costs { |
572 | sub check_costs { |
574 | my ($self, $costs, $do_remove) = @_; |
573 | my ($self, $costs, $do_remove) = @_; |
575 | |
574 | |
576 | my $costs = dclone ($costs); |
575 | my $costs = do { my $guard = Coro::Storable::guard; dclone $costs }; |
577 | |
576 | |
578 | for my $key (keys %$costs) { |
577 | for my $key (keys %$costs) { |
579 | my @grepar; |
578 | my @grepar; |
580 | if ($key =~ m/^(resist_|spec_|stat_)/) { # check the special items |
579 | if ($key =~ m/^(resist_|spec_|stat_)/) { # check the special items |
581 | eval { @grepar = @{Jeweler::getcfg (plans => $key) || []} }; |
580 | eval { @grepar = @{Jeweler::getcfg (plans => $key) || []} }; |