# GMR table sub routine
# ver 0.717(10/09/19)
#
#table_job :ジョブ表示
#table_prod：合成スキル表示
#table_stat:ステータス表示
#table_limit:シンプル表示
#table_limit2:アイコン表示
#table_full2:フル表示
#table_full3:フル２表示
#table_mission:ミッション進行度表示
#table_assault:アサルト表示
#table_history:履歴表示
#table_custom;カスタムフィールド表示
#table_weaponskill;WS習得一覧
#table_usable_ws;利用可能WS一覧
#table_synergy;練成一覧
#table_jade;ジェイド一覧（禁断
#table_atma;アートマ一覧（禁断
#table_sjade;ジェイド一覧（死闘
#table_satma;アートマ一覧（死闘
#table_mmm9;MMM警備課調練室実績一覧


sub table_synergy{
	print "<table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
	print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r&function=-1'>練成</a></TH>\n";
	for ($j=0;$j<=$#synergytech;$j++){
		print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r&function=$j'>$synergytech[$j]</a></TH>";
	}
	print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
	
	$count=0;
	
	$number=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);
		@prod_r = split(/,/,$etc[1]);
		($syn,@synt) = split( /,/, $prod[9]);
		if($class_edit==0){
			$class =~ s/&lt;/</g;
			$class =~ s/&gt;/>/g;
		}
		
		
		if($count==$c_max){
			print "</table><table cellpading=0 width=100% class=tbl><TR bgcolor=$indexcolor><TH width=2%>$index[0]</TH><TH width=8%><a href='$script?limit=$limit&level=$level&sort=15&mode=r'>$index[1]</a></TH><TH width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>";
			print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r'>練成</a></TH>\n";
			for ($j=0;$j<=$#synergytech;$j++){
				print "<TH width=2%><a href='$script?limit=$limit&level=$level&sort=31&mode=r'>$synergytech[$j]</a></TH>";
			}
			print "<TH width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>";
			$count=0;
		}
		
		
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		
		
		$bgn="";
		
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		
		print "<TR$bgn><TD align=center>$no</TD><TD align=center>$class</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>\n";
		
		$temprank = sprintf( "%d", $syn / 10 );
		$bg=" bgcolor=$color[$temprank]";
		print "<TD$bg align=center title='$ranklist[$temprank]'>$syn<BR>($ranklist[$temprank])</TD>\n";
		
		if(($anon ne "on") || ($anon_mode != 1 )){
			for ($j=0;$j<=$#synergytech;$j++){
				$bg=" bgcolor=$color[$synt[$j]]";
				print "<TD$bg align=center title='$synt[$j]'>$synt[$j]</TD>\n";
			}
		} else {
			for ($j=0;$j<=$#synergytech;$j++){
				print"<TD align=center>-</TD>";
			}
		}
		
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		
		$count++;
		$number++;
		
	}
	print "</table>";
}

#table_jade;ジェイド一覧
#table_atma;アートマ一覧
#table_mmm9;MMM警備課調練室実績一覧

