Natars automation system

+Natars will now spawn automatically, you can set how many day should
pass before the spawn of Natars (and artifacts), WW Villages and WW
building plans (Note: WW villages and WW building plans won't spawn
until the creation of the natar account)
+Added 3 timers under the left menu which indicate the spawn of
Natars/Artifacts, WW villages and WW building plans
+Added an option in the installation, to set the resource production of
oasis
+Fixed a bug that didn't permit to add multiple Units, Abtech and tech
rows with one query
+Added a new information to the Artifact of the fool, the next effect
reroll will now be displayed in his informations (in the treasury)
+Fixed a bug that dind't permit the correct timers flow in Dorf3.php
(Warehouse tab), they'll now flow correctly
+Timers and resources percentage of villages with a negative production
of crop will now be marked in red (in the Warehouse tab, Dorf3.php) and
will now be displayed in how much time the granary will be emptied
+Fixed a possible bug that prevented to add raids to farm lists
+Fixed a bug that didn't permit to create WW Villages from the
Multihunter control panel
+Reworked all timers, there will be only one timer field now (in
Session.php)
+Minor bug fixing and optimization

NOTE: To play this version of the game, you need to reinstall the server
OR you can simply add these lines of code into your "config.php" file:

// ***** Natars Spawn Time
define("NATARS_SPAWN_TIME",260);
define("NATARS_WW_SPAWN_TIME",260);
define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",260);

// ***** Oasis production
define("OASIS_WOOD_MULTIPLIER",40);
define("OASIS_CLAY_MULTIPLIER",40);
define("OASIS_IRON_MULTIPLIER",40);
define("OASIS_CROP_MULTIPLIER",40);
define("OASIS_WOOD_PRODUCTION",OASIS_WOOD_MULTIPLIER*SPEED);
define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED);
define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED);
define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED);

P.S: from the next version, the possibility to add manual WWs, WW
building plans and to create the natar account will be REMOVED.
This commit is contained in:
iopietro
2018-05-10 17:45:27 +02:00
parent ec63b04587
commit 90221cf19f
40 changed files with 1222 additions and 1236 deletions
+47 -66
View File
@@ -200,62 +200,59 @@ class Account {
}
private function Login() {
global $database,$session,$form;
global $database, $session, $form;
$user = $_POST['user'];
if(!isset($_POST['user']) || $_POST['user'] == "") {
$form->addError("user",$user);
if(!isset($_POST['user']) || empty($_POST['user'])){
$form->addError("user", $user);
}else if(!User::exists($database, $_POST['user'])){
$form->addError("user", USR_NT_FOUND);
}
else if(!User::exists($database,$_POST['user'])) {
$form->addError("user",USR_NT_FOUND);
}
if(!isset($_POST['pw']) || $_POST['pw'] == "") {
$form->addError("pw",LOGIN_PASS_EMPTY);
}
else if(!$database->login($_POST['user'],$_POST['pw']) && !$database->sitterLogin($_POST['user'],$_POST['pw'])) {
// try activation data if the user was not found
if (!$userData) {
$activateData = $database->getActivateField( $_POST['user'], 'act', 1 );
if ( $activateData != "" ) {
$form->addError( "activate", $_POST['user'] );
} else {
$form->addError("pw",LOGIN_PW_ERROR);
}
} else {
$form->addError("pw",LOGIN_PW_ERROR);
}
if(!isset($_POST['pw']) || empty($_POST['pw'])){
$form->addError("pw", LOGIN_PASS_EMPTY);
}else if(!$database->login($_POST['user'], $_POST['pw']) && !$database->sitterLogin($_POST['user'], $_POST['pw'])){
// try activation data if the user was not found
if(!$userData){
$activateData = $database->getActivateField($_POST['user'], 'act', 1);
if(!empty($activateData)) $form->addError("activate", $_POST['user']);
else $form->addError("pw", LOGIN_PW_ERROR);
}
else $form->addError("pw", LOGIN_PW_ERROR);
}
$userData = $database->getUserArray($_POST['user'], 0);
// Vacation mode by Shadow
if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()) {
$form->addError("vacation","Vacation mode is still enabled");
if($userData["vac_mode"] == 1 && $userData["vac_time"] > time()){
$form->addError("vacation", "Vacation mode is still enabled");
}
// Vacation mode by Shadow
if($form->returnErrors() > 0) {
if($form->returnErrors() > 0){
$_SESSION['errorarray'] = $form->getErrors();
$_SESSION['valuearray'] = $_POST;
header("Location: login.php");
exit;
} else {
// Vacation mode by Shadow
$database->removevacationmode($userData['id']);
// Vacation mode by Shadow
if($database->login($_POST['user'],$_POST['pw'])){
$database->UpdateOnline("login" ,$_POST['user'],time(),$userData['id']);
}else if($database->sitterLogin($_POST['user'],$_POST['pw'])){
$database->UpdateOnline("sitter" ,$_POST['user'],time(),$userData['id']);
}
setcookie("COOKUSR",$_POST['user'],time()+COOKIE_EXPIRE,COOKIE_PATH);
$session->login($_POST['user']);
exit();
}else{
// Vacation mode by Shadow
$database->removevacationmode($userData['id']);
// Vacation mode by Shadow
if($database->login($_POST['user'], $_POST['pw'])){
$database->UpdateOnline("login", $_POST['user'], time(), $userData['id']);
}else if($database->sitterLogin($_POST['user'], $_POST['pw'])){
$database->UpdateOnline("sitter", $_POST['user'], time(), $userData['id']);
}
setcookie("COOKUSR", $_POST['user'], time() + COOKIE_EXPIRE, COOKIE_PATH);
$session->login($_POST['user']);
}
}
private function Logout() {
global $session,$database;
global $session, $database;
unset($_SESSION['wid']);
$database->activeModify(addslashes($session->username),1);
$database->UpdateOnline("logout") or die(mysqli_error($database->dblink));
@@ -264,34 +261,18 @@ class Account {
private function validEmail($email) {
$regexp="/^[a-z0-9]+([_\\.-][a-z0-9]+)*@([a-z0-9]+([\.-][a-z0-9]+)*)+\\.[a-z]{2,}$/i";
if ( !preg_match($regexp, $email) ) {
return false;
}
return true;
return preg_match($regexp, $email);
}
function generateBase($kid,$uid,$username) {
global $database,$message;
if($kid == 0) {
$kid = rand(1,4);
}
else{
$kid = $_POST['kid'];
}
$wid = $database->generateBase($kid,0);
$database->setFieldTaken($wid);
$database->addVillage($wid,$uid,$username,1);
$database->addResourceFields($wid,$database->getVillageType($wid));
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$database->updateUserField($uid,"access",USER,1);
$message = new Message();
$message->sendWelcome($uid,$username);
function generateBase($kid, $uid, $username) {
global $database, $message;
if($kid == 0) $kid = rand(1,4);
else $kid = $_POST['kid'];
$database->generateVillages([['wid' => 0, 'kid' => $kid, 'capital' => 1]], $uid, $username);
$message->sendWelcome($uid, $username);
}
};
$account = new Account;
?>