Files
TravianZ/Templates/dorf3/3.tpl
iopietro 90221cf19f Natars automation system
+Natars will now spawn automatically, you can set how many day should
pass before the spawn of Natars (and artifacts), WW Villages and WW
building plans (Note: WW villages and WW building plans won't spawn
until the creation of the natar account)
+Added 3 timers under the left menu which indicate the spawn of
Natars/Artifacts, WW villages and WW building plans
+Added an option in the installation, to set the resource production of
oasis
+Fixed a bug that didn't permit to add multiple Units, Abtech and tech
rows with one query
+Added a new information to the Artifact of the fool, the next effect
reroll will now be displayed in his informations (in the treasury)
+Fixed a bug that dind't permit the correct timers flow in Dorf3.php
(Warehouse tab), they'll now flow correctly
+Timers and resources percentage of villages with a negative production
of crop will now be marked in red (in the Warehouse tab, Dorf3.php) and
will now be displayed in how much time the granary will be emptied
+Fixed a possible bug that prevented to add raids to farm lists
+Fixed a bug that didn't permit to create WW Villages from the
Multihunter control panel
+Reworked all timers, there will be only one timer field now (in
Session.php)
+Minor bug fixing and optimization

NOTE: To play this version of the game, you need to reinstall the server
OR you can simply add these lines of code into your "config.php" file:

// ***** Natars Spawn Time
define("NATARS_SPAWN_TIME",260);
define("NATARS_WW_SPAWN_TIME",260);
define("NATARS_WW_BUILDING_PLAN_SPAWN_TIME",260);

// ***** Oasis production
define("OASIS_WOOD_MULTIPLIER",40);
define("OASIS_CLAY_MULTIPLIER",40);
define("OASIS_IRON_MULTIPLIER",40);
define("OASIS_CROP_MULTIPLIER",40);
define("OASIS_WOOD_PRODUCTION",OASIS_WOOD_MULTIPLIER*SPEED);
define("OASIS_CLAY_PRODUCTION",OASIS_CLAY_MULTIPLIER*SPEED);
define("OASIS_IRON_PRODUCTION",OASIS_IRON_MULTIPLIER*SPEED);
define("OASIS_CROP_PRODUCTION",OASIS_CROP_MULTIPLIER*SPEED);

P.S: from the next version, the possibility to add manual WWs, WW
building plans and to create the natar account will be REMOVED.
2018-05-10 17:45:27 +02:00

133 lines
4.8 KiB
Smarty

