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

Comparing deliantra/server/ext/jeweler.ext (file contents):
Revision 1.13 by elmex, Mon Oct 15 17:52:04 2007 UTC vs.
Revision 1.15 by root, Mon Dec 17 08:03:22 2007 UTC

1#! perl 1#! perl
2 2
3use Data::Dumper; 3use strict;
4
4use Jeweler; 5use Jeweler;
5use List::Util qw/max min sum/; 6use List::Util qw/max min sum/;
6use strict;
7 7
8sub ingred_alias { 8sub ingred_alias {
9 my ($ing) = @_; 9 my ($ing) = @_;
10 10
11 my %aliases = ( 11 my %aliases = (
209 my $plan = $ingred->get_plan; 209 my $plan = $ingred->get_plan;
210 210
211 if ($plan) { 211 if ($plan) {
212 my @ring = $ingred->get_ring; 212 my @ring = $ingred->get_ring;
213 213
214 if (!@ring) {
215 # actually the algorithm cant
216 $pl->message ("You slap yourself, you forgot the jewelery!");
217 return;
218
214 if ((@ring > 1) || ($ring[0]->nrof > 1)) { 219 } elsif ((@ring > 1) || (grep { $_->nrof > 1 } @ring)) {
215 # actually the algorithm cant handle more than one improvement at a time 220 # actually the algorithm cant handle more than one improvement at a time
216 $pl->message ("You can't manage to improve more than one thing at a time!"); 221 $pl->message ("You can't manage to improve more than one thing at a time!");
217 return; 222 return;
218
219 } elsif (@ring < 1) {
220 # actually the algorithm cant
221 $pl->message ("You slap yourself, you forgot the jewelery!");
222 return;
223
224 } else { 223 } else {
225 my $ringo = Jeweler::Object->new (object => $ring[0]); 224 my $ringo = Jeweler::Object->new (object => $ring[0]);
226 my $iring = $ingred->improve_ring_by_plan ($plan, $ringo); 225 my $iring = $ingred->improve_ring_by_plan ($plan, $ringo);
227 my $c1 = $ringo->calc_costs; 226 my $c1 = $ringo->calc_costs;
228 my $c2 = $iring->calc_costs; 227 my $c2 = $iring->calc_costs;
270 }; 269 };
271 $@ and warn "ERROR: $@\n"; 270 $@ and warn "ERROR: $@\n";
272 } 271 }
273); 272);
274 273
275Jeweler::read_config "$DATADIR/jeweler.yaml"; 274Jeweler::read_config "res/jeweler.yaml";
276 275

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines