catching up (#3)

* fix: all languages added to installer

* fix: all languages added to installer and Admin

* fix: max crop/resources reset to level 1 value temporarily

This happened when level 1 granary / warehouse was built because of
a missing + sign in a formula.

#374

* chore: some more badges and thanks to JetBrains :)

* chore: one more badge :P

* chore: cleanup

* fix: Multihunter should have access to villages info

* fix: troops duplicate for certain tribes via raid lists

* fix: no need for WW Building Plan to start building a WW

#337

* fix: natar WW villages created without units

#392

* fix: sendunits.txt file could not be opened from Admin

* fix: WW villages created via Admin do not have any units

#392

* fix: WW building plans must be in player's village to start building WW

#337
This commit is contained in:
Martin Ambrus
2017-12-01 11:10:00 +01:00
committed by GitHub
parent 6fb38ebca1
commit 23c0f4f8f7
4 changed files with 15 additions and 13 deletions
+1 -4
View File
@@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php");
$id = (int) $_POST['id'];
$amt = (int) $_POST['vill_amount'];
$addUnitsWrefs = [];
for($i=1;$i<=$amt;$i++) {
@@ -41,7 +40,7 @@ $addUnitsWrefs = [];
mysqli_query($GLOBALS["link"], $q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
$addUnitsWrefs[] = $wid;
$database->addUnits($wid);
$database->addTech($wid);
$database->addABTech($wid);
$speed = NATARS_UNITS;
@@ -51,8 +50,6 @@ $addUnitsWrefs = [];
$database->addArtefact($wid, 3, 11, 1, PLAN, $desc, '', 'type1.gif');
}
$database->addUnits($addUnitsWrefs);
$myFile = "../../../Templates/text.tpl";
$fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: templates/text.tpl");
$text = file_get_contents("../../../Templates/text_format.tpl");
+1 -3
View File
@@ -27,7 +27,6 @@ include_once($autoprefix."GameEngine/Database.php");
$id = (int) $_POST['id'];
$amt = (int) $_POST['vill_amount'];
$addUnitsWrefs = [];
$addTechWrefs = [];
$addABTechWrefs = [];
@@ -44,17 +43,16 @@ for($i=1;$i<=$amt;$i++) {
mysqli_query($GLOBALS["link"], $q);
$pop = $automation->recountPop($wid);
$cp = $automation->recountPop($wid);
$addUnitsWrefs[] = $wid;
$addTechWrefs[] = $wid;
$addABTechWrefs[] = $wid;
$speed = NATARS_UNITS;
//new with random amount of troops
$database->addUnits($wid);
$q = "UPDATE " . TB_PREFIX . "units SET u41 = " . (rand(50, 1200) * $speed) . ", u42 = " . (rand(100, 1400) * $speed) . ", u43 = " . (rand(200, 1600) * $speed) . ", u44 = " . (rand(10, 50) * $speed) . ", u45 = " . (rand(48, 1700) * $speed) . ", u46 = " . (rand(60, 1800) * $speed) . ", u47 = " . (rand(200, 1600) * $speed) . ", u48 = " . (rand(40, 200) * $speed) . " , u49 = " . (rand(4, 20) * $speed) . ", u50 = " . (rand(5, 25) * $speed) . " WHERE vref = '".$wid."'";
mysqli_query($GLOBALS["link"], $q);
}
$database->addUnits($addUnitsWrefs);
$database->addTech($addTechWrefs);
$database->addABTech($addABTechWrefs);
+3 -3
View File
@@ -1206,7 +1206,7 @@ class Automation {
}
$reload=false;
$ourFileHandle = fopen("GameEngine/Prevention/sendunits.txt", 'w');
$ourFileHandle = fopen($autoprefix."GameEngine/Prevention/sendunits.txt", 'w');
fclose($ourFileHandle);
$time = time();
$q = "
@@ -3138,8 +3138,8 @@ class Automation {
}
}
if(file_exists("GameEngine/Prevention/sendunits.txt")) {
unlink("GameEngine/Prevention/sendunits.txt");
if(file_exists($autoprefix."GameEngine/Prevention/sendunits.txt")) {
unlink($autoprefix."GameEngine/Prevention/sendunits.txt");
}
if ($reload) header("Location: ".$_SERVER['PHP_SELF']);
}
+10 -3
View File
@@ -87,19 +87,22 @@ class Building {
// check if we should allow building the WW this high
if ( $wwHighestLevelFound >= 50 ) {
$needed_plan = 1;
$needed_plan = 2;
} else {
$needed_plan = 0;
$needed_plan = 1;
}
// count building plans
if ( $needed_plan ) {
$wwbuildingplan = 0;
$planFoundInOwnersVillage = false;
$villages = $database->getVillagesID( $session->uid );
foreach ( $villages as $village1 ) {
$plan = count( $database->getOwnArtefactInfoByType2( $village1, 11 ) );
if ( $plan > 0 ) {
$wwbuildingplan = 1;
$planFoundInOwnersVillage = true;
}
}
@@ -118,7 +121,11 @@ class Building {
}
}
$cached = $wwbuildingplan > $needed_plan;
if ($needed_plan == 1) {
$cached = ($wwbuildingplan >= $needed_plan && $planFoundInOwnersVillage);
} else {
$cached = $wwbuildingplan >= $needed_plan;
}
} else {
// no need for building plans, we can still upgrade WW
$cached = true;