… | |
… | |
117 | cf::ATNR_LIFE_STEALING => "LIFE_STEALING", |
117 | cf::ATNR_LIFE_STEALING => "LIFE_STEALING", |
118 | cf::ATNR_BLIND => "BLIND", |
118 | cf::ATNR_BLIND => "BLIND", |
119 | cf::ATNR_DISEASE => "DISEASE", |
119 | cf::ATNR_DISEASE => "DISEASE", |
120 | ); |
120 | ); |
121 | |
121 | |
|
|
122 | our %REV_RESMAP = map { $RESMAP{$_} => $_ } keys %RESMAP; |
|
|
123 | |
122 | our %LVL_DIFF_CHANCES = ( |
124 | our %LVL_DIFF_CHANCES = ( |
123 | +5 => 100, |
125 | +5 => 100, |
124 | +4 => 95, |
126 | +4 => 95, |
125 | +3 => 85, |
127 | +3 => 85, |
126 | +2 => 75, |
128 | +2 => 75, |
… | |
… | |
222 | my $outarchval = cf::arch::find ($outarch)->clone->value; |
224 | my $outarchval = cf::arch::find ($outarch)->clone->value; |
223 | |
225 | |
224 | my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); |
226 | my $nrof = int ($archvalsum / (($outarchval || 1000) * $outarchvalfact)); |
225 | if ($nrof) { |
227 | if ($nrof) { |
226 | # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) |
228 | # XXX: yes, i know what i'm doing here, i don't set nrof, but it didn't work somehow (pls. chek sometimes) |
|
|
229 | for (1..$nrof) { |
227 | $chdl->put (cf::object::new $outarch) for 1..$nrof; |
230 | $chdl->put (my $ob = cf::object::new $outarch); |
|
|
231 | $ob->set_animation (cf::rndm $ob->num_animations); |
|
|
232 | $ob->flag (cf::FLAG_IDENTIFIED, 1); |
|
|
233 | } |
228 | |
234 | |
229 | my $xp_sum = ($xp_gain * $nrof); |
235 | my $xp_sum = ($xp_gain * $nrof); |
230 | |
236 | |
231 | if ($xp_sum) { |
237 | if ($xp_sum) { |
232 | $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"); |
233 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_ADD_SKILL); |
239 | $pl->ob->change_exp ($xp_sum, "jeweler", cf::SK_EXP_SKILL_ONLY); |
234 | } |
240 | } |
|
|
241 | } else { |
|
|
242 | $pl->ob->message ("You fail to make something, propably you used not enough source material?"); |
235 | } |
243 | } |
236 | } |
244 | } |
237 | |
245 | |
238 | |
246 | |
239 | package Jeweler::CauldronHandler; |
247 | package Jeweler::CauldronHandler; |
… | |
… | |
320 | cf::POTION => 'potions', |
328 | cf::POTION => 'potions', |
321 | cf::SCROLL => 'scrolls', |
329 | cf::SCROLL => 'scrolls', |
322 | ); |
330 | ); |
323 | |
331 | |
324 | for ($self->{cauldron}->inv) { |
332 | for ($self->{cauldron}->inv) { |
|
|
333 | if ($_->flag (cf::FLAG_CURSED) || $_->flag (cf::FLAG_DAMNED)) { |
|
|
334 | die "cursed"; |
|
|
335 | } |
325 | |
336 | |
326 | if (my $k = $type_to_key{$_->type}) { |
337 | if (my $k = $type_to_key{$_->type}) { |
327 | push @{$ingreds->{$k}}, $_; |
338 | push @{$ingreds->{$k}}, $_; |
|
|
339 | } else { |
|
|
340 | push @{$ingreds->{other}}, $_; |
328 | } |
341 | } |
329 | } |
342 | } |
330 | |
343 | |
331 | return Jeweler::Ingredients->new (ingredients => $ingreds, cauldron_helper => $self) |
344 | return Jeweler::Ingredients->new (ingredients => $ingreds, cauldron_helper => $self) |
332 | } |
345 | } |
… | |
… | |
427 | sub get_plan { |
440 | sub get_plan { |
428 | my ($self) = @_; |
441 | my ($self) = @_; |
429 | |
442 | |
430 | my $ingred = $self->{ingredients}; |
443 | my $ingred = $self->{ingredients}; |
431 | |
444 | |
432 | for my $grp (keys %$ingred) { |
|
|
433 | for my $pot (@{$ingred->{$grp}}) { |
|
|
434 | for my $plan (keys %{$Jeweler::CFG->{plans}}) { |
445 | for my $plan (keys %{$Jeweler::CFG->{plans}}) { |
435 | my $plg = $Jeweler::CFG->{plans}->{$plan}; |
446 | my $plg = $Jeweler::CFG->{plans}->{$plan}; |
436 | my @plga = (); |
447 | my @plga = (); |
437 | unless (ref $plg eq 'ARRAY') { |
448 | unless (ref $plg eq 'ARRAY') { |
438 | push @plga, $plg; |
449 | push @plga, $plg; |
439 | } else { |
450 | } else { |
440 | @plga = @$plg; |
451 | @plga = @$plg; |
441 | } |
452 | } |
442 | next unless @plga > 0; |
453 | next unless @plga > 0; |
443 | if (Jeweler::Util::grep_for_match ($pot, @plga)) { |
454 | if (Jeweler::Util::grep_for_match ($ingred, @plga)) { |
444 | return $plan; |
455 | return $plan; |
445 | } |
|
|
446 | } |
|
|
447 | } |
456 | } |
448 | } |
457 | } |
449 | } |
458 | } |
450 | |
459 | |
451 | sub get_ring { |
460 | sub get_ring { |
… | |
… | |
454 | @{$self->{ingredients}->{ammys} || []}, |
463 | @{$self->{ingredients}->{ammys} || []}, |
455 | @{$self->{ingredients}->{rings} || []} |
464 | @{$self->{ingredients}->{rings} || []} |
456 | ); |
465 | ); |
457 | } |
466 | } |
458 | |
467 | |
|
|
468 | sub improve_max { |
|
|
469 | my ($stat, $impro) = @_; |
|
|
470 | if ($stat >= 0) { |
|
|
471 | $stat = $impro > $stat ? $impro : $stat; |
|
|
472 | } |
|
|
473 | $stat |
|
|
474 | } |
|
|
475 | |
459 | sub improve_ring_by_plan { |
476 | sub improve_ring_by_plan { |
460 | my ($self, $plan, $ring) = @_; |
477 | my ($self, $plan, $ring) = @_; |
461 | |
478 | |
462 | $ring = dclone ($ring); |
479 | $ring = dclone ($ring); |
463 | |
480 | |
… | |
… | |
468 | my $statname = $1; |
485 | my $statname = $1; |
469 | my $plingred = Jeweler::getcfg (plans => $plan) |
486 | my $plingred = Jeweler::getcfg (plans => $plan) |
470 | or die "ingredients for plan '$plan' not defined!"; |
487 | or die "ingredients for plan '$plan' not defined!"; |
471 | |
488 | |
472 | my $cnt = 0; |
489 | my $cnt = 0; |
473 | for my $pot (@{$ingred->{potions}}) { |
|
|
474 | if (Jeweler::Util::grep_for_match ($pot, @$plingred)) { |
490 | if (my $pot = Jeweler::Util::grep_for_match ($ingred, @$plingred)) { |
475 | $cnt += $pot->nrof; |
491 | $cnt += $pot->nrof; |
476 | } |
|
|
477 | } |
492 | } |
478 | |
493 | |
479 | my $maxstat = Jeweler::getcfg (maximprovements => 'stats'); |
494 | my $maxstat = Jeweler::getcfg (maximprovements => 'stats'); |
480 | my $did_impr = 0; |
|
|
481 | for my $x (1..$maxstat) { |
495 | for my $x (1..$maxstat) { |
482 | my $y = Jeweler::Object::fx ($x, 'stat_potions'); |
496 | my $y = Jeweler::Object::fx ($x, 'stat_items'); |
483 | |
497 | |
484 | if ($cnt <= $y->[0]) { |
498 | if ($cnt <= $y->[0]) { |
485 | $ring->{hash}->{stat}->{$statname} += $x; |
499 | $ring->{hash}->{stat}->{$statname} = |
486 | $did_impr = 1; |
500 | improve_max $ring->{hash}->{stat}->{$statname}, $x; |
487 | last; |
501 | last; |
488 | } |
502 | } |
489 | } |
503 | } |
490 | |
504 | |
491 | # we want at least this improvement if we have a plan... |
|
|
492 | $ring->{hash}->{stat}->{$statname} += 1 unless $did_impr; |
|
|
493 | |
|
|
494 | } elsif ($plan =~ m/^spec_(\S+)$/) { |
505 | } elsif ($plan =~ m/^spec_(\S+)$/) { |
|
|
506 | my $specname = $1; |
|
|
507 | my $plingred = Jeweler::getcfg (plans => $plan) |
|
|
508 | or die "ingredients for plan '$plan' not defined!"; |
|
|
509 | |
|
|
510 | my $cnt = 0; |
|
|
511 | if (my $pot = Jeweler::Util::grep_for_match ($ingred, @$plingred)) { |
|
|
512 | $cnt += $pot->nrof; |
|
|
513 | } |
|
|
514 | |
|
|
515 | my $maxspec = Jeweler::getcfg (maximprovements => 'specials'); |
|
|
516 | for my $x (1..$maxspec) { |
|
|
517 | my $y = Jeweler::Object::fx ($x, 'spec_items'); |
|
|
518 | |
|
|
519 | if ($cnt <= $y->[0]) { |
|
|
520 | $ring->{hash}->{spec}->{$specname} = |
|
|
521 | improve_max $ring->{hash}->{spec}->{$specname}, $x; |
|
|
522 | last; |
|
|
523 | } |
|
|
524 | } |
|
|
525 | |
495 | } elsif ($plan =~ m/^resist_(\S+)$/) { |
526 | } elsif ($plan =~ m/^resist_(\S+)$/) { |
|
|
527 | my $resname = $1; |
|
|
528 | my $resnum = $REV_RESMAP{$resname}; |
|
|
529 | my $plingred = Jeweler::getcfg (plans => $plan) |
|
|
530 | or die "ingredients for plan '$plan' not defined!"; |
|
|
531 | |
|
|
532 | my $cnt = 0; |
|
|
533 | if (my $it = Jeweler::Util::grep_for_match ($ingred, @$plingred)) { |
|
|
534 | $cnt += $it->nrof; |
|
|
535 | } |
|
|
536 | my $resist_item_nr = 0; |
|
|
537 | $self->do_grep (sub { $resist_item_nr += ($_[0]->nrof || 1); 0 }, @$plingred); |
|
|
538 | |
|
|
539 | my $maximprovname = (grep { $resnum eq $_ } @Jeweler::EFFECT_RESISTS) |
|
|
540 | ? 'effect_resistances' |
|
|
541 | : 'attack_resistances'; |
|
|
542 | |
|
|
543 | my $maxres = Jeweler::getcfg (maximprovements => $maximprovname); |
|
|
544 | $resist_item_nr = $maxres if ($resist_item_nr > $maxres); |
|
|
545 | $ring->{hash}->{resist}->{$resnum} = |
|
|
546 | improve_max $ring->{hash}->{resist}->{$resnum}, $resist_item_nr; |
496 | } |
547 | } |
497 | |
548 | |
498 | return $ring; |
549 | return $ring; |
499 | } |
550 | } |
500 | |
551 | |
501 | sub do_grep { |
552 | sub do_grep { |
502 | my ($self, $cb, @grepar) = @_; |
553 | my ($self, $cb, $cat, @grepar) = @_; |
503 | |
554 | |
504 | my $ingred = $self->{ingredients}; |
555 | my $ingred = $self->{ingredients}; |
505 | |
556 | |
506 | |
|
|
507 | for my $cat (keys %$ingred) { |
|
|
508 | my @rem; |
557 | my @rem; |
509 | for my $ing (@{$ingred->{$cat}}) { |
558 | for my $ing (@{$ingred->{$cat}}) { |
510 | if (Jeweler::Util::grep_for_match ($ing, @grepar)) { |
559 | if (Jeweler::Util::check_for_match ($ing, @grepar)) { |
511 | unless ($cb->($ing)) { |
560 | unless ($cb->($ing)) { |
512 | push @rem, $ing; |
|
|
513 | } |
|
|
514 | } else { |
|
|
515 | push @rem, $ing; |
561 | push @rem, $ing; |
516 | } |
562 | } |
|
|
563 | } else { |
|
|
564 | push @rem, $ing; |
517 | } |
565 | } |
|
|
566 | } |
518 | @{$ingred->{$cat}} = @rem; |
567 | @{$ingred->{$cat}} = @rem; |
519 | } |
|
|
520 | } |
568 | } |
521 | |
569 | |
522 | sub check_costs { |
570 | sub check_costs { |
523 | my ($self, $costs, $do_remove) = @_; |
571 | my ($self, $costs, $do_remove) = @_; |
524 | |
572 | |
525 | my $costs = dclone ($costs); |
573 | my $costs = dclone ($costs); |
526 | |
574 | |
527 | for my $key (keys %$costs) { |
575 | for my $key (keys %$costs) { |
528 | my @grepar; |
576 | my @grepar; |
529 | if ($key =~ m/^stat_(\S+)$/) { |
577 | if ($key =~ m/^(resist_|spec_|stat_)/) { # check the special items |
530 | @grepar = @{Jeweler::getcfg (plans => $key) || []}; |
578 | @grepar = @{Jeweler::getcfg (plans => $key) || []}; |
531 | } else { |
579 | } else { # check the gems |
532 | @grepar = (undef, undef, $key); |
580 | @grepar = ('gems', undef, undef, $key); |
533 | } |
581 | } |
534 | |
582 | |
535 | if ($do_remove) { |
583 | if ($do_remove) { |
536 | my $rem = $costs->{$key}; |
584 | my $rem = $costs->{$key}; |
537 | $self->do_grep (sub { if ($rem) { $rem = Jeweler::Util::remove ($_[0], $rem); } 1 }, @grepar); |
585 | $self->do_grep (sub { if ($rem) { $rem = Jeweler::Util::remove ($_[0], $rem); } 1 }, @grepar); |
538 | if ($rem > 0) { |
586 | if ($rem > 0) { |
539 | warn "JEWELER BUG: removed ingredients $rem > 0 after removing!"; |
587 | warn "JEWELER BUG: removed ingredients $rem > 0 after removing!"; |
540 | } |
588 | } |
541 | } else { |
589 | } else { |
542 | my $nr; |
590 | my $nr; |
543 | $self->do_grep (sub { $nr += $_[0]->nrof; 0 }, @grepar); |
591 | $self->do_grep (sub { $nr += ($_[0]->nrof || 1); 0 }, @grepar); |
544 | $costs->{$key} -= $nr; |
592 | $costs->{$key} -= $nr; |
545 | } |
593 | } |
|
|
594 | |
546 | } |
595 | } |
547 | |
596 | |
548 | return $costs; |
597 | return $costs; |
549 | } |
598 | } |
550 | |
599 | |
… | |
… | |
598 | sub wiz_analyze { |
647 | sub wiz_analyze { |
599 | my ($self, $pl) = @_; |
648 | my ($self, $pl) = @_; |
600 | my $costs = $self->calc_costs; |
649 | my $costs = $self->calc_costs; |
601 | my $desc = ""; |
650 | my $desc = ""; |
602 | 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 | |
603 | $pl->message ("costs: " . join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)); |
663 | $pl->message ("costs: " . (join (', ', map { "$_: " . sprintf "%.2f", $costs->{$_} } keys %$costs)) . " (".($scosts / 5000)." royalties)"); |
604 | $pl->message ("level: " . $desc); |
664 | $pl->message ("level: " . $desc); |
605 | } |
665 | } |
606 | |
666 | |
607 | |
667 | |
608 | sub get_chance_perc { |
668 | sub get_chance_perc { |
… | |
… | |
675 | my ($self, $thing) = @_; |
735 | my ($self, $thing) = @_; |
676 | |
736 | |
677 | my $obj = {}; |
737 | my $obj = {}; |
678 | |
738 | |
679 | for (@Jeweler::RESISTS) { |
739 | for (@Jeweler::RESISTS) { |
680 | $obj->{resist}->{$_} = $thing->resistance ($_); |
740 | $obj->{resist}->{$_} = $thing->resist ($_); |
681 | } |
741 | } |
682 | |
742 | |
683 | my $stats = $thing->stats; |
743 | my $stats = $thing->stats; |
684 | |
744 | |
685 | for (qw/Str Dex Con Wis Cha Int Pow/) { |
745 | for (qw/Str Dex Con Wis Cha Int Pow/) { |
… | |
… | |
720 | |
780 | |
721 | $stats->$_ ($self->{hash}{stat}{lc $_}) |
781 | $stats->$_ ($self->{hash}{stat}{lc $_}) |
722 | for qw/Str Dex Con Wis Cha Int Pow/; |
782 | for qw/Str Dex Con Wis Cha Int Pow/; |
723 | |
783 | |
724 | for (@Jeweler::RESISTS) { |
784 | for (@Jeweler::RESISTS) { |
725 | $obj->resistance ($_, $self->{hash}->{resist}->{$_}); |
785 | $obj->resist ($_, $self->{hash}->{resist}->{$_}); |
726 | } |
786 | } |
727 | |
787 | |
728 | $obj->flag (cf::FLAG_IDENTIFIED, 1); |
788 | $obj->flag (cf::FLAG_IDENTIFIED, 1); |
729 | |
789 | |
730 | return $obj; |
790 | return $obj; |
|
|
791 | } |
|
|
792 | |
|
|
793 | sub is_better_than { |
|
|
794 | my ($self, $other) = @_; |
|
|
795 | |
|
|
796 | for my $type (qw/spec stat resist/) { |
|
|
797 | for my $stat (keys %{$self->{hash}->{$type}}) { |
|
|
798 | if ($self->{hash}->{$type}->{$stat} > $other->{hash}->{$type}->{$stat}) { |
|
|
799 | return 1; |
|
|
800 | } |
|
|
801 | } |
|
|
802 | } |
|
|
803 | |
|
|
804 | return 0; |
731 | } |
805 | } |
732 | |
806 | |
733 | sub stat_level { |
807 | sub stat_level { |
734 | my ($self) = @_; |
808 | my ($self) = @_; |
735 | my $stats = $self->{hash}->{stat} || {}; |
809 | my $stats = $self->{hash}->{stat} || {}; |
… | |
… | |
849 | for my $stat (keys %$stats) { |
923 | for my $stat (keys %$stats) { |
850 | my $sum = $stats->{$stat}; |
924 | my $sum = $stats->{$stat}; |
851 | |
925 | |
852 | next unless $sum > 0; |
926 | next unless $sum > 0; |
853 | |
927 | |
854 | my $statfx = fx ($sum, 'stat_potions'); |
928 | my $statfx = fx ($sum, 'stat_items'); |
855 | $cost->{"stat_$stat"} += $statfx->[0]; |
929 | $cost->{"stat_$stat"} += $statfx->[0]; |
856 | split_diamonds ($cost, $statfx->[1], 'stat_' . $stat); |
930 | split_diamonds ($cost, $statfx->[1], 'stat_' . $stat); |
857 | } |
931 | } |
858 | } |
932 | } |
859 | |
933 | |
… | |
… | |
865 | for my $spec (keys %$specials) { |
939 | for my $spec (keys %$specials) { |
866 | my $sum = $specials->{$spec}; |
940 | my $sum = $specials->{$spec}; |
867 | |
941 | |
868 | next unless $sum > 0; |
942 | next unless $sum > 0; |
869 | |
943 | |
870 | my $specfx = fx ($sum, 'spec_potions'); |
944 | my $specfx = fx ($sum, 'spec_items'); |
871 | $cost->{"spec_$spec"} += $specfx->[0]; |
945 | $cost->{"spec_$spec"} += $specfx->[0]; |
872 | split_diamonds ($cost, $specfx->[1], 'spec_' . $spec); |
946 | split_diamonds ($cost, $specfx->[1], 'spec_' . $spec); |
873 | } |
947 | } |
874 | } |
948 | } |
875 | |
949 | |
… | |
… | |
878 | |
952 | |
879 | my $costs = {}; |
953 | my $costs = {}; |
880 | |
954 | |
881 | my $ring = $self->{hash}; |
955 | my $ring = $self->{hash}; |
882 | |
956 | |
883 | for my $resnam (keys %{$ring->{resist} || {}}) { |
957 | for my $resnum (keys %{$ring->{resist} || {}}) { |
884 | |
958 | |
885 | my $res = $ring->{resist}->{$resnam}; |
959 | my $res = $ring->{resist}->{$resnum}; |
886 | |
960 | |
887 | next unless $res > 0; |
961 | next unless $res > 0; |
888 | |
962 | |
889 | $costs->{"resist_" . $Jeweler::RESMAP{$resnam} . "_item"} += $res; |
963 | $costs->{"resist_" . $Jeweler::RESMAP{$resnum}} += $res; |
890 | |
964 | |
891 | my $diamonds; |
965 | my $diamonds; |
892 | if (grep { $resnam eq $_ } @Jeweler::EFFECT_RESISTS) { |
966 | if (grep { $resnum eq $_ } @Jeweler::EFFECT_RESISTS) { |
893 | $diamonds += fx ($res, 'effect_resist_diamonds'); |
967 | $diamonds += fx ($res, 'effect_resist_diamonds'); |
894 | } else { |
968 | } else { |
895 | $diamonds += fx ($res, 'attack_resist_diamonds'); |
969 | $diamonds += fx ($res, 'attack_resist_diamonds'); |
896 | } |
970 | } |
897 | |
971 | |
898 | split_diamonds ($costs, $diamonds, 'resist_' . $Jeweler::RESMAP{$resnam}); |
972 | split_diamonds ($costs, $diamonds, 'resist_' . $Jeweler::RESMAP{$resnum}); |
899 | } |
973 | } |
900 | |
974 | |
901 | $self->add_stat_costs ($costs); |
975 | $self->add_stat_costs ($costs); |
902 | $self->add_special_costs ($costs); |
976 | $self->add_special_costs ($costs); |
903 | |
977 | |
… | |
… | |
950 | my ($obj, $nrof) = @_; |
1024 | my ($obj, $nrof) = @_; |
951 | |
1025 | |
952 | my $cnt; |
1026 | my $cnt; |
953 | |
1027 | |
954 | if (defined $nrof) { |
1028 | if (defined $nrof) { |
|
|
1029 | # TODO: Check tihis line: |
955 | return 0 if ($nrof * 1) == 0; |
1030 | return 0 if ($nrof * 1) == 0; #XXX: ??? |
956 | $cnt = int (($obj->nrof || 1) - (1 * $nrof)); |
1031 | $cnt = int (($obj->nrof || 1) - (1 * $nrof)); |
957 | |
1032 | |
958 | if ($cnt > 0) { |
1033 | if ($cnt > 0) { |
959 | $obj->nrof ($cnt); |
1034 | $obj->nrof ($cnt); |
960 | return 0; |
1035 | return 0; |
… | |
… | |
964 | remove ($_) for $obj->inv; |
1039 | remove ($_) for $obj->inv; |
965 | $obj->destroy; |
1040 | $obj->destroy; |
966 | return $cnt; |
1041 | return $cnt; |
967 | } |
1042 | } |
968 | |
1043 | |
969 | sub grep_for_match { |
1044 | sub check_for_match { |
970 | my ($thing, @matchar) = @_; |
1045 | my ($thing, @matchar) = @_; |
971 | |
1046 | |
972 | my $i = 0; |
1047 | my $i = 0; |
973 | for my $match (@matchar) { |
1048 | for my $match (@matchar) { |
974 | if ($match =~ m/^\s*$/) { |
1049 | if ($match =~ m/^\s*$/) { |
… | |
… | |
989 | $i++; |
1064 | $i++; |
990 | } |
1065 | } |
991 | return 0; |
1066 | return 0; |
992 | } |
1067 | } |
993 | |
1068 | |
|
|
1069 | sub grep_for_match { |
|
|
1070 | my ($ingred, $group, @matchar) = @_; |
|
|
1071 | |
|
|
1072 | for my $thing (@{$ingred->{$group} || []}) { |
|
|
1073 | warn sprintf "DEB:(%s,%s,%s)<->%s\n", $thing->name, $thing->title, $thing->arch->name, "@matchar"; #d# |
|
|
1074 | if (check_for_match ($thing, @matchar)) { |
|
|
1075 | return $thing; |
|
|
1076 | } |
|
|
1077 | } |
|
|
1078 | return undef; |
|
|
1079 | } |
|
|
1080 | |
994 | =back |
1081 | =back |
995 | |
1082 | |
996 | =back |
|
|
997 | |
|
|
998 | 1 |
1083 | 1 |