mirror of
https://github.com/Shadowss/TravianZ.git
synced 2026-06-28 00:24:23 +00:00
General fixes
+Fixed a bug that didn't permit to change the name or the Tag of the alliance individually +Fixed a bug that didn't count the population growth sometimes +Fixed a bug that didn't halve the population consumption in WW villages
This commit is contained in:
@@ -661,12 +661,13 @@ class adm_DB {
|
||||
public function calculateProduction($wid, $uid, $b1, $b2, $b3, $b4, $fdata, $ocounter, $pop) {
|
||||
global $technology, $database;
|
||||
|
||||
$isNatar = $database->getVillageField($wid, "natar");
|
||||
$upkeep = $technology->getUpkeep($this->getAllUnits($wid), 0, $wid);
|
||||
$production = [];
|
||||
$production['wood'] = $this->getWoodProd($fdata, $ocounter,$b1);
|
||||
$production['clay'] = $this->getClayProd($fdata, $ocounter,$b2);
|
||||
$production['iron'] = $this->getIronProd($fdata, $ocounter,$b3);
|
||||
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4) - $pop - $upkeep;
|
||||
$production['crop'] = $this->getCropProd($fdata, $ocounter,$b4) - (!$isNatar ? $pop : round($pop / 2)) - $upkeep;
|
||||
return $production;
|
||||
}
|
||||
|
||||
|
||||
+11
-3
@@ -396,18 +396,21 @@ class Alliance {
|
||||
*****************************************/
|
||||
private function changeAliName($get) {
|
||||
global $form, $database, $session;
|
||||
|
||||
if($session->access == BANNED) {
|
||||
header("Location: banned.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
$userAlly = $database->getAlliance($session->alliance);
|
||||
|
||||
if(!isset($get['ally1']) || $get['ally1'] == "") $form->addError("ally1", ATAG_EMPTY);
|
||||
|
||||
if(!isset($get['ally2']) || $get['ally2'] == "") $form->addError("ally2", ANAME_EMPTY);
|
||||
|
||||
if($database->aExist($get['ally1'], "tag")) $form->addError("ally1", ATAG_EXIST);
|
||||
if($get['ally1'] != $userAlly['tag'] && $database->aExist($get['ally1'], "tag")) $form->addError("ally1", ATAG_EXIST);
|
||||
|
||||
if($database->aExist($get['ally2'], "name")) $form->addError("ally2", ANAME_EXIST);
|
||||
if($get['ally2'] != $userAlly['name'] && $database->aExist($get['ally2'], "name")) $form->addError("ally2", ANAME_EXIST);
|
||||
|
||||
if($this->userPermArray['opt3'] == 0) $form->addError("perm", NO_PERMISSION);
|
||||
|
||||
@@ -415,6 +418,11 @@ class Alliance {
|
||||
$database->setAlliName($session->alliance, $get['ally2'], $get['ally1']);
|
||||
// log the notice
|
||||
$database->insertAlliNotice($session->alliance, '<a href="spieler.php?uid='.$session->uid.'">'.addslashes($session->username).'</a> has changed the alliance name.');
|
||||
$form->addError("perm", NAME_OR_TAG_CHANGED);
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $get;
|
||||
header("Location: allianz.php?s=5");
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -427,7 +435,7 @@ class Alliance {
|
||||
if($this->userPermArray['opt3'] == 0) {
|
||||
$form->addError("perm", NO_PERMISSION);
|
||||
}
|
||||
if($form->returnErrors() != 0) {
|
||||
if($form->returnErrors() > 0) {
|
||||
$_SESSION['errorarray'] = $form->getErrors();
|
||||
$_SESSION['valuearray'] = $post;
|
||||
} else {
|
||||
|
||||
+20
-25
@@ -425,7 +425,7 @@ class Automation {
|
||||
|
||||
if($level == 1 && $max == STORAGE_BASE) $max = STORAGE_BASE;
|
||||
|
||||
if ($level != 1) $max -= ${'bid'.$indi['type']}[$level-1]['attri'] * STORAGE_MULTIPLIER;
|
||||
if ($level != 1) $max -= ${'bid'.$indi['type']}[$level - 1]['attri'] * STORAGE_MULTIPLIER;
|
||||
|
||||
$max += ${'bid'.$indi['type']}[$level]['attri'] * STORAGE_MULTIPLIER;
|
||||
|
||||
@@ -433,9 +433,7 @@ class Automation {
|
||||
}
|
||||
|
||||
// if we updated Embassy, update maximum members that the alliance can take
|
||||
if($indi['type'] == 18){
|
||||
Automation::updateMax($villageOwner);
|
||||
}
|
||||
if($indi['type'] == 18) Automation::updateMax($villageOwner);
|
||||
|
||||
// by SlimShady95 aka Manuel Mannhardt < manuel_mannhardt@web.de >
|
||||
if ($indi['type'] == 40 && ($indi['level'] % 5 == 0 || $indi['level'] > 95) && $indi['level'] != 100) {
|
||||
@@ -449,15 +447,12 @@ class Automation {
|
||||
|
||||
// TODO: find out what exactly these conditions are for
|
||||
// no special military conditioning for Teutons and Gauls
|
||||
if ($database->getUserField($villageOwner, "tribe", 0) != 1) {
|
||||
$loopconUpdates[$indi['wid']] = '';
|
||||
} else {
|
||||
if ($database->getUserField($villageOwner, "tribe", 0) != 1) $loopconUpdates[$indi['wid']] = '';
|
||||
else
|
||||
{
|
||||
// special condition for Roman military buildings
|
||||
if ($indi['field'] > 18) {
|
||||
$loopconUpdates[$indi['wid']] = ' AND field > 18';
|
||||
} else {
|
||||
$loopconUpdates[$indi['wid']] = ' AND field < 19';
|
||||
}
|
||||
if ($indi['field'] > 18) $loopconUpdates[$indi['wid']] = ' AND field > 18';
|
||||
else $loopconUpdates[$indi['wid']] = ' AND field < 19';
|
||||
}
|
||||
|
||||
// Update ww last finish upgrade
|
||||
@@ -477,7 +472,7 @@ class Automation {
|
||||
}
|
||||
|
||||
// update statistical data for affected villages
|
||||
foreach ($villagesAffected as $affected_id) $this->recountPop($affected_id);
|
||||
foreach ($villagesAffected as $affected_id) $this->recountPop($affected_id, false);
|
||||
|
||||
// update data that can be done in one swoop instead of using multiple update queries
|
||||
// no special checks for Romans
|
||||
@@ -3039,16 +3034,16 @@ class Automation {
|
||||
if(!$database->areArtifactsSpawned() || $database->areWWVillagesSpawned() || strtotime(START_DATE) + (NATARS_WW_SPAWN_TIME * 86400) > time()) return;
|
||||
|
||||
//WW village Natars' troops
|
||||
$unitArrays = [41 => rand(50, 1200) * NATARS_UNITS,
|
||||
42 => rand(100 , 1400) * NATARS_UNITS,
|
||||
43 => rand(200, 1600) * NATARS_UNITS,
|
||||
44 => rand(10, 50) * NATARS_UNITS,
|
||||
45 => rand(48, 1700) * NATARS_UNITS,
|
||||
46 => rand(60, 1800) * NATARS_UNITS,
|
||||
47 => rand(200, 1600) * NATARS_UNITS,
|
||||
48 => rand(40, 200) * NATARS_UNITS,
|
||||
49 => rand(4, 20) * NATARS_UNITS,
|
||||
50 => rand(5, 25) * NATARS_UNITS];
|
||||
$unitArrays = [41 => rand(500, 12000) * NATARS_UNITS,
|
||||
42 => rand(1000 , 14000) * NATARS_UNITS,
|
||||
43 => rand(2000, 16000) * NATARS_UNITS,
|
||||
44 => rand(100, 500) * NATARS_UNITS,
|
||||
45 => rand(480, 17000) * NATARS_UNITS,
|
||||
46 => rand(600, 18000) * NATARS_UNITS,
|
||||
47 => rand(2000, 16000) * NATARS_UNITS,
|
||||
48 => rand(400, 2000) * NATARS_UNITS,
|
||||
49 => rand(40, 200) * NATARS_UNITS,
|
||||
50 => rand(50, 250) * NATARS_UNITS];
|
||||
|
||||
//WW village buildings
|
||||
$buildingArrays = ["f99t" => 40, "f99" => 0, "f39t" => 16, "f39" => 1, "f19t" => 17, "f19" => 20, "f20t" => 11,
|
||||
@@ -3234,8 +3229,8 @@ class Automation {
|
||||
//Get an array with the numbers of the oasis
|
||||
$numberOfOasis = $this->bountysortOasis($oasisArray);
|
||||
|
||||
//Set the village population
|
||||
$villagePopulation = $villageInfoArray['pop'];
|
||||
//Set the village population (if WW Villages, it's halved)
|
||||
$villagePopulation = !$villageInfoArray['natar'] ? $villageInfoArray['pop'] : round($villageInfoArray['pop'] / 2);
|
||||
|
||||
//Get the upkeep of the village
|
||||
$upkeep = $technology->getUpkeep($this->getAllUnits($bountywid), 0, $bountywid);
|
||||
|
||||
@@ -22,11 +22,12 @@ class Building {
|
||||
public $NewBuilding = false;
|
||||
private $maxConcurrent;
|
||||
private $allocated;
|
||||
private $basic,$inner,$plus = 0;
|
||||
private $basic, $inner, $plus = 0;
|
||||
public $buildArray = [];
|
||||
|
||||
public function __construct() {
|
||||
global $session;
|
||||
|
||||
$this->maxConcurrent = BASIC_MAX;
|
||||
|
||||
if(ALLOW_ALL_TRIBE || $session->tribe == 1) $this->maxConcurrent += INNER_MAX;
|
||||
|
||||
@@ -100,6 +100,7 @@ define("SAME_NAME","You can't invite yourself");
|
||||
define("ALREADY_INVITED"," already invited");
|
||||
define("ALREADY_IN_ALLY"," is already in this alliance");
|
||||
define("ALREADY_IN_AN_ALLY"," is already in an alliance");
|
||||
define("NAME_OR_TAG_CHANGED","Name or Tag changed");
|
||||
define("VAC_MODE_WRONG_DAYS","You've inserted a wrong number of days");
|
||||
|
||||
//COPYRIGHT
|
||||
|
||||
@@ -157,7 +157,7 @@ class Village {
|
||||
$this->production['wood'] = $this->getWoodProd();
|
||||
$this->production['clay'] = $this->getClayProd();
|
||||
$this->production['iron'] = $this->getIronProd();
|
||||
$this->production['crop'] = $this->getCropProd() - $this->pop - $upkeep;
|
||||
$this->production['crop'] = $this->getCropProd() - (!$this->natar ? $this->pop : round($this->pop / 2)) - $upkeep;
|
||||
}
|
||||
|
||||
private function processProduction() {
|
||||
|
||||
Reference in New Issue
Block a user