Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

TravianT4 - yi12345. Training troops fix

Status
Not open for further replies.
Newbie Spellweaver
Joined
Mar 1, 2012
Messages
16
Reaction score
0
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:
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:
Newbie Spellweaver
Joined
Mar 1, 2012
Messages
16
Reaction score
0
Thread to delete.
In other relases of Travian T4 this bug is fixed.
 
Initiate Mage
Joined
Feb 6, 2013
Messages
4
Reaction score
0
I've this version, and the troops never get ready! :p
Does any one found a solution besides this??

mrozek Tks btw! =)
 
Newbie Spellweaver
Joined
Jan 27, 2013
Messages
5
Reaction score
0


Do you know the solution bug
 
Newbie Spellweaver
Joined
Mar 1, 2012
Messages
16
Reaction score
0


This is bugless relase of Travian T4 for me. Check it out
 
Skilled Illusionist
Joined
Sep 5, 2011
Messages
360
Reaction score
14
fix animals capture %100 [unknown]

Not ok Can help in this situation

you can not add the cages. I have 15 cages indicates it is -99

thanks
 
Status
Not open for further replies.
Back
Top