--- deliantra/server/ext/Jeweler.pm 2007/01/31 14:11:02 1.4 +++ deliantra/server/ext/Jeweler.pm 2007/02/04 00:35:23 1.8 @@ -228,7 +228,8 @@ # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) for (1..$nrof) { $chdl->put (my $ob = cf::object::new $outarch); - $ob->set_animation (cf::rndm $ob->num_animations); + $ob->set_animation (cf::rndm $ob->num_animations) + if ($ob->type == cf::RING); $ob->flag (cf::FLAG_IDENTIFIED, 1); } @@ -330,6 +331,11 @@ ); for ($self->{cauldron}->inv) { + if (!$_->flag (cf::FLAG_IDENTIFIED) && $_->need_identify) { + die "unidentified"; + } elsif ($_->flag (cf::FLAG_CURSED) || $_->flag (cf::FLAG_DAMNED)) { + die "cursed"; + } if (my $k = $type_to_key{$_->type}) { push @{$ingreds->{$k}}, $_; @@ -587,7 +593,6 @@ my $nr; $self->do_grep (sub { $nr += ($_[0]->nrof || 1); 0 }, @grepar); $costs->{$key} -= $nr; - warn "CHECKCOST $key <-> $nr -> $costs->{$key}\n"; } } @@ -626,6 +631,17 @@ $self; } +sub has_resist { + my ($self, $resistnam, $resistval) = @_; + my $resnum = $REV_RESMAP{uc $resistnam}; + if (defined ($resistval)) { + return 1 if $self->{hash}->{resist}->{$resnum} == $resistval; + } else { + return 1 if $self->{hash}->{resist}->{$resnum}; + } + return undef; +} + sub analyze { my ($self, $sk, $pl) = @_; @@ -647,7 +663,18 @@ my $costs = $self->calc_costs; my $desc = ""; my $lvl = $self->power_to_level (\$desc); - $pl->message ("costs: " . join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)); + my $emarch = cf::arch::find 'emerald'; + my $saarch = cf::arch::find 'sapphire'; + my $pearch = cf::arch::find 'pearl'; + my $ruarch = cf::arch::find 'ruby'; + my $diarch = cf::arch::find 'gem'; + my $scosts = $emarch->clone->value * $costs->{emerald} + + $saarch->clone->value * $costs->{sapphire} + + $pearch->clone->value * $costs->{pearl} + + $ruarch->clone->value * $costs->{ruby} + + $diarch->clone->value * $costs->{gem}; + + $pl->message ("costs: " . (join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)) . " (".($scosts / 5000)." royalties)"); $pl->message ("level: " . $desc); } @@ -753,6 +780,8 @@ my $obj = cf::object::new $self->{hash}->{arch}; + $obj->item_power ($self->power_to_level); # there have to be strings attached! + $obj->face ($self->{hash}{face}); my $stats = $obj->stats;