<!DOCTYPE html>
<html lang="en">
<body>
<?php
	$DropCFG = loadConfig('droplist');
	if(!is_array($DropCFG)) throw new Exception('DropList esta vacio.');

	loadModuleConfigs('droplist');

	$showSkill 		= mconfig('skill') ? true : false;
	$showLuck 		= mconfig('luck') ? true : false;
	$showAddo 		= mconfig('addo') ? true : false;
	$showExcelent 	= mconfig('excelent') ? true : false;
	$showAncient 	= mconfig('ancient') ? true : false;
	$showSocket 	= mconfig('socket') ? true : false;
	$showOp380 		= mconfig('op380') ? true : false;

	echo '<div class="alert alert-info" role="alert">
			<h3 style="text-align:center;"><i class="fas fa-info-circle"></i> Informacion</h3>
			<hr>
			<p><b>Nivel</b>: Es del nivel minimo a maximo en el cual el item puede caer.<br>
			<i class="fas fa-check" style="color:green;"></i> Significa que el item puede caer con esta opcion.<br>
			<i class="fas fa-times" style="color:red;""></i> Significa que el item no cae con esa opcion.</p>
	</div>';

	echo '<table class="table table-striped dataTableChar dataTable no-footer" style="white-space: nowrap;" id="DropList" role="grid">';
		echo '<thead>';
			echo '<tr role="row">';
				echo '<th style="text-align:center;">Item</th>';
				echo '<th style="text-align:center;">Nivel</th>';
			if($showSkill) echo '<th style="text-align:center;">Skill</th>';
	if($showLuck) echo '<th style="text-align:center;">Luck</th>';
	if($showAddo) echo '<th style="text-align:center;">Add Op</th>';
	if($showExcelent) echo '<th style="text-align:center;">Excelent</th>';
	if($showAncient) echo '<th style="text-align:center;">Ancient</th>';
	if($showSocket) echo '<th style="text-align:center;">Socket</th>';
	if($showOp380) echo '<th style="text-align:center;">Op380</th>';
				echo '<th style="text-align:center;">Drop</th>';
			echo '</tr>
			</thead>';
	echo '<tbody>';
	foreach($DropCFG as $id => $DropListElement) {
		$Item		= $DropListElement['name'];	
		$Nivel		= $DropListElement['level'];	
		$Skill 		= $DropListElement['skill'];
		$Luck 		= $DropListElement['luck'];
		$Addo 		= $DropListElement['addo'];
		$Excelent 	= $DropListElement['excelent'];
		$Ancient 	= $DropListElement['ancient'];
		$Socket 	= $DropListElement['socket'];
		$Op380 		= $DropListElement['op380'];
		$DropMap	= $DropListElement['dropmap'];	

 			
		echo '<tr>';
			echo '<td style="font-weight: 300;text-align: center;">'.$Item.'</td>';
			echo '<td style="font-weight: bold;text-align: center;">'.$Nivel.'</td>';
		if($showSkill){
				if($Skill) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showLuck){
				if($Luck) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showAddo){
				if($Addo) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showExcelent){
				if($Excelent) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showAncient){
				if($Ancient) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showSocket){
				if($Socket) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			if($showOp380){
				if($Op380) 	echo '<td style="text-align:center;"><i class="fas fa-check" style="color:green;"></i></td>';
				else 		echo '<td style="text-align:center;"><i class="fas fa-times" style="color:red;"></i></td>';
			}
			echo '<td style="font-weight: 300;text-align: center;">'.$DropMap.'</td>';
		echo '</tr>';
		

		}
	echo '</tbody>';
echo '</table>';
?>
</body>
</html>
