Hello,
shortly: this is fix for training troops trouble.
Fix is not in 100% working because 1 unit is trained immediately after training is started, but everything related with training is correctly.
---Edit---
Units are added after refresh any page :ehh:
----------
Ok so,
open:
"[root]/GameEngine/Automation.php"
search:
and replace all function:
Greetings from Poland :
shortly: this is fix for training troops trouble.
Fix is not in 100% working because 1 unit is trained immediately after training is started, but everything related with training is correctly.
---Edit---
Units are added after refresh any page :ehh:
----------
Ok so,
open:
"[root]/GameEngine/Automation.php"
search:
PHP:
private function trainingComplete()
and replace all function:
PHP:
private function trainingComplete() {
if(file_exists("GameEngine/Prevention/training.txt")) {
unlink("GameEngine/Prevention/training.txt");
}
global $database;
//pobieranie wiersza
$trainlist = $database->getTrainingList();
//jesli istnieja treningi
if(count($trainlist) > 0){
foreach($trainlist as $train){
$timepast = $train['timestamp'] - $train['timestamp2'];
$pop = $train['pop'];
if($timepast <= 0 && $train['amt'] > 0) {
$timepast2 = $time - $train['timestamp2'];
$trained = 1;
while($timepast2 >= $train['eachtime']){
$timepast2 -= $train['eachtime'];
$trained += 1;
}
if($trained > $train['amt']){
$trained = $train['amt'];
}
//dodawanie jednostki
if($train['unit']>60 && $train['unit']!=99){
$database->modifyUnit($train['vref'],$train['unit']-60,$trained,1);
}else{
$database->modifyUnit($train['vref'],$train['unit'],$trained,1);
}
///////////////////////
//odejmowanie treningu
$database->updateTraining($train['id'],$trained,$trained*$train['eachtime']);
}
if($train['amt'] == 0){
$database->trainUnit($train['id'],0,0,0,0,1,1);
}
$crop = $database->getCropProdstarv($train['vref']);
$unitarrays = $this->getAllUnits($train['vref']);
$village = $database->getVillage($train['vref']);
$upkeep = $village['pop'] + $this->getUpkeep($unitarrays, 0);
if ($crop < $upkeep){
// add starv data
$database->setVillageField($train['vref'], 'starv', $upkeep);
$database->setVillageField($train['vref'], 'starvupdate', $time);
}
}
}
if(file_exists("GameEngine/Prevention/training.txt")) {
unlink("GameEngine/Prevention/training.txt");
}
}
Greetings from Poland :
Last edited: