From e641d9e9d465f4cf1d92d412ddf8d0c19aa20e17 Mon Sep 17 00:00:00 2001 From: Shadow Date: Wed, 12 Mar 2014 08:40:43 +0200 Subject: [PATCH] vacation mode but i will disable it just implemented but will be disabled --- GameEngine/Database/db_MYSQL.php | 45 +++++++++++++++++++++++++++++ GameEngine/Lang/en.php | 2 +- GameEngine/Profile.php | 39 +++++++++++++++++++++++++ GameEngine/Units.php | 5 ++++ Templates/Build/17.tpl | 7 ++++- Templates/Profile/menu.tpl | 1 + Templates/Profile/special.tpl | 2 +- Templates/Profile/vacation.tpl | 49 ++++++++++++++++++++++++++++++++ login.php | 4 +++ spieler.php | 5 +++- 10 files changed, 155 insertions(+), 4 deletions(-) create mode 100644 Templates/Profile/vacation.tpl diff --git a/GameEngine/Database/db_MYSQL.php b/GameEngine/Database/db_MYSQL.php index 35eccc01..207b7ff0 100644 --- a/GameEngine/Database/db_MYSQL.php +++ b/GameEngine/Database/db_MYSQL.php @@ -3616,6 +3616,51 @@ class MYSQL_DB { $q = "DELETE from " . TB_PREFIX . "prisoners where id = '$id'"; mysql_query($q, $this->connection); } + + /***************************************** +Function to vacation mode - by advocaite +References: +*****************************************/ + + function setvacmode($uid,$days){ + $days1 =60*60*24*$days; + $time =time()+$days1; + $q ="UPDATE ".TB_PREFIX."users SET vac_mode = '1' , vac_time=".$time." WHERE id=".$uid.""; + $result =mysql_query($q,$this->connection); + } + + function removevacationmode($uid){ + $q ="UPDATE ".TB_PREFIX."users SET vac_mode = '0' , vac_time='0' WHERE id=".$uid.""; + $result =mysql_query($q,$this->connection); + } + + function getvacmodexy($wref){ + $q = "SELECT id,oasistype,occupied FROM " . TB_PREFIX . "wdata where id = $wref"; + $result = mysql_query($q, $this->connection); + $dbarray = mysql_fetch_array($result); + if($dbarray['occupied'] != 0 && $dbarray['oasistype'] == 0) { + $q1 = "SELECT owner FROM " . TB_PREFIX . "vdata where wref = ".$dbarray['id'].""; + $result1 = mysql_query($q1, $this->connection); + $dbarray1 = mysql_fetch_array($result1); + if($dbarray1['owner'] != 0){ + $q2 = "SELECT vac_mode,vac_time FROM " . TB_PREFIX . "users where id = ".$dbarray1['owner'].""; + $result2 = mysql_query($q2, $this->connection); + $dbarray2 = mysql_fetch_array($result2); + if($dbarray2['vac_mode'] ==1){ + return true; + }else{ + return false; + } + } + } else { + return false; + } + } + + /***************************************** +Function to vacation mode - by advocaite +References: +*****************************************/ /*************************** Function to get Hero Dead diff --git a/GameEngine/Lang/en.php b/GameEngine/Lang/en.php index 196b8f24..33d79b92 100644 --- a/GameEngine/Lang/en.php +++ b/GameEngine/Lang/en.php @@ -845,7 +845,7 @@ The construction plans are conquerable immediately when they appear to the serve There will be a countdown in game, showing the exact time of the release, 5 days prior to the launch. "); -//planos +//Building Plans define("PLAN","Ancient Construction Plan"); define("PLANVILLAGE","WW Buildingplan"); define("PLAN_DESC","With this ancient construction plan you will able to build World Wonder to level 50. to build further, your alliance must hold at least two plans."); diff --git a/GameEngine/Profile.php b/GameEngine/Profile.php index fede6cd1..24f55f20 100644 --- a/GameEngine/Profile.php +++ b/GameEngine/Profile.php @@ -30,6 +30,14 @@ class Profile { header("Location: banned.php"); } break; + case "p4": + // Vacation mode - by advocaite and Shadow + if($session->access!=BANNED){ + $this->setvactionmode($post); + }else{ + header("Location: banned.php"); + } + break; } } if(isset($post['s'])) { @@ -93,6 +101,37 @@ class Profile { $database->gpack($database->RemoveXSS($session->uid),$database->RemoveXSS($post['custom_url'])); header("Location: spieler.php?uid=".$session->uid); } + + /******************************************************* + Function to vacation mode - by advocaite and Shadow + References: + ********************************************************/ + + private function setvactionmode($post){ + global $database,$session,$form; + $set =false; + if($post['vac'] && $post['vac_days'] >=2 && $post['vac_days'] <=14) { + $database->setvacmode($post['uid'],$post['vac_days']); + $set =true; + } + else { + echo "Minimum days is 2";die();exit(); + } + if($set){ + unset($_SESSION['wid']); + $database->activeModify(addslashes($session->username),1); + $database->UpdateOnline("logout") or die(mysql_error()); + $session->Logout(); + header("Location: login.php"); + }else{ + header("Location: spieler.php?s=5"); + } + } + + /******************************************************* + Function to vacation mode - by advocaite and Shadow + References: + ********************************************************/ private function updateAccount($post) { global $database,$session,$form; diff --git a/GameEngine/Units.php b/GameEngine/Units.php index bf80043d..e9f68920 100644 --- a/GameEngine/Units.php +++ b/GameEngine/Units.php @@ -148,6 +148,11 @@ class Units { $id = $generator->getBaseID($coor['x'],$coor['y']); if (!$database->getVillageState($id)){ $form->addError("error","Coordinates do not exist"); + //check vaction mode- by advocaite + if($database->getvacmodexy($id)){ + $form->addError("error","User is on vacation mode"); + } + //END Vaction mode check } } if (!empty($coor)) { diff --git a/Templates/Build/17.tpl b/Templates/Build/17.tpl index dabb586a..a360dffb 100644 --- a/Templates/Build/17.tpl +++ b/Templates/Build/17.tpl @@ -27,9 +27,12 @@ if($checkexist){ $villageOwner = $database->getVillageField($getwref,'owner'); $userAccess = $database->getUserField($villageOwner,'access',0); } +// Function vacation mode by Shadow +$userVacation = $database->getUserField($villageOwner,'vac_mode',0); +} $maxcarry = $market->maxcarry; $maxcarry *= $market->merchantAvail(); -if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && $userAccess == 2){ +if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && $userAccess == 2 && $userVacation == 0){ ?>
@@ -215,6 +218,8 @@ if(isset($_POST['ft'])=='check'){ $error = 'You cannot send resources to the same village'; }elseif($userAccess == '0' or $userAccess == '8' or $userAccess == '9'){ $error = 'Player is Banned. You cannot send resources to him.'; + }elseif($userVacation == '1') { + $error = 'Player is on vacation mode. You cannot send resources to him.'; }elseif($_POST['r1']==0 && $_POST['r2']==0 && $_POST['r3']==0 && $_POST['r4']==0){ $error = 'Resources not selected.'; }elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){ diff --git a/Templates/Profile/menu.tpl b/Templates/Profile/menu.tpl index 20cda9e0..0b57337b 100644 --- a/Templates/Profile/menu.tpl +++ b/Templates/Profile/menu.tpl @@ -3,6 +3,7 @@ | >Profile | >Preferences | >Account + | >Vacation diff --git a/Templates/Profile/special.tpl b/Templates/Profile/special.tpl index 7257ba77..9fdf1f7e 100644 --- a/Templates/Profile/special.tpl +++ b/Templates/Profile/special.tpl @@ -1 +1 @@ -
Support and Multihunter
Support:
The support is a group of experienced players who will answer your questions gladly.
» Write message
Multihunter:
The Multihunters are responsible for the compliance with the game rules. If you have questions about the rules or want to report a violation, you can message a Multihunter.
» Write message
\ No newline at end of file +
Support and Multihunter
Support:
The support is a group of experienced players who will answer your questions gladly.
» Write message
Multihunter:
The Multihunters are responsible for the compliance with the game rules. If you have questions about the rules or want to report a violation, you can message a Multihunter.
» Write message
\ No newline at end of file diff --git a/Templates/Profile/vacation.tpl b/Templates/Profile/vacation.tpl new file mode 100644 index 00000000..084182e2 --- /dev/null +++ b/Templates/Profile/vacation.tpl @@ -0,0 +1,49 @@ +

Player profile

+ + + + + + + + + + + + + + + + + + + + + getError("vac") != "") { +echo "".$form->getError("vac").""; +} +?> +

+
diff --git a/login.php b/login.php index 9022ac39..466d7d68 100644 --- a/login.php +++ b/login.php @@ -207,6 +207,10 @@ if($form->getError("activate") != "") { getError("activate")."\">".VERIFY_EMAIL."

"; } +if($form->getError("vacation") != "") { +echo "

+".$form->getError("vacation")."

"; +} ?>
diff --git a/spieler.php b/spieler.php index 70efb16a..50b4e9f2 100644 --- a/spieler.php +++ b/spieler.php @@ -147,7 +147,10 @@ else if (isset($_GET['s'])) { if($_GET['s'] == 4) { include("Templates/Profile/graphic.tpl"); } - if($_GET['s'] > 4 or $session->sit == 1) { + if($_GET['s'] == 5) { + include("Templates/Profile/vacation.tpl"); + } + if($_GET['s'] > 5 or $session->sit == 1) { header("Location: ".$_SERVER['PHP_SELF']."?uid=".preg_replace("/[^a-zA-Z0-9_-]/","",$session->uid)); } }