# GMR for Keitai sub routine
# ver 0.65alpha(07/06/07)



sub header_i{
	print "Content-type: text/html\n\n";
	print "<html><head><title>$topic</title></head><body>\n";
}
sub footer_i{
	print "<hr>$version</body></html>";
}

sub list_i{
&get_cookie;

if(!open(IN,"$datafile")){&error_message('datafile error','data file access failed.');}
@all=<IN>;
close IN;

$sort=16;
$mode=r;
&sort_table;

print "[<a href='#login'>↓</a>]<BR>";
$count=0;
$pagenow=1;
foreach $i (@all){

	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);

$count++;
if($count==15){$count=0;$pagenow++;}

if($pagenow==$page){
$date=substr($time,0,8);

$diary="";
$diaryfile="$diarydir$name.$diaryletter";
if(-e "$diaryfile"){
	if((-M $diaryfile)<1){
		$diary.="<font color=red>UP!</font>";
	}
	print "$date:<a href='$script?function=prof&name=$name&ktai=on'>$name</a>";
	print " <a href='$script?function=diary&name=$name&ktai=on'>■</a>$diary<BR>";
}
else{
	print "$date:<a href='$script?function=prof&name=$name&ktai=on'>$name</a><BR>";
}
}
}


print "<a name='login'>[<a href='$script?ktai=on&page=1'>Top</a>]";
$pastpage=$page-1;
if($pastpage<1){
	print "[--]";
} else {
	print "[<a href='$script?ktai=on&page=$pastpage'>前</a>]";
}
$page++;
print "[<a href='$script?ktai=on&page=$page'>次</a>]";
print "[<a href='#pagetop'>↑</a>]";



print <<"EOM";

<form method=$method action=$script>
＜メンバーメニュー＞<BR>
Name<input type=text name=name size=14 value='$c_name'><BR>
Pass<input type=password name=pass size=8 value='$c_pass'><BR>
<input type=hidden name=ktai value='on'><input type=submit name=function value='$button[0]'><input type=submit name=function value='$button[1]'>
EOM
#if($mes_avail){
#print "<input type=submit name=function value='check'>";
#}
print "</form><HR>新規登録<form method=$method action=$script><input type=hidden name=function value=new>";
if($reg_mode==0){print "<input type=password name=gpass>";}
print "<input type=hidden name=ktai value='on'><input type=submit value='新規登録'>";
print "</form>";

print "<a href='$script?function=history&ktai=on'>最近の更新20件</a>\n";

}

sub prof_i{
&get_cookie;
print "Profile: $name<BR>";

if(!open(IN,"$datafile")){&error_message('datafile error2098','data file access failed.');}
@all=<IN>;
close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name){
				$match=$i;
		}
	}
	if($match eq ""){&header; &error_message('id/pass error','access failed.');}

	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);


if($mode eq "detail"){
#detail
	@skill = split(/,/,$etc[2]);

print "[<a href='#skill'>Skill</a>]<BR>\n";
print "メリットポイント状況<BR>\n";


$prod[12] =~ s/<\/TD><TD[^>]+>/<BR>/g;
$prod[12] =~ s/<TR><TD[^>]+>//g;
$prod[12] =~ s/<\/TD><\/TR>//g;
$prod[12] =~ s/<div[^>]+>//g;
$prod[12] =~ s/<\/div>/<BR>/g;
$dummy=quotemeta("基本<BR>グループ１<BR>グループ２");
$prod[12] =~ s/$dummy//g;
print "$prod[12]<BR>";

print "<HR><a name='skill'>武器魔法スキル<BR>";
	if ($skill_visible) {
	
	    for($i=0;$i<$#skilllist+1;$i++){
	        print "$skilllist[$i]:$skill[$i]<BR>";
	    }
	
	} else {
		print "skill function is not available.<BR>";
	}



} elsif($mode eq "prof"){

if($class_edit==0){
$class =~ s/&lt;/</g;
$class =~ s/&gt;/>/g;
}

print "$no/[$class]<BR>";
print "$racelist[$race]($facetypename[$etc[0]])/$relmlistl[$relm]/$point/rank $mrank<BR>";
print "コメント[$comment]<HR>";




if($prof ne "off"){
	print "ハンドル[$handle]<BR>";
	print "POLハンドル[$polhn]<BR>";
	print "e-mail[<a href='mailto:$mail'>$mail</a>]<BR>";
	print "ホームページ[<a href='$home' target='_blank'>$home</a>]<BR>";
	print "コメント<BR>$comment2";

} else {
	print "<BR>プロフィール非公開";
}


} elsif($mode eq "level"){
if(($anon ne "on") || ($anon_mode != 1 )){

if($lev[$mainjob]<10){
	$main_level="0$lev[$mainjob]";
} else {
	$main_level=$lev[$mainjob];
}

if($supportjob <99){
	$mod_level=int($lev[$mainjob]/2);
	if($mod_level==0){$mod_level=1;}
	if($mod_level>$lev[$supportjob]){$mod_level=$lev[$supportjob];}

if($mod_level<10){
	$mod_level="0$mod_level";
}
	print "$joblist[$mainjob]$main_level/$joblist[$supportjob]$mod_level<BR>";
} else {
	print "$joblist[$mainjob]$main_level<BR>";
}
print "ジョブレベル<BR>";
for ($j=0;$j<$job_max;$j++){
print "$joblist[$j]:$lev[$j]<BR>";
}
    @prod_r = split(/,/,$etc[1]);

print "合成<BR>";
for ($j=0;$j<$prod_max;$j++){
print "$prodlist[$j]:$prod[$j]($ranklist[$prod_r[$j]])<BR>";
}
}
} elsif($mode eq "mission"){
	@mission = split(/,/,$prod[15]);
	@assault= split (//,$mission[16]);
	$assault[0]=hex($assault[0]);

print"<HR>ミッション<BR>";
print"アトルガン：$amlist[$mission[15]]<BR>";
print"プロマシア：$pmlist[$mission[0]]<BR>";
print"ジラート：$jmlist[$mission[1]]<BR>";
print"サンドリア：$smlist[$mission[2]]<BR>";
print"バストゥーク：$bmlist[$mission[3]]<BR>";
print"ウインダス：$wmlist[$mission[4]]<BR>";
print"裏サンド：$maru[$mission[5]]<BR>";
print"裏バス：$maru[$mission[6]]<BR>";
print"裏ウイン：$maru[$mission[7]]<BR>";
print"裏ジュノ：$maru[$mission[8]]<BR>";
print"裏氷河：$maru[$mission[9]]<BR>";
print"裏ザルカ：$maru[$mission[10]]<BR>";
print"裏バルクルム：$maru[$mission[11]]<BR>";
print"裏ブブリム：$maru[$mission[12]]<BR>";
print"裏クフィム：$maru[$mission[13]]<BR>";
print"裏タブナジア：$maru[$mission[14]]<BR>";

print "<HR>アサルト<BR>";
print"$aslist[0]:$asrank[$assault[0]]<BR>";
print"$aslist[1]:$maru[$assault[1]]<BR>";
print"$aslist[2]:$maru[$assault[2]]<BR>";
print"$aslist[3]:$maru[$assault[3]]<BR>";
print"$aslist[4]:$maru[$assault[4]]<BR>";
print"$aslist[5]:$maru[$assault[5]]<BR>";
print "ナイズル島開通:";
if($mission[17]==0){print "$maru[0]";} else {print "$maru[1]";}
print "<BR>";

print"$aslist[6]:$maru[$assault[6]]<BR>";
print"$aslist[7]:$maru[$assault[7]]<BR>";
print"$aslist[8]:$maru[$assault[8]]<BR>";
print"$aslist[21]:$maru[$assault[21]]<BR>";
print"$aslist[22]:$maru[$assault[22]]<BR>";
print"$aslist[31]:$maru[$assault[31]]<BR>";
print"$aslist[32]:$maru[$assault[32]]<BR>";
print"$aslist[41]:$maru[$assault[41]]<BR>";
print"$aslist[46]:$maru[$assault[46]]<BR>";
print"$aslist[51]:$maru[$assault[51]]<BR>";

print"$aslist[9]:$maru[$assault[9]]<BR>";
print"$aslist[10]:$maru[$assault[10]]<BR>";
print"$aslist[11]:$maru[$assault[11]]<BR>";
print"$aslist[23]:$maru[$assault[23]]<BR>";
print"$aslist[24]:$maru[$assault[24]]<BR>";
print"$aslist[33]:$maru[$assault[33]]<BR>";
print"$aslist[34]:$maru[$assault[34]]<BR>";
print"$aslist[42]:$maru[$assault[42]]<BR>";
print"$aslist[47]:$maru[$assault[47]]<BR>";
print"$aslist[52]:$maru[$assault[52]]<BR>";

print"$aslist[12]:$maru[$assault[12]]<BR>";
print"$aslist[13]:$maru[$assault[13]]<BR>";
print"$aslist[14]:$maru[$assault[14]]<BR>";
print"$aslist[25]:$maru[$assault[25]]<BR>";
print"$aslist[26]:$maru[$assault[26]]<BR>";
print"$aslist[35]:$maru[$assault[35]]<BR>";
print"$aslist[36]:$maru[$assault[36]]<BR>";
print"$aslist[43]:$maru[$assault[43]]<BR>";
print"$aslist[48]:$maru[$assault[48]]<BR>";
print"$aslist[53]:$maru[$assault[53]]<BR>";

print"$aslist[15]:$maru[$assault[15]]<BR>";
print"$aslist[16]:$maru[$assault[16]]<BR>";
print"$aslist[17]:$maru[$assault[17]]<BR>";
print"$aslist[27]:$maru[$assault[27]]<BR>";
print"$aslist[28]:$maru[$assault[28]]<BR>";
print"$aslist[37]:$maru[$assault[37]]<BR>";
print"$aslist[38]:$maru[$assault[38]]<BR>";
print"$aslist[44]:$maru[$assault[44]]<BR>";
print"$aslist[49]:$maru[$assault[49]]<BR>";
print"$aslist[54]:$maru[$assault[54]]<BR>";

print"$aslist[18]:$maru[$assault[18]]<BR>";
print"$aslist[19]:$maru[$assault[19]]<BR>";
print"$aslist[20]:$maru[$assault[20]]<BR>";
print"$aslist[29]:$maru[$assault[29]]<BR>";
print"$aslist[30]:$maru[$assault[30]]<BR>";
print"$aslist[39]:$maru[$assault[39]]<BR>";
print"$aslist[40]:$maru[$assault[40]]<BR>";
print"$aslist[45]:$maru[$assault[45]]<BR>";
print"$aslist[50]:$maru[$assault[50]]<BR>";
print"$aslist[55]:$maru[$assault[55]]<BR>";


if($mission[17]>0){
print "ナイズル島到達度：$nzlist[$mission[17]]<BR>";
}

} elsif($mode eq "custom"){
@custom=split(/,/,$prod[11]);

print "<HR>$custom_field[0]<BR>";

for($j=1;$j<$#custom_field+1;$j++){
	if($custom_pulldown[$j]==0){
		print "$custom_field[$j]:$custom[$j]<BR>";
	} else {
		print "$custom_field[$j]:".${"custom_list$j"}[$custom[$j]]."<BR>";
	}
}

}	else {


#detailend
}
print "<HR>";
print "<a href='$script?name=$name&function=prof&ktai=on&mode=prof'>プロフィール</a><BR>";
print "<a href='$script?name=$name&function=prof&ktai=on&mode=level'>レベル・合成スキル</a><BR>";
print "<a href='$script?name=$name&function=prof&ktai=on&mode=mission'>ミッション</a><BR>";
print "<a href='$script?name=$name&function=prof&ktai=on&mode=custom'>$custom_field[0]</a><BR>";
print "<a href='$script?name=$name&function=prof&ktai=on&mode=detail'>メリポ/スキル</a><HR>";

if($mes_avail){
print <<"EOM";
$nameさんへメッセージ送信<BR>
<form method=post action=$script>
name<input type=text name=name size=14 value=$c_name>
pass<input type=password name=pass size=8 value=$c_pass>
<input type=hidden name=name2 value='$name'>
<input type=hidden name=ktai value='on'>
<input type=submit name=function value='send'>
</form>
EOM
}



print "<BR><a href='$script?ktai=on'>ListTop</a>";

}

