… | |
… | |
185 | unless $found; |
185 | unless $found; |
186 | } |
186 | } |
187 | |
187 | |
188 | # this function converts metals/minerals into a raw ring (of adornment) |
188 | # this function converts metals/minerals into a raw ring (of adornment) |
189 | sub simple_converter { |
189 | sub simple_converter { |
190 | my ($pl, $ingred, $chdl, $conv) = @_; |
190 | my ($pl, $ingred, $chdl, $conv, $sk_lvl, $low_skill_cb) = @_; |
191 | |
191 | |
192 | $conv = lc $conv; |
192 | $conv = lc $conv; |
193 | my $cnvs = $CFG->{conversions}; |
193 | my $cnvs = $CFG->{conversions}; |
194 | |
194 | |
195 | return unless $cnvs->{$conv}; |
195 | return unless $cnvs->{$conv}; |
… | |
… | |
217 | |
217 | |
218 | unless ($outarchvalfact >= 1) { |
218 | unless ($outarchvalfact >= 1) { |
219 | warn "WARNING: source-arch-value-multiplier < 1 in conversion '$outarch', results in more valuable output!\n"; |
219 | warn "WARNING: source-arch-value-multiplier < 1 in conversion '$outarch', results in more valuable output!\n"; |
220 | } |
220 | } |
221 | |
221 | |
222 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
222 | my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); |
223 | $ingred->remove ($ingr_grp, $srcarchname); |
|
|
224 | |
|
|
225 | my $outarchval = cf::arch::find ($outarch)->value; |
223 | my $outarchval = cf::arch::find ($outarch)->value; |
226 | |
|
|
227 | my $nrof = int $archvalsum / (($outarchval || 1000) * $outarchvalfact); |
224 | my $nrof = int $archvalsum / (($outarchval || 1000) * $outarchvalfact); |
|
|
225 | my $can_make_nr = int (($sk_lvl / 2) + 10); |
|
|
226 | |
|
|
227 | if ($nrof > $can_make_nr) { |
|
|
228 | $pl->ob->message ("Your jeweler level is too low to make $nrof rings, you can only make $can_make_nr at your current level."); |
|
|
229 | return; |
|
|
230 | } |
|
|
231 | |
228 | if ($nrof) { |
232 | if ($nrof) { |
229 | # XXX: yes, I know what I'm doing here, I don't set nrof, but it didn't work somehow (pls. check sometimes) |
233 | # XXX: yes, I know what I'm doing here, I don't set nrof, but it didn't work somehow (pls. check sometimes) |
|
|
234 | $ingred->remove ($ingr_grp, $srcarchname); |
230 | for (1 .. $nrof) { |
235 | for (1 .. $nrof) { |
231 | $chdl->put (my $ob = cf::object::new $outarch); |
236 | $chdl->put (my $ob = cf::object::new $outarch); |
232 | $ob->set_animation (cf::rndm $ob->num_animations) |
237 | $ob->set_animation (cf::rndm $ob->num_animations) |
233 | if ($ob->type == cf::RING); |
238 | if ($ob->type == cf::RING); |
234 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
239 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |