全ての $dummy01 を $lastcom にする(6ヶ所or4ヶ所)
全ての $newdummy01 を $newlastcom にする(2ヶ所)
ユーザー情報をチェック(sub checkname)と、
新規ペット登場(sub newpet)の、
$lastcomの初期値を変更する。
# $lastcom = 0;
$lastcom = '初めて(未選択)';
|
# ------------------------- #
# Sub Action
# アクション
# ------------------------- #
sub action {
$playmsg = "$playtime時間" if $playtime != 0;
$playmsg = "$playminute分" if $playtime == 0;
&checkname;
&error("まだ$playmsg経過していません") if $enter == 1;
&header;
&title;
&bodytop("ペットデータ($num代目)");
&petdata;
srand(time);
$rnd = int(rand(100) + 1); # Amend Ver 2.2
$fa = $FORM{'mode'};
if ($fa eq 'feed') { $lastcom = '餌をあげる'; }
elsif ($fa eq 'pat') { $lastcom = 'なでる'; }
elsif ($fa eq 'play') { $lastcom = '遊ぶ'; }
elsif ($fa eq 'hit') { $lastcom = 'しかる'; }
elsif ($fa eq 'out') { $lastcom = '外に出す'; }
else { $lastcom = '???'; } # 上記以外のコマンドの時(特殊イベントなど)
if ($fa eq 'play') { $lastplay = time }
if ($fa eq 'out') { $out = 1; $outdate = time }
if ($rnd <= $rnd_border) {
&petnow($rnd_img,$rnd_msg);
$love--;
$lastcom = 'ランダム';
}
elsif ($FORM{'good'} =~ /$fa/) {
&petnow($good_img{$fa},$good_msg{$fa});
$love++;$good++;
if ($fa eq "feed") { $lastfeed = time }
}
elsif ($FORM{'bad'} =~ /$fa/) {
&petnow($bad_img{$fa},$bad_msg{$fa});
$love--;$bad++;
}
else {
&petnow($else_img{$fa},$else_msg{$fa});
}
&openoutpetdata;
$goodbye = time - (60 * 60 * 24 * $goodbye);
$newlove = $love;
&openinuserdata('action');
&openoutuserdata;
$actionflag = 1; # 飼い主ランキングのリンクを表示
&bodybottom;
&footer;
}
|
if ($_[0] eq 'ownerlist') {
if ($love >= $loved) {
@lovelist[$lovenum] = "$name<>$lastcom";
$lovenum++;
if ($bestlove < $love)
{ $bestowner = "$name"; $bestlove = $love }
} elsif ($love <= $disliked) {
@hatelist[$hatenum] = "$name<>$lastcom";
$hatenum++;
} else {
@otherlist[$othernum] = "$name<>$lastcom";
$othernum++;
}
}
|
# ------------------------- #
# 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) {
($name,$lastcom) = split(/<>/,$owner);
print "$nameさん($lastcom)<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) {
($name,$lastcom) = split(/<>/,$owner);
print "$nameさん($lastcom)<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) {
($name,$lastcom) = split(/<>/,$owner);
print "$nameさん($lastcom)<br>\n";
}
}
&tablebottom;
&bodybottom;
&footer;
}
|