<!DOCTYPE html>
<html lang="en">
<body>
<?php
	if(!isLoggedIn()) redirect(1,'login');

	loadModuleConfigs('webshop');

	$common = new common();
	$ClassShop	= new WebShopNew();
	$this->muonline = Connection::Database('MuOnline');

	$accountInfo = $common->accountInformation($_SESSION['userid']);
	if(!is_array($accountInfo)) throw new Exception(lang('error_12',true));

	# Tipo de Baul
	$TypeVault				=	mconfig('type_vault');

	# Moneda
	$Moneda					=	mconfig('moneda');
	$Moneda_V				=	mconfig('moneda_v');
	$AcceptMismosSockets	=	mconfig('enable_samesocket');

	# Precios Items
	$PriceItemLevel			=	mconfig('option_itemlevel');
	$PriceOptionLife		=	mconfig('option_life');
	$PriceLuck				=	mconfig('option_luck');
	$PriceSkill				=	mconfig('option_skill');
	$PriceOPExe				=	mconfig('option_exe');
	$PriceOP380				=	mconfig('option_380');
	$PriceAncient			=	mconfig('option_ancient');
	$PriceSocket			=	mconfig('option_socket');
	$PriceHarmony			=	mconfig('option_harmony');

	# Categorias
	$ShowSword				=	mconfig('sword') ? true : false;
	$ShowAxe				=	mconfig('axe') ? true : false;
	$ShowMace				=	mconfig('mace') ? true : false;
	$ShowSpear				=	mconfig('spear') ? true : false;
	$ShowBow				=	mconfig('bow') ? true : false;
	$ShowStaff				=	mconfig('staff') ? true : false;
	$ShowHelm				=	mconfig('helm') ? true : false;
	$ShowArmor				=	mconfig('armor') ? true : false;
	$ShowPants				=	mconfig('pants') ? true : false;
	$ShowGloves				=	mconfig('gloves') ? true : false;
	$ShowBoots				=	mconfig('boots') ? true : false;
	$ShowShield				=	mconfig('shield') ? true : false;
	$ShowWings				=	mconfig('wings') ? true : false;
	$ShowOtros				=	mconfig('otros') ? true : false;

	#WebShop
	echo '<div class="alert alert-info text-center" role="alert">';
			echo '<h3 style="text-align:center;"><i class="fas fa-exclamation-circle"></i> IMPORTANTE</h3>';
			echo '<hr>';
			if($TypeVault) echo '<p>Esto es <b>AUTOMATICO!</b>. Una vez comprado el item, te llegara a tu <b>Gremory Case</b> (Letra <b>K</b> en el Juego).<br>';
			else echo '<p>Esto es <b>AUTOMATICO!</b>. Una vez comprado el item, te llegara a tu <b>Warehouse</b> (<b>Baul</b> del Juego).<br>';
	echo '</div>';	

	echo '<div class="row d-flex justify-content-center">';
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-primary btn-sm btn-block categoria_shop w-100" category="all"><i class="fas fa-eye"></i> Todo</button>';
		echo '</div>';
	if($ShowSword){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop w-100" category="Swords"><i class="fas fa-gavel"></i> Sword</button>';
		echo '</div>';
	}
	if($ShowAxe){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-success btn-sm btn-block categoria_shop w-100" category="Axes"><i class="fas fa-gavel"></i> Axe</button>';
		echo '</div>';
	}
	if($ShowMace){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop w-100" category="Maces"><i class="fas fa-hammer"></i> Mace</button>';
		echo '</div>';
	}
	if($ShowOtros){
		echo '<div class="col-md-3 col-12">';
			echo '<button type="button" class="btn btn-outline-info btn-sm btn-block categoria_shop w-100" category="Jewel/Misc"><i class="fas fa-adjust"></i> Amuletos/Rings/Otros</button>';
		echo '</div>';
	}
	echo '</div>';
	echo '<div class="row d-flex justify-content-center mt-1">';
	if($ShowSpear){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-dark btn-sm btn-block categoria_shop w-100" category="Spears"><i class="fas fa-gavel"></i> Spear</button>';
		echo '</div>';
	}
	if($ShowBow){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop w-100" category="Bows"><i class="fas fa-location-arrow"></i> Bow</button>';
		echo '</div>';
	}
	if($ShowStaff){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-success btn-sm btn-block categoria_shop w-100" category="Staffs"><i class="fas fa-candy-cane"></i> Staff</button>';
		echo '</div>';
	}
	if($ShowShield){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-warning btn-sm btn-block categoria_shop w-100" category="Shields"><i class="fas fa-shield-alt"></i> Shield</button>';
		echo '</div>';
	}
	if($ShowWings){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop w-100" category="Wings"><i class="fas fa-feather"></i> Wings</button>';
		echo '</div>';
	}
	echo '</div>';
	echo '<div class="row d-flex justify-content-center mt-1">';
	if($ShowHelm){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-secondary btn-sm btn-block categoria_shop w-100" category="Helmets"><i class="fab fa-redhat"></i> Helm</button>';
		echo '</div>';
	}
	if($ShowArmor){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-primary btn-sm btn-block categoria_shop w-100" category="Armors"><i class="fas fa-tshirt"></i> Armor</button>';
		echo '</div>';
	}
	if($ShowPants){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-danger btn-sm btn-block categoria_shop w-100" category="Pants"><i class="fab fa-leanpub"></i> Pants</button>';
		echo '</div>';
	}
	if($ShowGloves){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-warning btn-sm btn-block categoria_shop w-100" category="Gloves"><i class="fas fa-mitten"></i> Gloves</button>';
		echo '</div>';
	}
	if($ShowBoots){
		echo '<div class="col-md-2 col-12">';
			echo '<button type="button" class="btn btn-outline-dark btn-sm btn-block categoria_shop w-100" category="Boots"><i class="fas fa-socks"></i> Boots</button>';
		echo '</div>';
	}
	echo '</div>';

	echo '<hr>';		

	if(!isset($_POST['seleccion']) && !isset($_POST['comprar'])){
	echo '<div class="card-body">
				  <div class="row">';		  

	 	$ItemsShop = $ClassShop->ObtainItems();
		if(is_array($ItemsShop)){
			foreach ($ItemsShop as $ItemsList) {
				$GrupoName = $ClassShop->GrupoName($ItemsList['iGrupo']);
				if($ItemsList["Activo"] == 1){			
					echo '<div class="col-md-3 col-sm-12 p-2 col-12 categoria_shop_item" category="'.$GrupoName.'">';
						echo '<div class="card">';
							echo '<div class="card-footer">';
								echo '<p class="card-text text-center"><span class="text-muted">'.$GrupoName.'</span></p>';
							echo '</div>';
							echo '<div class="card-img-top d-flex flex-row justify-content-center alig-items-center" style="background-color: #565656 !important;">';
								echo '<img class="p-5 img-fluid" src="'.__PATH_IMG__.'webshop/items/'.$ItemsList["iGrupo"].'-'.$ItemsList["iIndex"].'.gif" data-toggle="tooltip" data-placement="top" alt="'.$ItemsList["Name"].'" title="'.$ItemsList["Name"].'!">';
							echo '</div>';	
							echo '<div class="card-body text-center">';
							echo '<h5 class="card-title text-danger"><b>'.$ItemsList["Name"].'</b></h5>';
								echo '<p class="card-text">'.$ItemsList["Descripcion"].'<br>';
								echo '</p>';
							echo '</div>';
							echo '<div class="card-footer">';
								echo '<div class="row">';
									echo '<div class="col-md-12 col-12 align-self-center text-center mb-1 botones-donaciones">';
										echo '<form action="" method="post">';
											echo '<input type="hidden" id="item_id" name="item_id" value="'.$id .'">';
											echo '<input type="hidden" id="item_index" name="item_index" value="'.$ItemsList["iIndex"] .'">';
											echo '<input type="hidden" id="item_type" name="item_type" value="'.$ItemsList["iGrupo"] .'">';									
											echo '<input type="hidden" id="item_typeb" name="item_typeb" value="'.$GrupoName .'">';
											echo '<input type="hidden" id="item_img" name="item_img" value="'.$ItemsList["iGrupo"].'-'.$ItemsList["iIndex"].'">';
											echo '<input class="btn btn-primary btn-sm btn-block" name="seleccion" type="submit" value="Seleccionar">';	
										echo '</form>';
									echo '</div>';
								echo '</div>';
							echo '</div>';
						echo '</div>';
					echo '</div>';
				}				
			}	
		}
			
echo '</div></div><br>';
}


	# Compra de Item
	else if(isset($_POST['comprar']))
	{		
		# Opciones
		$Usuario				=		$_SESSION['username'];
		$Character				=		'muonline';
		$Item_NAME 				= 		$_POST['item_Name'];
		$ConfigTexto			=		mconfig('text_gc');
		$TipoGremory			=		1;
		$ItemDuration 			= 		0;
		$DaysToUse 				= 		mconfig('days_gc');
		$Item_Group 			= 		$_POST['item_Tipo'];
		$Item_Index 			= 		$_POST['item_Index'];
		$ItemFinalIndex 		= 		(($Item_Group*512) + $Item_Index);
		$Durabilidad			=		255;
		$Level 					= 		($_POST['LevelItem'] == null ? 0 : $_POST['LevelItem']);
		$Skill					= 		($_POST['OpcionSkill'] == null ? 0 : $_POST['OpcionSkill']);
		$Luck 					= 		($_POST['OpcionLuck'] == null ? 0 : $_POST['OpcionLuck']);
		$Life 					= 		($_POST['OptionLife'] == null ? 0 : $_POST['OptionLife']);
		$ExeOP1 				= 		($_POST['OpcionExe1'] == null ? 0 : $_POST['OpcionExe1']);
		$ExeOP2 				= 		($_POST['OpcionExe2'] == null ? 0 : $_POST['OpcionExe2']);
		$ExeOP3 				= 		($_POST['OpcionExe3'] == null ? 0 : $_POST['OpcionExe3']);
		$ExeOP4 				= 		($_POST['OpcionExe4'] == null ? 0 : $_POST['OpcionExe4']);
		$ExeOP5 				= 		($_POST['OpcionExe5'] == null ? 0 : $_POST['OpcionExe5']);
		$ExeOP6 				= 		($_POST['OpcionExe6'] == null ? 0 : $_POST['OpcionExe6']);
		$SetOP 					= 		($_POST['AncientSet'] == null ? 0 : $_POST['AncientSet']);
		$HHOP					= 		($_POST['OptionHarmony'] == null ? 0 : $_POST['OptionHarmony']);
		$Op380 					= 		($_POST['Opcion380'] == null ? 0 : $_POST['Opcion380']);
		$Socket1 				= 		($_POST['SocketOp1'] == null ? 255 : $_POST['SocketOp1']);
		$Socket2 				= 		($_POST['SocketOp2'] == null ? 255 : $_POST['SocketOp2']);
		$Socket3 				= 		($_POST['SocketOp3'] == null ? 255 : $_POST['SocketOp3']);
		$Socket4 				= 		($_POST['SocketOp4'] == null ? 255 : $_POST['SocketOp4']);
		$Socket5 				= 		($_POST['SocketOp5'] == null ? 255 : $_POST['SocketOp5']);
		$ExeOP					=		($ExeOP1+$ExeOP2+$ExeOP3+$ExeOP4+$ExeOP5+$ExeOP6);

		# Verificaciones
		$ClassShop->Verificaciones($Usuario,$Character,$ConfigTexto,$TipoGremory,$ItemDuration,$DaysToUse,$Item_Group,$Item_Index,$ItemFinalIndex,$Durabilidad,$Level,$Skill,$Luck,$Life,$ExeOP1,$ExeOP2,$ExeOP3,$ExeOP4,$ExeOP5,$ExeOP6,$SetOP,$HHOP,$Op380,$Socket1,$Socket2,$Socket3,$Socket4,$Socket5,$ExeOP,$Item_NAME,$AcceptMismosSockets,$TypeVault);

	}else if(isset($_POST['seleccion']))
	{
		$Item_IMG 				= 		$_POST['item_img'];
		$Item_ID 				= 		$_POST['item_id'];
		$Item_TYPE 				= 		$_POST['item_type'];
		$Item_TYPEB 			= 		$_POST['item_typeb'];
		$Item_INDEX 			= 		$_POST['item_index'];

		$ItemInf            	=   	$ClassShop->ObtainItemsByGroup($Item_TYPE,$Item_INDEX);

		$Item_NAME 				= 		$ItemInf['Name'];
		$Item_DESC 				= 		$ItemInf['Descripcion'];
		$Item_PRICE 			= 		$ItemInf['Precio'];
		$Item_SOCKET 			= 		$ItemInf['Socket'];
		$Item_HARMONY 			= 		$ItemInf['Harmony'];
		$Item_ANCIENT 			= 		$ItemInf['Ancient'];
		$Item_OP380 			= 		$ItemInf['Op380'];
		$Item_MinLevel			=		$ItemInf['MinLevel'];
		$Item_MaxLevel			=		$ItemInf['MaxLevel'];
		$Item_MinLevelLife		=		$ItemInf['MinLevelLife'];
		$Item_MaxLevelLife		=		$ItemInf['MaxLevelLife'];
		$Item_MinOpExe			=		$ItemInf['MinOpExe'];
		$Item_MaxOpExe			=		$ItemInf['MaxOpExe'];
		$Item_MaxSockets		=		$ItemInf['MaxSockets'];
		$Item_SKILL 			= 		$ItemInf['Skill'];
		$Item_LUCK 				= 		$ItemInf['Luck'];


		?>

		<div class="container">
			<div class="row justify-content-center alig-items-center">
			<div class="w-100"></div>
				<div class="col-md-12">
					<?php
				echo '<form action="" method="post">';
					echo '<br><div class="alert alert-warning text-center" role="alert">';
						echo '<h3 style="text-align:center;"><i class="fas fa-exclamation-circle"></i> RESTRICCIONES</h3>';
						echo '<hr>';
						echo '<div class="row text-start">';
							echo '<div class="col"><b>- M</b>inimo Nivel de Item: <b class="text-success"> [ + '.$Item_MinLevel.' ]</b></div>';
							echo '<div class="col"><b>- M</b>aximo Nivel de Item: <b class="text-danger"> [ + '.$Item_MaxLevel.' ]</b></div>';
						echo '</div>';
						echo '<div class="row text-start">';
							if($Item_TYPE == 6){ $iOptionTextMin = $Item_MinLevelLife*5; $iOptionTextMax = $Item_MaxLevelLife*5; }
							else { $iOptionTextMin = $Item_MinLevelLife*4; $iOptionTextMax = $Item_MaxLevelLife*4; }
							echo '<div class="col"><b>- M</b>inimo Life Opcion de Item: <b class="text-success"> [ + '.$iOptionTextMin.' ]</b></div>';
							echo '<div class="col"><b>- M</b>aximo Life Opcion de Item: <b class="text-danger"> [ + '.$iOptionTextMax.' ]</b></div>';
						echo '</div>';
						echo '<div class="row text-start">';
							echo '<div class="col"><b>- M</b>inimas Opciones Exe en Item: <b class="text-success"> [ '.$Item_MinOpExe.' ]</b></div>';
							echo '<div class="col"><b>- M</b>aximas Opciones Exe en Item: <b class="text-danger"> [ '.$Item_MaxOpExe.' ]</b></div>';
						echo '</div>';
						echo '<div class="row text-start">';
							echo '<div class="col"><b>- M</b>aximos Sockets en Item: <b class="text-danger"> [ '.$Item_MaxSockets.' ]</b></div>';
						echo '</div>';
					echo '</div>';
					echo '<div class="card mb-3 mx-auto">';
						echo '<div class="row g-0">';
							echo '<div class="col-md-5" style="background-color:#2d2d2d;padding-bottom: 10px;">';
								echo '<div class="d-flex flex-row justify-content-center alig-items-center" style="background-color: #2d2d2d !important;">';
									echo '<img style="min-width:75px;" class="p-3 img-fluid rounded-start" src="'.__PATH_IMG__.'webshop/items/'.$Item_IMG.'.gif" data-toggle="tooltip" data-placement="top" alt="'.$Item_NAME.'" title="'.$Item_NAME.'!">';
								echo '</div>';
								echo '<input type="hidden" id="item_Tipo" name="item_Tipo" value="'.$Item_TYPE .'">';
								echo '<input type="hidden" id="item_Index" name="item_Index" value="'.$Item_INDEX .'">';
								echo '<input type="hidden" id="item_Price" name="item_Price" value="'.$Item_PRICE .'">';
								echo '<input type="hidden" id="item_Name" name="item_Name" value="'.$Item_NAME .'">';
								# Prices para Javascript
								echo '<input type="hidden" id="item_PriceItemLevel" name="item_PriceItemLevel" value="'.$PriceItemLevel .'">';
								echo '<input type="hidden" id="item_PriceOptionLife" name="item_PriceOptionLife" value="'.$PriceOptionLife .'">';
								echo '<input type="hidden" id="item_PriceLuck" name="item_PriceLuck" value="'.$PriceLuck .'">';
								echo '<input type="hidden" id="item_PriceSkill" name="item_PriceSkill" value="'.$PriceSkill .'">';
								echo '<input type="hidden" id="item_PriceOPExe" name="item_PriceOPExe" value="'.$PriceOPExe .'">';
								echo '<input type="hidden" id="item_PriceOP380" name="item_PriceOP380" value="'.$PriceOP380 .'">';
								echo '<input type="hidden" id="item_PriceAncient" name="item_PriceAncient" value="'.$PriceAncient .'">';
								echo '<input type="hidden" id="item_PriceSocket" name="item_PriceSocket" value="'.$PriceSocket .'">';
								echo '<input type="hidden" id="item_PriceHarmony" name="item_PriceHarmony" value="'.$PriceHarmony .'">';
								# End prices
								echo '<input type="hidden" id="item_ItemACC" name="item_ItemACC" value="'.$Item_ANCIENT .'">';
								echo '<input type="hidden" id="item_Op380" name="item_Op380" value="'.$Item_OP380 .'">';
								echo '<input type="hidden" id="item_OpHH" name="item_OpHH" value="'.$Item_HARMONY .'">';
								echo '<input type="hidden" id="item_OpSock" name="item_OpSock" value="'.$Item_SOCKET .'">';
								echo '<input type="hidden" id="item_OpMaxSock" name="item_OpMaxSock" value="'.$Item_MaxSockets .'">';
								echo '<input type="hidden" id="item_OpType" name="item_OpType" value="'.$Item_TYPE .'">';
								echo '<div class="d-grid">';
									echo '<button class="btn btn-danger btn-block disabled m-1" type="button" style="font-size:25px;"><b>Precio: <span id="span1">'.number_format($Item_PRICE,0,',','.').'</span></b></button>';
									echo '<button class="btn btn-success btn-block disabled m-1" type="button" style="font-size:20px;"><b>Moneda: '.$Moneda_V.'</b></button>';
									echo '<input class="btn btn-outline-danger btn-block m-1" name="comprar" type="submit" value="Comprar">';
							  	echo '</div>';
							echo '</div>';
							echo '<div class="col-md-7">';
								echo '<div class="card-body">';

									# Nombre Item
									echo '<div class="row">';
										echo '<div class="col"><hr></div>';
											echo '<div class="col-auto text-center"><h5 class="card-title text-danger"><b>'.$Item_NAME.'</b></h5></div>';
										echo '<div class="col"><hr></div>';
									echo '</div>';
									if($Item_TYPE < 13 || $Item_TYPE == 13 && $Item_INDEX == 30){
										# Item Level
										if(mconfig('enable_itemlevel') == 1){
											echo '<div class="form-row align-items-center">';
												echo '<div class="col-auto my-1">';
													echo '<label class="mr-sm-2 text-center" for="LevelItem">Nivel de Item</label>';
													echo '<select class="form-control form-control-sm" id="LevelItem" name="LevelItem" style="max-width:400px;" onchange="ItemPrice();">';
														for($iLevel = $Item_MinLevel; $iLevel <= $Item_MaxLevel; $iLevel++){
																echo '<option value="'.$iLevel.'">+ '.$iLevel.'</option>';
														} 
													echo '</select>';
												echo '</div>';
											echo '</div>';
										}
										# Option Life	
										if(mconfig('enable_oplife') == 1){
											echo '<div class="form-row align-items-center">';
												echo '<div class="col-auto my-1">';
													echo '<label class="mr-sm-2" for="OptionLife">Opcion de Life</label>';
													echo '<select class="form-control form-control-sm" id="OptionLife" name="OptionLife" style="max-width:400px;" onchange="ItemPrice();">';
														for($iOption = $Item_MinLevelLife; $iOption <= $Item_MaxLevelLife; $iOption++){
															if($Item_TYPE == 6) $iOptionText = $iOption*5;
															else $iOptionText = $iOption*4;
															echo '<option value="'.$iOption.'">+ '.$iOptionText.'</option>';
														}
													echo '</select>';
												echo '</div>';
											echo '</div>';
										}
										# Opciones Luck / Skill
										echo '<div class="row">';
											echo '<div class="col"><hr></div>';
											echo '<div class="col-auto text-center text-danger fw-bold">[ Luck / Skill ]</div>';
											echo '<div class="col"><hr></div>';
										echo '</div>';
										if(mconfig('enable_luck') == 1){
											echo '<div class="form-check">';
												echo '<input class="form-check-input" type="checkbox" value="1" name="OpcionLuck" id="OpcionLuck" onchange="ItemPrice();">';
												echo '<label class="form-check-label" for="OpcionLuck">';
												echo 'Luck';
												echo '</label>';
											echo '</div>';
										}
										if(mconfig('enable_skill') == 1){
											if($Item_TYPE < 6){
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="checkbox" value="1" name="OpcionSkill" id="OpcionSkill" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="OpcionSkill">';
													echo 'Skill';
													echo '</label>';
												echo '</div>';
											}
										}
										# Opciones Exe
										if(mconfig('enable_opexe') == 1){
											echo '<div class="row">';
												echo '<div class="col"><hr></div>';
												echo '<div class="col-auto text-center text-danger fw-bold">[ Opciones Exe ]</div>';
												echo '<div class="col"><hr></div>';
											echo '</div>';
											if($Item_TYPE < 12){
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="checkbox" value="32" name="OpcionExe1" id="OpcionExe1" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="OpcionExe1">';
													if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo "Excellent Damage Rate +10%";
													else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo "Increase Maximun Life +4%";
													echo '</label>';
												echo '</div>';
											}
											if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings3_Array)){ echo ''; }
											else{
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="checkbox" value="16" name="OpcionExe2" id="OpcionExe2" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="OpcionExe2">';
													if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo 'Increase Damage +level/20';
													else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo 'Increase Maximun Mana +4%';
													else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings2_Array) || $Item_TYPE == 13 && $Item_INDEX == 30 ) echo 'Increase attacking (wizardry) speed +5'; 
													echo '</label>';
												echo '</div>';
											}
											echo '<div class="form-check">';
												echo '<input class="form-check-input" type="checkbox" value="8" name="OpcionExe3" id="OpcionExe3" onchange="ItemPrice();">';
												echo '<label class="form-check-label" for="OpcionExe3">';
												if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo 'Increase Damage +2%';
												else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo 'Damage Decrease +4%';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings2_Array) || $Item_TYPE == 13 && $Item_INDEX == 30 ) echo 'Max AG +50 increased';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings3_Array)) echo 'Complete recovery mana +5%';
												echo '</label>';
											echo '</div>';
											echo '<div class="form-check">';
												echo '<input class="form-check-input" type="checkbox" value="4" name="OpcionExe4" id="OpcionExe4" onchange="ItemPrice();">';
												echo '<label class="form-check-label" for="OpcionExe4">';
												if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo 'Increase attacking (wizardry) speed +7';
												else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo 'Reflect Damage +5%';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings2_Array) || $Item_TYPE == 13 && $Item_INDEX == 30 ) echo 'Ignore Opponent defensive power +3%';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings3_Array)) echo 'Complete recovery life +5%';
												echo '</label>';
											echo '</div>';
											echo '<div class="form-check">';
												echo '<input class="form-check-input" type="checkbox" value="2" name="OpcionExe5" id="OpcionExe5" onchange="ItemPrice();">';
												echo '<label class="form-check-label" for="OpcionExe5">';
												if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo 'Increase recovery life when kill monster +life/8';
												else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo 'Defense Success Rate +10%';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings2_Array) || $Item_TYPE == 13 && $Item_INDEX == 30 ) echo 'Mana +50 increased';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings3_Array)) echo 'Return the enemy attack power +5%';
												echo '</label>';
											echo '</div>';
											echo '<div class="form-check">';
												echo '<input class="form-check-input" type="checkbox" value="1" name="OpcionExe6" id="OpcionExe6" onchange="ItemPrice();">';
												echo '<label class="form-check-label" for="OpcionExe6">';
												if(in_array($Item_TYPE, $ClassShop->iType_Weapon_Array)) echo 'Increase recovery mana when kill monster +mana/8';
												else if(in_array($Item_TYPE, $ClassShop->iType_Set_Array)) echo 'Increase Zen Drop Rate +70%';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings2_Array) || $Item_TYPE == 13 && $Item_INDEX == 30 ) echo 'HP +50 increased';
												else if($Item_TYPE == 12 && in_array($Item_INDEX, $ClassShop->iIndex_Wings3_Array)) echo 'Ignore opponent defensive power +5%';
												echo '</label>';
											echo '</div>';
										}
									}
									# Ancient Set
									if($Item_TYPE < 12){
										if(mconfig('enable_ancient') == 1){
											if($Item_ANCIENT > 0){
												echo '<div class="row">';
													echo '<div class="col"><hr></div>';
													echo '<div class="col-auto text-center text-danger fw-bold">[ Ancient Set ]</div>';
													echo '<div class="col"><hr></div>';
												echo '</div>';
											}
											if($Item_ANCIENT == 1){
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="checkbox" value="5" name="AncientSet" id="AncientSetCB" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="AncientSetCB">';
													echo 'Ancient Set 1';
													echo '</label>';
												echo '</div>';
											}
											if($Item_ANCIENT > 1){
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="radio" value="0" name="AncientSet" id="AncientSet0" onchange="ItemPrice();" checked>';
													echo '<label class="form-check-label" for="AncientSet0">';
													echo 'No Ancient';
													echo '</label>';
												echo '</div>';
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="radio" value="5" name="AncientSet" id="AncientSet" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="AncientSet">';
													echo 'Ancient Set 1';
													echo '</label>';
												echo '</div>';
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="radio" value="6" name="AncientSet" id="AncientSet2" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="AncientSet2">';
													echo 'Ancient Set 2';
													echo '</label>';
												echo '</div>';
											}
										}
										# Opcion 380
										if(mconfig('enable_op380') == 1){
											if($Item_OP380 == 1){
												echo '<div class="row">';
													echo '<div class="col"><hr></div>';
													echo '<div class="col-auto text-center text-danger fw-bold">[ Opcion 380 ]</div>';
													echo '<div class="col"><hr></div>';
												echo '</div>';
												echo '<div class="form-check">';
													echo '<input class="form-check-input" type="checkbox" value="128" name="Opcion380" id="Opcion380" onchange="ItemPrice();">';
													echo '<label class="form-check-label" for="Opcion380">';
													echo 'Opcion 380';
													echo '</label>';
												echo '</div>';
											}
										}
										
										# Opcion Harmony
										if(mconfig('enable_harmony') == 1){
											if($Item_HARMONY == 1){
												# Separador
												echo '<hr>';
												echo '<div class="form-row align-items-center">';
													echo '<div class="col-auto my-1">';
														echo '<label class="mr-sm-2" for="OptionHarmony">Option Harmony</label>';
														echo '<select class="form-control form-control-sm" id="OptionHarmony" name="OptionHarmony" style="max-width:400px;" onchange="ItemPrice();" >';
															if($Item_TYPE < 5) { 
																foreach( $ClassShop->iHarmony_Weapons_Array as $HaromnyID => $iHaromnyOP ){
																	echo '<option value="'.$HaromnyID.'">'.$iHaromnyOP.'</option>';
																}
															}else if($Item_TYPE == 5){
																foreach( $ClassShop->iHarmony_Staff_Array as $HaromnyID => $iHaromnyOP ){
																	echo '<option value="'.$HaromnyID.'">'.$iHaromnyOP.'</option>';
																}
															}else {
																foreach( $ClassShop->iHarmony_Set_Array as $HaromnyID => $iHaromnyOP ){
																	echo '<option value="'.$HaromnyID.'">'.$iHaromnyOP.'</option>';
																}
															}
														echo '</select>';
													echo '</div>';
												echo '</div>';
											}
										}
										# Opciones Sockets
										if(mconfig('enable_socket') == 1){
											if($Item_SOCKET == 1){
												echo '<div class="row">';
													echo '<div class="col"><hr></div>';
													echo '<div class="col-auto text-center text-danger fw-bold">[ Opciones Sockets ]</div>';
													echo '<div class="col"><hr></div>';
												echo '</div>';
												### Op Socket 1
												if($Item_MaxSockets >= 1){
													echo '<div class="form-row align-items-center">';
														echo '<div class="col-auto my-1">';
															echo '<label class="mr-sm-2" for="SocketOp1">Opcion Socket 1</label>';
															echo '<select class="form-control form-control-sm" id="SocketOp1" name="SocketOp1" style="max-width:400px;" onchange="ItemPrice();">';
																if($Item_TYPE < 6) { 
																	foreach( $ClassShop->iSocket_Weapons_Array as $SocketID => $iSocketOP ){ 
																		echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																} else {
																	foreach( $ClassShop->iSocket_Set_Array as $SocketID => $iSocketOP ){
																			echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																}
															echo '</select>';
														echo '</div>';
													echo '</div>';
												}
												### Op Socket 2
												if($Item_MaxSockets >= 2){
													echo '<div class="form-row align-items-center">';
														echo '<div class="col-auto my-1">';
															echo '<label class="mr-sm-2" for="SocketOp2">Opcion Socket 2</label>';
															echo '<select class="form-control form-control-sm" id="SocketOp2" name="SocketOp2" style="max-width:400px;" onchange="ItemPrice();">';
																if($Item_TYPE < 6) { 
																	foreach( $ClassShop->iSocket_Weapons_Array as $SocketID => $iSocketOP ){ 
																		echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																} else {
																	foreach( $ClassShop->iSocket_Set_Array as $SocketID => $iSocketOP ){
																			echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																}
															echo '</select>';
														echo '</div>';
													echo '</div>';
												}
												### Op Socket 3
												if($Item_MaxSockets >= 3){
													echo '<div class="form-row align-items-center">';
														echo '<div class="col-auto my-1">';
															echo '<label class="mr-sm-2" for="SocketOp3">Opcion Socket 3</label>';
															echo '<select class="form-control form-control-sm" id="SocketOp3" name="SocketOp3" style="max-width:400px;" onchange="ItemPrice();">';
																if($Item_TYPE < 6) { 
																	foreach( $ClassShop->iSocket_Weapons_Array as $SocketID => $iSocketOP ){ 
																		echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																} else {
																	foreach( $ClassShop->iSocket_Set_Array as $SocketID => $iSocketOP ){
																			echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																}
															echo '</select>';
														echo '</div>';
													echo '</div>';
												}
												### Op Socket 4
												if($Item_MaxSockets >= 4){
													echo '<div class="form-row align-items-center">';
														echo '<div class="col-auto my-1">';
															echo '<label class="mr-sm-2" for="SocketOp4">Opcion Socket 4</label>';
															echo '<select class="form-control form-control-sm" id="SocketOp4" name="SocketOp4" style="max-width:400px;" onchange="ItemPrice();">';
																if($Item_TYPE < 6) { 
																	foreach( $ClassShop->iSocket_Weapons_Array as $SocketID => $iSocketOP ){ 
																		echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																} else {
																	foreach( $ClassShop->iSocket_Set_Array as $SocketID => $iSocketOP ){
																			echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																}
															echo '</select>';
														echo '</div>';
													echo '</div>';
												}
												### Op Socket 5
												if($Item_MaxSockets >= 5){
													echo '<div class="form-row align-items-center">';
														echo '<div class="col-auto my-1">';
															echo '<label class="mr-sm-2" for="SocketOp5">Opcion Socket 5</label>';
															echo '<select class="form-control form-control-sm" id="SocketOp5" name="SocketOp5" style="max-width:400px;" onchange="ItemPrice();">';
																if($Item_TYPE < 6) { 
																	foreach( $ClassShop->iSocket_Weapons_Array as $SocketID => $iSocketOP ){ 
																		echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																} else {
																	foreach( $ClassShop->iSocket_Set_Array as $SocketID => $iSocketOP ){
																			echo '<option value="'.$SocketID.'">'.$iSocketOP.'</option>';
																	}
																}
															echo '</select>';
														echo '</div>';
													echo '</div>';
												}
											}
										}
									}
								echo '</div>';
							echo '</div>';
						echo '</div>';
					echo '</div>';
				echo '</form>';
									
					?>
				</div>
			</div>
		</div>

<?
	}
?>
</body>
</html>