<?php
include ('menu.tpl');
?>
<table id="warehouse" cellpadding="1" cellspacing="1">
<thead>
<tr>
<th colspan="7">Warehouse</th>
</tr>
<tr>
<td>Village</td>
<td><img class="r1" src="img/x.gif" title="Wood" alt="Wood"></td>
<td><img class="r2" src="img/x.gif" title="Clay" alt="Clay"></td>
<td><img class="r3" src="img/x.gif" title="Iron" alt="Iron"></td>
<td><img class="clock" src="img/x.gif" title="Clock" alt="Clock"></td>
<td><img class="r4" src="img/x.gif" title="Crop" alt="Crop"></td>
<td><img class="clock" src="img/x.gif" title="Clock" alt="Clock"></td>
</tr>
</thead>
<tbody>
<?php
$varray = $database->getProfileVillages($session->uid);
foreach($varray as $vil){
$vid = $vil['wref'];
$vdata = $database->getVillage($vid);
$pop = $vdata['pop'];
$wood = floor($vdata['wood']);
$clay = floor($vdata['clay']);
$iron = floor($vdata['iron']);
$crop = floor($vdata['crop']);
$maxs = $vdata['maxstore'];
$maxc = $vdata['maxcrop'];
$vresarray = $database->getResourceLevel($vid);
$prod_wood = $sawmill = $prod_clay = $claypit = $prod_iron = $foundry = $prod_crop = $grainmill = $bakery = 0;
$woodholder = $clayholder = $ironholder = $cropholder = [];
for($i = 1; $i <= 38; $i++){
if($vresarray['f'.$i.'t'] == 1) array_push($woodholder, 'f'.$i);
elseif($vresarray['f'.$i.'t'] == 5) $sawmill = $vresarray['f'.$i];
elseif($vresarray['f'.$i.'t'] == 2) array_push($clayholder, 'f'.$i);
elseif($vresarray['f'.$i.'t'] == 6) $claypit = $vresarray['f'.$i];
elseif($vresarray['f'.$i.'t'] == 3) array_push($ironholder, 'f'.$i);
elseif($vresarray['f'.$i.'t'] == 7) $foundry = $vresarray['f'.$i];
elseif($vresarray['f'.$i.'t'] == 4) array_push($cropholder, 'f'.$i);
elseif($vresarray['f'.$i.'t'] == 8) $grainmill = $vresarray['f'.$i];
elseif($vresarray['f'.$i.'t'] == 9) $bakery = $vresarray['f'.$i];
}
for($i = 0; $i <= count($woodholder) - 1; $i++){
$prod_wood += $bid1[$vresarray[$woodholder[$i]]]['prod'];
}
for($i = 0; $i <= count($clayholder) - 1; $i++){
$prod_clay += $bid2[$vresarray[$clayholder[$i]]]['prod'];
}
for($i = 0; $i <= count($ironholder) - 1; $i++){
$prod_iron += $bid3[$vresarray[$ironholder[$i]]]['prod'];
}
for($i = 0; $i <= count($cropholder) - 1; $i++){
$prod_crop += $bid4[$vresarray[$cropholder[$i]]]['prod'];
}
if($sawmill >= 1) $prod_wood += $prod_wood / 100 * $bid5[$sawmill]['attri'];
if($claypit >= 1) $prod_clay += $prod_clay / 100 * $bid6[$claypit]['attri'];
if($foundry >= 1) $prod_iron += $prod_iron / 100 * $bid7[$foundry]['attri'];
if($grainmill >= 1 || $bakery >= 1){
$prod_crop += $prod_crop / 100 * ((isset($bid8[$grainmill]['attri']) ? $bid8[$grainmill]['attri'] : 0) + (isset($bid9[$bakery]['attri']) ? $bid9[$bakery]['attri'] : 0));
}
$oasisowned = $database->getOasis($vid);
// more oasis logic required
if($session->plus){
$prod_wood *= 1.25;
$prod_clay *= 1.25;
$prod_iron *= 1.25;
$prod_crop *= 1.25;
}
$prod_wood *= SPEED;
$prod_clay *= SPEED;
$prod_iron *= SPEED;
$prod_crop *= SPEED;
$prod_crop -= $pop;
$prod_crop -= $technology->getUpkeep($technology->getAllUnits($vid), 0);
$percentW = floor($wood / ($maxs / 100));
$percentC = floor($clay / ($maxs / 100));
$percentI = floor($iron / ($maxs / 100));
$percentCr = floor($crop / ($maxc / 100));
if($vid == $village->wid) $class = 'hl';
else $class = '';
$cr = 95; // warning percentage
if($percentW >= $cr) $critW = 'crit';
else $critW = '';
if($percentC >= $cr) $critC = 'crit';
else $critC = '';
if($percentI >= $cr) $critI = 'crit';
else $critI = '';
if($percentCr >= $cr) $critCR = 'crit';
else $critCR = '';
if($prod_crop < 0) $critCR = $critNCR = 'crit';
else $critNCR = '';
$timerwood = floor(($maxs - $wood) / $prod_wood * 3600);
$timerclay = floor(($maxs - $clay) / $prod_clay * 3600);
$timeriron = floor(($maxs - $iron) / $prod_iron * 3600);
$timer1 = min($timerwood, $timerclay, $timeriron);
$timer2 = floor(($prod_crop >= 0 ? $maxc - $crop : $crop) / abs($prod_crop) * 3600);
if($timer1 > 0) $session->timer++;
echo '<tr class="'.$class.'">
<td class="vil fc"><a href="dorf1.php?newdid='.$vid.'">'.$vdata['name'].'</a></td>
<td class="lum '.$critW.'" title="'.$wood.'/'.$maxs.'">'.$percentW.'%</td>
<td class="clay '.$critC.'" title="'.$clay.'/'.$maxs.'">'.$percentC.'%</td>
<td class="iron '.$critI.'" title="'.$iron.'/'.$maxs.'">'.$percentI.'%</td>
<td class="max123"><span '.($timer1 > 0 ? 'id="timer'.$session->timer.'"' : '').'>'.($timer1 >= 0 ? $generator->getTimeFormat($timer1) : 'Never').'</span></td>';
if($timer2 > 0) $session->timer++;
echo '
<td class="crop '.$critCR.'" title="'.$crop.'/'.$maxc.'">'.$percentCr.'%</td>
<td class="max4 '.$critNCR.'"><span '.($timer2 > 0 ? 'id="timer'.$session->timer.'"' : '').'>'.($timer2 >= 0 ? $generator->getTimeFormat($timer2) : 'Never').'</span></td></tr>';
}
?>
</tbody>
</table>