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.19 by elmex, Thu Aug 9 10:49:56 2007 UTC vs.
Revision 1.22 by root, Sun Oct 14 20:23:48 2007 UTC

177 $pl->message ($r->to_string . ": " . $msg); 177 $pl->message ($r->to_string . ": " . $msg);
178 if ($pl->flag (cf::FLAG_WIZ)) { 178 if ($pl->flag (cf::FLAG_WIZ)) {
179 $r->wiz_analyze ($pl); 179 $r->wiz_analyze ($pl);
180 } 180 }
181 } 181 }
182 if ($hadunid) {
183 $pl->message ("You couldn't identify the other rings and not analyze them!"); 182 $pl->message ("You couldn't identify the other rings and not analyze them!")
184 } 183 if $hadunid;
185} 184}
186 185
187# this function converts metals/minerals into a raw ring (of adornment) 186# this function converts metals/minerals into a raw ring (of adornment)
188sub simple_converter { 187sub simple_converter {
189 my ($pl, $ingred, $chdl, $conv) = @_; 188 my ($pl, $ingred, $chdl, $conv) = @_;
203 warn "ERROR: Conversion for '$outarch' has only " . (@conv_cfg) . " arguments!"; 202 warn "ERROR: Conversion for '$outarch' has only " . (@conv_cfg) . " arguments!";
204 return; 203 return;
205 } 204 }
206 205
207 unless ($xp_gain > 0) { 206 unless ($xp_gain > 0) {
208 warn "WARNING: xp gain isn't > 0 in convesion '$outarch'\n"; 207 warn "WARNING: xp gain isn't > 0 in conversion '$outarch'\n";
209 return; 208 return;
210 } 209 }
211 210
212 unless ($outarchvalfact) { 211 unless ($outarchvalfact) {
213 warn "ERROR: source-arch-value-multiplier == 0 in conversion '$outarch'\n"; 212 warn "ERROR: source-arch-value-multiplier == 0 in conversion '$outarch'\n";
221 my $archvalsum = $ingred->value ($ingr_grp, $srcarchname); 220 my $archvalsum = $ingred->value ($ingr_grp, $srcarchname);
222 $ingred->remove ($ingr_grp, $srcarchname); 221 $ingred->remove ($ingr_grp, $srcarchname);
223 222
224 my $outarchval = cf::arch::find ($outarch)->value; 223 my $outarchval = cf::arch::find ($outarch)->value;
225 224
226 my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); 225 my $nrof = int $archvalsum / (($outarchval || 1000) * $outarchvalfact);
227 if ($nrof) { 226 if ($nrof) {
228 # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) 227 # XXX: yes, I know what I'm doing here, I don't set nrof, but it didn't work somehow (pls. check sometimes)
229 for (1..$nrof) { 228 for (1 .. $nrof) {
230 $chdl->put (my $ob = cf::object::new $outarch); 229 $chdl->put (my $ob = cf::object::new $outarch);
231 $ob->set_animation (cf::rndm $ob->num_animations) 230 $ob->set_animation (cf::rndm $ob->num_animations)
232 if ($ob->type == cf::RING); 231 if ($ob->type == cf::RING);
233 $ob->flag (cf::FLAG_IDENTIFIED, 1); 232 $ob->flag (cf::FLAG_IDENTIFIED, 1);
234 } 233 }
235 234
236 my $xp_sum = ($xp_gain * $nrof); 235 my $xp_sum = $xp_gain * $nrof;
237 236
238 if ($xp_sum) { 237 if ($xp_sum) {
239 $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s"); 238 $pl->ob->message ("You got $xp_sum xp by making $nrof ${outarch}s");
240 $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); 239 $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY);
241 } 240 }
355 354
356sub put { 355sub put {
357 my ($self, $obj) = @_; 356 my ($self, $obj) = @_;
358 357
359 return undef unless $self->{cauldron}; 358 return undef unless $self->{cauldron};
360 $obj->insert_ob_in_ob ($self->{cauldron}); 359 $self->{cauldron}->insert ($obj);
361} 360}
362 361
363=back 362=back
364 363
365=cut 364=cut
477} 476}
478 477
479sub improve_ring_by_plan { 478sub improve_ring_by_plan {
480 my ($self, $plan, $ring) = @_; 479 my ($self, $plan, $ring) = @_;
481 480
482 $ring = dclone ($ring); 481 $ring = do { my $guard = Coro::Storable::guard; dclone $ring };
483 482
484 my $ingred = $self->{ingredients}; 483 my $ingred = $self->{ingredients};
485 my $impr = {}; 484 my $impr = {};
486 485
487 if ($plan =~ m/^stat_(\S+)$/) { 486 if ($plan =~ m/^stat_(\S+)$/) {
571} 570}
572 571
573sub check_costs { 572sub check_costs {
574 my ($self, $costs, $do_remove) = @_; 573 my ($self, $costs, $do_remove) = @_;
575 574
576 my $costs = dclone ($costs); 575 my $costs = do { my $guard = Coro::Storable::guard; dclone $costs };
577 576
578 for my $key (keys %$costs) { 577 for my $key (keys %$costs) {
579 my @grepar; 578 my @grepar;
580 if ($key =~ m/^(resist_|spec_|stat_)/) { # check the special items 579 if ($key =~ m/^(resist_|spec_|stat_)/) { # check the special items
581 eval { @grepar = @{Jeweler::getcfg (plans => $key) || []} }; 580 eval { @grepar = @{Jeweler::getcfg (plans => $key) || []} };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines