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.4 by elmex, Wed Jan 31 14:11:02 2007 UTC vs.
Revision 1.5 by elmex, Wed Jan 31 15:53:17 2007 UTC

328 cf::POTION => 'potions', 328 cf::POTION => 'potions',
329 cf::SCROLL => 'scrolls', 329 cf::SCROLL => 'scrolls',
330 ); 330 );
331 331
332 for ($self->{cauldron}->inv) { 332 for ($self->{cauldron}->inv) {
333 if ($_->flag (cf::FLAG_CURSED) || $_->flag (cf::FLAG_DAMNED)) {
334 die "cursed";
335 }
333 336
334 if (my $k = $type_to_key{$_->type}) { 337 if (my $k = $type_to_key{$_->type}) {
335 push @{$ingreds->{$k}}, $_; 338 push @{$ingreds->{$k}}, $_;
336 } else { 339 } else {
337 push @{$ingreds->{other}}, $_; 340 push @{$ingreds->{other}}, $_;
585 } 588 }
586 } else { 589 } else {
587 my $nr; 590 my $nr;
588 $self->do_grep (sub { $nr += ($_[0]->nrof || 1); 0 }, @grepar); 591 $self->do_grep (sub { $nr += ($_[0]->nrof || 1); 0 }, @grepar);
589 $costs->{$key} -= $nr; 592 $costs->{$key} -= $nr;
590 warn "CHECKCOST $key <-> $nr -> $costs->{$key}\n";
591 } 593 }
592 594
593 } 595 }
594 596
595 return $costs; 597 return $costs;
645sub wiz_analyze { 647sub wiz_analyze {
646 my ($self, $pl) = @_; 648 my ($self, $pl) = @_;
647 my $costs = $self->calc_costs; 649 my $costs = $self->calc_costs;
648 my $desc = ""; 650 my $desc = "";
649 my $lvl = $self->power_to_level (\$desc); 651 my $lvl = $self->power_to_level (\$desc);
652 my $emarch = cf::arch::find 'emerald';
653 my $saarch = cf::arch::find 'sapphire';
654 my $pearch = cf::arch::find 'pearl';
655 my $ruarch = cf::arch::find 'ruby';
656 my $diarch = cf::arch::find 'gem';
657 my $scosts = $emarch->clone->value * $costs->{emerald}
658 + $saarch->clone->value * $costs->{sapphire}
659 + $pearch->clone->value * $costs->{pearl}
660 + $ruarch->clone->value * $costs->{ruby}
661 + $diarch->clone->value * $costs->{gem};
662
650 $pl->message ("costs: " . join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)); 663 $pl->message ("costs: " . (join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)) . " (".($scosts / 5000)." royalties)");
651 $pl->message ("level: " . $desc); 664 $pl->message ("level: " . $desc);
652} 665}
653 666
654 667
655sub get_chance_perc { 668sub get_chance_perc {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines