fix hero training time

This commit is contained in:
unknown
2012-04-01 01:18:57 +03:00
parent 10f0256506
commit 92fb8468c4
4 changed files with 58 additions and 91 deletions
+56 -12
View File
@@ -25,25 +25,68 @@
<?php
if($hero_info['unit'] == 1) {
$name = "Legionnaire";
} else if($hero_info['unit'] == 2) {
$name = "Praetorian";
} else if($hero_info['unit'] == 3) {
$name = "Imperian";
} else if($hero_info['unit'] == 5) {
$name = "Equites Imperatoris";
} else if($hero_info['unit'] == 6) {
$name = "Equites Caesaris";
} else if($hero_info['unit'] == 11) {
$name = "Clubswinger";
} else if($hero_info['unit'] == 12) {
$name = "Spearman";
} else if($hero_info['unit'] == 13) {
$name = "Axeman";
} else if($hero_info['unit'] == 15) {
$name = "Paladin";
} else if($hero_info['unit'] == 16) {
$name = "Teutonic Knight";
} else if($hero_info['unit'] == 21) {
$name = "Phalanx";
} else if($hero_info['unit'] == 22) {
$name = "Swordsman";
} else if($hero_info['unit'] == 24) {
$name = "Theutates Thunder";
} else if($hero_info['unit'] == 25) {
$name = "Druidrider";
} else if($hero_info['unit'] == 26) {
$name = "Haeduan";
}
$name1 = $hero_info['name'];
if($hero_info['trainingtime'] > time()) {
$timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time());
?>
<table id="distribution" cellpadding="1" cellspacing="1">
<thead>
<tr>
<?php echo "<tr class='next'><th>Hero will be ready in <span id=timer1>" . $timeleft . "</span></th></tr>"; ?>
</tr>
</thead>
if($hero_info['trainingtime'] <= time()) {
if($hero_info['trainingtime'] != 0) {
if($hero_info['dead'] == 0) {
mysql_query("UPDATE " . TB_PREFIX . "hero SET trainingtime = '0' WHERE uid = " . $session->uid . "");
mysql_query("UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".$village->wid."");
}
}
}
<tr>
<?php
echo "<tr>
<td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u1\" src=\"img/x.gif\" alt=\"Legionnaire\" title=\"Legionnaire\" />
Legionnaire ($name1)
</div>"
?>
</tr>
</table>
<?php }else{
if(isset($_GET['land'])) {
include("37_land.tpl");
} else {
if(mysql_num_rows($hero) == 0){
include("37_train.tpl");
}
if(mysql_num_rows($hero) != 0 AND $hero_info['trainingtime'] > time()){
include("37_train2.tpl");
}
if(mysql_num_rows($hero) != 0 AND $hero_info['dead'] == 1){
include("37_revive.tpl");
}
@@ -51,6 +94,7 @@
include("37_hero.tpl");
}
}
}
include ("upgrade.tpl"); ?>
</div>
+1 -8
View File
@@ -132,13 +132,6 @@
header("Location: build.php?id=".$id."");
}
if($hero_info['trainingtime'] <= time()) {
if($hero_info['trainingtime'] != 0) {
if($hero_info['dead'] == 0) {
mysql_query("UPDATE " . TB_PREFIX . "hero SET trainingtime = '0' WHERE uid = " . $session->uid . "");
mysql_query("UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".$village->wid."");
}
}
}
include ("37_train.tpl");
?>
-70
View File
@@ -1,70 +0,0 @@
<?php
/*-------------------------------------------------------*\
| ********* DO NOT REMOVE THIS COPYRIGHT NOTICE ********* |
+---------------------------------------------------------+
| Developed by: Manni < manuel_mannhardt@web.de > |
| Dzoki < dzoki.travian@gmail.com > |
| Copyright: TravianX Project All rights reserved |
\*-------------------------------------------------------*/
if($hero_info['unit'] == 1) {
$name = "Legionnaire";
} else if($hero_info['unit'] == 2) {
$name = "Praetorian";
} else if($hero_info['unit'] == 3) {
$name = "Imperian";
} else if($hero_info['unit'] == 5) {
$name = "Equites Imperatoris";
} else if($hero_info['unit'] == 6) {
$name = "Equites Caesaris";
} else if($hero_info['unit'] == 11) {
$name = "Clubswinger";
} else if($hero_info['unit'] == 12) {
$name = "Spearman";
} else if($hero_info['unit'] == 13) {
$name = "Axeman";
} else if($hero_info['unit'] == 15) {
$name = "Paladin";
} else if($hero_info['unit'] == 16) {
$name = "Teutonic Knight";
} else if($hero_info['unit'] == 21) {
$name = "Phalanx";
} else if($hero_info['unit'] == 22) {
$name = "Swordsman";
} else if($hero_info['unit'] == 24) {
$name = "Theutates Thunder";
} else if($hero_info['unit'] == 25) {
$name = "Druidrider";
} else if($hero_info['unit'] == 26) {
$name = "Haeduan";
}
if($hero_info['trainingtime'] <= time()) {
if($hero_info['trainingtime'] != 0) {
if($hero_info['dead'] == 0) {
mysql_query("UPDATE " . TB_PREFIX . "hero SET trainingtime = '0', dead = '0' WHERE uid = " . $session->uid . "");
mysql_query("UPDATE " . TB_PREFIX . "units SET hero = 1 WHERE vref = ".$village->wid."");
}
}
}
if($hero_info['trainingtime'] > time()) {
$timeleft = $generator->getTimeFormat($hero_info['trainingtime'] - time());
?>
<table id="distribution" cellpadding="1" cellspacing="1">
<thead>
<tr>
<?php echo "<tr class='next'><th>Hero will be ready in <span id=timer1>" . $timeleft . "</span></th></tr>"; ?>
</tr>
</thead>
<tr>
<td><img class="u<?php echo $hero_info['unit']; ?>" src="img/x.gif" /> <?php echo $name . " (<b>" . $hero_info['name'] . "</b>) "; ?></td>
</tr>
</table>
<?php } ?>
+1 -1
View File
@@ -783,7 +783,7 @@ CREATE TABLE IF NOT EXISTS `%PREFIX%hero` (
`defencebonus` tinyint(1) unsigned NOT NULL,
`regeneration` tinyint(1) unsigned NOT NULL,
`autoregen` int(2) NOT NULL,
`trainingtime` mediumint(3) unsigned NOT NULL,
`trainingtime` int(11) unsigned NOT NULL,
PRIMARY KEY (`heroid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;