--- deliantra/server/ext/jeweler.ext 2007/10/17 19:18:40 1.14 +++ deliantra/server/ext/jeweler.ext 2010/04/29 07:52:01 1.24 @@ -1,9 +1,9 @@ #! perl -use Data::Dumper; +use strict; + use Jeweler; use List::Util qw/max min sum/; -use strict; sub ingred_alias { my ($ing) = @_; @@ -50,7 +50,7 @@ my @rings = map { Jeweler::Object->new (object => $_) } @ring; @rings >= 2 - or return $pl->reply (undef, "You slap yourself, you forgot to put at least 2 jewels in!"); + or return $pl->message ("You slap yourself, you forgot to put at least 2 jewels in!"); my $input_level = 0; my $value; @@ -63,7 +63,7 @@ $ring->improve_by_ring (@rings); if ($do_analyze) { - $pl->reply (undef, "You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl, $input_level)); + $pl->message ("You want to make a " . $ring->to_string . ": " . $ring->analyze ($sk, $pl, $input_level)); $ring->wiz_analyze ($pl) if $pl->flag (cf::FLAG_WIZ); return; @@ -82,7 +82,7 @@ my $ch = $ring->get_chance_perc ($sk); my $succ = 0; - my $r = cf::random_roll (0, 100, $pl, cf::PREFER_HIGH); + my $r = cf::random_roll (0, 100, $pl, cf::PREFER_LOW); my $make_status; my $exp; @@ -90,11 +90,12 @@ if ($r <= $ch or $pl->flag (cf::FLAG_WIZ)) { $exp = $ring->projected_exp ($input_level); - $pl->change_exp ($exp, "jeweler", cf::SK_EXP_SKILL_ONLY); - $pl->message ("You succeed and get $exp experience points."); + $pl->change_exp ($exp, "jeweler"); + $pl->message ( + "You succeed and get " . int ($exp) . " experience points."); $make_status = "succeeded"; - $ring->set_value ($value * 0.8); # 20% of the input values will vanish + $ring->set_value ($value); } else { $pl->message ("You fail!"); @@ -113,7 +114,8 @@ $pl->name, $ring->to_string, $ring_ob->uuid, $sklvl, $ring->power_to_level, $exp, $make_status; - warn "$make_info\n" if $make_status eq 'succeeded'; + cf::debug "$make_info\n" + if $make_status eq 'succeeded'; } $chdl->put ($ring_ob); @@ -129,7 +131,7 @@ $pl->message ("There are unidentified items in the workbench, identify them before you do anything."). return } elsif ($@) { - warn "error in jeweler ingredient extraction: $@"; + cf::error "error in jeweler ingredient extraction: $@"; return; } $ingred; @@ -151,6 +153,7 @@ $cfg->{connection}, $cfg->{state} ); + $obj->decrease (1); cf::override; } } @@ -195,7 +198,9 @@ return } - Jeweler::simple_converter ($player, $ingred, $chdl, $1); + Jeweler::simple_converter ( + $player, $ingred, $chdl, $1, + cf::exp_to_level ($sk->stats->exp)); } elsif ($msg =~ m/^\s*merge\s*analy[sz]e\s*$/i) { merge ($chdl, $sk, $pl, 1); @@ -267,9 +272,9 @@ } } }; - $@ and warn "ERROR: $@\n"; + $@ and cf::error "$@\n"; } ); -Jeweler::read_config "$DATADIR/jeweler.yaml"; +Jeweler::load_config;