diff --git a/GameEngine/Alliance.php b/GameEngine/Alliance.php index 550aa00b..f1ee6ff6 100755 --- a/GameEngine/Alliance.php +++ b/GameEngine/Alliance.php @@ -182,7 +182,7 @@ class Alliance { $database->insertAlliNotice($invite['alliance'], '' . addslashes($session->username) . ' has rejected the invitation.'); } } - header("Location: build.php?id=".$get['id']); + header("Location: build.php?gid=18"); exit; }else{ header("Location: banned.php"); @@ -241,7 +241,7 @@ class Alliance { if($accept_error == 1){ $form->addError("ally_accept", "The alliance can contain only ".$max." members at this moment."); }else{ - header("Location: build.php?id=" . $get['id']); + header("Location: build.php?gid=18"); exit; } } else{ @@ -254,7 +254,7 @@ class Alliance { Function to create an alliance *****************************************/ private function createAlliance($post) { - global $form, $database, $session, $bid18, $village; + global $form, $database, $session, $bid18, $building; if($session->access != BANNED){ if(!isset($post['ally1']) || $post['ally1'] == "") { $form->addError("ally1", ATAG_EMPTY); @@ -268,14 +268,20 @@ class Alliance { if($database->aExist($post['ally2'], "name")) { $form->addError("ally2", ANAME_EXIST); } + if($session->alliance != 0){ + $form->addError("ally3", ALREADY_ALLY_MEMBER); + } + if($building->getTypeLevel(18) < 3){ + $form->addError("ally4", ALLY_TOO_LOW); + } if($form->returnErrors() != 0) { $_SESSION['errorarray'] = $form->getErrors(); $_SESSION['valuearray'] = $post; - - header("Location: build.php?id=" . $post['id']); + if($building->getTypeLevel(18) > 0) header("Location: build.php?gid=18"); + else header("Location: dorf2.php"); exit; } else { - $max = $bid18[$village->resarray['f' . $post['id']]]['attri']; + $max = $bid18[$building->getTypeLevel(18)]['attri']; $aid = $database->createAlliance($post['ally1'], $post['ally2'], $session->uid, $max); $database->updateUserField($session->uid, "alliance", $aid, 1); $database->procAllyPop($aid); @@ -283,7 +289,7 @@ class Alliance { $database->createAlliPermissions($session->uid, $aid, 'Alliance founder', '1', '1', '1', '1', '1', '1', '1', '1'); // log the notice $database->insertAlliNotice($aid, 'The alliance has been founded by ' . addslashes($session->username) . '.'); - header("Location: build.php?id=" . $post['id']); + header("Location: build.php?gid=18"); exit; } }else{ diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 6fa17f27..8885b9b4 100755 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -71,6 +71,8 @@ define("ATAG_EMPTY","Tag empty"); define("ANAME_EMPTY","Name empty"); define("ATAG_EXIST","Tag taken"); define("ANAME_EXIST","Name taken"); +define("ALREADY_ALLY_MEMBER","You're already in an alliance"); +define("ALLY_TOO_LOW", "You must have a level 3 or greater alliance"); define("NOT_OPENED_YET","Server not started yet."); define("REGISTER_CLOSED","The register is closed. You can't register to this server."); define("NAME_EMPTY","Please insert name"); diff --git a/Templates/Build/18.tpl b/Templates/Build/18.tpl index b1536390..7f0cb6c0 100644 --- a/Templates/Build/18.tpl +++ b/Templates/Build/18.tpl @@ -22,7 +22,7 @@ echo " ".NAME." ".$alliance->allianceArray['name']." - + ".$form->getError("ally3")." @@ -36,7 +36,6 @@ echo " ?> - @@ -56,6 +55,7 @@ echo " } ?>
+

getError("ally4"); ?>

gotInvite) { echo "

".$form->getError("ally_accept")."

"; diff --git a/Templates/Build/18_create.tpl b/Templates/Build/18_create.tpl index cb29195b..baabe3e7 100644 --- a/Templates/Build/18_create.tpl +++ b/Templates/Build/18_create.tpl @@ -1,7 +1,6 @@ access!=BANNED){ ?> - @@ -11,7 +10,6 @@ @@ -29,7 +27,6 @@
" maxlength="15"> getError("ally1"); ?> -
- @@ -39,7 +36,6 @@
" maxlength="8"> getError("ally1"); ?> -