Mercurial > boosterpack
diff index.pl @ 3:2e849c856026 boosterpack
[svn r5] it works!
author | robert |
---|---|
date | Tue, 08 Sep 2009 05:55:51 -0400 |
parents | d7dd496a4fa6 |
children | e91d6f908222 |
line wrap: on
line diff
1.1 --- a/index.pl Tue Sep 08 02:45:26 2009 -0400 1.2 +++ b/index.pl Tue Sep 08 05:55:51 2009 -0400 1.3 @@ -78,18 +78,37 @@ 1.4 my $currentRuleref = retrieve 'rlm/booster.prefs'; 1.5 $currentRule = $$currentRuleref; 1.6 1.7 + my $mapRules = $currentRule -> getRarityMap(); 1.8 + my %mapRules = %$mapRules; 1.9 + 1.10 + 1.11 + 1.12 + 1.13 #print ERR "@pokes"; 1.14 @reduced = filter(\&tag_analyze, @pokes); 1.15 + @reduced = shuffle(@reduced); 1.16 1.17 - #print ERR "@reduced"; 1.18 + my @final_list = (); 1.19 + my $rnum = $mapRules{"Rare"}; 1.20 + my $unum = $mapRules{"Uncommon"}; 1.21 + my $cnum = $mapRules{"Common"}; 1.22 1.23 for $crd(@reduced) 1.24 { 1.25 - #print ERR $crd->getPix(); 1.26 - $rob = $rob.$crd->getPix(); 1.27 - $rob = $rob."<br>"; 1.28 + if (($crd -> hasTags("Rare") or $crd -> hasTags("Rare Holo"))and ($rnum>0)){push @r_list, $crd; $rnum--;} 1.29 + if (($crd -> hasTags("Uncommon"))and ($unum>0)){push @u_list, $crd; $unum--;} 1.30 + if (($crd -> hasTags("Common"))and ($cnum>0)){push @c_list, $crd; $cnum--;} 1.31 + if ($rnum+$unum+$cnum == 0){last;} 1.32 } 1.33 - 1.34 + 1.35 + @final_list = (@r_list,@u_list,@c_list); 1.36 + 1.37 + 1.38 + for $crd(@final_list) 1.39 + { 1.40 + $rob = $rob."<img src = \"".$crd->getPix()."\"></img>"; 1.41 + } 1.42 + 1.43 #print $rob; 1.44 1.45 #print ERR @reduced;