mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-08-28 06:07:14 +00:00
Update Units.php
This commit is contained in:
+32
-49
@@ -76,14 +76,19 @@ class Units {
|
|||||||
global $database,$village,$session,$generator,$logging,$form;
|
global $database,$village,$session,$generator,$logging,$form;
|
||||||
// Busqueda por nombre de pueblo
|
// Busqueda por nombre de pueblo
|
||||||
// Confirmamos y buscamos las coordenadas por nombre de pueblo
|
// Confirmamos y buscamos las coordenadas por nombre de pueblo
|
||||||
if($post['x']!="" && $post['y']!=""){
|
if(isset($post['x']) && isset($post['y']) && $post['x'] != "" && $post['y'] != "") {
|
||||||
$oid = $database->getVilWref($post['x'],$post['y']);
|
$vid = $database->getVilWref($post['x'],$post['y']);
|
||||||
}else if($post['dname']!=""){
|
unset($post['dname']);
|
||||||
$oid = $database->getVillageByName(stripslashes($post['dname']));
|
unset($_POST['dname']);
|
||||||
|
}else if(isset($post['dname']) && $post['dname']!=""){
|
||||||
|
$vid = $database->getVillageByName(stripslashes($post['dname']));
|
||||||
}
|
}
|
||||||
if($database->isVillageOases($oid) != 0){
|
if (!empty($vid)) {
|
||||||
$too = $database->getOasisField($oid,"conqured");
|
if($database->isVillageOases($vid) != 0){
|
||||||
if($too['conqured'] == 0){$disabledr ="disabled=disabled"; $disabled ="disabled=disabled";}else{
|
$too = $database->getOasisField($vid,"conqured");
|
||||||
|
if($too == 0){
|
||||||
|
$disabledr ="disabled=disabled"; $disabled ="disabled=disabled";
|
||||||
|
}else{
|
||||||
$disabledr ="";
|
$disabledr ="";
|
||||||
if($session->sit == 0){
|
if($session->sit == 0){
|
||||||
$disabled ="";
|
$disabled ="";
|
||||||
@@ -91,6 +96,19 @@ class Units {
|
|||||||
$disabled ="disabled=disabled";
|
$disabled ="disabled=disabled";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
$too = $database->getVillage($vid);
|
||||||
|
if($too['owner'] == 3){
|
||||||
|
$disabledr ="disabled=disabled"; $disabled ="";
|
||||||
|
}else{
|
||||||
|
$disabledr ="";
|
||||||
|
if($session->sit == 0){
|
||||||
|
$disabled ="";
|
||||||
|
}else{
|
||||||
|
$disabled ="disabled=disabled";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
$disabledr ="";
|
$disabledr ="";
|
||||||
if($session->sit == 0){
|
if($session->sit == 0){
|
||||||
@@ -131,64 +149,29 @@ class Units {
|
|||||||
if (!$database->getVillageState($id)){
|
if (!$database->getVillageState($id)){
|
||||||
$form->addError("error","Coordinates do not exist");
|
$form->addError("error","Coordinates do not exist");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if (!empty($coor)) {
|
||||||
if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
|
if ($session->tribe == 1){$Gtribe = "";}elseif ($session->tribe == 2){$Gtribe = "1";}elseif ($session->tribe == 3){$Gtribe = "2";}elseif ($session->tribe == 4){$Gtribe = "3";}elseif ($session->tribe == 5){$Gtribe = "4";}
|
||||||
for($i=1; $i<12; $i++)
|
for($i=1; $i<12; $i++){
|
||||||
{
|
if(isset($post['t'.$i])){
|
||||||
if(isset($post['t'.$i]))
|
|
||||||
|
|
||||||
{
|
|
||||||
|
|
||||||
if ($i<10) $troophave=$village->unitarray['u'.$Gtribe.$i];
|
if ($i<10) $troophave=$village->unitarray['u'.$Gtribe.$i];
|
||||||
if ($i==10)$troophave=$village->unitarray['u'.floor(intval($Gtribe)+1)*$i];
|
if ($i==10)$troophave=$village->unitarray['u'.floor(intval($Gtribe)+1)*$i];
|
||||||
if ($i==11)$troophave=$village->unitarray['hero'];
|
if ($i==11)$troophave=$village->unitarray['hero'];
|
||||||
|
|
||||||
if (intval($post['t'.$i]) > $troophave)
|
if (intval($post['t'.$i]) > $troophave){
|
||||||
{
|
|
||||||
$form->addError("error","You can't send more units than you have");
|
$form->addError("error","You can't send more units than you have");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(intval($post['t'.$i])<0){
|
||||||
if(intval($post['t'.$i])<0)
|
|
||||||
{
|
|
||||||
$form->addError("error","You can't send negative units.");
|
$form->addError("error","You can't send negative units.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(preg_match('/[^0-9]/',$post['t'.$i])){
|
||||||
if($post['t'.$i]>30000000)
|
|
||||||
{
|
|
||||||
$form->addError("error","Bug attempt!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(preg_match('/[^0-9]/',$post['t'.$i]))
|
|
||||||
{
|
|
||||||
$form->addError("error","Special characters can't entered");
|
$form->addError("error","Special characters can't entered");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($post['t11'] > $village->unitarray['hero'])
|
|
||||||
{
|
|
||||||
$form->addError("error","You can't send more units than you have");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if($post['t11']<0)
|
|
||||||
{
|
|
||||||
$form->addError("error","You can't send negative units.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if($post['t11']>2)
|
|
||||||
{
|
|
||||||
$form->addError("error","Bug attempt!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if(preg_match('/[^0-9]/',$post['t11']))
|
|
||||||
{
|
|
||||||
$form->addError("error","Special characters can't entered");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ($database->isVillageOases($id) == 0) {
|
if ($database->isVillageOases($id) == 0) {
|
||||||
if($database->hasBeginnerProtection($id)==1) {
|
if($database->hasBeginnerProtection($id)==1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user