mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-07-02 02:24:21 +00:00
Artifacts fix
+Added the possibility to add WW villages to a player, in the admin panel +Fixed the WW villages counter +Deleted Natars' artifacts can now be recovered from the admin panel
This commit is contained in:
@@ -93,25 +93,30 @@ class funct
|
||||
$artifactInfo = $database->getArtefactDetails($_GET['artid'], $_GET['del']);
|
||||
|
||||
//Check if the artifact exists
|
||||
if(empty($artifactInfo) || $artifactInfo['owner'] == Artifacts::NATARS_UID) {
|
||||
if(empty($artifactInfo)) {
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}elseif($artifactInfo['owner'] == Artifacts::NATARS_UID){
|
||||
$database->updateArtifactDetails($_GET['artid'], ['del' => 0]);
|
||||
header("location: admin.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
$artifact->returnArtifactToNatars($artifactInfo);
|
||||
break;
|
||||
|
||||
case "addArtifacts":
|
||||
|
||||
$selectedArtifact = $_POST['selectedArtifact'];
|
||||
$artifactQuantity = $_POST['artifactQuantity'];
|
||||
$playerId = $_POST['playerId'];
|
||||
$artifactQuantity = (int)$_POST['artifactQuantity'];
|
||||
$playerId = (int)$_POST['playerId'];
|
||||
|
||||
//Check if the inputs are valid
|
||||
if(!isset($selectedArtifact) || !isset($artifactQuantity) || !isset($playerId) || empty($selectedArtifact) ||
|
||||
!is_numeric($artifactQuantity) || !is_numeric($playerId) || strpos($selectedArtifact, ':') === false ||
|
||||
$database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php?p=artifacts&error=0");
|
||||
!is_numeric($artifactQuantity) || $artifactQuantity <= 0 || $artifactQuantity > 999 || !is_numeric($playerId) ||
|
||||
strpos($selectedArtifact, ':') === false || $database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php?p=natars&error=0");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -125,7 +130,7 @@ class funct
|
||||
|
||||
//Check if the artifact has been found or if doesn't exist
|
||||
if(empty($chosenArtifact)){
|
||||
header("location: admin.php?p=artifacts&error=1");
|
||||
header("location: admin.php?p=natars&error=1");
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -137,6 +142,21 @@ class funct
|
||||
$artifact->addArtifactVillages($artifactArrays, $playerId);
|
||||
break;
|
||||
|
||||
case "addWWVillages":
|
||||
|
||||
$numberOfVillages = (int)$_POST['numberOfVillages'];
|
||||
$playerId = (int)$_POST['playerId'];
|
||||
|
||||
//Check if the inserted values are valid
|
||||
if(!is_numeric($numberOfVillages) || $numberOfVillages <= 0 || $numberOfVillages > 999
|
||||
|| !is_numeric($playerId) || $database->getUserField($playerId, "username", 0) == "[?]"){
|
||||
header("location: admin.php?p=natars&error=2");
|
||||
}
|
||||
|
||||
//Create the desired WW villages
|
||||
$artifact->createWWVillages($numberOfVillages, $playerId);
|
||||
break;
|
||||
|
||||
case "killHero":
|
||||
$varray = $database->getProfileVillages($get['uid']);
|
||||
$killhero = false;
|
||||
|
||||
Reference in New Issue
Block a user