} else { @otherlist[$othernum] = "$name"; $othernum++; } } } } # → ここ! # ------------------------- # # Sub Open Out User Data # ユーザーデータの書きこみ # ------------------------- # sub openoutuserdata { if ($lockkey == 1) { &lock; } open(OUT,">$userdata") || &error("Can't write $userdata"); print OUT @new; close(OUT); &unlock; } |
# ------------------------- # # Sub User Sort # ユーザーソート # ------------------------- # sub user_sort_r { local(@txt) = @_; @newtxt = sort by_reverse_number @txt; } sub by_reverse_number { if ($a == $b) { $a cmp $b; } else { $b <=> $a; } } |
if ($_[0] eq 'ownerlist') { if ($love >= $loved) { @lovelist[$lovenum] = "$love<>$name"; $lovenum++; if ($bestlove < $love) { $bestowner = "$name"; $bestlove = $love; } } elsif ($love <= $disliked) { @hatelist[$hatenum] = "$love<>$name"; $hatenum++; } else { @otherlist[$othernum] = "$love<>$name"; $othernum++; } } |
if ($_[0] eq 'ownerlist') { if ($love >= $loved) { @lovelist[$lovenum] = "$love<>$name"; $lovenum++; if ($bestlove < $love) { $bestowner = "$name"; $bestlove = $love; } } elsif ($love <= $disliked) { @hatelist[$hatenum] = "$love<>$name"; $hatenum++; } else { @otherlist[$othernum] = "$love<>$name"; $othernum++; } } } if ($_[0] eq 'ownerlist') { &user_sort_r(@lovelist); @lovelist = @newtxt; &user_sort_r(@hatelist); @hatelist = @newtxt; &user_sort_r(@otherlist); @otherlist = @newtxt; } } # ------------------------- # # Sub Open Out User Data # ユーザーデータの書きこみ |
# ------------------------- # # Sub Owner List # 飼い主ランキング # ------------------------- # sub ownerlist { &header; &title; $bestlove = $lovenum = $hatenum = $othernum = 0; &openinuserdata('ownerlist'); &bodytop('飼い主ランキング'); &tabletop; print "$font2$petnameが一番なついている人は</font><br>"; if ($bestlove < $loved) { print "いません<br>\n";} else { print "$bestownerさんです<br>\n"; } print "<br>\n"; print "$font2$petnameがなついている人は</font><br>"; if ($lovenum == 0) { print "いません<br>"; } # else { foreach $owner (@lovelist) { print "$ownerさん<br>\n"; } } else { foreach $owner (@lovelist) { ($love,$name) = split(/<>/,$owner); # ←プレイヤーの明示をしている人はここ注意! print "$nameさん($loveポイント)<br>\n"; } } print "<br>\n"; print "$font2$petnameが嫌いな人は</font><br>"; if ($hatenum == 0) { print "いません<br>";} # else { foreach $owner (@hatelist) { print "$ownerさん<br>\n"; } } else { foreach $owner (@hatelist) { ($love,$name) = split(/<>/,$owner); # ←プレイヤーの明示をしている人はここ注意! print "$nameさん($loveポイント)<br>\n"; } } print "<br>\n"; print "$font2それ以外の人</font><br>"; if ($othernum == 0) { print "いません<br>"; } # else { foreach $owner (@otherlist) { print "$ownerさん<br>\n"; } } else { foreach $owner (@otherlist) { ($love,$name) = split(/<>/,$owner); # ←プレイヤーの明示をしている人はここ注意! print "$nameさん($loveポイント)<br>\n"; } } &tablebottom; &bodybottom; &footer; } |