sub table_jade {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=0;$i<=$#abyssname;$i++){
		@templist = @{$jadelist[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=1% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=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);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[23]);
		@atmas = split(/\//,$mission[24]);
		@mmm9cs = split( /\//,$mission[25]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=0; $j<=$#abyssname; $j++ ){
			@jade = split( //, $jades[$j] );
			for ( $k=0; $k<=$#{$jadelist[$j]}; $k++ ){
				print "<TD align=center>$maru[ $jade[$k] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}


sub table_atma {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=1;$i<=$#abyssname;$i++){
		@templist = @{$atmalist[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=2% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=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);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[23]);
		@atmas = split(/\//,$mission[24]);
		@mmm9cs = split( /\//,$mission[25]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=1; $j<=$#abyssname; $j++ ){
			@atma = split( //, $atmas[$j] );
			for ( $k=0; $k<=$#{$atmalist[$j]}; $k++ ){
				print "<TD align=center>$maru[ $atma[ $k ] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}

sub table_sjade {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=0;$i<=$#abyssname2;$i++){
		@templist = @{$jadelist2[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname2[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=1% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=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);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[26]);
		@atmas = split(/\//,$mission[27]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=0; $j<=$#abyssname2; $j++ ){
			@jade = split( //, $jades[$j] );
			for ( $k=0; $k<=$#{$jadelist2[$j]}; $k++ ){
				print "<TD align=center>$maru[ $jade[$k] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}


sub table_satma {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=1;$i<=$#abyssname2;$i++){
		@templist = @{$atmalist2[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$str1 .= "<TH colspan=$itemnum>$abyssname2[$i]</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=2% style=\"writing-mode: tb-rl; word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=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);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[26]);
		@atmas = split(/\//,$mission[27]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=1; $j<=$#abyssname2; $j++ ){
			@atma = split( //, $atmas[$j] );
			for ( $k=0; $k<=$#{$atmalist2[$j]}; $k++ ){
				print "<TD align=center>$maru[ $atma[ $k ] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}

sub table_mmm9 {
	$str2 = "<TR bgcolor=$indexcolor>";
	$str1 = <<"EOM";
<table cellpading=0 width=100% class=tbl>
<TR bgcolor=$indexcolor>
<TH rowspan=2 width=2%>$index[0]</TH>
<TH rowspan=2 width=10%><a href='$script?limit=$limit&level=$level&sort=1'>$index[2]</a></TH>
EOM
	for($i=0;$i<=$#mmm9list;$i++){
		@templist = @{$mmm9list[$i]};
		$itemnum = $#templist+1;
		$listlength[$j] = $#templist;
		$step = $i+1;
		$str1 .= "<TH colspan=$itemnum>Step $step</TH>\n";
		for( $k=0; $k<$itemnum; $k++ ){
			$str2 .= "<TH valign=bottom width=7% style=\"word-break:break-all\">$templist[$k]</TH>";
		}
	}
	$str1 .= "<TH rowspan=2 width=5%><a href='$script?limit=$limit&level=$level&sort=16&mode=r'>$index[8]</a></TH></TR>\n";
	$str2 .= "</TR>\n";
	print "$str1\n$str2\n";
	
	$count=0;
	$number=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);
		@elist = split(/\,/, $prod[15]);
		
		@mission = split(/,/,$prod[15]);
		@jades = split(/\//,$mission[23]);
		@atmas = split(/\//,$mission[24]);
		@mmm9cs = split( /\//,$mission[25]);
		
		if($count==$c_max){
			print "</table>\n$str1\n$str2\n";
			$count = 0;
		}
		
		$bgn="";
		$diary="";
		$diaryfile="$diarydir$name.$diaryletter";
		if(-e "$diaryfile"){
			$diary="<a href='$script?function=prof&name=$name'><img src='$diarygif' border=0>";
			if((-M $diaryfile)<1){
				$diary.="<img src='$upgif' border=0>";
			}
			$diary.="</a>";
		}
		if($name eq $c_name){$bgn=" bgcolor=$mydata";} else {$bgn=" bgcolor=$otherdata";}
		if($class eq ""){$class="&nbsp";}
		print "<TR$bgn><TD align=center>$no</TD><TD><a href='$script?function=profdetail&name=$name'>$name</a>$diary</TD>";
		
		for( $j=0; $j<=$#mmm9list; $j++ ){
			@mmm9c = split( //, $mmm9cs[$j] );
			for ( $k=0; $k<=$#{$mmm9list[$j]}; $k++ ){
				print "<TD align=center>$maru[ $mmm9c[ $k ] ]</TD>\n";
			}
		}
		$date=substr($time,0,8)."<br>".substr($time,9,2).":".substr($time,11,2);
		print "<TD align=center>$date</TD></TR>\n";
		$count++;
		$number++;
	}
	print "</table>\n";
		
}




# return 1 to require
1;