function getClosest($zona, $status, $mode) { $area; /* echo "<h3>Asignacion de Area</h3><br><div>"; if($mode == 1) echo "Zona: ".$zona; //else echo "Zona 1: ".$zona[0]." + Zona 2: ".$zona[1]; echo " | Estatus: ".$status." | Mode: ".$mode."</div>"; */ $matrix = Type()[$status]; //echo "<pre>"; if ($mode == 1) { //print_r($matrix[$zona]); $indexes = $matrix[$zona]; for ($i = 0; $i < count($indexes); $i++) { $area = $indexes[$i]; //echo "<div>Selected: E".$area."</div>"; $libres = libres($area); if (count($libres) > 0) { break; } } } $x = Points()[$area][$zona]['x']; $y = Points()[$area][$zona]['y']; $lower = 100000; $id = -1; foreach ($libres as $key => $value) { $distance = sqrt(pow($x - $value['x'], 2) + pow($y - $value['y'], 2)); //echo "<div>X: ".$value['x']." | Y: ".$value['y']." | Distance: ".$distance."</div>"; if ($distance < $lower) { $id = $key; $lower = $distance; } } //echo "<div>Id :".$id." | Distance: ".$lower."</div>"; $output = array(); if ($id != -1) { $output['area'] = $area; $output['recomendado'] = $libres[$id]; unset($libres[$id]); $output['disponibles'] = $libres; } else { $output['area'] = 0; } return $output; //echo "</pre>"; }
function IC_Skill_Check() { $sReturn = ''; //Check if player spent too many points if ($_POST['chkNPC'] == '' && Points() > MAX_CHAR_PTS) { $sReturn .= "You cannot spend more than " . MAX_CHAR_PTS . " character points<br>\n"; } elseif (Points() > MAX_NPC_PTS) { $sReturn .= "You cannot spend more than " . MAX_NPC_PTS . " character points<br>\n"; } //If Ritual Magic 1, 2 or 3 was selected, check they have healing, incantation or spellcasting //sk33, sk2, sk4 are Ritual Magic 1, 2 & 3 if ((int) $_POST['sk33'] > 0 || (int) $_POST['sk2'] > 0 || (int) $_POST['sk4'] > 0) { //sk21, sk23, sk29, sk31, sk25, 2k27 are Healing, Incanting, Spellcasting 1/2. If they add up to zero, raise error if ((int) $_POST['sk21'] + (int) $_POST['sk23'] + (int) $_POST['sk29'] + (int) $_POST['sk31'] + (int) $_POST['sk25'] + (int) $_POST['sk27'] == 0) { $sReturn .= "You cannot take Ritual Magic unless you also take Healing, Spellcasting or Incantation (of any level)<br>\n"; } } //Cannot have more than one magic skill at level 2 $iMagicSkills = 0; if ((int) $_POST['sk23'] > 0) { $iMagicSkills++; } if ((int) $_POST['sk27'] > 0) { $iMagicSkills++; } if ((int) $_POST['sk31'] > 0) { $iMagicSkills++; } if ($iMagicSkills > 1) { $sReturn .= "You cannot take more than one magic skill (healing, incanting, spellcasting) at level 2 or above.<br>\n"; } //Cannot have a magic skill at level 2 and the same type at level 1 if ((int) $_POST['sk23'] > 0 && (int) $_POST['sk21'] > 0) { $sReturn .= "You cannot take Healing at level 2 and at level 1.<br>\n"; } if ((int) $_POST['sk27'] > 0 && (int) $_POST['sk25'] > 0) { $sReturn .= "You cannot take Spellcasting at level 2 and at level 1.<br>\n"; } if ((int) $_POST['sk31'] > 0 && (int) $_POST['sk29'] > 0) { $sReturn .= "You cannot take Incantation at level 2 and at level 1.<br>\n"; } //Cannot have more than one power skill $iPowerSkills = 0; if ((int) $_POST['sk10'] > 0) { $iPowerSkills++; } if ((int) $_POST['sk12'] > 0) { $iPowerSkills++; } if ((int) $_POST['sk14'] > 0) { $iPowerSkills++; } if ((int) $_POST['sk16'] > 0) { $iPowerSkills++; } if ($iPowerSkills > 1) { $sReturn .= "You cannot take more than one power skill.<br>\n"; } //Cannot have both body dev 1 & body dev 2 if ((int) $_POST['sk11'] > 0 && (int) $_POST['sk13'] > 0) { $sReturn .= "You cannot take both body development 1 <b>and</b> body development 2.<br>\n"; } return $sReturn; }