ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/Jeweler.pm
(Generate patch)

Comparing deliantra/server/ext/Jeweler.pm (file contents):
Revision 1.22 by root, Sun Oct 14 20:23:48 2007 UTC vs.
Revision 1.26 by elmex, Sun Jul 13 20:15:51 2008 UTC

24our $CFG; 24our $CFG;
25 25
26sub read_config { 26sub read_config {
27 my ($filename) = @_; 27 my ($filename) = @_;
28 28
29 unless (-e $filename) { 29 if (my $meta = $cf::RESOURCE{$filename}) {
30 $CFG = cf::decode_json $meta->{data};
31 } else {
30 warn "$filename doesn't exists! no config for jeweler skill loaded!\n"; 32 warn "$filename doesn't exist! no config for jeweler skill loaded!\n";
31 $CFG = {}; 33 $CFG = {};
32 return
33 } 34 }
34
35 $CFG = YAML::LoadFile $filename;
36} 35}
37 36
38sub getcfg { 37sub getcfg {
39 my ($sect, $key) = @_; 38 my ($sect, $key) = @_;
40 return $CFG->{$sect} unless defined $key; 39 return $CFG->{$sect} unless defined $key;
165 164
166sub analyze { 165sub analyze {
167 my ($sk, $chdl, $pl, $input_level) = @_; 166 my ($sk, $chdl, $pl, $input_level) = @_;
168 167
169 my $hadunid = 0; 168 my $hadunid = 0;
169 my $found = 0;
170 for ($chdl->grep_by_type (cf::RING, cf::AMULET)) { 170 for ($chdl->grep_by_type (cf::RING, cf::AMULET)) {
171 if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { 171 if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) {
172 $hadunid = 1; 172 $hadunid = 1;
173 next; 173 next;
174 } 174 }
175 $found = 1;
175 my $r = Jeweler::Object->new (object => $_); 176 my $r = Jeweler::Object->new (object => $_);
176 my $msg = $r->analyze ($sk, $pl, $input_level); 177 my $msg = $r->analyze ($sk, $pl, $input_level);
177 $pl->message ($r->to_string . ": " . $msg); 178 $pl->message ($r->to_string . ": " . $msg);
178 if ($pl->flag (cf::FLAG_WIZ)) { 179 if ($pl->flag (cf::FLAG_WIZ)) {
179 $r->wiz_analyze ($pl); 180 $r->wiz_analyze ($pl);
180 } 181 }
181 } 182 }
182 $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!")
183 if $hadunid; 184 if $hadunid;
185 $pl->message ("You couldn't find anything in the bench to analyse!")
186 unless $found;
184} 187}
185 188
186# this function converts metals/minerals into a raw ring (of adornment) 189# this function converts metals/minerals into a raw ring (of adornment)
187sub simple_converter { 190sub simple_converter {
188 my ($pl, $ingred, $chdl, $conv) = @_; 191 my ($pl, $ingred, $chdl, $conv) = @_;
660 $exp -= $subexp; 663 $exp -= $subexp;
661 $exp = max ($exp, 0); 664 $exp = max ($exp, 0);
662 665
663 } else { 666 } else {
664 # the experience bonus here is to make level 1 rings give you at least 667 # the experience bonus here is to make level 1 rings give you at least
665 # 100 exp points when making them. This also makes leveling in the 668 # 200 exp points when making them. This also makes leveling in the
666 # first few levels a bit easier. (probably until around level 5-6). 669 # first few levels a bit easier. (probably until around level 5-6).
667 my $expbonus = cf::level_to_min_exp (2) / 10; 670 my $expbonus = cf::level_to_min_exp (2) / 5;
668 # this bonus should also only be given for _new_ rings and not for merged 671 # this bonus should also only be given for _new_ rings and not for merged
669 # ones - to prevent infinite exp making. 672 # ones - to prevent infinite exp making.
670 $exp += $expbonus; 673 $exp += $expbonus;
671 } 674 }
672 675
716 if (defined $costs) { 719 if (defined $costs) {
717 my $desc = ""; 720 my $desc = "";
718 my $lvl = $self->power_to_level (\$desc); 721 my $lvl = $self->power_to_level (\$desc);
719 my $scosts = $self->calc_value_from_cost ($costs); 722 my $scosts = $self->calc_value_from_cost ($costs);
720 723
721 $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 / "platinacoin"->cf::arch::find->value)
728 . " platinum)");
722 $pl->message ("level: " . $desc); 729 $pl->message ("level: $desc");
723 } else { 730 } else {
724 $pl->message ("level: impossible to make, due to impossible resistancy configuration"); 731 $pl->message ("level: impossible to make, due to impossible resistancy configuration");
725 } 732 }
726} 733}
727 734

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines