getMInfo($d);
$baseId = isset($basearray['id'])? $basearray['id'] : 0;
$uinfo = $database->getVillage($baseId);
$isOasis = ($basearray['fieldtype'] == 0);
$oasis = array('conqured'=>0,'owner'=>0);
if ($isOasis) {
$q = $database->dblink->query('SELECT conqured, owner FROM `'.TB_PREFIX.'odata` WHERE wref='.(int)$d);
if($q) $oasis = $q->fetch_assoc();
}
$access = $session->access;
$oasislink = '';
$coords = "(".$basearray['x']."|".$basearray['y'].")";
$otext = $isOasis? ($oasis['conqured']? OCCUOASIS : UNOCCUOASIS) : '';
// ---------- 1. FIELD ----------
$fieldMap = array(
1=>'3-3-3-9', 2=>'3-4-5-6', 3=>'4-4-4-6', 4=>'4-5-3-6',
5=>'5-3-4-6', 6=>'1-1-1-15', 7=>'4-4-3-7', 8=>'3-4-4-7',
9=>'4-3-4-7', 10=>'3-5-4-6', 11=>'4-3-5-6', 12=>'5-4-3-6'
);
$tt = $isOasis? '' : (isset($fieldMap[$basearray['fieldtype']])? $fieldMap[$basearray['fieldtype']] : '');
$landd = $isOasis? array() : explode('-', $tt);
// ---------- 2. OASIS BONUS ----------
$oasisBonus = array(
1=>array(array('r1',LUMBER,25)), 2=>array(array('r1',LUMBER,25)),
3=>array(array('r1',LUMBER,25),array('r4',CROP,25)),
4=>array(array('r2',CLAY,25)), 5=>array(array('r2',CLAY,25)),
6=>array(array('r2',CLAY,25),array('r4',CROP,25)),
7=>array(array('r3',IRON,25)), 8=>array(array('r3',IRON,25)),
9=>array(array('r3',IRON,25),array('r4',CROP,25)),
10=>array(array('r4',CROP,25)), 11=>array(array('r4',CROP,25)),
12=>array(array('r4',CROP,50))
);
$bonusData = $isOasis? (isset($oasisBonus[$basearray['oasistype']])? $oasisBonus[$basearray['oasistype']] : array()) : array();
if ($isOasis) {
$parts = array_map(function($b){ return "+".$b[2]."% ".$b[1]; }, $bonusData);
$tt = implode(' and ', $parts).' '.PERHOUR;
}
// ---------- 3. HELPERE ----------
function tribeName($t){
$m = array(1=>TRIBE1,2=>TRIBE2,3=>TRIBE3,4=>TRIBE4,5=>TRIBE5);
return isset($m[$t])? $m[$t] : '';
}
function renderBonus($bonusData){
foreach($bonusData as $b){
$cls=$b[0]; $res=$b[1]; $pct=$b[2];
echo '
'.$pct.'% '.$res.' |
';
}
}
function renderReports($database,$generator,$session,$d,$limit,$typeMap=null){
$where = $session->alliance? 'ally = '.(int)$session->alliance : 'uid = '.(int)$session->uid;
$sql = 'SELECT ntype,id,topic,time FROM '.TB_PREFIX.'ndata WHERE ('.$limit.') AND '.$where.' AND toWref = '.(int)$d.' ORDER BY time DESC LIMIT 5';
$res = $database->dblink->query($sql);
if(!$res ||!$res->num_rows){ echo '
| '.THERENOINFO.' |
'; return; }
while($row=$res->fetch_assoc()){
$type = $row['ntype'];
if($typeMap && isset($typeMap[$type])) $type = $typeMap[$type];
if($type>=18 && $type<=22){
$icon = '
!['.$row['topic'].' '.$row['topic'].'](gpack/travian_default/img/scouts/'.$type.'.gif)
';
} else {
$icon = '
!['.$row['topic'].'](img/x.gif)
';
}
$date = $generator->procMtime($row['time']);
// Reports here are selected by `ally = session alliance` (shared alliance
// reports) whenever the viewer is in an alliance, so they may be owned by
// an ally rather than the viewer. berichte.php only renders such a report
// when the `aid` param is present (its uid-owner branch fails for allies),
// hence the blank page. Append &aid= like Alliance/attacks.tpl does.
$link = 'berichte.php?id='.$row['id'].($session->alliance? '&aid='.(int)$session->alliance : '');
echo '
| '.$icon.' '.$date[0].' '.substr($date[1],0,5).' |
';
}
}
?>
(capital)
';?>