sub diary_i{
print "$name 's diary<HR>";

if(!open(IN,"$datafile")){&error_message('datafile error2098','data file access failed.');}
@all=<IN>;
close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name){
				$match=$i;
		}
	}
	if($match eq ""){&header; &error_message('id/pass error','access failed.');}

	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);




$diaryfile="$diarydir$name.$diaryletter";
if($diarybg ne ""){$dbg=" bgcolor=$diarybg";}

if (!open(DB,"$diaryfile")) { 
	print "$name さんの日記はありません。";
}
elsif($prof ne "off"){
@lines = <DB>;
close(DB);

$pagenow=1;
foreach $i (@lines){
	($no,$today2,$title,$body,$imgexist,$res)=split(/\t/,$i);
	if($pagenow==$page){

print "●$title/$today2($no)<HR>";
if($imgexist ne ""){
	@imgfiles = split(/,/,$imgexist);
	foreach $imgfile(@imgfiles){
	print "<a href='$putdir$imgfile' target='_blank'>[画像]</a><BR>";
	}
}

if ($FORM{'all'} ne "true")
{
	@diarylines = split(/<BR>/,$body);
	if ($#diarylines > 8)
	{
		$body = join("<BR>", @diarylines[0..8])."(略<BR><a href='$script?function=diary&name=$name&page=$page&ktai=on&all=true'>[全文を読む]</a>";
	}
}


print "$body";
if($res ne ""){print "<HR>$res<HR>";}

if($diaryres){
	print "<form method=$method action=$script>名前<input type=text size=10 name=name value='$c_name'><textarea name=body></textarea><input type=hidden name=function value=resdiary><input type=hidden name=name2 value='$name'><input type=hidden name=no value=$no><input type=submit value='レス'><input type=hidden name=page value='$page'><input type=hidden name=ktai value='on'></form>";
		}
	}
	$pagenow++;

}
$page++;
print "<HR><a href='$script?function=diary&name=$name&page=$page&ktai=on'>Next</a>";
print "<BR><a href='$script?function=diary&name=$name&page=1&ktai=on'>DiaryTop</a>";
print "<BR><a href='$script?ktai=on'>ListTop</a>";
}
 else {
	print "$name さんの日記は非公開になっています。";
}

}

sub res_diary_i{
	if($body eq ""){&header;&error_message('本文がありません','');}
	if($name eq ""){&header;&error_message('名前がありません','');}
	if($body !~ /[\x81-\x9A]/ && $denyeng){&header;&error_message('アルファベットのみの書き込みは禁止されています。','')};
	&word_ban;

	$diaryfile="$diarydir$name2.$diaryletter";

	&dirlock;

	if (!open(DB,"$diaryfile")) { 
		&header;
		print "<HR><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH>$name さんの日記はありません。</TH></TR></table>";
	} else {
		@lines = <DB>;
		close(DB);

	foreach $i(@lines){
			($r_no,$r_today,$r_title,$r_body,$r_img,$r_res)=split(/\t/,$i);
			if($no !=$r_no){
				push(@out,$i);
			} else {
			$r_res =~ s/\n//g;
			$body =~ s/<BR>//g;
			$r_res.="$name &gt; $body ($today2)<BR>";
			$r_body =~ s/\n//g; #旧バージョン対策
				push(@out,"$r_no\t$r_today\t$r_title\t$r_body\t$r_img\t$r_res\t\n");
			}
	}

if (!open(OUT,">$diaryfile")) {&header; &error_message('filesystem error','access failed.');}
print OUT @out;
close(OUT);

#RSS用履歴ファイル作成
$historybase="RESDIA\t$name $name2\t$timenow\t$rsstime\t$no\t$body\t$rh\t$addr\t\n";
&add_history;



if(!open(IN,"$datafile")){&error_message('datafile error2480','data file access failed.');}
@all=<IN>;
close IN;

@out=();
foreach $i(@all){
	 ($no,$r_name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
	if($r_name eq $name2){
		push(@out,"$no\t$r_name\t$pass\t$anon\t$race\t$relm\t$mainjob\t$supportjob\t$prof\t$handle\t$polhn\t$mail\t$home\t$comment2\t$point\t$class\t$timenow\t$comment\t$mrank\t$etc[0]\t$etc[1]\t$etc[2]\t$prod[0]\t$prod[1]\t$prod[2]\t$prod[3]\t$prod[4]\t$prod[5]\t$prod[6]\t$prod[7]\t$prod[8]\t$prod[9]\t$prod[10]\t$prod[11]\t$prod[12]\t$prod[13]\t$prod[14]\t$prod[15]\t$lev[0]\t$lev[1]\t$lev[2]\t$lev[3]\t$lev[4]\t$lev[5]\t$lev[6]\t$lev[7]\t$lev[8]\t$lev[9]\t$lev[10]\t$lev[11]\t$lev[12]\t$lev[13]\t$lev[14]\t$lev[15]\t$lev[16]\t$lev[17]\t$lev[18]\t$lev[19]\t\n");
	} else {
		push(@out,$i);
	}
}

		if(!open(OUT,">$datafile")){&header; &error_message('datafile error2494','data file access failed.');}
		print OUT @out;
		close OUT;


rmdir($lockdir);




}

$name=$name2;
}

sub new_regist_i{

	if(($gpass ne $reg_pass && $reg_mode==0)){&error_message('illegal login','password is not correct.');}

	if($mode eq "regist"){
		&new_regist_regist_i;
	} else {
		&new_regist_normal_i;
	}

}

sub new_regist_regist_i{

if(!open(IN,"$datafile")){&error_message('datafile error1791','data file access failed.');}
@all=<IN>;
close IN;

	if( !($pass =~ /^[A-Za-z0-9_]+$/) ){
	&error_message('そのパスワードは登録に利用できません。','パスワードは半角英数字で登録してください。');
	}
	if( !($name =~ /^[A-Za-z0-9_]+$/) ){
	&error_message('その名前は使えません。','名前は半角英数字で登録してください。');
	}


	if($mainjob == $supportjob){&error_message('main/job error','メインとサポートは同一のジョブにはできません');}
	

$min_no=0;
		foreach $i (@all){
			($r_no,$r_user,$dummy)=split(/\t/,$i);
			if($r_user eq $name){&error_message('already registed',"'$name' has already registed.");}
		}

$no=$#all+2;
if($no<10){$no="0$no";}
if($no<100){$no="0$no";}

		push(@all,"$no\t$name\t$pass\t$anon\t$race\t$relm\t$mainjob\t$supportjob\t$prof\t$handle\t$polhn\t$mail\t$home\t$comment2\t$point\t$class\t$timenow\t$comment\t$mrank\t$etc[0]\t$etc[1]\t$etc[2]\t$prod[0]\t$prod[1]\t$prod[2]\t$prod[3]\t$prod[4]\t$prod[5]\t$prod[6]\t$prod[7]\t$prod[8]\t$prod[9]\t$prod[10]\t$prod[11]\t$prod[12]\t$prod[13]\t$prod[14]\t$prod[15]\t$lev[0]\t$lev[1]\t$lev[2]\t$lev[3]\t$lev[4]\t$lev[5]\t$lev[6]\t$lev[7]\t$lev[8]\t$lev[9]\t$lev[10]\t$lev[11]\t$lev[12]\t$lev[13]\t$lev[14]\t$lev[15]\t$lev[16]\t$lev[17]\t$lev[18]\t$lev[19]\t\n");

&dirlock;
		if(!open(OUT,">$datafile")){&error_message('datafile error1819','data file access failed.');}
		print OUT @all;
		close OUT;
rmdir($lockdir);

#RSS用履歴ファイル作成
$historybase="NEWREG\t$name\tNewMember\t$rsstime\t$no\t$rh\t\t$addr\t\n";
&add_history;

		print "新規メンバー'$name'($no)の登録を完了しました。";
print "<HR><a href=$script?ktai=on&$salt>ListTop</a>";

}


sub new_regist_normal_i{

	print <<"EOM";
必要事項を入力してください。
<form method=$method action=$script>
<input type=hidden name=gpass value=$gpass>
<input type=hidden name=ktai value=on>
<input type=hidden name=function value=new>
<input type=hidden name=mode value=regist>
name<input type=text name=name><BR>
pass<input type=text name=pass><BR>
anon mode<select name=anon>
<option value=off>off</option>
<option value=on>on</option>
</select><BR>
EOM
print "Race<select name=race>";
for($i=0;$i<$#racelist+1;$i++){
print "<option value=$i>$racelist[$i]</option>\n";
}
print "</select><BR>";
print "Realm<select name=relm>";
for($i=0;$i<$#relmlist+1;$i++){
print "<option value=$i>$relmlistl[$i]</option>\n";
}
print "</select><BR>";

print "FaceType<select name=ftype>";
for($i=0;$i<$#facetypename+1;$i++){
    print "<option value=$i>$facetypename[$i]</option>\n";
}
print "</select>";


print "Main<select name=mainjob>";
for($i=0;$i<$job_max;$i++){
print "<option value=$i>$joblist[$i]</option>\n";
}
print "</select><BR>";
print "Sup<select name=supportjob>";
	print "<option value=99>none</option>\n";
for($i=0;$i<$job_max;$i++){
print "<option value=$i>$joblist[$i]</option>\n";
}
print "</select><BR>";

for($i=0;$i<$job_max;$i++){
print "$joblist[$i]<input type=text size=2 name=lev$i><BR>";
}

for($i=0;$i<$prod_max;$i++){
print "$prodlist[$i]<input type=text name=prod$i><BR>";
}



print "point<input type=text name=point><BR>";
print "rank<input type=text name=mrank><BR>";
print "comment<input type=text name=comment size=80><BR>";

print "profile 公開<select name=prof>";
if($prof eq off){
print "<option value=off selected>off</option><option value=on>on</option>";
} else {
print "<option value=off>off</option><option value=on selected>on</option>";
}	
print "</select><BR>";

print "ハンドル<input type=text name=handle value='$handle'><BR>";
print "POL内ハンドル<input type=text name=polhn value='$polhn'><BR>";
print "e-mail<input type=text name=mail value='$mail'><BR>";

print "url<input type=text name=home size=80 value='http://'><BR>";

$comment2 =~ s/<BR>/\r/g;
print "prof comment<textarea name=comment2 rows=5 cols=60>$comment2</textarea><BR>";

print "<input type=submit value='新規登録'></form>";

}

sub keitai_menu{

	print "modifying=$all<BR>";

	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
	@prod_r = split(/,/,$etc[1]);
	@mp=split(/,/,$prod[13]);
	@mission = split(/,/,$prod[15]);
	@assault=split( //,$mission[16]);
	$assault[0]=hex($assault[0]);

#################共通フォーム

print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=submit name=mode value='back'></form>";

print "No. $no : '$name' 修正<BR><form method=$method action=$script><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=mode value=modify><input type=hidden name=function value='$button[0]'>";

####################ジョブ・合成スキル
if($all eq "m_level"){
print "<input type=hidden name=all value=m_level>";

print "Main Job<select name=mainjob>";
for($i=0;$i<$job_max;$i++){
	if($i==$mainjob){
	print "<option value=$i selected>$joblist[$i]</option>\n";
	} else {
	print "<option value=$i>$joblist[$i]</option>\n";
	}
}
print "</select><BR>";


print "Support Job<select name=supportjob>";
	print "<option value=99>none</option>\n";

for($i=0;$i<$job_max;$i++){
	if($i==$supportjob){
	print "<option value=$i selected>$joblist[$i]</option>\n";
	} else {
	print "<option value=$i>$joblist[$i]</option>\n";
	}
}
print "</select><BR>";



for($i=0;$i<$job_max;$i++){
print "$joblist[$i]<input type=text size=2 name=lev$i value=$lev[$i]><BR>\n";
}

for($i=0;$i<$prod_max;$i++){
print "$prodlist[$i]<input type=text size=2 name=prod$i value=$prod[$i]>\n";
print "<select name=prod_r$i>";
	for($j=0;$j<$#ranklist+1;$j++){
		if($j==$prod_r[$i]){
			print "<option value=$j selected>$ranklist[$j]</option>\n";
		} else {
			print "<option value=$j>$ranklist[$j]</option>\n";
		}
	}
print "</select><BR>\n";
}

}

######################プロフィール
if($all eq "m_prof"){
print "<input type=hidden name=all value=m_prof>";

if($class_edit){
print "class<input type=text name=class value='$class'><BR>";
} else {
print "<input type=hidden name=class value='$class'><BR>";
}

print "anon mode(レベル表\示を隠します)<select name=anon>";
if($anon eq on){
print "<option value=off>off</option><option value=on selected>on</option>";
} else {
print "<option value=off selected>off</option><option value=on>on</option>";
}	
print "</select><BR>";



print "Race<select name=race>";
for($i=0;$i<$#racelist+1;$i++){
	if($i==$race){
	print "<option value=$i selected>$racelist[$i]</option>\n";
	} else {
	print "<option value=$i>$racelist[$i]</option>\n";
	}
}
print "</select><BR>";

print "Realm<select name=relm>";
for($i=0;$i<$#relmlist+1;$i++){
	if($i==$relm){
	print "<option value=$i selected>$relmlistl[$i]</option>\n";
	} else {
	print "<option value=$i>$relmlistl[$i]</option>\n";
	}
}
print "</select><BR>";

print "FaceType<select name=ftype>";
for($i=0;$i<$#facetypename+1;$i++){
    if($i==$etc[0]){
    print "<option value=$i selected>$facetypename[$i]</option>\n";
    } else {
    print "<option value=$i>$facetypename[$i]</option>\n";
    }
}
print "</select>";
print "個人ポイント（リージョン情報参照）<input type=text name=point value='$point'><BR>";
print "ミッションランク<input type=text name=mrank value='$mrank'><BR>";
print "comment（リストに表\示されます）<input type=text name=comment size=80 value='$comment'><BR>";
print "<HR>";
print "profile＆日記公開スイッチ（on:公開）<select name=prof>";
if($prof eq off){
print "<option value=off selected>off</option><option value=on>on</option>";
} else {
print "<option value=off>off</option><option value=on selected>on</option>";
}	
print "</select><BR>";

print "ハンドル<input type=text name=handle value='$handle'><BR>";
print "POL内ハンドル<input type=text name=polhn value='$polhn'><BR>";
print "e-mail<input type=text name=mail value='$mail'><BR>";

print "homepage url<input type=text name=home size=80 value='$home'><BR>";
print "<input type=hidden name='profimage' value='$prod[14]'>"; #プロフ画像
$comment2 =~ s/<BR>/\r/g;
print "プロフィール用コメント<textarea name=comment2 rows=5 cols=60>$comment2</textarea><BR>";

}

######################武器魔法スキル
if($all eq "m_skill"){
	print "<input type=hidden name=all value=m_skill>";

    @skill = split(/,/,$etc[2]);
	if ($skill_visible) {
	
	    for($i=0;$i<$#skilllist+1;$i++){
	        print "$skilllist[$i]<input type=text size=4 name=skill$i value=$skill[$i]><BR>";
	    }
	
	} else {
		print "skill function is not available.<BR>";
	}

}
#######################カスタムフィールド
if($all eq "custom"){
	print "<input type=hidden name=all value=custom>";
	@custom=split(/,/,$prod[11]);
	for ($i=1;$i<$#custom_field+1;$i++){
		if($custom_pulldown[$i]==0){
			if($custom_control[$i] eq "0"){
				print "$custom_field[$i]<input type=text name=custom$i value='$custom[$i]'><BR>";
			} else {
				print "<input type=hidden name=custom$i value='$custom[$i]'>";
			}
		} else {
			if($custom_control[$i] eq "0"){
			print "$custom_field[$i]<select name=custom$i>";
			for($j=0;$j<$#{"custom_list$i"}+1;$j++){
				if($j == $custom[$i]){
					print "<option value=$j selected>".${"custom_list$i"}[$j]."</option>";
				} else {
					print "<option value=$j>".${"custom_list$i"}[$j]."</option>";
				}
			}
			print "</select><BR>";
			} else {
				print "<input type=hidden name=custom$i value='$custom[$i]'>";
			}
		}
	}
}
######################メリポ1 0-27
if($all eq "mpoint1"){
	&list_mpoint_i;
	print "<input type=hidden name=all value=mpoint1>";
	for($i=0;$i<28;$i++){
		print "$m_name[$i]($m_categoryname[$m_categorycode[$i]])";
		print "<select name=mp$i>";
		for($j=0;$j<$m_max[$i]+1;$j++){
			if($mp[$i] == $j){
				print "<option value=$j selected>$j</option>";
			} else {
				print "<option value=$j>$j</option>";
			}
		}
		print "</select><BR>";
	}
}
######################メリポ2 28-44
if($all eq "mpoint2"){
	&list_mpoint_i;
	print "<input type=hidden name=all value=mpoint2>";
	for($i=28;$i<45;$i++){
		print "$m_name[$i]($m_categoryname[$m_categorycode[$i]])";
		print "<select name=mp$i>";
		for($j=0;$j<$m_max[$i]+1;$j++){
			if($mp[$i] == $j){
				print "<option value=$j selected>$j</option>";
			} else {
				print "<option value=$j>$j</option>";
			}
		}
		print "</select><BR>";
	}
}

######################メリポ3 45-140
if($all eq "mpoint3"){
	&list_mpoint_i;
	print "<input type=hidden name=all value=mpoint3>";

	for($i=45;$i<141;$i++){
		if($lev[$m_jobcode[$i]] == 75){
			print "$m_name[$i]($m_categoryname[$m_categorycode[$i]])";
			print "<select name=mp$i>";
			for($j=0;$j<$m_max[$i]+1;$j++){
				if($mp[$i] == $j){
					print "<option value=$j selected>$j</option>";
				} else {
					print "<option value=$j>$j</option>";
				}
			}
			print "</select><BR>";
		}
	}
}
######################メリポ4 141-223
if($all eq "mpoint4"){
	&list_mpoint_i;
	print "<input type=hidden name=all value=mpoint4>";

	for($i=141;$i<223;$i++){
		if($lev[$m_jobcode[$i]] == 75){
			print "$m_name[$i]($m_categoryname[$m_categorycode[$i]])";
			print "<select name=mp$i>";
			for($j=0;$j<$m_max[$i]+1;$j++){
				if($mp[$i] == $j){
					print "<option value=$j selected>$j</option>";
				} else {
					print "<option value=$j>$j</option>";
				}
			}
			print "</select><BR>";
		}
	}
}

######################ミッション1 三国
if($all eq "mission1"){
	print "<input type=hidden name=all value=mission1>";

print "$mlist[2]";
print "<select name=mission2>";
	for($j=0;$j<$#smlist+1;$j++){
		if($j==$mission[2]){
			print "<option value=$j selected>$smlist[$j]</option>\n";
		} else {
			print "<option value=$j>$smlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";
print "$mlist[3]";
print "<select name=mission3>";
	for($j=0;$j<$#bmlist+1;$j++){
		if($j==$mission[3]){
			print "<option value=$j selected>$bmlist[$j]</option>\n";
		} else {
			print "<option value=$j>$bmlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";


print "<TR><TD>$mlist[4]</TD><TD>";
print "<select name=mission4>";
	for($j=0;$j<$#wmlist+1;$j++){
		if($j==$mission[4]){
			print "<option value=$j selected>$wmlist[$j]</option>\n";
		} else {
			print "<option value=$j>$wmlist[$j]</option>\n";
		}
	}
print "</select></TD></TR>\n";

}

######################ミッション2 デュナミス
if($all eq "mission2"){
	print "<input type=hidden name=all value=mission2>";


for($k=5;$k<15;$k++){

print "<select name=mission$k>";
	for($j=0;$j<$#maru+1;$j++){
		if($j==$mission[$k]){
			print "<option value=$j selected>$maru[$j]</option>\n";
		} else {
			print "<option value=$j>$maru[$j]</option>\n";
		}
	}
print "</select>$mlist[$k]<BR>";
}


}

######################ミッション3 ジラート
if($all eq "mission3"){
	print "<input type=hidden name=all value=mission3>";

print "$mlist[1]";
print "<select name=mission1>";
	for($j=0;$j<$#jmlist+1;$j++){
		if($j==$mission[1]){
			print "<option value=$j selected>$jmlist[$j]</option>\n";
		} else {
			print "<option value=$j>$jmlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";
}
######################ミッション4 プロマシア
if($all eq "mission4"){
	print "<input type=hidden name=all value=mission4>";

print "$mlist[0]";
print "<select name=mission0>";
	for($j=0;$j<$#pmlist+1;$j++){
		if($j==$mission[0]){
			print "<option value=$j selected>$pmlist[$j]</option>\n";
		} else {
			print "<option value=$j>$pmlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";
}
######################ミッション5 アトルガン
if($all eq "mission5"){
	print "<input type=hidden name=all value=mission5>";

print "$mlist[15]";
print "<select name=mission15>";
	for($j=0;$j<$#amlist+1;$j++){
		if($j==$mission[15]){
			print "<option value=$j selected>$amlist[$j]</option>\n";
		} else {
			print "<option value=$j>$amlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";
}

######################ミッション6 アサルト
if($all eq "mission6"){
	print "<input type=hidden name=all value=mission6>";

print "$aslist[0]";
print "<select name=assault0>";
	for($j=0;$j<$#asrank+1;$j++){
		if($j==$assault[0]){
			print "<option value=$j selected>$asrank[$j]</option>\n";
		} else {
			print "<option value=$j>$asrank[$j]</option>\n";
		}
	}
print "</select><BR>\n";


	for($j=1;$j<$#aslist+1;$j++){
	print "<select name=assault$j>";
		if($assault[$j]==1){
			print "<option value=1 selected>$maru[1]</option>\n";
			print "<option value=0>$maru[0]</option>\n";
		} else {
			print "<option value=1>$maru[1]</option>\n";
			print "<option value=0 selected>$maru[0]</option>\n";
		}
	print "</select>$aslist[$j]<BR>\n";
	}

print "ナイズル島進行度（開通）";
print "<select name=mission17>";
	for($j=0;$j<$#nzlist+1;$j++){
		if($j==$mission[17]){
			print "<option value=$j selected>$nzlist[$j]</option>\n";
		} else {
			print "<option value=$j>$nzlist[$j]</option>\n";
		}
	}
print "</select><BR>\n";

}



####################共通部フッタ
print "<input type=hidden name=ktai value=on><input type=submit value=modify><BR></form>";

}

sub keitai_mpoint_menu{
#メリポ用メニュー
#mpoint1 HPMPステータス戦闘 0-27
#mpoint2 魔法その他 28-44
#mpoint3 ジョブ１ 45-140
#mpoint4 ジョブ２ 141-210
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mpoint1'><input type=hidden name=mode value=menu><input type=submit value='HPMPステータス戦闘'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mpoint2'><input type=hidden name=mode value=menu><input type=submit value='魔法その他'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mpoint3'><input type=hidden name=mode value=menu><input type=submit value='ジョブグループ１'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mpoint4'><input type=hidden name=mode value=menu><input type=submit value='ジョブグループ２'></form>";


}
sub keitai_mission_menu{
#ミッション用メニュー
#mission1 3国
#mission2 デュナミス
#mission3 ジラート
#mission4 プロマシア
#mission5 アトルガン
#mission6 アサルト
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission1'><input type=hidden name=mode value=menu><input type=submit value='３国ミッション'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission2'><input type=hidden name=mode value=menu><input type=submit value='デュナミス'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission3'><input type=hidden name=mode value=menu><input type=submit value='ジラート'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission4'><input type=hidden name=mode value=menu><input type=submit value='プロマシア'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission5'><input type=hidden name=mode value=menu><input type=submit value='アトルガン'></form>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='mission6'><input type=hidden name=mode value=menu><input type=submit value='アサルト'></form>";
}


sub keitai_modify{

	print "modifying=$all<BR>";
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=submit name=mode value='back'></form>";


#最初に$allをチェックしてマッチファイルから元データを上書きする。

if($all eq "m_prof"){
	 ($no,$name,$pass,$dummy,$dummy,$dummy,$mainjob,$supportjob,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
} elsif ($all eq "m_level"){
	 ($no,$name,$pass,$anon,$race,$relm,$dummy,$dummy,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$dummy,$etc[2],$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy,$dummy)=split(/\t/,$match);
} elsif ($all eq "m_skill"){
	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$dummy,$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
} elsif ($all eq "custom"){
	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
		for($j=1;$j<$#custom_field+1;$j++){
			if($custom_control[$j] eq $name){
				$custom[$j]=$FORM{"custom$count"."_$j"};
				if($FORM{"custom0"} != 0){
				$custom[$FORM{"custom0"}] += $FORM{"custom$count"."_$j"};
				}
			}
		}
		$prod[11]=join(",", @custom);
} elsif ($all =~ "mission"){
	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
    @mission = split(/,/,$prod[15]);

	if($all eq "mission1"){
		$mission[2]=$FORM{"mission2"};
		$mission[3]=$FORM{"mission3"};
		$mission[4]=$FORM{"mission4"};
	}
	if($all eq "mission2"){
		for($i=5;$i<15;$i++){
			$mission[$i]=$FORM{"mission$i"};
		}
	}
	if($all eq "mission3"){
		$mission[1]=$FORM{"mission1"};
	}
	if($all eq "mission4"){
		$mission[0]=$FORM{"mission0"};
	}
	if($all eq "mission5"){
		$mission[15]=$FORM{"mission15"};
	}
	if($all eq "mission6"){
		$FORM{"assault0"}=sprintf("%x",$FORM{"assault0"});
		$mission[16]=$FORM{"assault0"};
		for($j=1;$j<$#aslist+1;$j++){
			$mission[16]=$mission[16].$FORM{"assault$j"};
		}
		$mission[17]=$FORM{"mission17"};
	}


	$prod[15]=join(",", @mission);



} elsif ($all =~ "mpoint"){
	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
&list_mpoint_i;
	@mp=split(/,/,$prod[13]);

	if($all eq "mpoint1"){
		for($i=0;$i<28;$i++){
			$mp[$i]=$FORM{"mp$i"}
		}
	}
	if($all eq "mpoint2"){
		for($i=28;$i<45;$i++){
			$mp[$i]=$FORM{"mp$i"}
		}
	}
	if($all eq "mpoint3"){
		for($i=45;$i<141;$i++){
			$mp[$i]=$FORM{"mp$i"}
		}
	}
	if($all eq "mpoint4"){
		for($i=141;$i<223;$i++){
			$mp[$i]=$FORM{"mp$i"}
		}
	}
	

	$prod[13]="";
	$mptotal=0;
	for($i=0;$i<223;$i++){
		$prod[13]=$prod[13].$mp[$i].",";
		if($mp[$i]>0){
			for($j=0;$j<$mp[$i];$j++){
				$mptotal= $mptotal + substr($m_needpoint[$i],$j,1);
			}
		}
	}
		#layout style2
	$j=99; #現在カテゴリ
	$prod[12]="<TR><TD bgcolor=$indexcolor width=30% align=center>基本</TD><TD bgcolor=$indexcolor width=35% align=center>グループ１</TD><TD bgcolor=$indexcolor width=35% align=center>グループ２</TD></TR><TR><TD bgcolor=$profcolor width=30% valign=top>";
	for($i=0;$i<45;$i++){ #基本
		if($mp[$i]>0){
			if($j !=$m_categorycode[$i]){
				$prod[12]=$prod[12]."<div style=\"background-color : $indexcolor; text-align : center\">$m_categoryname[$m_categorycode[$i]](カテゴリ上限$m_categorymax[$m_categorycode[$i]])</div>";
				$j=$m_categorycode[$i];
			}
			$prod[12]=$prod[12]."$m_name[$i] :".$mp[$i]."/$m_max[$i]<BR>";
		}
	}
	$prod[12]=$prod[12]."</TD><TD bgcolor=$profcolor width=35% valign=top>";
	for($i=45;$i<141;$i++){ #ジョブカテゴリ１
		if($mp[$i]>0){
			if($j !=$m_categorycode[$i]){
				$prod[12]=$prod[12]."<div style=\"background-color : $indexcolor; text-align : center\">$m_categoryname[$m_categorycode[$i]](カテゴリ上限$m_categorymax[$m_categorycode[$i]])</div>";
				$j=$m_categorycode[$i];
			}
			$prod[12]=$prod[12]."$m_name[$i] :".$mp[$i]."/$m_max[$i]<BR>";
		}
	}
	$prod[12]=$prod[12]."</TD><TD bgcolor=$profcolor width=35% valign=top>";
	for($i=141;$i<223;$i++){ #ジョブカテゴリ２
		if($mp[$i]>0){
			if($j !=$m_categorycode[$i]){
				$prod[12]=$prod[12]."<div style=\"background-color : $indexcolor; text-align : center\">$m_categoryname[$m_categorycode[$i]](カテゴリ上限$m_categorymax[$m_categorycode[$i]])</div>";
				$j=$m_categorycode[$i];
			}
			$prod[12]=$prod[12]."$m_name[$i] :".$mp[$i]."/$m_max[$i]<BR>";
		}
	}
	$prod[12]=$prod[12]."</TD></TR>";

	if($mptotal>0){
		$prod[12]=$prod[12]."<TR><TD colspan=2 bgcolor=$indexcolor width=40%>総消費メリットポイント</TD><TD bgcolor=$profcolor>$mptotal</TD></TR>";
	}



} else {
	 ($no,$name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$match);
}



&dirlock;
if(!open(IN,"$datafile")){&error_message('datafile error612i','data file access failed.');}
@all=<IN>;
close IN;


@out=();
foreach $i(@all){
		 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
	if($r_name eq $name && $pass eq $r_pass){
		$pastdat=$i;
		$newdat="$r_no\t$name\t$pass\t$anon\t$race\t$relm\t$mainjob\t$supportjob\t$prof\t$handle\t$polhn\t$mail\t$home\t$comment2\t$point\t$class\t$timenow\t$comment\t$mrank\t$etc[0]\t$etc[1]\t$etc[2]\t$prod[0]\t$prod[1]\t$prod[2]\t$prod[3]\t$prod[4]\t$prod[5]\t$prod[6]\t$prod[7]\t$prod[8]\t$prod[9]\t$prod[10]\t$prod[11]\t$prod[12]\t$prod[13]\t$prod[14]\t$prod[15]\t$lev[0]\t$lev[1]\t$lev[2]\t$lev[3]\t$lev[4]\t$lev[5]\t$lev[6]\t$lev[7]\t$lev[8]\t$lev[9]\t$lev[10]\t$lev[11]\t$lev[12]\t$lev[13]\t$lev[14]\t$lev[15]\t$lev[16]\t$lev[17]\t$lev[18]\t$lev[19]\t\n";
		push(@out,$newdat);
	} else {
		push(@out,$i);
	}
}

		if(!open(OUT,">$datafile")){&header; &error_message('datafile error627i','data file access failed.');}
		print OUT @out;
		close OUT;
rmdir($lockdir);


#RSS用履歴ファイル作成

&compare_history;


$historybase="PROFED\t$name\t$name profile modify\t$rsstime\t$no\t$message\t$rh\t$addr\t\n";
&add_history;

print "個人データ更新終了";
print "<HR><a href=$script?ktai=on&$salt>ListTop</a>";



}





sub login_i {

	if(!open(IN,"$datafile")){&header; &error_message('datafile error/system','data file access failed.');}
	@all=<IN>;
	close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name && $pass eq $r_pass){
				$match=$i;
		}
	}
	if($match eq ""){&header; &error_message('id/pass error','access failed.');}


	if($function eq "mission"){
		&mission_i;
	} elsif ($mode eq "login"){
		&login_enter_i;
	} elsif($mode eq "mission"){
		&keitai_mission_menu;
	} elsif($mode eq "mpoint"){
		&keitai_mpoint_menu;
	} elsif($mode eq "menu"){
		&keitai_menu;
	} elsif($mode eq "modify"){
		&keitai_modify;
	} else {
		&login_enter_i;
	}

}


sub login_enter_i{

print "<a href=$script?ktai=on>MemberList Top</a><BR>";
print "No. $no : '$name' LoginMenu<BR>";
print "登録データ修正";
#prof
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='m_prof'><input type=hidden name=mode value=menu><input type=submit value=profile></form>";
#levelf
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='m_level'><input type=hidden name=mode value=menu><input type=submit value=level></form>";
#skill
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=all value='m_skill'><input type=hidden name=mode value=menu><input type=submit value=skill></form>";
#mpoint
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=mode value=mpoint><input type=submit value=meritpoint></form>";
#mission
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=mode value=mission><input type=submit value=mission></form>";
#custom
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='$button[0]'><input type=hidden name=mode value=menu><input type=hidden name=all value='custom'><input type=submit value=custom></form>";
#message
if($mes_avail){
#新規メッセージチェック
	print "<HR> メッセージ";
	if (-e "$mesdir$name.cgi") {
		if(!open(IN,"$mesdir$name.cgi")){&error_message('datafile error490','data file access failed.');}
		@mes=<IN>;
		close IN;
		$k=0;
		for $i(@mes){
			($j,$dummy)=split(/\t/,$i);
			$k=$k+$j;
		}
		if($k>0){print "<BR><font color=red><B>$k 件の新しいメッセージがあります。</B></font>";}
	}
print "<form method=$method action=$script><input type=hidden name=ktai value='on'><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value='check'><input type=submit value=check></form>";
} 
print "<HR>日記を書く";
print "<form method=$method action=$script><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=ktai value=on><input type=hidden name=function value=$button[1]><input type=submit value='日記入力'><BR></form>";

}

sub write_diary_i{

$diaryfile="$diarydir$name.$diaryletter";

	if(!open(IN,"$datafile")){&header; &error_message('datafile error2249','data file access failed.');}
	@all=<IN>;
	close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name && $pass eq $r_pass){
				$match=$i;
		}
	}
	if($match eq ""){&header; &error_message('id/pass error','access failed.');}

	if ($mode eq "write"){

	if($body eq ""){&header;&error_message('本文がありません','');}

if (!open(DB,"$diaryfile")) { @lines=(); }
@lines = <DB>;
close(DB);

($maxno,$dummy1,$dummy2,$dummy3)=split(/\t/,$lines[0]);
$maxno++;
#あげ対策
$maxno=time();


$fnt="";
if($imgexist){$fnt="$name$maxno.$fileexst";}
@lines=reverse(@lines);
push(@lines,"$maxno\t$today2\t$title\t$body\t$fnt\t\t\n");
@lines=reverse(@lines);

@out=();
$count=0;
foreach $i(@lines){
if($count<$diarymax){
push(@out,$i);
$count++;
}



}
if (!open(OUT,">$diaryfile")) {&header; &error_message('filesystem error','access failed.');}
print OUT @out;
close(OUT);

if(!open(IN,"$datafile")){&error_message('datafile error2315','data file access failed.');}
@all=<IN>;
close IN;

@out=();
foreach $i(@all){
	 ($no,$r_name,$pass,$anon,$race,$relm,$mainjob,$supportjob,$prof,$handle,$polhn,$mail,$home,$comment2,$point,$class,$time,$comment,$mrank,$etc[0],$etc[1],$etc[2],$prod[0],$prod[1],$prod[2],$prod[3],$prod[4],$prod[5],$prod[6],$prod[7],$prod[8],$prod[9],$prod[10],$prod[11],$prod[12],$prod[13],$prod[14],$prod[15],$lev[0],$lev[1],$lev[2],$lev[3],$lev[4],$lev[5],$lev[6],$lev[7],$lev[8],$lev[9],$lev[10],$lev[11],$lev[12],$lev[13],$lev[14],$lev[15],$lev[16],$lev[17],$lev[18],$lev[19])=split(/\t/,$i);
	if($r_name eq $name){
		push(@out,"$no\t$r_name\t$pass\t$anon\t$race\t$relm\t$mainjob\t$supportjob\t$prof\t$handle\t$polhn\t$mail\t$home\t$comment2\t$point\t$class\t$timenow\t$comment\t$mrank\t$etc[0]\t$etc[1]\t$etc[2]\t$prod[0]\t$prod[1]\t$prod[2]\t$prod[3]\t$prod[4]\t$prod[5]\t$prod[6]\t$prod[7]\t$prod[8]\t$prod[9]\t$prod[10]\t$prod[11]\t$prod[12]\t$prod[13]\t$prod[14]\t$prod[15]\t$lev[0]\t$lev[1]\t$lev[2]\t$lev[3]\t$lev[4]\t$lev[5]\t$lev[6]\t$lev[7]\t$lev[8]\t$lev[9]\t$lev[10]\t$lev[11]\t$lev[12]\t$lev[13]\t$lev[14]\t$lev[15]\t$lev[16]\t$lev[17]\t$lev[18]\t$lev[19]\t\n");
	} else {
		push(@out,$i);
	}
}

		if(!open(OUT,">$datafile")){&header; &error_message('datafile error2329','data file access failed.');}
		print OUT @out;
		close OUT;


#RSS用履歴ファイル作成
$historybase="DWRITE\t$name\t$title\t$rsstime\t$maxno\t$body\t$rh\t$addr\t\n";
&add_history;



	print "日記を書き込みました。<BR>";
print "<HR><a href=$script?ktai=on&$salt>ListTop</a>";

} else {
print "新規日記<BR>";

print "<form method=$method action=$script><input type=hidden name=name value=$name><input type=hidden name=pass value=$pass><input type=hidden name=function value=$button[1]><input type=hidden name=ktai value=on><input type=hidden name=mode value=write>\ntitle<BR><input type=text name=title size=80 value='$today2'><BR>body<BR><textarea name=body cols=80 rows=10></textarea><BR>";
print"<input type=submit value=write></form>";
}


}


sub send_message_i{

	if(!open(IN,"$datafile")){&error_message('datafile error/system','data file access failed.');}
	@all=<IN>;
	close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name && $pass eq $r_pass){
				$match=$i;
		}
	}
	if($match eq ""){&header; &error_message('id/pass error','access failed.');}


if($mode eq "submit"){


if($language ne "English"){
	if($body eq ""){&error_message('本文がありません','');}
	if($name eq ""){&error_message('名前がありません','');}
} else {
	if($body eq ""){&error_message('no text','');}
	if($name eq ""){&error_message('no name','');}
}

#未読flag sender title body time

$message="1\t$name\t$title\t$body\t$timenow\t\n";

	if(!open(IN,"$datafile")){&error_message('datafile error/system','data file access failed.');}
	@all=<IN>;
	close IN;

	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name2){
				$match=$i;
		}
	}
	if($match eq ""){&error_message('送信先が存在しません。','access failed.');}


if(!open(OUT,">>$mesdir$name2.cgi")){&error_message('datafile error1872','data file access failed.');}
print OUT $message;
close OUT;

print <<"EOM";
メッセージを送信しました。<BR>
<a href=$script?ktai=on>MemberList Top</a><BR>
<form method=post action=$script>
<input type=hidden name=function value=check>
<input type=hidden name=name value='$name'>
<input type=hidden name=pass value='$pass'>
<input type=hidden name=ktai value='on'>
<input type=submit value='戻る'>
</form>
EOM

} else {

print "$name message send";
print "<a href=$script?ktai=on>MemberList Top</a><BR>";

#mode eq replyの場合は

if($mode eq "reply"){
	$title="Re: $title";
	$body="> $body";
	$body=~ s/<BR>/\n> /g;
}

print <<"EOM";
send message from '$name' to '$name2'<HR>
<form method=post action=$script>
title :<BR>
<input type=text name=title value='$title'><BR>
message<BR>
<textarea name=body cols=80 rows=5>$body</textarea>
<input type=hidden name=function value=send>
<input type=hidden name=mode value=submit>
<input type=hidden name=name value='$name'>
<input type=hidden name=name2 value='$name2'>
<input type=hidden name=pass value='$pass'>
<input type=hidden name=ktai value='on'>
<input type=submit value='send'>
</form>

EOM
}


}

sub check_message_i{

	
	if(!open(IN,"$datafile")){&error_message('datafile error/system','data file access failed.');}
	@all=<IN>;
	close IN;


	$match="";
	foreach $i(@all){
			 ($r_no,$r_name,$r_pass,$r_dummy)=split(/\t/,$i);
		if($r_name eq $name && $pass eq $r_pass){
				$match=$i;
		}
	}
	if($match eq ""){&error_message('id/pass error','access failed.');}

	if(!open(IN,"$mesdir$name.cgi")){&error_message('メッセージはありません。','');}
	@mes=<IN>;
	close IN;

	if($mode eq "read"){

print "$name check message:";
print "<a href=$script?ktai=on>MemberList Top</a><BR>";

	$count=0;
	@outmes=();
	foreach $i(@mes){
		print "<form method=post action=$script>";
		($read,$from,$title,$body,$time)=split(/\t/,$i);
		if($count == $no){
			print "Title:$title<BR>";
			print "From:$from<BR>";
			print "Time:$time<BR>";
			print "Message:<BR>$body<BR>";
			$body2=$body;
			$body2=~ s/<BR>/\n/g;
			$body2=~ s/"/&quot;/g;

		print <<"EOM";
<HR>
<form method=post action=$script>
<input type=hidden name=title value='$title'>
<input type=hidden name=name value='$name'>
<input type=hidden name=name2 value='$from'>
<input type=hidden name=pass value='$pass'>
<input type=hidden name=function value='check'>
<input type=hidden name=no value='$count'>
<input type=hidden name=ktai value='on'>
<input type=submit name=mode value='delete'>
<input type=submit name=mode value='reply'><input type=submit name=mode value='back'></form>
EOM


		if($read ==1){
			$message="0\t$name(open)\t開封確認メッセージ\tこのメッセージは$timenowに開封されました。<BR>Title:$title<BR>Message:<BR>$body\t$timenow\t\n";
			if(!open(OUT,">>$mesdir$from.cgi")){&error_message('datafile error3354','data file access failed.');}
			print OUT $message;
			close OUT;
			$read=0;
		}


		}

		
		push(@outmes,"$read\t$from\t$title\t$body\t$time\t\n");
		$count++;
	}
		if(!open(OUT,">$mesdir$name.cgi")){&error_message('datafile error3316','data file access failed.');}
		print OUT @outmes;
		close OUT;


	} elsif($mode eq "reply"){
	
	&send_message_i;

	} else {



print "$name message check:<BR>";
print "<a href=$script?ktai=on>MemberList Top</a><BR>";

#新規メッセージチェック
	print "<BR>";
	if (-e "$mesdir$name.cgi") {
		if(!open(IN,"$mesdir$name.cgi")){&error_message('datafile error490','data file access failed.');}
		@mes=<IN>;
		close IN;
		$k=0;
		for $i(@mes){
			($j,$dummy)=split(/\t/,$i);
			$k=$k+$j;
		}
		if($k>0){print "<font color=red><B>$k 件の新しいメッセージがあります。</B></font>";}
	}

	if($mode eq "delete"){
	$count=0;
	@outmes=();
	foreach $i(@mes){
		print "<form method=post action=$script>";
		($read,$from,$title,$body,$time)=split(/\t/,$i);
		if($count != $no){push(@outmes,"$read\t$from\t$title\t$body\t$time\t\n");}
		$count++;
	}
	if(!open(OUT,">$mesdir$name.cgi")){&error_message('datafile error3316','data file access failed.');}
	print OUT @outmes;
	close OUT;
	@mes=@outmes;

	print "メッセージを1件削除しました。<BR>";
	}
	

	@mes=reverse(@mes);

	$count=$#mes;
	foreach $i(@mes){
		print "<form method=post action=$script>";
		($read,$from,$title,$body,$time)=split(/\t/,$i);
		if($read){
			print "未読:$title from $from on $time";
		} else {print "既読:$title from $from on $time";}
		print <<"EOM";
<input type=hidden name=name value='$name'>
<input type=hidden name=pass value='$pass'>
<input type=hidden name=function value='check'>
<input type=hidden name=mode value='read'>
<input type=hidden name=no value='$count'>
<input type=hidden name=ktai value='on'>
<input type=submit value='read'></form><HR>
EOM
	$count--;
	}
	}

}

sub history_i{

#履歴表示
if(!open(IN,"$historyfile")){&header; &error_message('datafile error2449','data file access failed.');}
@list=<IN>;
close IN;

@list=reverse(@list);

$items="";
$item="";
$count=0;
print "最近の更新20件<BR><BR>\n";
foreach $i(@list){
	($dummy,$rname,$rtitle,$rtime,$rmaxno,$rbody)=split(/\t/,$i);
	$rbody =~ s/&/&amp;/g;
	$rbody =~ s/"/&quot;/g;
	$rbody =~ s/'/&apos;/g;
	$rbody =~ s/&amp;sbquo;/&sbquo;/g;
	$rbody =~ s/&amp;lt;/&lt;/g;
	$rbody =~ s/&amp;gt;/&gt;/g;
	$rtime =~ s/T/ /g;
	$rtime =~ s/\+09:00//g;


if($dummy eq "DWRITE"){
	$rstitle="$rtitle : $rname さんの日記[$rmaxno]更新";
	$rsource="$rname/diary/$rmaxno";
	$link="$script?function=diary&amp;name=$rname&amp;mode=$rmaxno";
}
if($dummy eq "NEWREG"){
	$rstitle="$rtitle : $rname さん[$rmaxno]新規登録";
	$rsource="$rname/newreg/$rmaxno";
	$link="$script?function=prof&amp;name=$rname";
	$rbody="新規登録";
}
if($dummy eq "DMODIF"){
	$rstitle="$rtitle : $rname さんの日記[$rmaxno]修正";
	$rsource="$rname/dmodif/$rmaxno";
	$link="$script?function=diary&amp;name=$rname&amp;mode=$rmaxno&amp;mod";
	$rbody="日記修正";
}
if($dummy eq "PROFED"){
	$rstitle="$rname さんプロフィール変更";
	$rsource="$rname/profed/$rmaxno";
	$link="$script?function=prof&amp;name=$rname";
	$rbody =~ s/\//<BR>\n/g;
}
if($dummy eq "MERIED"){
	$rstitle="$rname さんメリットポイント 変更";
	$rsource="$rname/profed/$rmaxno";
	$link="$script?function=prof&amp;name=$rname";
	$rbody =~ s/\//<BR>\n/g;
#	$rbody = "メリットポイントに変更がありました。";
}
if($dummy eq "CUSTED"){
	$rstitle="$rname さん$custom_field[0] 変更";
	$rsource="$rname/profed/$rmaxno";
	$link="$script?function=prof&amp;name=$rname";
	$rbody =~ s/\//<BR>\n/g;
#	$rbody = "$custom_field[0]変更";
}
if($dummy eq "DERASE"){
	$rstitle="$rname さんの日記[$rmaxno]が削除";
	$rsource="$rname/derase/$rmaxno";
	$link="$script?function=prof&amp;name=$rname&amp;del";
	$rbody="deleted";
}

if($dummy eq "RESDIA"){
	($n1,$n2)=split(/ /,$rname);
	$rstitle="$n2 さんの日記[$rmaxno]に$n1さんがレス";
	$rsource="$n1$n2$rtitle/resdia/$rmaxno";
	$link="$script?function=diary&amp;name=$n2&amp;mode=$rmaxno&amp;$rtitle";
}

	@rbodylines = split(/<BR>/,$rbody);
	if ($#rbodylines > 8)
	{
		$rbody = join("<BR>", @rbodylines[0..5])."(and more)";
	}

if($count<20){
print "<a href='$link&ktai=on'>■</a>$rstitle($rtime)<BR>\n";
}
$count++;

}

print "<BR><a href='$script?ktai=on'>List Top</a>\n";

}



sub list_mpoint_i{


#各カテゴリのmax
@m_categorymax=(
'8','5','20','16','8','10','10','10','10','10','10','10','10','10','10','10','10','10','10','10','10','10','10','6','6','6','6','6','6','6','6','6','6','6','6','6','6','6','6','6','6',);


if($language ne "English"){

#カテゴリリスト
@m_categoryname=('HP/MP','ステータス','戦闘スキル','魔法スキル','その他の能力','戦士１','モンク１','白魔道士１','黒魔道士１','赤魔道士１','シーフ１','ナイト１','暗黒騎士１','獣使い１','吟遊詩人１','狩人１','侍１','忍者１','竜騎士１','召喚士１','青魔道士１','コルセア１','からくり士１','戦士２','モンク２','白魔道士２','黒魔道士２','赤魔道士２','シーフ２','ナイト２','暗黒騎士２','獣使い２','吟遊詩人２','狩人２','侍２','忍者２','竜騎士２','召喚士２','青魔道士２','コルセア２','からくり士２',);

#各項目名称
@m_name=(
'HP','MP','STR','DEX','VIT','AGI','INT','MND','CHR','格闘','短剣','片手剣','両手剣','片手斧','両手斧','両手鎌','両手槍','片手刀','両手刀','片手棍','両手棍','弓術','射撃','投てき','ガード','回避','盾','受け流し','神聖魔法','回復魔法','強化魔法','弱体魔法','精霊魔法','暗黒魔法','歌唱','弦楽器','管楽器','忍術','召喚魔法','青魔法','敵対心＋','敵対心－','クリティカルヒット率','被クリティカルヒット率','詠唱中断率','バーサク使用間隔','ディフェンダー使用間隔','ウォークライ使用間隔','アグレッサー使用間隔','ダブルアタック確率','集中使用間隔','回避使用間隔','チャクラ使用間隔','カウンター確率','蹴撃確率','女神の印使用間隔','ケアル詠唱時間','属性耐性魔法効果','バニシュ効果','リジェネ効果','精霊の印使用間隔','火属性魔法攻撃力','氷属性魔法攻撃力','風属性魔法攻撃力','土属性魔法攻撃力','雷属性魔法攻撃力','水属性魔法攻撃力','コンバート使用間隔','火属性魔法命中率','氷属性魔法命中率','風属性魔法命中率','土属性魔法命中率','雷属性魔法命中率','水属性魔法命中率','とんずら使用間隔','かくれる使用間隔','不意打ち使用間隔','だまし討ち使用間隔','トリプルアタック確率','シールドバッシュ使用間隔','ホーリーサークル使用間隔','センチネル使用間隔','かばう効果時間','ランパート使用間隔','暗黒使用間隔','アルケインサークル使用間隔','ラストリゾート使用間隔','ラストリゾート効果','ウェポンバッシュ使用間隔','キラー確率','いたわる使用間隔','よびだす使用間隔','ほんきだせ使用間隔','なだめる使用間隔','ララバイ使用間隔','フィナーレ使用間隔','ミンネ効果','メヌエット効果','マドリガル効果','スカベンジ使用間隔','カモフラージュ使用間隔','狙い撃ち使用間隔','エンドレスショット使用間隔','ラピッドショット確率','心眼使用間隔','護摩の守護円使用間隔','ストアTP効果','黙想使用間隔','残心確率','モクシャ効果','火遁の術効果','氷遁の術効果','風遁の術効果','土遁の術効果','雷遁の術効果','水遁の術効果','エンシェントサークル使用間隔','ジャンプ使用間隔','ハイジャンプ使用間隔','スーパージャンプ使用間隔','スピリットリンク使用間隔','召喚獣物理命中率','召喚獣物理攻撃力','召喚獣魔法命中率','召喚獣魔法攻撃力','精霊維持費－','ブルーチェーン使用間隔','ブルーバースト使用間隔','モンスター相関関係効果','物理系青魔法攻撃力','魔法系青魔法命中率','ファントムロール使用間隔','クイックドロー使用間隔','クイックドロー命中率','ランダムディール使用間隔','Bust時間短縮','オートマトン白兵戦スキル','オートマトン射撃戦スキル','オートマトン魔法戦スキル','アクティベート使用間隔','リペアー使用間隔','ウォリアーチャージ','トマホーク','サベッジリ','アグレシブエイム','マントラ','無想無念','錬気','発剄','マーター','デヴォーション','プロテアV','シェルラV','フレアII','フリーズII','トルネドII','クエイクII','バーストII','フラッドII','ディアIII','スロウII','パライズII','ファランクスII','バイオIII','ブラインII','アサシンチャージ','フェイント','オーラスティール','アンブッシュ','フィールティ','シバルリー','アイアンウィル','ガーディアン','ダークシール','ディアボリクアイ','ミューテッドソウル','デスペレートブロー','フェラルハウル','K.インスティンクト','ビーストアフニティ','ビーストヒーラー','ナイチンゲール','トルバドゥール','魔物のシルベント','冒険者のダージュ','ステルスショット','フラッシーショット','スナップショット','リサイクル','士気高揚','峰打ち','意気衝天','正正堂堂','散華','忍具の知識','火遁の術:参','氷遁の術:参','風遁の術:参','土遁の術:参','雷遁の術:参','水遁の術:参','ディープブリージング','アンゴン','エンパシー','ストレイフ','メテオストライク','ヘヴンリーストライク','ウィンドブレード','ジオクラッシュ','サンダーストーム','グランドフォール','コンバージェンス','ディフュージョン','エンチェーンメント','アシミレーション','スネークアイ','フォールド','ウィニングストリーク','ローデッドデッキ','黒衣チェンジ','腹話術','微調整','最適化');
} else {

@m_categoryname=('HP/MP','Attributes','CombatSkills','MagicSkills','OtherSkills','Warrior1','Monk1','WhiteMage1','BlackMage1','RedMage1','Thief1','Paladin1','DarkKnight1','Beastmaster1','Bard1','Ranger1','Samurai1','Ninja1','Dragoon1','Summoner1','BlueMage1','Corsair1','Puppetmaster1','Warrior2','Monk2','WhiteMage2','BlackMage2','RedMage2','Thief2','Paladin2','DarkKnight2','BeastMaster2','Bard2','Ranger2','Samurai2','Ninja2','Dragoon2','Summoner2','BlueMage2','Corsair2','Puppetmaster2',);

@m_name=('HP','MP','STR','DEX','VIT','AGI','INT','MND','CHR','Hand-to-Hand','Dagger','Sword','GreatSword','Axe','GreatAxe','Scythe','Polearm','Katana','GreatKatana','Club','Staff','Archery','Marksmanship','Throwing','Guarding','Evasion','Shield','Parrying','DivineMagic','HealingMagic','EnhancingMagic','EnfeeblingMagic','ElementalMagic','DarkMagic','Singing','StringInstrument','WindInstrument','Ninjutsu','Summoning','BlueMagic','EnmityIncrease','EnmitiyDecrease','CriticalHitRate','EnemyCriticalHitRate','SpellInterruptionRate','Berserk Recast','Defender Recast','Warcry Recast','Aggressor Recast','Double Attack Rate','Focus Recast','Dodge Recast','Chakra Recast','Counter Rate','Kick Attack Rate ','Divine Seal Recast','Cure Cast Time','Bar Spell Effect','Banish Effect','Regen Effect','Elemental Seal Recast','Fire Magic Potency','Ice Magic Potency','Wind Magic Potency','Earth Magic Potency','Lightning Magic Potency','Water Magic Potency ','Convert Recast','Fire Magic Accuracy','Ice Magic Accuracy','Wind Magic Accuracy','Earth Magic Accuracy','Lightning Magic Accuracy','Water Magic Accuracy','Flee Recast','Hide Recast','Sneak Attack Recast','Trick Attack Recast','Triple Attack Rate ','Shield Bash Recast','Holy Circle Recast','Sentinel Recast','Cover Effect Length','Rampart Recast','Souleater Recast','Arcane Circle Recast','Last Resort Recast','Last Resort Effect','Weapon Bash Recast ','Killer Effects','Reward Recast','Call Beast Recast','Sic Recast','Tame Recast','Lullaby Recast','Finale Recast','Minne Effect','Minuet Effect','Madrigal Effect ','Scavenge Recast','Camouflage Recast','Sharpshot Recast','Unlimited Shot Recast','Rapid Shot Rate','Third Eye Recast','Warding Circle Recast','Store TP Effect','Meditate Recast','Zanshin Attack Rate ','Subtle Blow Effect','Katon Effect','Hyoton Effect','Huton Effect','Doton Effect','Raiton Effect','Suiton Effect','Ancient Circle Recast','Jump Recast','High Jump Recast','Super Jump Recast','Spirit Link Recast ','Avatar Physical Accuracy','Avatar Physical Attack','Avatar Magical Accuracy','Avatar Magical Attack','Elemental MP Cost ','Chain Affinity Recast','Burst Affinity Recast','Monster Correlation','Physical Potency','Magical Accuracy','Phantom Roll Recast','Quick Draw Recast','Quick Draw Accuracy','Random Deal Recast','Bust Duration','Automaton Melee Skill','Automaton Ranged Skill','Automaton Magic Skill','Activate Recast','Repair Recast',"Warriors Charge",'Tomahawk','Savagery','Aggressive Aim','Mantra','Formless Strikes','Invigorate','Penance ','Martyr','Devotion','Protectra V','Shellra V','Flare II','Freeze II','Tornado II','Quake II','Burst II ','Flood II ','Dia III','Slow II','Paralyze II','Phalanx II','Bio III','Blind II',"Assassins Charge",'Feint','Aura Steal','Ambush','Fealty','Chivalry','Iron Will','Guardian','Dark Seal','Diabolic Eye','Muted Soul','Desperate Blows','Feral Howl','Killer Instinct','Beast Affinity ','Beast Healer','Nightingale','Troubadour','Foe Sirvente',"Adventurers Dirge",'Stealth Shot','Flashy Shot','Snapshot','Recycle','Shikikoyo','Blade Bash','Ikishoten','Overwhelm','Katon: San','Hyoton: San','Huton: San','Doton: San','Raiton: San','Suiton: San','Sange','Ninja Tool Expertise','Deep Breathing','Angon','Empathy','Strafe','Meteor Strike','Heavenly Strike','Wind Blade','Geocrush','Thunderstorm','Grand Fall','BLU1','BLU2','BLU3','BLU4','COR1','COR2','COR3','COR4','PUP1','PUP2','PUP3','PUP4');
}




#各項目のカテゴリコード
@m_categorycode=(
'0','0','1','1','1','1','1','1','1','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','2','3','3','3','3','3','3','3','3','3','3','3','3','4','4','4','4','4','5','5','5','5','5','6','6','6','6','6','7','7','7','7','7','8','8','8','8','8','8','8','9','9','9','9','9','9','9','10','10','10','10','10','11','11','11','11','11','12','12','12','12','12','13','13','13','13','13','14','14','14','14','14','15','15','15','15','15','16','16','16','16','16','17','17','17','17','17','17','17','18','18','18','18','18','19','19','19','19','19','20','20','20','20','20','21','21','21','21','21','22','22','22','22','22','23','23','23','23','24','24','24','24','25','25','25','25','26','26','26','26','26','26','27','27','27','27','27','27','28','28','28','28','29','29','29','29','30','30','30','30','31','31','31','31','32','32','32','32','33','33','33','33','34','34','34','34','35','35','35','35','35','35','35','35','36','36','36','36','37','37','37','37','37','37','38','38','38','38','39','39','39','39','40','40','40','40',);

#各項目のMAX値
@m_max=(
'8','8','5','5','5','5','5','5','5','8','8','8','8','8','8','8','8','8','8','8','8','8','8','8','4','4','4','4','8','8','8','8','8','8','8','8','8','8','8','8','4','4','4','4','4','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','5','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3','3',);


#各カテゴリの必要ポイント
@m_needpoint=(
'12345555','12345555','36999','36999','36999','36999','36999','36999','36999','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','1233','1233','1233','1233','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','12333333','1234','1234','1234','1234','1234','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','12345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345','345');

#表示制限ジョブコード
@m_jobcode=(
'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','1','1','1','1','1','2','2','2','2','2','3','3','3','3','3','3','3','4','4','4','4','4','4','4','5','5','5','5','5','6','6','6','6','6','7','7','7','7','7','10','10','10','10','10','9','9','9','9','9','8','8','8','8','8','14','14','14','14','14','13','13','13','13','13','13','13','11','11','11','11','11','12','12','12','12','12','15','15','15','15','15','16','16','16','16','16','17','17','17','17','17','0','0','0','0','1','1','1','1','2','2','2','2','3','3','3','3','3','3','4','4','4','4','4','4','5','5','5','5','6','6','6','6','7','7','7','7','10','10','10','10','9','9','9','9','8','8','8','8','14','14','14','14','13','13','13','13','13','13','13','13','11','11','11','11','12','12','12','12','12','12','15','15','15','15','16','16','16','16','17','17','17','17');

}





1;

