Refactor + BugFix

1. Fix a bug in Admin Panel that you can edit by yourself your rank, now you cannot edit your rank anymore.

2. Now Alliance Leader can edit his own Position

3. Fix negative value on Demolition Building, now in database at lvl is appear new level not -1

4. Refactor Ajax map, now all is alligned (Ajax folder and Map folder)

5. Fix bug from Palace (when change capital now Automation recount population automaticaly on old capital and new capital)
This commit is contained in:
novgorodschi catalin
2026-05-18 09:18:35 +03:00
parent 2bce101a27
commit 55e6dd60b5
96 changed files with 6176 additions and 6763 deletions
+20 -13
View File
@@ -38,19 +38,26 @@ function go_url(url) {
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td> <td>Change Access</td>
Change Access <td>
</td> <?php if($id != $_SESSION['id']) { ?>
<td> <select name="access" class="dropdown">
<select name="access" class="dropdown"> <option value="0" <?php if($user['access'] == 0) echo 'selected="selected"'; ?>>Banned</option>
<option value="0" <?php if($user['access'] == 0) { echo 'selected="selected"'; } else { echo ''; } ?>>Banned</option> <option value="2" <?php if($user['access'] == 2) echo 'selected="selected"'; ?>>Normal User</option>
<option value="2" <?php if($user['access'] == 2) { echo 'selected="selected"'; } else { echo ''; } ?>>Normal User</option> <option value="8" <?php if($user['access'] == 8) echo 'selected="selected"'; ?>>Multihunter</option>
<option value="8" <?php if($user['access'] == 8) { echo 'selected="selected"'; } else { echo ''; } ?>>Multihunter</option> <option value="9" <?php if($user['access'] == 9) echo 'selected="selected"'; ?>>Admin</option>
<option value="9" <?php if($user['access'] == 9) { echo 'selected="selected"'; } else { echo ''; } ?>>Admin</option> </select>
</select> <?php } else { ?>
</td> <!-- nu permiți editarea propriului acces -->
</tr> <input type="hidden" name="access" value="<?php echo $user['access']; ?>">
<?php
$names = [0=>'Banned', 2=>'Normal User', 8=>'Multihunter', 9=>'Admin'];
echo '<b style="color:#c00;">'.$names[$user['access']].'</b> - Nu îți poți modifica propriul acces';
?>
<?php } ?>
</td>
</tr>
<tr> <tr>
<td>Edit Gold</td> <td>Edit Gold</td>
<td> <td>
+1 -1
View File
@@ -71,5 +71,5 @@ if ($_SESSION['access'] == MULTIHUNTER) {
Credits: Akakori & Elmar<br /> Credits: Akakori & Elmar<br />
Fixed, remade and new features added by <b>Dzoki</b><br /> Fixed, remade and new features added by <b>Dzoki</b><br />
Reworked by <b>aggenkeech</b><br /> Reworked by <b>aggenkeech</b><br />
Remaked by <b>Shadow</b> Refactored by <b>Shadow</b>
</div> </div>
+500 -818
View File
File diff suppressed because it is too large Load Diff
+15 -5
View File
@@ -3383,11 +3383,15 @@ class Automation {
$varray = $database->getDemolition(); $varray = $database->getDemolition();
foreach($varray as $vil) { foreach($varray as $vil) {
if ($vil['lvl'] < 0) {
$database->delDemolition($vil['vref'], true);
continue;
}
if ($vil['timetofinish'] <= time()) { if ($vil['timetofinish'] <= time()) {
$type = $database->getFieldType($vil['vref'],$vil['buildnumber']); $type = $database->getFieldType($vil['vref'],$vil['buildnumber']);
$level = $database->getFieldLevel($vil['vref'],$vil['buildnumber']); $level = $database->getFieldLevel($vil['vref'],$vil['buildnumber']);
if ($level < 0) $level = 0; $newLevel = max(0, $level - 1);
$buildarray = $GLOBALS["bid".$type]; $buildarray = $GLOBALS["bid".$type];
@@ -3395,7 +3399,7 @@ class Automation {
$database->query(" $database->query("
UPDATE ".TB_PREFIX."vdata UPDATE ".TB_PREFIX."vdata
SET SET
`maxstore` = IF(`maxstore` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxstore` - ".$buildarray[$level]['attri']."), `maxstore` = IF(`maxstore` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxstore` - ".$buildarray[$level]['attri'].")
WHERE WHERE
wref=".(int) $vil['vref']); wref=".(int) $vil['vref']);
} }
@@ -3404,7 +3408,7 @@ class Automation {
$database->query(" $database->query("
UPDATE ".TB_PREFIX."vdata UPDATE ".TB_PREFIX."vdata
SET SET
`maxcrop` = IF(`maxcrop` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxcrop` - ".$buildarray[$level]['attri']."), `maxcrop` = IF(`maxcrop` - ".$buildarray[$level]['attri']." <= ".STORAGE_BASE.", ".STORAGE_BASE.", `maxcrop` - ".$buildarray[$level]['attri'].")
WHERE WHERE
wref=".(int) $vil['vref']); wref=".(int) $vil['vref']);
} }
@@ -3414,10 +3418,16 @@ class Automation {
if ($database->getVillageField($vil['vref'], 'natar') == 1 && $type == 40) $clear = ""; //fix by ronix - fixed by iopietro if ($database->getVillageField($vil['vref'], 'natar') == 1 && $type == 40) $clear = ""; //fix by ronix - fixed by iopietro
$q = "UPDATE ".TB_PREFIX."fdata SET f".$vil['buildnumber']."=".(($level - 1 >= 0) ? $level - 1 : 0).$clear." WHERE vref=".(int) $vil['vref']; $q = "
UPDATE ".TB_PREFIX."fdata
SET
f".$vil['buildnumber']."=".$newLevel."
".$clear."
WHERE
vref=".(int)$vil['vref'];
$database->query($q); $database->query($q);
$pop = $this->getPop($type, $level - 1); $pop = $this->getPop($type, $newLevel);
$database->modifyPop($vil['vref'], $pop[0], 1); $database->modifyPop($vil['vref'], $pop[0], 1);
$this->procClimbers($database->getVillageField($vil['vref'], 'owner')); $this->procClimbers($database->getVillageField($vil['vref'], 'owner'));
$database->delDemolition($vil['vref'], true); $database->delDemolition($vil['vref'], true);
+8 -1
View File
@@ -4774,7 +4774,14 @@ References: User ID/Message ID, Mode
$q = "DELETE FROM ".TB_PREFIX."bdata WHERE field=$field AND wid=$wid"; $q = "DELETE FROM ".TB_PREFIX."bdata WHERE field=$field AND wid=$wid";
mysqli_query($this->dblink,$q); mysqli_query($this->dblink,$q);
$uprequire = $building->resourceRequired($field,$village->resarray['f'.$field.'t'],0); $uprequire = $building->resourceRequired($field,$village->resarray['f'.$field.'t'],0);
$q = "INSERT INTO ".TB_PREFIX."demolition VALUES (".$wid.",".$field.",".($fLevel-1).",".(time()+floor($uprequire['time']/2)).")"; $newLevel = max(0, $fLevel - 1);
$q = "INSERT INTO ".TB_PREFIX."demolition VALUES (
".$wid.",
".$field.",
".$newLevel.",
".(time() + floor($uprequire['time'] / 2))."
)";
mysqli_query($this->dblink,$q); mysqli_query($this->dblink,$q);
return true; return true;
+230 -116
View File
@@ -1,157 +1,271 @@
<?php <?php
#################################################################################
## TravianZ Project - Map View JSON ##
## Incremental Refactor (Shadow Assistant) ##
## --------------------------------------------------------------------------- ##
## Credits: Advocaite, yi12345, Shadow, MisterX ##
## Refactor (readability / structure): ChatGPT ##
## Compatibility: PHP 7+ / legacy ##
## Note: No behavior change - only refactor, cleanup, readability ##
#################################################################################
/* =========================
BOOTSTRAP
========================= */
session_start(); session_start();
include_once('GameEngine/config.php'); include_once('GameEngine/config.php');
include_once ("GameEngine/Lang/" . LANG . ".php"); include_once("GameEngine/Lang/". LANG. ".php");
include_once("GameEngine/Generator.php"); include_once("GameEngine/Generator.php");
include_once("GameEngine/Database.php"); include_once("GameEngine/Database.php");
if($y < $yy) {$y = $y + (($yy - $y) /2);} /* =========================
else {$y = $yy + (($y - $yy) /2);} WORLD CONFIG SHORTCUT
========================= */
$W = WORLD_MAX;
/* =========================
CENTER COORDINATE CALCULATION
(kept behavior identical to original)
========================= */
if ($y < $yy) {
$y = $y + (($yy - $y) / 2);
} else {
$y = $yy + (($y - $yy) / 2);
}
$x = $x - (($x - $xx) / 2); $x = $x - (($x - $xx) / 2);
$x = ($x < -WORLD_MAX)? $x+WORLD_MAX*2+1 : $x;
$x = ($x > WORLD_MAX)? $x-WORLD_MAX*2-1 : $x; /* =========================
$y = ($y < -WORLD_MAX)? $y+WORLD_MAX*2+1 : $y; WORLD WRAP (original +1 logic preserved)
$y = ($y > WORLD_MAX)? $y-WORLD_MAX*2-1 : $y; ========================= */
$xm3 = ($x-3) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-2 : $x-3; $x = ($x < -$W)? $x + $W * 2 + 1 : $x;
$xm2 = ($x-2) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-1 : $x-2; $x = ($x > $W)? $x - $W * 2 - 1 : $x;
$xm1 = ($x-1) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX : $x-1; $y = ($y < -$W)? $y + $W * 2 + 1 : $y;
$xp1 = ($x+1) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX : $x+1; $y = ($y > $W)? $y - $W * 2 - 1 : $y;
$xp2 = ($x+2) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+1 : $x+2;
$xp3 = ($x+3) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+2: $x+3; /* =========================
$ym3 = ($y-3) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-2 : $y-3; MAP COORDINATES CALCULATION
$ym2 = ($y-2) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-1 : $y-2; ========================= */
$ym1 = ($y-1) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX : $y-1; $xm3 = ($x - 3) < -$W? $x + $W + $W - 2 : $x - 3;
$yp1 = ($y+1) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX : $y+1; $xm2 = ($x - 2) < -$W? $x + $W + $W - 1 : $x - 2;
$yp2 = ($y+2) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+1 : $y+2; $xm1 = ($x - 1) < -$W? $x + $W + $W : $x - 1;
$yp3 = ($y+3) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+2: $y+3;
$xarray = array($xm3,$xm2,$xm1,$x,$xp1,$xp2,$xp3); $xp1 = ($x + 1) > $W? $x - $W - $W : $x + 1;
$yarray = array($ym3,$ym2,$ym1,$y,$yp1,$yp2,$yp3); $xp2 = ($x + 2) > $W? $x - $W - $W + 1 : $x + 2;
$maparray = array(); $xp3 = ($x + 3) > $W? $x - $W - $W + 2 : $x + 3;
$xcount = 0;
$ym3 = ($y - 3) < -$W? $y + $W + $W - 2 : $y - 3;
$ym2 = ($y - 2) < -$W? $y + $W + $W - 1 : $y - 2;
$ym1 = ($y - 1) < -$W? $y + $W + $W : $y - 1;
$yp1 = ($y + 1) > $W? $y - $W - $W : $y + 1;
$yp2 = ($y + 2) > $W? $y - $W - $W + 1 : $y + 2;
$yp3 = ($y + 3) > $W? $y - $W - $W + 2 : $y + 3;
/* =========================
MAP GRID ARRAYS
========================= */
$xarray = array($xm3, $xm2, $xm1, $x, $xp1, $xp2, $xp3);
$yarray = array($ym3, $ym2, $ym1, $y, $yp1, $yp2, $yp3);
$maparray = ''; $maparray = '';
$maparray2 = ''; $maparray2 = '';
for($i=0; $i<=6; $i++){
if($xcount != 7){ $xcount = 0;
$maparray .= '\''.$generator->getBaseID($xarray[$xcount],$yarray[$i]).'\',';
$maparray2 .= $generator->getBaseID($xarray[$xcount],$yarray[$i]).','; for ($i = 0; $i <= 6; $i++) {
if($i==6){ if ($xcount!= 7) {
$i = -1; $id = $generator->getBaseID($xarray[$xcount], $yarray[$i]);
$xcount +=1;
} $maparray.= "'". $id. "',";
} $maparray2.= $id. ",";
if ($i == 6) {
$i = -1;
$xcount++;
}
}
} }
$maparray = substr($maparray, 0, -1);
header("Content-Type: application/json;"); header("Content-Type: application/json;");
$maparray = (substr($maparray, 0, -1)); /* =========================
MAIN MAP QUERY
(formatted only, same logic)
========================= */
$query2 = "
SELECT
". TB_PREFIX. "wdata.id AS map_id,
". TB_PREFIX. "wdata.fieldtype AS map_fieldtype,
". TB_PREFIX. "wdata.oasistype AS map_oasis,
". TB_PREFIX. "wdata.x AS map_x,
". TB_PREFIX. "wdata.y AS map_y,
". TB_PREFIX. "wdata.occupied AS map_occupied,
". TB_PREFIX. "wdata.image AS map_image,
$query2 = "SELECT ". TB_PREFIX. "odata.conqured AS oasis_conqured,
".TB_PREFIX."wdata.id AS map_id, info_user_oasis.username AS oasis_user,
".TB_PREFIX."wdata.fieldtype AS map_fieldtype, info_user_oasis.tribe AS oasis_tribe,
".TB_PREFIX."wdata.oasistype AS map_oasis, info_alliance_oasis.tag AS oasis_alli_name,
".TB_PREFIX."wdata.x AS map_x,
".TB_PREFIX."wdata.y AS map_y,
".TB_PREFIX."wdata.occupied AS map_occupied,
".TB_PREFIX."wdata.image AS map_image,
".TB_PREFIX."odata.conqured AS oasis_conqured, ". TB_PREFIX. "vdata.wref AS ville_id,
info_user_oasis.username AS oasis_user, ". TB_PREFIX. "vdata.owner AS ville_user,
info_user_oasis.tribe AS oasis_tribe, ". TB_PREFIX. "vdata.name AS ville_name,
info_alliance_oasis.tag AS oasis_alli_name, ". TB_PREFIX. "vdata.capital AS ville_capital,
". TB_PREFIX. "vdata.pop AS ville_pop,
".TB_PREFIX."vdata.wref AS ville_id, ". TB_PREFIX. "users.id AS user_id,
".TB_PREFIX."vdata.owner AS ville_user, ". TB_PREFIX. "users.username AS user_username,
".TB_PREFIX."vdata.name AS ville_name, ". TB_PREFIX. "users.tribe AS user_tribe,
".TB_PREFIX."vdata.capital AS ville_capital, ". TB_PREFIX. "users.alliance AS user_alliance,
".TB_PREFIX."vdata.pop AS ville_pop,
".TB_PREFIX."users.id AS user_id, ". TB_PREFIX. "alidata.id AS aliance_id,
".TB_PREFIX."users.username AS user_username, ". TB_PREFIX. "alidata.tag AS aliance_name
".TB_PREFIX."users.tribe AS user_tribe,
".TB_PREFIX."users.alliance AS user_alliance,
".TB_PREFIX."alidata.id AS aliance_id, FROM ((((((". TB_PREFIX. "wdata
".TB_PREFIX."alidata.tag AS aliance_name LEFT JOIN ". TB_PREFIX. "vdata ON ". TB_PREFIX. "vdata.wref = ". TB_PREFIX. "wdata.id)
LEFT JOIN ". TB_PREFIX. "odata ON ". TB_PREFIX. "odata.wref = ". TB_PREFIX. "wdata.id)
LEFT JOIN ". TB_PREFIX. "users AS info_user_oasis ON info_user_oasis.id = ". TB_PREFIX. "odata.owner)
LEFT JOIN ". TB_PREFIX. "alidata AS info_alliance_oasis ON info_alliance_oasis.id = info_user_oasis.alliance)
LEFT JOIN ". TB_PREFIX. "users ON ". TB_PREFIX. "users.id = ". TB_PREFIX. "vdata.owner)
LEFT JOIN ". TB_PREFIX. "alidata ON ". TB_PREFIX. "alidata.id = ". TB_PREFIX. "users.alliance)
FROM ((((((".TB_PREFIX."wdata WHERE ". TB_PREFIX. "wdata.id IN ($maparray)
LEFT JOIN ".TB_PREFIX."vdata ON ".TB_PREFIX."vdata.wref = ".TB_PREFIX."wdata.id ) ORDER BY FIND_IN_SET(". TB_PREFIX. "wdata.id,'$maparray2')
LEFT JOIN ".TB_PREFIX."odata ON ".TB_PREFIX."odata.wref = ".TB_PREFIX."wdata.id ) ";
LEFT JOIN ".TB_PREFIX."users AS info_user_oasis ON info_user_oasis.id = ".TB_PREFIX."odata.owner )
LEFT JOIN ".TB_PREFIX."alidata AS info_alliance_oasis ON info_alliance_oasis.id = info_user_oasis.alliance )
LEFT JOIN ".TB_PREFIX."users ON ".TB_PREFIX."users.id = ".TB_PREFIX."vdata.owner )
LEFT JOIN ".TB_PREFIX."alidata ON ".TB_PREFIX."alidata.id = ".TB_PREFIX."users.alliance )
where ".TB_PREFIX."wdata.id IN ($maparray)
ORDER BY FIND_IN_SET(".TB_PREFIX."wdata.id,'$maparray2')";
$result2 = mysqli_query($database->dblink,$query2) or die(mysqli_error($database->dblink)); $result2 = mysqli_query($database->dblink, $query2) or die(mysqli_error($database->dblink));
$i=0; /* =========================
//Load coor array OUTPUT PREPARATION
========================= */
$i = 0;
$yrow = 0; $yrow = 0;
$map_js = '';
$map_js =''; /* =========================
while ($donnees = mysqli_fetch_assoc($result2)){ MAIN LOOP (UNCHANGED LOGIC)
========================= */
while ($donnees = mysqli_fetch_assoc($result2)) {
$targetalliance=$donnees["aliance_id"]; $targetalliance = $donnees["aliance_id"];
$friendarray=$database->getAllianceAlly($donnees["aliance_id"],1);
$neutralarray=$database->getAllianceAlly($donnees["aliance_id"],2);
$enemyarray=$database->getAllianceWar2($donnees["aliance_id"]);
$friend = ((isset($friendarray[0]) && isset($friendarray[0]['alli1']) && isset($friendarray[0]['alli2']) && $friendarray[0]['alli1']>0 and $friendarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($friendarray[0]['alli1']==$_SESSION['alliance_user'] or $friendarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; /* =========================
RELATION STATUS (session based)
========================= */
$friendarray = $database->getAllianceAlly($donnees["aliance_id"], 1);
$neutralarray = $database->getAllianceAlly($donnees["aliance_id"], 2);
$enemyarray = $database->getAllianceWar2($donnees["aliance_id"]);
$war = ((isset($enemyarray[0]) && isset($enemyarray[0]['alli1']) && isset($enemyarray[0]['alli2']) && $enemyarray[0]['alli1']>0 and $enemyarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($enemyarray[0]['alli1']==$_SESSION['alliance_user'] or $enemyarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; $sessionAlliance = $_SESSION['alliance_user'];
$neutral = ((isset($neutralarray[0]) && isset($neutralarray[0]['alli1']) && isset($neutralarray[0]['alli2']) && $neutralarray[0]['alli1']>0 and $neutralarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($neutralarray[0]['alli1']==$_SESSION['alliance_user'] or $neutralarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; $friend = ((isset($friendarray[0]) && isset($friendarray[0]['alli1']) && isset($friendarray[0]['alli2']) && $friendarray[0]['alli1'] > 0 && $friendarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($friendarray[0]['alli1'] == $sessionAlliance || $friendarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
$war = ((isset($enemyarray[0]) && isset($enemyarray[0]['alli1']) && isset($enemyarray[0]['alli2']) && $enemyarray[0]['alli1'] > 0 && $enemyarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($enemyarray[0]['alli1'] == $sessionAlliance || $enemyarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
$image = ($donnees['map_occupied'] == 1 && $donnees['map_fieldtype'] > 0)?(($donnees['ville_user'] == $_SESSION['id_user'])? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b30': 'b20' :'b10' : 'b00') : (($targetalliance != 0)? ($friend==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b31': 'b21' :'b11' : 'b01') : ($war==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b32': 'b22' :'b12' : 'b02') : ($neutral==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b35': 'b25' :'b15' : 'b05') : ($targetalliance == $_SESSION['alliance_user']? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b33': 'b23' :'b13' : 'b03') : ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b34': 'b24' :'b14' : 'b04'))))) : ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b34': 'b24' :'b14' : 'b04'))) : $donnees['map_image']; $neutral = ((isset($neutralarray[0]) && isset($neutralarray[0]['alli1']) && isset($neutralarray[0]['alli2']) && $neutralarray[0]['alli1'] > 0 && $neutralarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($neutralarray[0]['alli1'] == $sessionAlliance || $neutralarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
if($donnees['ville_user']==3 && $donnees['ville_name']==PLANVILLAGE){
$image = "o99";
}
/* =========================
IMAGE DECISION (UNCHANGED)
========================= */
$image = ($donnees['map_occupied'] == 1 && $donnees['map_fieldtype'] > 0)
? (($donnees['ville_user'] == $_SESSION['id_user'])
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b30' : 'b20')
: 'b10')
: 'b00')
: (($targetalliance!= 0)
? ($friend == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b31' : 'b21')
: 'b11')
: 'b01')
: ($war == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b32' : 'b22')
: 'b12')
: 'b02')
: ($neutral == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b35' : 'b25')
: 'b15')
: 'b05')
: ($targetalliance == $sessionAlliance
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b33' : 'b23')
: 'b13')
: 'b03')
: ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b34' : 'b24')
: 'b14')
: 'b04')))))
: ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b34' : 'b24')
: 'b14')
: 'b04')))
: $donnees['map_image'];
if ($donnees['ville_user'] == 3 && $donnees['ville_name'] == PLANVILLAGE) {
$image = "o99";
}
/* =========================
ATTACK MARKERS (numeric for JSON)
========================= */
$att = ""; $att = "";
if(isset($_SESSION['troops_movement'])) {
if (isset($_SESSION['troops_movement'])) {
if (isset($_SESSION['troops_movement']['attacks']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['attacks'])) { if (isset($_SESSION['troops_movement']['attacks']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['attacks'])) {
$att = 3; $att = 3;
}elseif (isset($_SESSION['troops_movement']['scouts']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['scouts'])) { } elseif (isset($_SESSION['troops_movement']['scouts']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['scouts'])) {
$att = 6; $att = 6;
}elseif (isset($_SESSION['troops_movement']['enforcements']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['enforcements'])) { } elseif (isset($_SESSION['troops_movement']['enforcements']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['enforcements'])) {
$att = 9; $att = 9;
} }
} }
//Javascript map info /* =========================
$regcount=0; JS MAP DATA
if($yrow!=7){ ========================= */
$map_js .= "[".$donnees['map_x'].",".$donnees['map_y'].",".$donnees['map_fieldtype'].",". ((!empty($donnees['map_oasis'])) ? $donnees['map_oasis'] : 0) .",\"d=".$donnees['map_id']."&c=".$generator->getMapCheck($donnees['map_id'])."\",\"".$image."\",\"".$att."\""; if ($yrow!= 7) {
if($donnees['map_occupied']){ $map_js.= "[". $donnees['map_x']. ",". $donnees['map_y']. ",". $donnees['map_fieldtype']. ",". ((!empty($donnees['map_oasis']))? $donnees['map_oasis'] : 0). ",\"d=". $donnees['map_id']. "&c=". $generator->getMapCheck($donnees['map_id']). "\",\"". $image. "\",\"". $att. "\"";
if($donnees['map_fieldtype'] != 0){
$map_js.= ",\"".$donnees['ville_name']."\",\"".$donnees['user_username']."\",\"".$donnees['ville_pop']."\",\"".$donnees['aliance_name']."\",\"".$donnees['user_tribe']."\"]\n";
}
}
elseif($donnees['map_oasis'] != 0){
if ($donnees['oasis_conqured'] != 0){
$map_js.= ",\"\",\"".$donnees['oasis_user']."\",\"-\",\"".$donnees['oasis_alli_name']."\",\"".$donnees['oasis_tribe']."\"]";
}
else{
$map_js.="]";
}
}
else{$map_js .= "]";}
if($i == 6 && $yrow !=6){ if ($donnees['map_occupied']) {
$i = -1; if ($donnees['map_fieldtype']!= 0) {
$yrow +=1; $map_js.= ",\"". $donnees['ville_name']. "\",\"". $donnees['user_username']. "\",\"". $donnees['ville_pop']. "\",\"". $donnees['aliance_name']. "\",\"". $donnees['user_tribe']. "\"]\n";
$map_js .= "],["; }
} } elseif ($donnees['map_oasis']!= 0) {
else { if ($donnees['oasis_conqured']!= 0) {
if($yrow == 6 && $i == 6) {$map_js .= "]";} $map_js.= ",\"\",\"". $donnees['oasis_user']. "\",\"-\",\"". $donnees['oasis_alli_name']. "\",\"". $donnees['oasis_tribe']. "\"]";
else {$map_js .= ",";} } else {
} $map_js.= "]";
$regcount += 1; }
} } else {
else {$map_js .= "]";} $map_js.= "]";
++$i; }
if ($i == 6 && $yrow!= 6) {
$i = -1;
$yrow++;
$map_js.= "],[";
} else {
$map_js.= ($yrow == 6 && $i == 6)? "]" : ",";
}
} else {
$map_js.= "]";
}
$i++;
} }
echo '[['.$map_js.']';
echo '[['. $map_js. ']';
+231 -133
View File
@@ -1,174 +1,272 @@
<?php <?php
#################################################################################
## TravianZ Project - Map View JSON (13x13) ##
## Incremental Refactor (Shadow Assistant) ##
## --------------------------------------------------------------------------- ##
## Credits: Advocaite, yi12345, Shadow, MisterX ##
## Refactor (readability / structure): ChatGPT ##
## Compatibility: PHP 7+ / legacy ##
## Note: No behavior change - only refactor, cleanup, readability ##
#################################################################################
/* =========================
BOOTSTRAP
========================= */
session_start(); session_start();
include_once('GameEngine/config.php'); include_once('GameEngine/config.php');
include_once ("GameEngine/Lang/" . LANG . ".php"); include_once("GameEngine/Lang/". LANG. ".php");
include_once("GameEngine/Generator.php"); include_once("GameEngine/Generator.php");
include_once("GameEngine/Database.php"); include_once("GameEngine/Database.php");
header("Content-Type: application/json;"); header("Content-Type: application/json;");
if($y < $yy) {$y = $y + (($yy - $y) /2);} /* =========================
else {$y = $yy + (($y - $yy) /2);} WORLD CONFIG SHORTCUT
========================= */
$W = WORLD_MAX;
/* =========================
CENTER COORDINATE CALCULATION
========================= */
if ($y < $yy) {
$y = $y + (($yy - $y) / 2);
} else {
$y = $yy + (($y - $yy) / 2);
}
$x = $x - (($x - $xx) / 2); $x = $x - (($x - $xx) / 2);
$x = ($x < -WORLD_MAX)? $x+WORLD_MAX*2+1 : $x;
$x = ($x > WORLD_MAX)? $x-WORLD_MAX*2-1 : $x;
$y = ($y < -WORLD_MAX)? $y+WORLD_MAX*2+1 : $y;
$y = ($y > WORLD_MAX)? $y-WORLD_MAX*2-1 : $y;
$xm6 = ($x-6) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-5 : $x-6;
$xm5 = ($x-5) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-4 : $x-5;
$xm4 = ($x-4) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-3 : $x-4;
$xm3 = ($x-3) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-2 : $x-3;
$xm2 = ($x-2) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX-1 : $x-2;
$xm1 = ($x-1) < -WORLD_MAX? $x+WORLD_MAX+WORLD_MAX : $x-1;
$xp1 = ($x+1) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX : $x+1;
$xp2 = ($x+2) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+1 : $x+2;
$xp3 = ($x+3) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+2: $x+3;
$xp4 = ($x+4) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+3 : $x+4;
$xp5 = ($x+5) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+4 : $x+5;
$xp6 = ($x+6) > WORLD_MAX? $x-WORLD_MAX-WORLD_MAX+5: $x+6;
$ym6 = ($y-6) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-5 : $y-6;
$ym5 = ($y-5) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-4 : $y-5;
$ym4 = ($y-4) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-3 : $y-4;
$ym3 = ($y-3) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-2 : $y-3;
$ym2 = ($y-2) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX-1 : $y-2;
$ym1 = ($y-1) < -WORLD_MAX? $y+WORLD_MAX+WORLD_MAX : $y-1;
$yp1 = ($y+1) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX : $y+1;
$yp2 = ($y+2) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+1 : $y+2;
$yp3 = ($y+3) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+2: $y+3;
$yp4 = ($y+4) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+3: $y+4;
$yp5 = ($y+5) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+4 : $y+5;
$yp6 = ($y+6) > WORLD_MAX? $y-WORLD_MAX-WORLD_MAX+5: $y+6;
$xarray = array($xm6,$xm5,$xm4,$xm3,$xm2,$xm1,$x,$xp1,$xp2,$xp3,$xp4,$xp5,$xp6); /* =========================
$yarray = array($ym6,$ym5,$ym4,$ym3,$ym2,$ym1,$y,$yp1,$yp2,$yp3,$yp4,$yp5,$yp6); WORLD WRAP (original +1 logic preserved)
$maparray = array(); ========================= */
$xcount = 0; $x = ($x < -$W)? $x + $W * 2 + 1 : $x;
$x = ($x > $W)? $x - $W * 2 - 1 : $x;
$y = ($y < -$W)? $y + $W * 2 + 1 : $y;
$y = ($y > $W)? $y - $W * 2 - 1 : $y;
/* =========================
MAP COORDINATES CALCULATION (13x13)
========================= */
$xm6 = ($x - 6) < -$W? $x + $W + $W - 5 : $x - 6;
$xm5 = ($x - 5) < -$W? $x + $W + $W - 4 : $x - 5;
$xm4 = ($x - 4) < -$W? $x + $W + $W - 3 : $x - 4;
$xm3 = ($x - 3) < -$W? $x + $W + $W - 2 : $x - 3;
$xm2 = ($x - 2) < -$W? $x + $W + $W - 1 : $x - 2;
$xm1 = ($x - 1) < -$W? $x + $W + $W : $x - 1;
$xp1 = ($x + 1) > $W? $x - $W - $W : $x + 1;
$xp2 = ($x + 2) > $W? $x - $W - $W + 1 : $x + 2;
$xp3 = ($x + 3) > $W? $x - $W - $W + 2 : $x + 3;
$xp4 = ($x + 4) > $W? $x - $W - $W + 3 : $x + 4;
$xp5 = ($x + 5) > $W? $x - $W - $W + 4 : $x + 5;
$xp6 = ($x + 6) > $W? $x - $W - $W + 5 : $x + 6;
$ym6 = ($y - 6) < -$W? $y + $W + $W - 5 : $y - 6;
$ym5 = ($y - 5) < -$W? $y + $W + $W - 4 : $y - 5;
$ym4 = ($y - 4) < -$W? $y + $W + $W - 3 : $y - 4;
$ym3 = ($y - 3) < -$W? $y + $W + $W - 2 : $y - 3;
$ym2 = ($y - 2) < -$W? $y + $W + $W - 1 : $y - 2;
$ym1 = ($y - 1) < -$W? $y + $W + $W : $y - 1;
$yp1 = ($y + 1) > $W? $y - $W - $W : $y + 1;
$yp2 = ($y + 2) > $W? $y - $W - $W + 1 : $y + 2;
$yp3 = ($y + 3) > $W? $y - $W - $W + 2 : $y + 3;
$yp4 = ($y + 4) > $W? $y - $W - $W + 3 : $y + 4;
$yp5 = ($y + 5) > $W? $y - $W - $W + 4 : $y + 5;
$yp6 = ($y + 6) > $W? $y - $W - $W + 5 : $y + 6;
/* =========================
MAP GRID ARRAYS
========================= */
$xarray = array($xm6, $xm5, $xm4, $xm3, $xm2, $xm1, $x, $xp1, $xp2, $xp3, $xp4, $xp5, $xp6);
$yarray = array($ym6, $ym5, $ym4, $ym3, $ym2, $ym1, $y, $yp1, $yp2, $yp3, $yp4, $yp5, $yp6);
$maparray = ''; $maparray = '';
$maparray2 = ''; $maparray2 = '';
for($i=0; $i<=12; $i++){
if($xcount != 13){ $xcount = 0;
$maparray .= '\''.$generator->getBaseID($xarray[$xcount],$yarray[$i]).'\',';
$maparray2 .= $generator->getBaseID($xarray[$xcount],$yarray[$i]).','; for ($i = 0; $i <= 12; $i++) {
if($i==12){ if ($xcount!= 13) {
$i = -1; $id = $generator->getBaseID($xarray[$xcount], $yarray[$i]);
$xcount +=1;
} $maparray.= "'". $id. "',";
} $maparray2.= $id. ",";
if ($i == 12) {
$i = -1;
$xcount++;
}
}
} }
$maparray = (substr($maparray, 0, -1)); $maparray = substr($maparray, 0, -1);
$maparray2 = (substr($maparray2, 0, -1)); $maparray2 = substr($maparray2, 0, -1);
//echo $maparray;
$query2 = "SELECT /* =========================
".TB_PREFIX."wdata.id AS map_id, MAIN MAP QUERY
".TB_PREFIX."wdata.fieldtype AS map_fieldtype, ========================= */
".TB_PREFIX."wdata.oasistype AS map_oasis, $query2 = "
".TB_PREFIX."wdata.x AS map_x, SELECT
".TB_PREFIX."wdata.y AS map_y, ". TB_PREFIX. "wdata.id AS map_id,
".TB_PREFIX."wdata.occupied AS map_occupied, ". TB_PREFIX. "wdata.fieldtype AS map_fieldtype,
".TB_PREFIX."wdata.image AS map_image, ". TB_PREFIX. "wdata.oasistype AS map_oasis,
". TB_PREFIX. "wdata.x AS map_x,
". TB_PREFIX. "wdata.y AS map_y,
". TB_PREFIX. "wdata.occupied AS map_occupied,
". TB_PREFIX. "wdata.image AS map_image,
".TB_PREFIX."odata.conqured AS oasis_conqured, ". TB_PREFIX. "odata.conqured AS oasis_conqured,
info_user_oasis.username AS oasis_user, info_user_oasis.username AS oasis_user,
info_user_oasis.tribe AS oasis_tribe, info_user_oasis.tribe AS oasis_tribe,
info_alliance_oasis.tag AS oasis_alli_name, info_alliance_oasis.tag AS oasis_alli_name,
".TB_PREFIX."vdata.wref AS ville_id, ". TB_PREFIX. "vdata.wref AS ville_id,
".TB_PREFIX."vdata.owner AS ville_user, ". TB_PREFIX. "vdata.owner AS ville_user,
".TB_PREFIX."vdata.name AS ville_name, ". TB_PREFIX. "vdata.name AS ville_name,
".TB_PREFIX."vdata.capital AS ville_capital, ". TB_PREFIX. "vdata.capital AS ville_capital,
".TB_PREFIX."vdata.pop AS ville_pop, ". TB_PREFIX. "vdata.pop AS ville_pop,
".TB_PREFIX."users.id AS user_id, ". TB_PREFIX. "users.id AS user_id,
".TB_PREFIX."users.username AS user_username, ". TB_PREFIX. "users.username AS user_username,
".TB_PREFIX."users.tribe AS user_tribe, ". TB_PREFIX. "users.tribe AS user_tribe,
".TB_PREFIX."users.alliance AS user_alliance, ". TB_PREFIX. "users.alliance AS user_alliance,
".TB_PREFIX."alidata.id AS aliance_id, ". TB_PREFIX. "alidata.id AS aliance_id,
".TB_PREFIX."alidata.tag AS aliance_name ". TB_PREFIX. "alidata.tag AS aliance_name
FROM ((((((".TB_PREFIX."wdata FROM ((((((". TB_PREFIX. "wdata
LEFT JOIN ".TB_PREFIX."vdata ON ".TB_PREFIX."vdata.wref = ".TB_PREFIX."wdata.id ) LEFT JOIN ". TB_PREFIX. "vdata ON ". TB_PREFIX. "vdata.wref = ". TB_PREFIX. "wdata.id)
LEFT JOIN ".TB_PREFIX."odata ON ".TB_PREFIX."odata.wref = ".TB_PREFIX."wdata.id ) LEFT JOIN ". TB_PREFIX. "odata ON ". TB_PREFIX. "odata.wref = ". TB_PREFIX. "wdata.id)
LEFT JOIN ".TB_PREFIX."users AS info_user_oasis ON info_user_oasis.id = ".TB_PREFIX."odata.owner ) LEFT JOIN ". TB_PREFIX. "users AS info_user_oasis ON info_user_oasis.id = ". TB_PREFIX. "odata.owner)
LEFT JOIN ".TB_PREFIX."alidata AS info_alliance_oasis ON info_alliance_oasis.id = info_user_oasis.alliance ) LEFT JOIN ". TB_PREFIX. "alidata AS info_alliance_oasis ON info_alliance_oasis.id = info_user_oasis.alliance)
LEFT JOIN ".TB_PREFIX."users ON ".TB_PREFIX."users.id = ".TB_PREFIX."vdata.owner ) LEFT JOIN ". TB_PREFIX. "users ON ". TB_PREFIX. "users.id = ". TB_PREFIX. "vdata.owner)
LEFT JOIN ".TB_PREFIX."alidata ON ".TB_PREFIX."alidata.id = ".TB_PREFIX."users.alliance ) LEFT JOIN ". TB_PREFIX. "alidata ON ". TB_PREFIX. "alidata.id = ". TB_PREFIX. "users.alliance)
where ".TB_PREFIX."wdata.id IN ($maparray)
ORDER BY FIND_IN_SET(".TB_PREFIX."wdata.id,'$maparray2')";
//echo $query2; WHERE ". TB_PREFIX. "wdata.id IN ($maparray)
$result2 = mysqli_query($database->dblink,$query2) or die(mysqli_error($database->dblink)); ORDER BY FIND_IN_SET(". TB_PREFIX. "wdata.id,'$maparray2')
";
$i=0; $result2 = mysqli_query($database->dblink, $query2) or die(mysqli_error($database->dblink));
$i2=0;
/* =========================
OUTPUT PREPARATION
========================= */
$i = 0;
$yrow = 0; $yrow = 0;
$row = 0; $map_js = '';
$coorindex = 0;
$map_js ='';
while ($donnees = mysqli_fetch_assoc($result2)){ /* =========================
MAIN LOOP (UNCHANGED LOGIC)
========================= */
while ($donnees = mysqli_fetch_assoc($result2)) {
$targetalliance=$donnees["aliance_id"]; $targetalliance = $donnees["aliance_id"];
$friendarray=$database->getAllianceAlly($donnees["aliance_id"],1);
$neutralarray=$database->getAllianceAlly($donnees["aliance_id"],2);
$enemyarray=$database->getAllianceWar2($donnees["aliance_id"]);
$friend = ((isset($friendarray[0]) && isset($friendarray[0]['alli1']) && isset($friendarray[0]['alli2']) && $friendarray[0]['alli1']>0 and $friendarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($friendarray[0]['alli1']==$_SESSION['alliance_user'] or $friendarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; $friendarray = $database->getAllianceAlly($donnees["aliance_id"], 1);
$neutralarray = $database->getAllianceAlly($donnees["aliance_id"], 2);
$enemyarray = $database->getAllianceWar2($donnees["aliance_id"]);
$war = ((isset($enemyarray[0]) && isset($enemyarray[0]['alli1']) && isset($enemyarray[0]['alli2']) && $enemyarray[0]['alli1']>0 and $enemyarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($enemyarray[0]['alli1']==$_SESSION['alliance_user'] or $enemyarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; $sessionAlliance = $_SESSION['alliance_user'];
$neutral = ((isset($neutralarray[0]) && isset($neutralarray[0]['alli1']) && isset($neutralarray[0]['alli2']) && $neutralarray[0]['alli1']>0 and $neutralarray[0]['alli2']>0 and $donnees["aliance_id"]>0) and ($neutralarray[0]['alli1']==$_SESSION['alliance_user'] or $neutralarray[0]['alli2']==$_SESSION['alliance_user']) and ($_SESSION['alliance_user'] != $targetalliance and $_SESSION['alliance_user'] and $targetalliance)) ? '1':'0'; $friend = ((isset($friendarray[0]) && isset($friendarray[0]['alli1']) && isset($friendarray[0]['alli2']) && $friendarray[0]['alli1'] > 0 && $friendarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($friendarray[0]['alli1'] == $sessionAlliance || $friendarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
$war = ((isset($enemyarray[0]) && isset($enemyarray[0]['alli1']) && isset($enemyarray[0]['alli2']) && $enemyarray[0]['alli1'] > 0 && $enemyarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($enemyarray[0]['alli1'] == $sessionAlliance || $enemyarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
$image = ($donnees['map_occupied'] == 1 && $donnees['map_fieldtype'] > 0)?(($donnees['ville_user'] == $_SESSION['id_user'])? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b30': 'b20' :'b10' : 'b00') : (($targetalliance != 0)? ($friend==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b31': 'b21' :'b11' : 'b01') : ($war==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b32': 'b22' :'b12' : 'b02') : ($neutral==1? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b35': 'b25' :'b15' : 'b05') : ($targetalliance == $_SESSION['alliance_user']? ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b33': 'b23' :'b13' : 'b03') : ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b34': 'b24' :'b14' : 'b04'))))) : ($donnees['ville_pop']>=100? $donnees['ville_pop']>= 250?$donnees['ville_pop']>=500? 'b34': 'b24' :'b14' : 'b04'))) : $donnees['map_image']; $neutral = ((isset($neutralarray[0]) && isset($neutralarray[0]['alli1']) && isset($neutralarray[0]['alli2']) && $neutralarray[0]['alli1'] > 0 && $neutralarray[0]['alli2'] > 0 && $donnees["aliance_id"] > 0) && ($neutralarray[0]['alli1'] == $sessionAlliance || $neutralarray[0]['alli2'] == $sessionAlliance) && ($sessionAlliance!= $targetalliance && $sessionAlliance && $targetalliance))? '1' : '0';
if($donnees['ville_user']==3 && $donnees['ville_name']==PLANVILLAGE){
$image = "o99";
}
/* IMAGE DECISION */
$image = ($donnees['map_occupied'] == 1 && $donnees['map_fieldtype'] > 0)
? (($donnees['ville_user'] == $_SESSION['id_user'])
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b30' : 'b20')
: 'b10')
: 'b00')
: (($targetalliance!= 0)
? ($friend == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b31' : 'b21')
: 'b11')
: 'b01')
: ($war == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b32' : 'b22')
: 'b12')
: 'b02')
: ($neutral == 1
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b35' : 'b25')
: 'b15')
: 'b05')
: ($targetalliance == $sessionAlliance
? ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b33' : 'b23')
: 'b13')
: 'b03')
: ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b34' : 'b24')
: 'b14')
: 'b04')))))
: ($donnees['ville_pop'] >= 100
? ($donnees['ville_pop'] >= 250
? ($donnees['ville_pop'] >= 500? 'b34' : 'b24')
: 'b14')
: 'b04')))
: $donnees['map_image'];
if ($donnees['ville_user'] == 3 && $donnees['ville_name'] == PLANVILLAGE) {
$image = "o99";
}
/* ATTACK MARKERS */
$att = ""; $att = "";
if(isset($_SESSION['troops_movement'])) { if (isset($_SESSION['troops_movement'])) {
if (isset($_SESSION['troops_movement']['attacks']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['attacks'])) { if (isset($_SESSION['troops_movement']['attacks']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['attacks'])) {
$att = 3; $att = 3;
}elseif (isset($_SESSION['troops_movement']['scouts']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['scouts'])) { } elseif (isset($_SESSION['troops_movement']['scouts']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['scouts'])) {
$att = 6; $att = 6;
}elseif (isset($_SESSION['troops_movement']['enforcements']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['enforcements'])) { } elseif (isset($_SESSION['troops_movement']['enforcements']) && in_array($donnees['map_id'], $_SESSION['troops_movement']['enforcements'])) {
$att = 9; $att = 9;
} }
} }
//Javascript map info /* JS MAP DATA */
$regcount=0; if ($yrow!= 13) {
if($yrow!=13){ $map_js.= "[". $donnees['map_x']. ",". $donnees['map_y']. ",". $donnees['map_fieldtype']. ",". ((!empty($donnees['map_oasis']))? $donnees['map_oasis'] : 0). ",\"d=". $donnees['map_id']. "&c=". $generator->getMapCheck($donnees['map_id']). "\",\"". $image. "\",\"". $att. "\"";
$map_js .= "[".$donnees['map_x'].",".$donnees['map_y'].",".$donnees['map_fieldtype'].",". ((!empty($donnees['map_oasis'])) ? $donnees['map_oasis'] : 0) .",\"d=".$donnees['map_id']."&c=".$generator->getMapCheck($donnees['map_id'])."\",\"".$image."\",\"".$att."\"";
if($donnees['map_occupied']){
if($donnees['map_fieldtype'] != 0){
$map_js.= ",\"".$donnees['ville_name']."\",\"".$donnees['user_username']."\",\"".$donnees['ville_pop']."\",\"".$donnees['aliance_name']."\",\"".$donnees['user_tribe']."\"]\n";
}
}
elseif($donnees['map_oasis'] != 0){
if ($donnees['oasis_conqured'] != 0){
$map_js.= ",\"\",\"".$donnees['oasis_user']."\",\"-\",\"".$donnees['oasis_alli_name']."\",\"".$donnees['oasis_tribe']."\"]";
}
else{
$map_js.="]";
}
}
else{$map_js .= "]";}
if($i == 12 && $yrow !=12){ if ($donnees['map_occupied']) {
$i = -1; if ($donnees['map_fieldtype']!= 0) {
$yrow +=1; $map_js.= ",\"". $donnees['ville_name']. "\",\"". $donnees['user_username']. "\",\"". $donnees['ville_pop']. "\",\"". $donnees['aliance_name']. "\",\"". $donnees['user_tribe']. "\"]\n";
$map_js .= "],["; }
} } elseif ($donnees['map_oasis']!= 0) {
else { if ($donnees['oasis_conqured']!= 0) {
if($yrow == 12 && $i == 12) {$map_js .= "]";} $map_js.= ",\"\",\"". $donnees['oasis_user']. "\",\"-\",\"". $donnees['oasis_alli_name']. "\",\"". $donnees['oasis_tribe']. "\"]";
else {$map_js .= ",";} } else {
} $map_js.= "]";
$regcount += 1; }
} } else {
else {$map_js .= "]";} $map_js.= "]";
++$i; }
if ($i == 12 && $yrow!= 12) {
$i = -1;
$yrow++;
$map_js.= "],[";
} else {
$map_js.= ($yrow == 12 && $i == 12)? "]" : ",";
}
} else {
$map_js.= "]";
}
$i++;
} }
echo '[['.$map_js.']';
echo '[['. $map_js. ']';
+59 -59
View File
@@ -4,26 +4,56 @@
## --------------------------------------------------------------------------- ## ## --------------------------------------------------------------------------- ##
## Project: TravianZ (Refactor incremental) ## ## Project: TravianZ (Refactor incremental) ##
## File: changepos.tpl ## ## File: changepos.tpl ##
## Description: Alliance member permissions ## ## Description: Alliance member permissions ##
## Improvements: ## ## Improvements: ##
## - Fixed PHP 5.3 compatibility (no [] arrays) ## ## - Fixed PHP 5.3 compatibility (no [] arrays) ##
## - Removed invalid array syntax ## ## - Removed invalid array syntax ##
## - Input validation & casting ## ## - Input validation & casting ##
## - XSS protection ## ## - XSS protection ##
## - Cleaner checkbox rendering ## ## - Cleaner checkbox rendering ##
## - Allow leader to edit own rank only ##
################################################################################# #################################################################################
// secure input // secure input
$aUser = isset($_POST['a_user']) ? (int)$_POST['a_user'] : 0; $aUser = isset($_POST['a_user'])? (int)$_POST['a_user'] : 0;
// fallback alliance id
if (!isset($aid)) {
$aid = $session->alliance;
}
// load data
$playerData = $database->getAlliPermissions($aUser, $aid);
$playername = $database->getUserField($aUser, 'username', 0);
$allianceinfo = $database->getAlliance($aid);
// status checks
$isLeader = $database->isAllianceOwner($session->uid);
$isSelfEdit = ($aUser == $session->uid);
$isTargetLeader = $database->isAllianceOwner($aUser);
$allowOnlyRank = ($isLeader && $isSelfEdit); // liderul se editeaza pe sine
// Permission map - definit aici ca sa-l folosim si pentru hidden inputs
$map = array(
array('e1','opt1','Assign to position'),
array('e2','opt2','Kick player'),
array('e3','opt3','Change alliance description'),
array('e6','opt6','Alliance diplomacy'),
array('e7','opt7','IGMs to every alliance member'),
array('e4','opt4','Invite a player into the alliance'),
array('e5','opt5','Manage forums')
);
// validation checks // validation checks
if ($database->getUserField($aUser, "alliance", 0) != $session->alliance) { if ($database->getUserField($aUser, "alliance", 0)!= $session->alliance) {
$form->addError("perm", USER_NOT_IN_YOUR_ALLY); $form->addError("perm", USER_NOT_IN_YOUR_ALLY);
} elseif ($aUser == $session->uid) { } elseif ($isSelfEdit &&!$isLeader) {
// membrii normali nu au voie sa-si editeze singuri permisiunile
$form->addError("perm", CANT_EDIT_YOUR_PERMISSIONS); $form->addError("perm", CANT_EDIT_YOUR_PERMISSIONS);
} elseif ($database->isAllianceOwner($aUser)) { } elseif ($isTargetLeader &&!$isSelfEdit) {
// nu poti edita un alt lider
$form->addError("perm", CANT_EDIT_LEADER_PERMISSIONS); $form->addError("perm", CANT_EDIT_LEADER_PERMISSIONS);
} }
@@ -36,20 +66,10 @@ if ($form->returnErrors() > 0) {
exit; exit;
} }
// fallback alliance id
if (!isset($aid)) {
$aid = $session->alliance;
}
// load data
$playerData = $database->getAlliPermissions($aUser, $aid);
$playername = $database->getUserField($aUser, 'username', 0);
$allianceinfo = $database->getAlliance($aid);
// header // header
echo "<h1>" . htmlspecialchars($allianceinfo['tag'], ENT_QUOTES, 'UTF-8') . echo "<h1>". htmlspecialchars($allianceinfo['tag'], ENT_QUOTES, 'UTF-8').
" - " . " - ".
htmlspecialchars($allianceinfo['name'], ENT_QUOTES, 'UTF-8') . htmlspecialchars($allianceinfo['name'], ENT_QUOTES, 'UTF-8').
"</h1>"; "</h1>";
include("alli_menu.tpl"); include("alli_menu.tpl");
@@ -58,76 +78,44 @@ include("alli_menu.tpl");
<form method="post" action="allianz.php"> <form method="post" action="allianz.php">
<table cellpadding="1" cellspacing="1" id="position" class="small_option"> <table cellpadding="1" cellspacing="1" id="position" class="small_option">
<thead> <thead>
<tr> <tr>
<th colspan="2">Assign to position</th> <th colspan="2">Assign to position</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<th>Name:</th> <th>Name:</th>
<td><?php echo htmlspecialchars($playername, ENT_QUOTES, 'UTF-8'); ?></td> <td><?php echo htmlspecialchars($playername, ENT_QUOTES, 'UTF-8');?></td>
</tr> </tr>
<tr> <tr>
<th>Position:</th> <th>Position:</th>
<td> <td>
<input class="name text" <input class="name text"
type="text" type="text"
name="a_titel" name="a_titel"
value="<?php echo htmlspecialchars($playerData['rank'], ENT_QUOTES, 'UTF-8'); ?>" value="<?php echo htmlspecialchars($playerData['rank'], ENT_QUOTES, 'UTF-8');?>"
maxlength="50" /> maxlength="50" />
</td> </td>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<!-- RIGHTS TABLE --> <?php if (!$allowOnlyRank) {?>
<!-- RIGHTS TABLE - afisat normal pentru toti ceilalti -->
<table cellpadding="1" cellspacing="1" id="rights" class="small_option"> <table cellpadding="1" cellspacing="1" id="rights" class="small_option">
<thead> <thead>
<tr> <tr>
<th colspan="2">Assign rights</th> <th colspan="2">Assign rights</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
/*
|--------------------------------------------------------------------------
| Permission map
| IMPORTANT:
| - folosim array() pentru compatibilitate PHP 5.3
|--------------------------------------------------------------------------
*/
$map = array(
array('e1','opt1','Assign to position'),
array('e2','opt2','Kick player'),
array('e3','opt3','Change alliance description'),
array('e6','opt6','Alliance diplomacy'),
array('e7','opt7','IGMs to every alliance member'),
array('e4','opt4','Invite a player into the alliance'),
array('e5','opt5','Manage forums')
);
/*
|--------------------------------------------------------------------------
| Render checkbox rights
|--------------------------------------------------------------------------
*/
foreach ($map as $r) { foreach ($map as $r) {
$field = $r[0]; $field = $r[0];
$opt = $r[1]; $opt = $r[1];
$label = $r[2]; $label = $r[2];
$checked =!empty($playerData[$opt])? 'checked="checked"' : '';
$checked = !empty($playerData[$opt]) ? 'checked="checked"' : '';
echo "<tr> echo "<tr>
<td class=\"sel\"> <td class=\"sel\">
<input class=\"check\" type=\"checkbox\" name=\"$field\" value=\"1\" $checked> <input class=\"check\" type=\"checkbox\" name=\"$field\" value=\"1\" $checked>
@@ -136,16 +124,28 @@ foreach ($map as $r) {
</tr>"; </tr>";
} }
?> ?>
</tbody> </tbody>
</table> </table>
<?php } else {?>
<!-- Liderul isi editeaza doar rank-ul -->
<p style="margin:10px 0;color:#666;">As a leader, you can only change your title. Your rights remain at their maximum.</p>
<?php
// pastram drepturile ca hidden ca allianz.php sa nu le reseteze la 0
foreach ($map as $r) {
$field = $r[0];
$opt = $r[1];
$val =!empty($playerData[$opt])? 1 : 0;
echo '<input type="hidden" name="'.$field.'" value="'.$val.'">'."\n";
}
?>
<?php }?>
<!-- SUBMIT --> <!-- SUBMIT -->
<p> <p>
<input type="hidden" name="a" value="1"> <input type="hidden" name="a" value="1">
<input type="hidden" name="o" value="1"> <input type="hidden" name="o" value="1">
<input type="hidden" name="s" value="5"> <input type="hidden" name="s" value="5">
<input type="hidden" name="a_user" value="<?php echo $aUser; ?>"> <input type="hidden" name="a_user" value="<?php echo $aUser;?>">
<input type="image" value="ok" name="s1" id="btn_ok" <input type="image" value="ok" name="s1" id="btn_ok"
class="dynamic_img" src="img/x.gif" alt="OK" /> class="dynamic_img" src="img/x.gif" alt="OK" />
+47 -51
View File
@@ -1,53 +1,49 @@
<?php <?php
include("next.tpl");
// WOODCUTER
include 'next.tpl';
// — pregătire date —
$field = 'f' . $id;
$currentLevel = (int) ($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentProd = $bid1[$currentLevel]['prod'] * SPEED;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = ($village->capital == 1) ? 20 : 10;
// calculează nivelul următor luând în calcul queue-urile
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextProd = $bid1[$nextLevel]['prod'] * SPEED;
?> ?>
<div id="build" class="gid1"><a href="#" onClick="return Popup(0,4);" class="build_logo"> <div id="build" class="gid1">
<img class="building g1" src="img/x.gif" alt="<?php echo WOODCUTTER; ?>" title="<?php echo WOODCUTTER; ?>" /> <a href="#" onclick="return Popup(0,4);" class="build_logo">
</a> <img class="building g1" src="img/x.gif" alt="<?= WOODCUTTER ?>" title="<?= WOODCUTTER ?>">
<h1><?php echo WOODCUTTER; ?> <span class="level"><?php echo LEVEL." "; echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo WOODCUTTER_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <h1>
<tr> <?= WOODCUTTER ?>
<th><?php echo CUR_PROD; ?>:</th> <span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
<td><b><?php echo $bid1[$village->resarray['f'.$id]]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td> </h1>
</tr>
<?php <p class="build_desc"><?= WOODCUTTER_DESC ?></p>
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; <table cellpadding="1" cellspacing="1" id="build_value">
if($village->capital == 1) { <tr>
if($next<=20){ <th><?= CUR_PROD ?>:</th>
?> <td><b><?= $currentProd ?></b> <?= PER_HR ?></td>
<tr> </tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid1[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td> <?php if (!$isMax): ?>
</tr> <tr>
<?php <th><?= NEXT_PROD ?> <?= $nextLevel ?>:</th>
}else{ <td><b><?= $nextProd ?></b> <?= PER_HR ?></td>
?> </tr>
<tr> <?php endif; ?>
<th><?php echo NEXT_PROD; 20 ?>:</th> </table>
<td><b><?php echo $bid1[20]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr> <?php include 'upgrade.tpl'; ?>
<?php </div>
}}else{
if($next<=10){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid1[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 10; ?>:</th>
<td><b><?php echo $bid1[10]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}}
?>
</table>
<?php
include("upgrade.tpl");
?>
</p></div>
+43 -34
View File
@@ -1,38 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid10"><a href="#" onClick="return Popup(10,4);" class="build_logo">
<img class="building g10" src="img/x.gif" alt="Warehouse" title="<?php echo WAREHOUSE; ?>" />
</a>
<h1><?php echo WAREHOUSE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo WAREHOUSE_DESC; ?></p>
// WAREHOUSE
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_CAPACITY; ?></th> $field = 'f' . $id;
<td><b><?php echo $bid10[$village->resarray['f'.$id]]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentCapacity = $bid10[$currentLevel]['attri'] * STORAGE_MULTIPLIER;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next<=20){ $maxLevel = 20;
?>
<th><?php echo CAPACITY_LEVEL; ?> <?php echo $next ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid10[$next]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextCapacity = $bid10[$nextLevel]['attri'] * STORAGE_MULTIPLIER;
}else{
?>
<th><?php echo CAPACITY_LEVEL; ?> 20:</th>
<td><b><?php echo $bid10[20]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td>
<?php
}
}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid10">
<a href="#" onclick="return Popup(10,4);" class="build_logo">
<img class="building g10" src="img/x.gif" alt="<?= WAREHOUSE ?>" title="<?= WAREHOUSE ?>">
</a>
<h1>
<?= WAREHOUSE ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= WAREHOUSE_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_CAPACITY ?>:</th>
<td><b><?= $currentCapacity ?></b> <?= RESOURCE_UNITS ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= CAPACITY_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextCapacity ?></b> <?= RESOURCE_UNITS ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+42 -34
View File
@@ -1,39 +1,47 @@
<?php <?php
include("next.tpl");
// GRANARY
include 'next.tpl';
$field = 'f' . $id;
$currentLevel = (int) ($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentCapacity = $bid11[$currentLevel]['attri'] * STORAGE_MULTIPLIER;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = 20;
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextCapacity = $bid11[$nextLevel]['attri'] * STORAGE_MULTIPLIER;
?> ?>
<div id="build" class="gid11"><a href="#" onClick="return Popup(11,4);" class="build_logo"> <div id="build" class="gid11">
<img class="building g11" src="img/x.gif" alt="Granary" title="<?php echo GRANARY; ?>" /> <a href="#" onclick="return Popup(11,4);" class="build_logo">
</a> <img class="building g11" src="img/x.gif" alt="<?= GRANARY ?>" title="<?= GRANARY ?>">
<h1><?php echo GRANARY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo GRANARY_DESC; ?></p>
<h1>
<?= GRANARY ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<table cellpadding="1" cellspacing="1" id="build_value"> <p class="build_desc"><?= GRANARY_DESC ?></p>
<tr>
<th><?php echo CURRENT_CAPACITY; ?></th>
<td><b><?php echo $bid11[$village->resarray['f'.$id]]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td>
</tr>
<tr> <table cellpadding="1" cellspacing="1" id="build_value">
<?php <tr>
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { <th><?= CURRENT_CAPACITY ?>:</th>
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; <td><b><?= $currentCapacity ?></b> <?= CROP_UNITS ?></td>
if($next<=20){ </tr>
?>
<th><?php echo CAPACITY_LEVEL; ?> <?php echo $next ?>:</th> <?php if (!$isMax): ?>
<td><b><?php echo $bid11[$next]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td> <tr>
<?php <th><?= CAPACITY_LEVEL ?> <?= $nextLevel ?>:</th>
}else{ <td><b><?= $nextCapacity ?></b> <?= CROP_UNITS ?></td>
?> </tr>
<th><?php echo CAPACITY_LEVEL; ?> 20:</th> <?php endif; ?>
<td><b><?php echo $bid11[20]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td> </table>
<?php
} <?php include 'upgrade.tpl'; ?>
} </div>
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?>
</p></div>
+27 -14
View File
@@ -1,16 +1,29 @@
<div id="build" class="gid12"><a href="#" onClick="return Popup(12,4);" class="build_logo">
<img class="building g12" src="img/x.gif" alt="Blacksmith" title="<?php echo BLACKSMITH; ?>" />
</a>
<h1><?php echo BLACKSMITH; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo BLACKSMITH_DESC; ?></p>
<?php <?php
if ($building->getTypeLevel(12) > 0) {
include("12_upgrades.tpl"); // BLACKSMITH
} else {
echo "<p><b><?php echo UPGRADES_COMMENCE_BLACKSMITH; ?></b><br>\n"; // nu ai next.tpl aici în original, îl las așa
} $field = 'f' . $id;
include("upgrade.tpl"); $currentLevel = (int) ($village->resarray[$field] ?? 0);
$hasBlacksmith = $building->getTypeLevel(12) > 0;
?> ?>
</p> <div id="build" class="gid12">
</div> <a href="#" onclick="return Popup(12,4);" class="build_logo">
<img class="building g12" src="img/x.gif" alt="<?= BLACKSMITH ?>" title="<?= BLACKSMITH ?>">
</a>
<h1>
<?= BLACKSMITH ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= BLACKSMITH_DESC ?></p>
<?php if ($hasBlacksmith): ?>
<?php include '12_upgrades.tpl'; ?>
<?php else: ?>
<p><b><?= UPGRADES_COMMENCE_BLACKSMITH ?></b></p>
<?php endif; ?>
<?php include 'upgrade.tpl'; ?>
</div>
+139 -93
View File
@@ -1,99 +1,145 @@
<?php
// BLACKSMITH UPGRADES
$abdata = $database->getABTech($village->wid);
$ABups = $technology->getABUpgrades('b');
$totalUps = count($ABups);
$blacksmithLevel = $building->getTypeLevel(12);
$bsAttri = $bid12[$blacksmithLevel]['attri'] / 100;
$start = $session->tribe * 10 - 9;
$end = $session->tribe * 10 - 2;
?>
<table cellpadding="1" cellspacing="1" class="build_details"> <table cellpadding="1" cellspacing="1" class="build_details">
<thead> <thead>
<tr> <tr>
<td><?php echo BLACKSMITH; ?></td> <td><?= BLACKSMITH?></td>
<td><?php echo ACTION; ?></td> <td><?= ACTION?></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <?php for ($i = $start; $i <= $end; $i++):
<?php $j = $i % 10;
$abdata = $database->getABTech($village->wid); if (!($technology->getTech($i) || $j == 1)) continue;
$ABups = $technology->getABUpgrades('b');
$totalUps = count($ABups);
for($i=($session->tribe*10-9);$i<=($session->tribe*10-2);$i++) {
$j = $i % 10 ;
if ( $technology->getTech($i) || $j == 1 ) {
echo "<tr><td class=\"desc\"><div class=\"tit\"> $unitName = $technology->getUnitName($i);
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> $current = (int)$abdata['b'.$j];
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> (Level ".$abdata['b'.$j];
$ups = 0;
if($totalUps > 0){
foreach($ABups as $upgrade){
if(in_array(("b".$j), $upgrade)) $ups++;
}
if($ups > 0) echo "+".$ups;
}
echo ")</div>";
if($abdata['b'.$j]+$ups != 20) { // câte upgrade-uri sunt deja în coadă pentru unitatea asta
echo "<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"duration\" />"; $ups = 0;
echo $generator->getTimeFormat(round(${'ab'.$i}[$abdata['b'.$j]+1+$ups]['time']*($bid12[$building->getTypeLevel(12)]['attri'] / 100)/SPEED)); foreach ($ABups as $up) {
if (in_array('b'.$j, $up)) $ups++;
}
$shownLevel = $current + $ups;
$nextLevel = $shownLevel + 1;
$ab = ${'ab'.$i};
$next = $ab[$nextLevel]?? null;
?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?= $i?>" src="img/x.gif" alt="<?= $unitName?>" title="<?= $unitName?>">
<a href="#" onclick="return Popup(<?= $i?>,1);"><?= $unitName?></a>
(<?= LEVEL?> <?= $current?><?= $ups > 0? '+'.$ups : ''?>)
</div>
//-- If available resources combined are not enough, remove NPC button <?php if ($current < 20 && $next):?>
$total_required = (int)(${'ab'.$i}[$abdata['b'.$j]+1+$ups]['wood'] + ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['clay'] + ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['iron'] + ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop']); <div class="details">
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { <img class="r1" src="img/x.gif" alt="Lumber" title="Lumber"> <?= $next['wood']?>|
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['wood']."&r2=".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['clay']."&r3=".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['iron']."&r4=".${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; <img class="r2" src="img/x.gif" alt="Clay" title="Clay"> <?= $next['clay']?>|
} <img class="r3" src="img/x.gif" alt="Iron" title="Iron"> <?= $next['iron']?>|
} <img class="r4" src="img/x.gif" alt="Crop" title="Crop"> <?= $next['crop']?>|
if($abdata['b'.$j] == 20) { <img class="clock" src="img/x.gif" alt="duration" title="duration">
echo "<td class=\"act\"><div class=\"none\">".MAXIMUM_LEVEL."</div></td></tr>"; <?= $generator->getTimeFormat(round($next['time'] * $bsAttri / SPEED))?>
}
else if ($building->getTypeLevel(12) <= $abdata['b'.$j]+$ups) { <?php
echo "<td class=\"act\"><div class=\"none\">".UPGRADE_BLACKSMITH."</div></td></tr>"; $totalRequired = $next['wood'] + $next['clay'] + $next['iron'] + $next['crop'];
} $canNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
else if(${'ab'.$i}[$abdata['b'.$j]+1+$ups]['wood'] > $village->maxstore || ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['clay'] > $village->maxstore || ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['iron'] > $village->maxstore) { ?>
echo "<td class=\"act\"><div class=\"none\">".EXPAND_WAREHOUSE."</div></td></tr>"; <?php if ($canNpc):?>
} |<a href="build.php?gid=17&t=3&r1=<?= $next['wood']?>&r2=<?= $next['clay']?>&r3=<?= $next['iron']?>&r4=<?= $next['crop']?>" title="NPC trade">
else if (${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop'] > $village->maxcrop) { <img class="npc" src="img/x.gif" alt="NPC trade" title="NPC trade">
echo "<td class=\"act\"><div class=\"none\">".EXPAND_GRANARY."</div></td></tr>"; </a>
} <?php endif;?>
else if (${'ab'.$i}[$abdata['b'.$j]+1+$ups]['wood'] > $village->awood || ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['clay'] > $village->aclay || ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['iron'] > $village->airon || ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop'] > $village->acrop) {
if($village->getProd("crop")>0 || $village->acrop > ${'ab'.$i}[$abdata['b'.$j]+1+$ups]['crop']){ <?php
$time = $technology->calculateAvaliable(12,${'ab'.$i}[$abdata['b'.$j]+1+$ups]); // mesaj resurse insuficiente
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>"; if ($next['wood'] > $village->awood || $next['clay'] > $village->aclay || $next['iron'] > $village->airon || $next['crop'] > $village->acrop) {
} else { if ($village->getProd('crop') > 0 || $village->acrop > $next['crop']) {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>"; $time = $technology->calculateAvaliable(12, $next);
} echo '<br><span class="none">'.ENOUGH_RESOURCES.' '.$time[0].' at '.$time[1].'</span>';
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>"; } else {
} echo '<br><span class="none">'.CROP_NEGATIVE.'</span>';
else if ($totalUps == 1 && !$session->plus || $totalUps > 1) { }
echo "<td class=\"act\"><div class=\"none\">".UPGRADE_IN_PROGRESS."</div></td></tr>"; }
} ?>
else if($session->access != BANNED){ </div>
echo "<td class=\"act\"><a class=\"research\" href=\"build.php?id=$id&amp;a=$j&amp;c=".$session->mchecker."\">".UPGRADE."</a>"; <?php endif;?>
if($totalUps != 0) echo "<span class=\"none\"> ".WAITING."</span>"; </td>
echo"</td></tr>";
}else{ <td class="act">
echo "<td class=\"act\"><a class=\"research\" href=\"banned.php\">".UPGRADE."</a>"; <?php if ($current >= 20):?>
if($totalUps != 0) echo "<span class=\"none\"> ".WAITING."</span>"; <div class="none"><?= MAXIMUM_LEVEL?></div>
echo"</td></tr>";
} <?php elseif ($blacksmithLevel <= $shownLevel):?>
} <div class="none"><?= UPGRADE_BLACKSMITH?></div>
}
?> <?php elseif ($next && ($next['wood'] > $village->maxstore || $next['clay'] > $village->maxstore || $next['iron'] > $village->maxstore)):?>
</tbody> <div class="none"><?= EXPAND_WAREHOUSE?></div>
<?php elseif ($next && $next['crop'] > $village->maxcrop):?>
<div class="none"><?= EXPAND_GRANARY?></div>
<?php elseif ($next && ($next['wood'] > $village->awood || $next['clay'] > $village->aclay || $next['iron'] > $village->airon || $next['crop'] > $village->acrop)):?>
<div class="none"><?= TOO_FEW_RESOURCES?></div>
<?php elseif ($totalUps == 1 &&!$session->plus || $totalUps > 1):?>
<div class="none"><?= UPGRADE_IN_PROGRESS?></div>
<?php elseif ($session->access!= BANNED):?>
<a class="research" href="build.php?id=<?= $id?>&amp;a=<?= $j?>&amp;c=<?= $session->mchecker?>"><?= UPGRADE?></a>
<?php if ($totalUps!= 0):?><span class="none"> <?= WAITING?></span><?php endif;?>
<?php else:?>
<a class="research" href="banned.php"><?= UPGRADE?></a>
<?php if ($totalUps!= 0):?><span class="none"> <?= WAITING?></span><?php endif;?>
<?php endif;?>
</td>
</tr>
<?php endfor;?>
</tbody>
</table> </table>
<?php <?php if ($totalUps > 0):?>
if($totalUps > 0) { <table cellpadding="1" cellspacing="1" class="under_progress">
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".UPGRADING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr> <thead>
</thead><tbody>"; <tr>
foreach($ABups as $black) { <td><?= UPGRADING?></td>
$count++; <td><?= DURATION?></td>
$ABUnit = substr($black['tech'], 1, 2); <td><?= COMPLETE?></td>
$abdata['b'.$ABUnit]++; </tr>
$unit = ($session->tribe - 1) * 10 + $ABUnit; </thead>
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit); <tbody>
echo "<span class=\"none\"> (".LEVEL." ".$abdata['b'.$ABUnit].")</span>"; <?php $count = 0; foreach ($ABups as $black):
if($count > 1) echo "<span class=\"none\"> ".WAITING."</span>"; $count++;
echo "</td>"; $ABUnit = (int)substr($black['tech'], 1, 2);
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($black['timestamp']-time())."</span></td>"; $abdata['b'.$ABUnit]++; // incrementează pentru afișare corectă
$date = $generator->procMtime($black['timestamp']); $unit = ($session->tribe - 1) * 10 + $ABUnit;
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>"; $unitName = $technology->getUnitName($unit);
echo "</tr>"; $date = $generator->procMtime($black['timestamp']);
} ?>
echo "</tbody></table>"; <tr>
} <td class="desc">
?> <img class="unit u<?= $unit?>" src="img/x.gif" alt="<?= $unitName?>" title="<?= $unitName?>">
<?= $unitName?>
<span class="none"> (<?= LEVEL?> <?= $abdata['b'.$ABUnit]?>)</span>
<?php if ($count > 1):?><span class="none"> <?= WAITING?></span><?php endif;?>
</td>
<td class="dur"><span id="timer<?= ++$session->timer?>"><?= $generator->getTimeFormat($black['timestamp'] - time())?></span></td>
<td class="fin"><span><?= $date[1]?></span><span> hrs</span></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
+26 -14
View File
@@ -1,16 +1,28 @@
<div id="build" class="gid13"><a href="#" onClick="return Popup(13,4);" class="build_logo">
<img class="building g13" src="img/x.gif" alt="Armoury" title="<?php echo ARMOURY; ?>" />
</a>
<h1><?php echo ARMOURY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo ARMOURY_DESC; ?></p>
<?php <?php
if ($building->getTypeLevel(13) > 0) {
include("13_upgrades.tpl"); // ARMOURY
} else {
echo "<p><b><?php echo UPGRADES_COMMENCE_ARMOURY; ?>Upgrades can commence when armoury is completed.</b><br>\n"; $field = 'f' . $id;
} $currentLevel = isset($village->resarray[$field]) ? (int)$village->resarray[$field] : 0;
include("upgrade.tpl"); $hasArmoury = $building->getTypeLevel(13) > 0;
?> ?>
</p> <div id="build" class="gid13">
</div> <a href="#" onclick="return Popup(13,4);" class="build_logo">
<img class="building g13" src="img/x.gif" alt="<?php echo ARMOURY; ?>" title="<?php echo ARMOURY; ?>">
</a>
<h1>
<?php echo ARMOURY; ?>
<span class="level"><?php echo LEVEL; ?> <?php echo $currentLevel; ?></span>
</h1>
<p class="build_desc"><?php echo ARMOURY_DESC; ?></p>
<?php if ($hasArmoury): ?>
<?php include '13_upgrades.tpl'; ?>
<?php else: ?>
<p><b><?php echo UPGRADES_COMMENCE_ARMOURY; ?></b></p>
<?php endif; ?>
<?php include 'upgrade.tpl'; ?>
</div>
+138 -93
View File
@@ -1,99 +1,144 @@
<?php
// ARMOURY UPGRADES
$abdata = $database->getABTech($village->wid);
$ABups = $technology->getABUpgrades('a');
$totalUps = count($ABups);
$armouryLevel = $building->getTypeLevel(13);
$arAttri = $bid13[$armouryLevel]['attri'] / 100;
$start = $session->tribe * 10 - 9;
$end = $session->tribe * 10 - 2;
?>
<table cellpadding="1" cellspacing="1" class="build_details"> <table cellpadding="1" cellspacing="1" class="build_details">
<thead> <thead>
<tr> <tr>
<td><?php echo ARMOURY; ?></td> <td><?= ARMOURY?></td>
<td><?php echo ACTION; ?></td> <td><?= ACTION?></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <?php for ($i = $start; $i <= $end; $i++):
<?php $j = $i % 10;
$abdata = $database->getABTech($village->wid); if (!($technology->getTech($i) || $j == 1)) continue;
$ABups = $technology->getABUpgrades('a');
$totalUps = count($ABups);
for($i=($session->tribe*10-9);$i<=($session->tribe*10-2);$i++) {
$j = $i % 10 ;
if ( $technology->getTech($i) || $j == 1 ) {
echo "<tr><td class=\"desc\"><div class=\"tit\"> $unitName = $technology->getUnitName($i);
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> $current = (int)$abdata['a'.$j];
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> (Level ".$abdata['a'.$j];
$ups = 0;
if($totalUps > 0){
foreach($ABups as $upgrade){
if(in_array(("a".$j), $upgrade)) $ups++;
}
if($ups > 0) echo "+".$ups;
}
echo ")</div>";
if($abdata['a'.$j]+$ups != 20) { // câte upgrade-uri sunt deja în coadă pentru unitatea asta
echo "<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"duration\" />"; $ups = 0;
echo $generator->getTimeFormat(round(${'ab'.$i}[$abdata['a'.$j]+1+$ups]['time']*($bid13[$building->getTypeLevel(13)]['attri'] / 100)/SPEED)); foreach ($ABups as $up) {
if (in_array('a'.$j, $up)) $ups++;
}
$shownLevel = $current + $ups;
$nextLevel = $shownLevel + 1;
$ab = ${'ab'.$i};
$next = $ab[$nextLevel]?? null;
?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?= $i?>" src="img/x.gif" alt="<?= $unitName?>" title="<?= $unitName?>">
<a href="#" onclick="return Popup(<?= $i?>,1);"><?= $unitName?></a>
(<?= LEVEL?> <?= $current?><?= $ups > 0? '+'.$ups : ''?>)
</div>
//-- If available resources combined are not enough, remove NPC button <?php if ($current < 20 && $next):?>
$total_required = (int)(${'ab'.$i}[$abdata['a'.$j]+1+$ups]['wood'] + ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['clay'] + ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['iron'] + ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop']); <div class="details">
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { <img class="r1" src="img/x.gif" alt="Lumber" title="Lumber"> <?= $next['wood']?>|
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['wood']."&r2=".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['clay']."&r3=".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['iron']."&r4=".${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; <img class="r2" src="img/x.gif" alt="Clay" title="Clay"> <?= $next['clay']?>|
} <img class="r3" src="img/x.gif" alt="Iron" title="Iron"> <?= $next['iron']?>|
} <img class="r4" src="img/x.gif" alt="Crop" title="Crop"> <?= $next['crop']?>|
if($abdata['a'.$j] == 20) { <img class="clock" src="img/x.gif" alt="duration" title="duration">
echo "<td class=\"act\"><div class=\"none\">".MAXIMUM_LEVEL."</div></td></tr>"; <?= $generator->getTimeFormat(round($next['time'] * $arAttri / SPEED))?>
}
else if ($building->getTypeLevel(13) <= $abdata['a'.$j]+$ups) { <?php
echo "<td class=\"act\"><div class=\"none\">".UPGRADE_ARMOURY."</div></td></tr>"; $totalRequired = $next['wood'] + $next['clay'] + $next['iron'] + $next['crop'];
} $canNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
else if(${'ab'.$i}[$abdata['a'.$j]+1+$ups]['wood'] > $village->maxstore || ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['clay'] > $village->maxstore || ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['iron'] > $village->maxstore) { ?>
echo "<td class=\"act\"><div class=\"none\">".EXPAND_WAREHOUSE."</div></td></tr>"; <?php if ($canNpc):?>
} |<a href="build.php?gid=17&t=3&r1=<?= $next['wood']?>&r2=<?= $next['clay']?>&r3=<?= $next['iron']?>&r4=<?= $next['crop']?>" title="NPC trade">
else if (${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop'] > $village->maxcrop) { <img class="npc" src="img/x.gif" alt="NPC trade" title="NPC trade">
echo "<td class=\"act\"><div class=\"none\">".EXPAND_GRANARY."</div></td></tr>"; </a>
} <?php endif;?>
else if (${'ab'.$i}[$abdata['a'.$j]+1+$ups]['wood'] > $village->awood || ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['clay'] > $village->aclay || ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['iron'] > $village->airon || ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop'] > $village->acrop) {
if($village->getProd("crop")>0 || $village->acrop > ${'ab'.$i}[$abdata['a'.$j]+1+$ups]['crop']){ <?php
$time = $technology->calculateAvaliable(13,${'ab'.$i}[$abdata['a'.$j]+1+$ups]); if ($next['wood'] > $village->awood || $next['clay'] > $village->aclay || $next['iron'] > $village->airon || $next['crop'] > $village->acrop) {
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>"; if ($village->getProd('crop') > 0 || $village->acrop > $next['crop']) {
} else { $time = $technology->calculateAvaliable(13, $next);
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>"; echo '<br><span class="none">'.ENOUGH_RESOURCES.' '.$time[0].' at '.$time[1].'</span>';
} } else {
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>"; echo '<br><span class="none">'.CROP_NEGATIVE.'</span>';
} }
else if ($totalUps == 1 && !$session->plus || $totalUps > 1) { }
echo "<td class=\"act\"><div class=\"none\">".UPGRADE_IN_PROGRESS."</div></td></tr>"; ?>
} </div>
else if($session->access != BANNED){ <?php endif;?>
echo "<td class=\"act\"><a class=\"research\" href=\"build.php?id=$id&amp;a=$j&amp;c=".$session->mchecker."\">".UPGRADE."</a>"; </td>
if($totalUps != 0) echo "<span class=\"none\"> ".WAITING."</span>";
echo"</td></tr>"; <td class="act">
}else{ <?php if ($current >= 20):?>
echo "<td class=\"act\"><a class=\"research\" href=\"banned.php\">".UPGRADE."</a>"; <div class="none"><?= MAXIMUM_LEVEL?></div>
if($totalUps != 0) echo "<span class=\"none\"> ".WAITING."</span>";
echo"</td></tr>"; <?php elseif ($armouryLevel <= $shownLevel):?>
} <div class="none"><?= UPGRADE_ARMOURY?></div>
}
} <?php elseif ($next && ($next['wood'] > $village->maxstore || $next['clay'] > $village->maxstore || $next['iron'] > $village->maxstore)):?>
?> <div class="none"><?= EXPAND_WAREHOUSE?></div>
</tbody>
<?php elseif ($next && $next['crop'] > $village->maxcrop):?>
<div class="none"><?= EXPAND_GRANARY?></div>
<?php elseif ($next && ($next['wood'] > $village->awood || $next['clay'] > $village->aclay || $next['iron'] > $village->airon || $next['crop'] > $village->acrop)):?>
<div class="none"><?= TOO_FEW_RESOURCES?></div>
<?php elseif ($totalUps == 1 &&!$session->plus || $totalUps > 1):?>
<div class="none"><?= UPGRADE_IN_PROGRESS?></div>
<?php elseif ($session->access!= BANNED):?>
<a class="research" href="build.php?id=<?= $id?>&amp;a=<?= $j?>&amp;c=<?= $session->mchecker?>"><?= UPGRADE?></a>
<?php if ($totalUps!= 0):?><span class="none"> <?= WAITING?></span><?php endif;?>
<?php else:?>
<a class="research" href="banned.php"><?= UPGRADE?></a>
<?php if ($totalUps!= 0):?><span class="none"> <?= WAITING?></span><?php endif;?>
<?php endif;?>
</td>
</tr>
<?php endfor;?>
</tbody>
</table> </table>
<?php <?php if ($totalUps > 0):?>
if($totalUps > 0) { <table cellpadding="1" cellspacing="1" class="under_progress">
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".UPGRADING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr> <thead>
</thead><tbody>"; <tr>
foreach($ABups as $arms) { <td><?= UPGRADING?></td>
$count++; <td><?= DURATION?></td>
$ABUnit = substr($arms['tech'], 1, 2); <td><?= COMPLETE?></td>
$abdata['a' . $ABUnit]++; </tr>
$unit = ($session->tribe - 1) * 10 + $ABUnit; </thead>
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit); <tbody>
echo "<span class=\"none\"> (".LEVEL." ".$abdata['a'.$ABUnit].")</span>"; <?php $count = 0; foreach ($ABups as $arms):
if($count > 1) echo "<span class=\"none\"> ".WAITING."</span>"; $count++;
echo "</td>"; $ABUnit = (int)substr($arms['tech'], 1, 2);
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($arms['timestamp']-time())."</span></td>"; $abdata['a'.$ABUnit]++;
$date = $generator->procMtime($arms['timestamp']); $unit = ($session->tribe - 1) * 10 + $ABUnit;
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>"; $unitName = $technology->getUnitName($unit);
echo "</tr>"; $date = $generator->procMtime($arms['timestamp']);
} ?>
echo "</tbody></table>"; <tr>
} <td class="desc">
?> <img class="unit u<?= $unit?>" src="img/x.gif" alt="<?= $unitName?>" title="<?= $unitName?>">
<?= $unitName?>
<span class="none"> (<?= LEVEL?> <?= $abdata['a'.$ABUnit]?>)</span>
<?php if ($count > 1):?><span class="none"> <?= WAITING?></span><?php endif;?>
</td>
<td class="dur"><span id="timer<?= ++$session->timer?>"><?= $generator->getTimeFormat($arms['timestamp'] - time())?></span></td>
<td class="fin"><span><?= $date[1]?></span><span> hrs</span></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid14"><a href="#" onClick="return Popup(14,4);" class="build_logo">
<img class="building g14" src="img/x.gif" alt="Tournament Square" title="<?php echo TOURNAMENTSQUARE; ?>" />
</a>
<h1><?php echo TOURNAMENTSQUARE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo TOURNAMENTSQUARE_DESC; ?> </p>
// TOURNAMENT SQUARE
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_SPEED; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid14[$village->resarray['f'.$id]]['attri'] : 100; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int)($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentSpeed = $currentLevel > 0 ? $bid14[$currentLevel]['attri'] : 100;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next <= 20){ $maxLevel = 20;
?>
<th><?php echo SPEED_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid14[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextSpeed = $bid14[$nextLevel]['attri'];
}else{
?>
<th><?php echo SPEED_LEVEL; ?> 20:</th>
<td><b><?php echo $bid14[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid14">
<a href="#" onclick="return Popup(14,4);" class="build_logo">
<img class="building g14" src="img/x.gif" alt="<?= TOURNAMENTSQUARE ?>" title="<?= TOURNAMENTSQUARE ?>">
</a>
<h1>
<?= TOURNAMENTSQUARE ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= TOURNAMENTSQUARE_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_SPEED ?>:</th>
<td><b><?= $currentSpeed ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= SPEED_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextSpeed ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+47 -36
View File
@@ -1,41 +1,52 @@
<?php <?php
include("next.tpl");
// MAIN BUILDING
include 'next.tpl';
$field = 'f' . $id;
$currentLevel = (int)($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentTime = $currentLevel > 0 ? round($bid15[$currentLevel]['attri']) : 300;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = 20;
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextTime = round($bid15[$nextLevel]['attri']);
?> ?>
<div id="build" class="gid15"><a href="#" onClick="return Popup(15,4);" class="build_logo"> <div id="build" class="gid15">
<img class="building g15" src="img/x.gif" alt="Main Building" title="<?php echo MAINBUILDING; ?>" /> <a href="#" onclick="return Popup(15,4);" class="build_logo">
</a> <img class="building g15" src="img/x.gif" alt="<?= MAINBUILDING ?>" title="<?= MAINBUILDING ?>">
<h1><?php echo MAINBUILDING; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo MAINBUILDING_DESC; ?></p>
<h1>
<?= MAINBUILDING ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<table cellpadding="1" cellspacing="1" id="build_value"> <p class="build_desc"><?= MAINBUILDING_DESC ?></p>
<tr>
<th><?php echo CURRENT_CONSTRUCTION_TIME; ?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? round($bid15[$village->resarray['f'.$id]]['attri']) : 300; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo CONSTRUCTION_TIME_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo round($bid15[$next]['attri']); ?></b> <?php echo PERCENT; ?></td>
<?php
}else{
?>
<th><?php echo CONSTRUCTION_TIME_LEVEL; ?> 20:</th>
<td><b><?php echo round($bid15[20]['attri']); ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php <table cellpadding="1" cellspacing="1" id="build_value">
if($village->resarray['f'.$id] >= 10){ <tr>
include("Templates/Build/15_1.tpl"); <th><?= CURRENT_CONSTRUCTION_TIME ?>:</th>
} <td><b><?= $currentTime ?></b> <?= PERCENT ?></td>
include("upgrade.tpl"); </tr>
?>
</p></div> <?php if (!$isMax): ?>
<tr>
<th><?= CONSTRUCTION_TIME_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextTime ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php
if ($currentLevel >= 10) {
include 'Templates/Build/15_1.tpl';
}
include 'upgrade.tpl';
?>
</div>
+131 -107
View File
@@ -1,123 +1,147 @@
<?php <?php
$ty = (isset($_GET['ty']))? $_GET['ty']:"";
if(isset($_REQUEST["cancel"]) && $_REQUEST["cancel"] == "1") { // MAIN BUILDING DEMOLISH
$ty = isset($_GET['ty'])? $_GET['ty'] : '';
// cancel demolition
if (isset($_REQUEST['cancel']) && $_REQUEST['cancel'] == '1') {
$database->delDemolition($village->wid); $database->delDemolition($village->wid);
header("Location: build.php?gid=15&ty=$ty&cancel=0&demolish=0"); header("Location: build.php?gid=15&ty=$ty&cancel=0&demolish=0");
exit; exit;
} }
if($session->alliance) $memberCount = $database->countAllianceMembers($session->alliance); $memberCount = $session->alliance? $database->countAllianceMembers($session->alliance) : 0;
else $memberCount = 0; $VillageLevels = $database->getResourceLevel($village->wid);
if(!empty($_REQUEST["demolish"]) && $_REQUEST["c"] == $session->mchecker) { // start demolition
if($_REQUEST["type"] != null && ($_REQUEST["type"] >= 19 && $_REQUEST["type"] <= 40 || $_REQUEST["type"] == 99)) { if (!empty($_REQUEST['demolish']) && $_REQUEST['c'] == $session->mchecker) {
$type = $_REQUEST['type']; $type = (int)($_REQUEST['type']?? 0);
$demolish_permitted = $database->addDemolition($village->wid,$type); $instant = isset($_POST['instant']) && $_POST['instant'] == '1';
if ($demolish_permitted === true) {
$session->changeChecker(); if ($type >= 19 && $type <= 40 || $type == 99) {
header("Location: build.php?gid=15&ty=$type&cancel=0&demolish=0"); $field = 'f'.$type;
$buildType = $VillageLevels[$field.'t'];
$currentLvl = $VillageLevels[$field];
// blocaj ambasada - la fel ca originalul
if($buildType == 18 && $session->alliance && $database->isAllianceOwner($session->uid) == $session->alliance && $memberCount > 1){
header("Location: build.php?gid=15&ty=$type&nodemolish=18");
exit;
}
if($instant){
// DEMOLARE COMPLETA CU GOLD
if($session->gold < 10){
header("Location: build.php?gid=15&ty=$type&notenoughgold=1");
exit;
}
if($currentLvl > 0){
// sterge orice demolare in curs
$database->delDemolition($village->wid);
// setare nivel 0 direct in DB
$database->query("UPDATE ".TB_PREFIX."fdata SET `$field` = 0, `{$field}t` = 0 WHERE `vref` = ".$village->wid);
// scade gold
$database->modifyGold($session->uid, -10, 0);
$session->gold -= 10;
$session->changeChecker();
header("Location: build.php?gid=15&ty=$type&demolished=1");
exit;
}
}else{
// DEMOLARE CLASICA
$ok = $database->addDemolition($village->wid, $type);
if ($ok === true) {
$session->changeChecker();
header("Location: build.php?gid=15&ty=$type&cancel=0&demolish=0");
} else {
header("Location: build.php?gid=15&ty=$type&nodemolish=$ok");
}
exit;
} }
else header("Location: build.php?gid=15&ty=$type&nodemolish=".$demolish_permitted);
exit;
} }
} }
if($village->resarray['f'.$id] >= DEMOLISH_LEVEL_REQ) { if ($village->resarray['f'.$id] < DEMOLISH_LEVEL_REQ) return;
echo "<h2>".DEMOLITION_BUILDING."";
$VillageResourceLevels = $database->getResourceLevel($village->wid);
$DemolitionProgress = $database->getDemolition($village->wid);
if (!empty($DemolitionProgress)) {
$Demolition = $DemolitionProgress[0];
echo "<b>";
echo "<a href='build.php?id=".$_GET['id']."&ty=".$ty."&cancel=1'><img src='img/x.gif' class='del' title='".CANCEL."' alt='cancel'></a> ";
echo "".DEMOLITION_OF." ".$building->procResType($VillageResourceLevels['f'.$Demolition['buildnumber'].'t']).": <span id=timer1>".$generator->getTimeFormat($Demolition['timetofinish']-time())."</span>";
if($session->gold >= 2) {
?>
<a href="?id=15&buildingFinish=1&ty=<?php echo $ty;?>" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="<?php echo FINISH_GOLD; ?>"><img class="clock" alt="Finish all construction and research orders in this village immediately for 2 Gold?" src="img/x.gif"/></a>
<?php
}
echo "</b>";
} else {
if (isset($_GET['nodemolish'])) {
switch ($_GET['nodemolish']) {
case 18:
echo '<p style="color: #ff0000; text-align: left">
Because you are the leader of your alliance, demolition of your current Embassy cannot be started,
since it still holds all of your <b>'.$memberCount.'</b> alliance members.
You can, however <a href="allianz.php?s=5">quit the alliance</a>, while selecting a new leader
in the &quot;quit alliance&quot; form, then continue the demolition.
</p>';
break;
}
}
echo " $Demolition = $database->getDemolition($village->wid);
<form action=\"build.php?gid=15&amp;demolish=1&amp;cancel=0&amp;c=".$session->mchecker."\" method=\"POST\" style=\"display:inline\"> $inProgress =!empty($Demolition)? $Demolition[0] : null;
<select id=\"demolition_type\" name=\"type\" class=\"dropdown\">";
for ($i=19; $i<=41; $i++) {
$select=($i==$ty)? " SELECTED":"";
if (isset($VillageResourceLevels['f'.$i]) && $VillageResourceLevels['f'.$i] >= 1 && !$building->isCurrent($i) && !$building->isLoop($i)) {
echo "<option value=".$i.$select.">".$i.". ".$building->procResType($VillageResourceLevels['f'.$i.'t'])." (lvl ".$VillageResourceLevels['f'.$i].")</option>";
}
}
if ($village->natar==1) {
$select=($ty==99)? " SELECTED":"";
if ($VillageResourceLevels['f99'] >= 1 && !$building->isCurrent(99) && !$building->isLoop(99)) {
echo "<option value=99".$select.">99. ".$building->procResType(40)." (lvl ".$VillageResourceLevels['f99'].")</option>";
}
}
echo "</select><input id=\"btn_demolish\" name=\"demolish\" class=\"dynamic_img\" value=\"Demolish\" type=\"image\" src=\"img/x.gif\" alt=\"Demolish\" title=\"".DEMOLISH."\" onClick=\"javascript:return verify_demolition();\" /></form>";
}
}
?> ?>
<h2><?= DEMOLITION_BUILDING?></h2>
<script type="text/javascript"> <?php if ($inProgress):?>
<!-- <b>
function verify_demolition() { <a href="build.php?id=<?= $_GET['id']?? 15?>&ty=<?= $ty?>&cancel=1">
var dType = document.getElementById('demolition_type'); <img src="img/x.gif" class="del" title="<?= CANCEL?>" alt="cancel">
var warnLvl3 = <?php </a>
if ( <?= DEMOLITION_OF?> <?= $building->procResType($VillageLevels['f'.$inProgress['buildnumber'].'t'])?>:
$session->alliance && <span id="timer1"><?= $generator->getTimeFormat($inProgress['timetofinish'] - time())?></span>
$database->isAllianceOwner($session->uid) == $session->alliance && <?php if ($session->gold >= 2):?>
// don't show the OK/Cancel warning if we have more members, since <a href="?id=15&buildingFinish=1&ty=<?= $ty?>" onclick="return confirm('Finish all construction and research orders in this village immediately for 2 Gold?');" title="<?= FINISH_GOLD?>">
// that will be handled by the returned value <img class="clock" alt="Finish" src="img/x.gif">
$memberCount == 1 && </a>
$database->getSingleFieldTypeCount($session->uid, 18, '>=', 3) == 1 <?php endif;?>
) { </b>
echo 'true';
} else {
echo 'false';
}
?>;
var warnLvl1 = <?php
if ($session->alliance && $database->getSingleFieldTypeCount($session->uid, 18, '>=', 1) == 1) {
echo 'true';
} else {
echo 'false';
}
?>;
if (warnLvl3 && dType.options[dType.selectedIndex].text.indexOf('Embassy (lvl 3)') > -1) { <?php else:?>
// check if we really want to demolish a lvl 3 embassy
if (!window.confirm('WARNING!\n'
+ 'You are about to demolish the last lvl3 Embassy!\n\n'
+ 'Since you are the leader of your alliance and because there are no additional members left, the alliance will be disbanded once the demolition completes.\n\n'
+ 'After that happens, you can found a new alliance or join one that already exists.\n\n'
+ 'Click OK to confirm or Cancel to stop.')) {
return false;
}
} else if (warnLvl1 && dType.options[dType.selectedIndex].text.indexOf('Embassy (lvl 1)') > -1) {
// check if we really want to demolish a lvl 1 embassy
if (!window.confirm('WARNING!\n'
+ 'You are about to demolish your last Embassy!\n\n'
+ 'Since you are in an alliance, you will automatically quit that alliance once the demolition completes.\n\n'
+ 'After that happens, you can found or join an alliance again.\n\n'
+ 'Click OK to confirm or Cancel to stop.')) {
return false;
}
}
return true; <?php if (isset($_GET['nodemolish']) && $_GET['nodemolish'] == 18):?>
} <p style="color:#ff0000; text-align:left">
//--> Because you are the leader of your alliance, demolition of your current Embassy cannot be started,
since it still holds all of your <b><?= $memberCount?></b> alliance members.
</p>
<?php endif;?>
<?php if (isset($_GET['notenoughgold'])):?>
<p style="color:#ff0000">You don't have enough gold. You need 10 gold for instant demolition.</p>
<?php endif;?>
<?php if (isset($_GET['demolished'])):?>
<p style="color:#008000">The building was completely demolished for 10 gold!</p>
<?php endif;?>
<form action="build.php?gid=15&amp;demolish=1&amp;cancel=0&amp;c=<?= $session->mchecker?>" method="POST" style="display:inline">
<select id="demolition_type" name="type" class="dropdown">
<?php for ($i = 19; $i <= 41; $i++):
if (!isset($VillageLevels['f'.$i]) || $VillageLevels['f'.$i] < 1) continue;
if ($building->isCurrent($i) || $building->isLoop($i)) continue;
$selected = ($i == $ty)? ' selected' : '';
?>
<option value="<?= $i?>"<?= $selected?>><?= $i?>. <?= $building->procResType($VillageLevels['f'.$i.'t'])?> (lvl <?= $VillageLevels['f'.$i]?>)</option>
<?php endfor;?>
<?php if ($village->natar == 1 && isset($VillageLevels['f99']) && $VillageLevels['f99'] >= 1 &&!$building->isCurrent(99) &&!$building->isLoop(99)):
$selected = ($ty == 99)? ' selected' : '';
?>
<option value="99"<?= $selected?>>99. <?= $building->procResType(40)?> (lvl <?= $VillageLevels['f99']?>)</option>
<?php endif;?>
</select>
<label style="margin:0 10px;">
<input type="checkbox" name="instant" value="1" id="instant_demolish" <?= $session->gold < 10 ? 'disabled' : ''?>>
Demolare completă (10 <img src="img/x.gif" class="gold" style="vertical-align:middle">)
</label>
<input id="btn_demolish" name="demolish" class="dynamic_img" value="Demolish" type="image" src="img/x.gif" alt="Demolish" title="<?= DEMOLISH?>" onclick="return verify_demolition();">
</form>
<?php endif;?>
<script>
function verify_demolition() {
var dType = document.getElementById('demolition_type');
var instant = document.getElementById('instant_demolish').checked;
var warnLvl3 = <?= ($session->alliance && $database->isAllianceOwner($session->uid) == $session->alliance && $memberCount == 1 && $database->getSingleFieldTypeCount($session->uid, 18, '>=', 3) == 1)? 'true' : 'false'?>;
var warnLvl1 = <?= ($session->alliance && $database->getSingleFieldTypeCount($session->uid, 18, '>=', 1) == 1)? 'true' : 'false'?>;
var text = dType.options[dType.selectedIndex].text;
if (instant) {
return confirm('Surely you want to demolish COMPLETELY '+text+' for 10 GOLD?\nThe building will disappear instantly, it cannot be undone.');
}
if (warnLvl3 && text.indexOf('Embassy (lvl 3)') > -1) {
return confirm('WARNING!\n\nYou are about to demolish the last lvl3 Embassy!\n\nSince you are the leader of your alliance and because there are no additional members left, the alliance will be disbanded once the demolition completes.');
}
if (warnLvl1 && text.indexOf('Embassy (lvl 1)') > -1) {
return confirm('WARNING!\n\nYou are about to demolish your last Embassy!\n\nSince you are in an alliance, you will automatically quit that alliance once the demolition completes.');
}
return true;
}
</script> </script>
+200 -311
View File
@@ -1,315 +1,204 @@
<?php <?php
if(isset($_GET['refresh'])){
$village->unitarray = $database->getUnit($village->wid, false); // RALLY POINT
if (isset($_GET['refresh'])) {
$village->unitarray = $database->getUnit($village->wid, false);
} }
?><div id="build" class="gid16"> $hasRally = $village->resarray['f39'] > 0;
<a href="#" onClick="return Popup(16,4);" class="build_logo"> <img
class="g16" src="img/x.gif" alt="Rally point"
title="<?php echo RALLYPOINT;?>" />
</a>
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span>
</h1>
<p class="build_desc"><?php echo RALLYPOINT_DESC;?></p>
<?php
if($village->resarray['f39'] > 0){
include_once ("16_menu.tpl");
$units_type = $database->getMovement(34, $village->wid, 1);
$settlers = $database->getMovement(7, $village->wid, 1);
$oasis_incoming = 0;
$array = $database->getOasis($village->wid);
foreach($array as $conqured) $oasis_incoming += count($database->getMovement(6, $conqured['wref'], 0));
$units_incoming = count($units_type);
$settlers_incoming = count($settlers);
for($i = 0; $i < $units_incoming; $i++){
if($units_type[$i]['attack_type'] == 1 && $units_type[$i]['sort_type'] == 3) $units_incoming -= 1;
}
if($units_incoming > 0 || $settlers_incoming > 0 || $oasis_incoming > 0){
?>
<h4><?php echo INCOMING_TROOPS;?> (<?php echo $units_incoming+$settlers_incoming+$oasis_incoming; ?>)</h4>
<?php
include ("16_incomming.tpl");
}
?>
<h4><?php echo TROOPS_IN_THE_VILLAGE;?></h4>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td
colspan="<?php echo $village->unitarray['hero'] == 0 ? 10 : 11; ?>">
<a href="spieler.php?uid=<?php echo $session->uid; ?>"><?php echo OWN_TROOPS;?></a>
</td>
</tr>
</thead>
<tbody class="units">
<?php
include ("16_troops.tpl");
?>
</tbody>
</table>
<?php
if(count($village->enforcetome) > 0){
foreach($village->enforcetome as $enforce){
$colspan = 10 + $enforce['hero'];
if($enforce['from'] != 0){
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
if(LANG == "es"){
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".TROOPS." ".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." </a>";
}else{
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." ".TROOPS."</a>";
}
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?w=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}else{
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a>".TASKMASTER."</a></td>
<td colspan=\"$colspan\">";
echo "<a> ".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = 4;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><span class=none><b>".SEND_BACK."</b></span></div></td></tr>";
echo "</tbody></table>";
}
}
}
$enforcevill = array();
$enforceoasis = array();
$allenforce = $village->enforcetoyou;
$enforcemeoasis = $village->enforceoasis;
if(count($allenforce) > 0){
foreach($allenforce as $enforce){
$conquredvid = $database->getOasisField($enforce['vref'], "conqured");
if($conquredvid > 0){
$enforce['conqured'] = $conquredvid;
array_push($enforceoasis, $enforce);
}else{
array_push($enforcevill, $enforce);
}
}
}
if(count($enforcemeoasis) > 0){
foreach($enforcemeoasis as $enforce){
array_push($enforceoasis, $enforce);
}
}
if(count($enforcevill) > 0){
echo "<h4>".TROOPS_IN_OTHER_VILLAGE."</h4>";
foreach($enforcevill as $enforce){
$colspan = 10 + $enforce['hero'];
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['vref'])."\">".REINFORCEMENTFOR." ".$database->getVillageField($enforce['vref'], "name")." </a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?r=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($enforceoasis) > 0){
echo "<h4>".TROOPS_IN_OASIS."</h4>";
foreach($enforceoasis as $enforce){
$colspan = 10 + $enforce['hero'];
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$enforce['vref']."&c=".$generator->getMapCheck($enforce['vref'])."\">".$database->getVillageField($enforce['conqured'], "name")."</a></td>
<td colspan=\"$colspan\">";
if(LANG == "es"){
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".TROOPS." ".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." </a> ".FROM." <a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a>";
}else{
echo "<a href=\"spieler.php?uid=".$database->getVillageField($enforce['from'], "owner")."\">".$database->getUserField($database->getVillageField($enforce['from'], "owner"), "username", 0)." ".TROOPS."</a> ".FROM." <a href=\"karte.php?d=".$enforce['from']."&c=".$generator->getMapCheck($enforce['from'])."\">".$database->getVillageField($enforce['from'], "name")."</a>";
}
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($enforce['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($enforce['hero'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = $start; $i <= ($start + 9); $i++){
if($enforce['u'.$i] == 0){
echo "<td class=\"none\">";
}else{
echo "<td>";
}
echo $enforce['u'.$i]."</td>";
}
if($enforce['hero'] != 0){
echo "<td>".$enforce['hero']."</td>";
}
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan\"><div class='sup'>".$technology->getUpkeep($enforce, $tribe)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?r=".$enforce['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($database->getPrisoners3($village->wid)) > 0){
echo "<h4>".PRISONERS."</h4>";
foreach($database->getPrisoners3($village->wid) as $prisoners){
$colspan = 10 + $prisoners['t11'];
$colspan2 = $colspan + 1;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">".$database->getVillageField($prisoners['wref'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$prisoners['wref']."&c=".$generator->getMapCheck($prisoners['wref'])."\">".PRISONERSIN." ".$database->getVillageField($prisoners['wref'], "name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($prisoners['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($prisoners['t11'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
if($prisoners['t'.$i] == 0){
echo "<td class=\"none\">";
}else
echo "<td>";
echo $prisoners['t'.$i]."</td>";
}
if($prisoners['t11'] > 0) echo "<td>".$prisoners['t11']."</td>";
echo "</tr></tbody>
<tbody class=\"infos\"><tr><th>".UPKEEP."</th><td colspan=\"$colspan2\"><div class='sup'>".$technology->getUpkeep($prisoners, $tribe, 0, 1)."<img class=\"r4\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" />".PER_HR."</div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>".KILL."</a></div></td></tr>";
echo "</tbody></table>";
}
}
if(count($database->getPrisoners($village->wid)) > 0){
echo "<h4>".PRISONERS."</h4>";
foreach($database->getPrisoners($village->wid) as $prisoners){
$colspan = 10 + $prisoners['t11'];
$colspan2 = $colspan + 1;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">".$database->getVillageField($prisoners['from'], "name")."</a></td>
<td colspan=\"$colspan\">";
echo "<a href=\"karte.php?d=".$prisoners['from']."&c=".$generator->getMapCheck($prisoners['from'])."\">".PRISONERSFROM." ".$database->getVillageField($prisoners['from'], "name")."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($database->getVillageField($prisoners['from'], "owner"), "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($prisoners['t11'] != 0){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
if($prisoners['t'.$i] == 0){
echo "<td class=\"none\">";
}else
echo "<td>";
echo $prisoners['t'.$i]."</td>";
}
if($prisoners['t11'] > 0) echo "<td>".$prisoners['t11']."</td>";
echo "</tr></tbody>
<tbody class=\"infos\"><tr><td colspan=\"$colspan2\"><div class='sup'><img class=\"r6\" src=\"img/x.gif\" title=\"Crop\" alt=\"Crop\" /></div><div class='sback'><a href='a2b.php?delprisoners=".$prisoners['id']."'>".SEND_BACK."</a></div></td></tr>";
echo "</tbody></table>";
}
}
?>
<?php
$units_type = $database->getMovement(3, $village->wid, 0);
$settlers = $database->getMovement(5, $village->wid, 0);
$units_incoming = count($units_type);
for($i = 0; $i < $units_incoming; $i++){
if($units_type[$i]['vref'] != $village->wid) $units_incoming -= 1;
}
$units_incoming += count($settlers);
if($units_incoming >= 1){
echo "<h4>".TROOPS_ON_THEIR_WAY."</h4>";
include ("16_walking.tpl");
}
}
else echo '<b>'.RALLYPOINT_COMMENCE.'</b><br>';
include ("upgrade.tpl");
?> ?>
</p> <div id="build" class="gid16">
<a href="#" onclick="return Popup(16,4);" class="build_logo">
<img class="g16" src="img/x.gif" alt="Rally point" title="<?= RALLYPOINT ?>">
</a>
<h1><?= RALLYPOINT ?> <span class="level"><?= LEVEL ?> <?= $village->resarray['f'.$id] ?></span></h1>
<p class="build_desc"><?= RALLYPOINT_DESC ?></p>
<?php if ($hasRally): ?>
<?php include_once '16_menu.tpl'; ?>
<?php
// --- INCOMING ---
$units_type = $database->getMovement(34, $village->wid, 1);
$settlers = $database->getMovement(7, $village->wid, 1);
$oasis_incoming = 0;
foreach ($database->getOasis($village->wid) as $o) {
$oasis_incoming += count($database->getMovement(6, $o['wref'], 0));
}
$units_incoming = count($units_type);
foreach ($units_type as $u) if ($u['attack_type'] == 1 && $u['sort_type'] == 3) $units_incoming--;
$totalIncoming = $units_incoming + count($settlers) + $oasis_incoming;
?>
<?php if ($totalIncoming > 0): ?>
<h4><?= INCOMING_TROOPS ?> (<?= $totalIncoming ?>)</h4>
<?php include '16_incomming.tpl'; ?>
<?php endif; ?>
<!-- OWN TROOPS -->
<h4><?= TROOPS_IN_THE_VILLAGE ?></h4>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?= $village->wid ?>&c=<?= $generator->getMapCheck($village->wid) ?>"><?= $village->vname ?></a></td>
<td colspan="<?= $village->unitarray['hero'] ? 11 : 10 ?>"><a href="spieler.php?uid=<?= $session->uid ?>"><?= OWN_TROOPS ?></a></td>
</tr>
</thead>
<tbody class="units"><?php include '16_troops.tpl'; ?></tbody>
</table>
<!-- REINFORCEMENTS TO ME -->
<?php foreach ($village->enforcetome as $e):
$isTaskmaster = $e['from'] == 0;
$colspan = 10 + $e['hero'];
$tribe = $isTaskmaster ? 4 : $database->getUserField($database->getVillageField($e['from'],'owner'),'tribe',0);
$start = ($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role">
<?php if (!$isTaskmaster): ?>
<a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a>
<?php else: ?><a><?= TASKMASTER ?></a><?php endif; ?>
</td>
<td colspan="<?= $colspan ?>">
<?php if (!$isTaskmaster):
$owner = $database->getVillageField($e['from'],'owner');
$uname = $database->getUserField($owner,'username',0);
?>
<a href="spieler.php?uid=<?= $owner ?>"><?= LANG=='es' ? TROOPS.' '.$uname : $uname.' '.TROOPS ?></a>
<?php else: ?><a><?= VILLAGE_OF_THE_ELDERS_TROOPS ?></a><?php endif; ?>
</td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>" title="<?= $technology->getUnitName($i) ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero" title="Hero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><?php if(!$isTaskmaster): ?><a href="a2b.php?w=<?= $e['id'] ?>"><?= SEND_BACK ?></a><?php else: ?><span class="none"><b><?= SEND_BACK ?></b></span><?php endif; ?></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php
// split my reinforcements
$enforcevill = []; $enforceoasis = [];
foreach ($village->enforcetoyou as $e) {
$conq = (int)$database->getOasisField($e['vref'],'conqured');
if ($conq>0) { $e['conqured']=$conq; $enforceoasis[]=$e; } else $enforcevill[]=$e;
}
foreach ($village->enforceoasis as $e) $enforceoasis[]=$e;
?>
<!-- TROOPS IN OTHER VILLAGES -->
<?php if ($enforcevill): ?>
<h4><?= TROOPS_IN_OTHER_VILLAGE ?></h4>
<?php foreach ($enforcevill as $e):
$colspan=10+$e['hero']; $tribe=$database->getUserField($database->getVillageField($e['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $e['vref'] ?>&c=<?= $generator->getMapCheck($e['vref']) ?>"><?= REINFORCEMENTFOR ?> <?= $database->getVillageField($e['vref'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>" title="<?= $technology->getUnitName($i) ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?r=<?= $e['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- TROOPS IN OASIS -->
<?php if ($enforceoasis): ?>
<h4><?= TROOPS_IN_OASIS ?></h4>
<?php foreach ($enforceoasis as $e):
$colspan=10+$e['hero']; $owner=$database->getVillageField($e['from'],'owner'); $tribe=$database->getUserField($owner,'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $e['vref'] ?>&c=<?= $generator->getMapCheck($e['vref']) ?>"><?= $database->getVillageField($e['conqured'],'name') ?></a></td>
<td colspan="<?= $colspan ?>">
<a href="spieler.php?uid=<?= $owner ?>"><?= $database->getUserField($owner,'username',0) ?> <?= TROOPS ?></a> <?= FROM ?> <a href="karte.php?d=<?= $e['from'] ?>&c=<?= $generator->getMapCheck($e['from']) ?>"><?= $database->getVillageField($e['from'],'name') ?></a>
</td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($e['hero']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=$start;$i<$start+10;$i++): ?><td class="<?= $e['u'.$i]==0?'none':'' ?>"><?= $e['u'.$i] ?></td><?php endfor; ?><?php if($e['hero']): ?><td><?= $e['hero'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan ?>">
<div class="sup"><?= $technology->getUpkeep($e,$tribe) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?r=<?= $e['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- PRISONERS (held by me) -->
<?php $p3 = $database->getPrisoners3($village->wid); if($p3): ?>
<h4><?= PRISONERS ?></h4>
<?php foreach($p3 as $p):
$colspan=10+$p['t11']; $tribe=$database->getUserField($database->getVillageField($p['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $p['wref'] ?>&c=<?= $generator->getMapCheck($p['wref']) ?>"><?= $database->getVillageField($p['wref'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $p['wref'] ?>"><?= PRISONERSIN ?> <?= $database->getVillageField($p['wref'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($p['t11']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=1;$i<=10;$i++): ?><td class="<?= $p['t'.$i]==0?'none':'' ?>"><?= $p['t'.$i] ?></td><?php endfor; ?><?php if($p['t11']): ?><td><?= $p['t11'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><th><?= UPKEEP ?></th><td colspan="<?= $colspan+1 ?>">
<div class="sup"><?= $technology->getUpkeep($p,$tribe,0,1) ?><img class="r4" src="img/x.gif"> <?= PER_HR ?></div>
<div class="sback"><a href="a2b.php?delprisoners=<?= $p['id'] ?>"><?= KILL ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<!-- PRISONERS (my troops captured) -->
<?php $p = $database->getPrisoners($village->wid); if($p): ?>
<h4><?= PRISONERS ?></h4>
<?php foreach($p as $pr):
$colspan=10+$pr['t11']; $tribe=$database->getUserField($database->getVillageField($pr['from'],'owner'),'tribe',0); $start=($tribe-1)*10+1;
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $pr['from'] ?>&c=<?= $generator->getMapCheck($pr['from']) ?>"><?= $database->getVillageField($pr['from'],'name') ?></a></td>
<td colspan="<?= $colspan ?>"><a href="karte.php?d=<?= $pr['from'] ?>"><?= PRISONERSFROM ?> <?= $database->getVillageField($pr['from'],'name') ?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++): ?><td><img src="img/x.gif" class="unit u<?= $i ?>"></td><?php endfor; ?><?php if($pr['t11']): ?><td><img src="img/x.gif" class="unit uhero"></td><?php endif; ?></tr>
<tr><th><?= TROOPS ?></th><?php for($i=1;$i<=10;$i++): ?><td class="<?= $pr['t'.$i]==0?'none':'' ?>"><?= $pr['t'.$i] ?></td><?php endfor; ?><?php if($pr['t11']): ?><td><?= $pr['t11'] ?></td><?php endif; ?></tr>
</tbody>
<tbody class="infos"><tr><td colspan="<?= $colspan+1 ?>">
<div class="sup"><img class="r6" src="img/x.gif"></div>
<div class="sback"><a href="a2b.php?delprisoners=<?= $pr['id'] ?>"><?= SEND_BACK ?></a></div>
</td></tr></tbody>
</table>
<?php endforeach; ?>
<?php endif; ?>
<?php
$out = $database->getMovement(3,$village->wid,0);
$set = $database->getMovement(5,$village->wid,0);
$cnt = count($set);
foreach($out as $u) if($u['vref']==$village->wid) $cnt++;
?>
<?php if($cnt>=1): ?>
<h4><?= TROOPS_ON_THEIR_WAY ?></h4>
<?php include '16_walking.tpl'; ?>
<?php endif; ?>
<?php else: ?>
<b><?= RALLYPOINT_COMMENCE ?></b><br>
<?php endif; ?>
<?php include 'upgrade.tpl'; ?>
</div> </div>
+56 -51
View File
@@ -1,60 +1,65 @@
<?php <?php
if(!$session->goldclub) include("Templates/Build/16.tpl");
else
{
?>
<div id="build" class="gid16"><a href="#" onClick="return Popup(16,4);" class="build_logo">
<img class="g16" src="img/x.gif" alt="Rally point" title="<?php echo RALLYPOINT;?>" />
</a>
<h1><?php echo RALLYPOINT;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo RALLYPOINT_DESC;?></p>
<?php include("16_menu.tpl")?>
<div id="raidList"> // RALLY POINT GOLD CLUB
<?php include("Templates/goldClub/farmlist.tpl"); ?>
</div> if (!$session->goldclub) {
<br /> include 'Templates/Build/16.tpl';
<?php if( !isset( $hideevasion ) || $hideevasion == 0){ ?> return;
<table id="raidList" cellpadding="1" cellspacing="1"> }
$hideEvasion = isset($hideevasion) ? (int)$hideevasion : 0;
$user = $database->getUserArray($session->uid, 1);
?>
<div id="build" class="gid16">
<a href="#" onclick="return Popup(16,4);" class="build_logo">
<img class="g16" src="img/x.gif" alt="Rally point" title="<?= RALLYPOINT ?>">
</a>
<h1><?= RALLYPOINT ?> <span class="level"><?= LEVEL ?> <?= $village->resarray['f'.$id] ?></span></h1>
<p class="build_desc"><?= RALLYPOINT_DESC ?></p>
<?php include '16_menu.tpl'; ?>
<div id="raidList">
<?php include 'Templates/goldClub/farmlist.tpl'; ?>
</div>
<br>
<?php if ($hideEvasion == 0): ?>
<table id="raidList" cellpadding="1" cellspacing="1">
<thead> <thead>
<tr> <tr><th colspan="4"><?= EVASION_SETTINGS ?></th></tr>
<th colspan="4"><?php echo EVASION_SETTINGS;?></th>
</tr>
<tr> <tr>
<td></td> <td></td>
<td><?php echo VILLAGE; ?></td> <td><?= VILLAGE ?></td>
<td><?php echo OWN_TROOPS; ?></td> <td><?= OWN_TROOPS ?></td>
<td><?php echo REINFORCEMENT;?></td> <td><?= REINFORCEMENT ?></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php foreach ($session->villages as $wref):
for($i = 0; $i <= count($session->villages) - 1; $i++) { $vname = $database->getVillageField($wref, 'name');
$wref = $session->villages[$i]; $vchecked = $database->getVillageField($wref, 'evasion');
$vname = $database->getVillageField($wref, "name"); $reinf = $database->getEnforceVillage($wref, 0);
$vchecked = $database->getVillageField($wref, "evasion"); $checked = $vchecked == 1 ? 'checked' : '';
$reinf = $database->getEnforceVillage($wref, 0); ?>
if($vchecked == 1) $checked = 'checked';
else $checked = '';
?>
<tr> <tr>
<td><input type="checkbox" class="check" name="hideShow" onclick="window.location.href = '?gid=16&t=99&evasion=<?php echo $wref;?>';" <?php echo $checked; ?>></td> <td><input type="checkbox" class="check" name="hideShow" onclick="window.location.href='?gid=16&t=99&evasion=<?= $wref ?>';" <?= $checked ?>></td>
<td><?php echo $vname; ?></td> <td><?= $vname ?></td>
<td><div style="text-align: center"><?php echo $database->getUnitsNumber($wref); ?></div></td> <td><div style="text-align:center"><?= $database->getUnitsNumber($wref) ?></div></td>
<td><div style="text-align: center"><?php echo count($reinf); ?></div></td> <td><div style="text-align:center"><?= count($reinf) ?></div></td>
</tr> </tr>
<?php <?php endforeach; ?>
} </tbody>
$user = $database->getUserArray($session->uid, 1); </table>
?>
</tbody> <form action="build.php?id=39&t=99" method="POST">
</table> <br>
<form action="build.php?id=39&t=99" method="POST"> <?= SEND_TROOPS_AWAY_MAX ?>
<br /> <input class="text" type="text" name="maxevasion" value="<?= $user['maxevasion'] ?>" maxlength="3" style="width:50px;">
<?php echo SEND_TROOPS_AWAY_MAX;?> <input class="text" type="text" name="maxevasion" value="<?php echo $user['maxevasion']; ?>" maxlength="3" style="width:50px;"> <?php echo TIMES;?> <?= TIMES ?>
<span class="none">(<?php echo COSTS;?>: <img src="<?php echo GP_LOCATE; ?>img/a/gold_g.gif" alt="Gold" title="<?php echo GOLD;?>"/><b>2</b> <?php echo PER_EVASION;?>)</span> <span class="none">(<?= COSTS ?>: <img src="<?= GP_LOCATE ?>img/a/gold_g.gif" alt="Gold" title="<?= GOLD ?>"><b>2</b> <?= PER_EVASION ?>)</span>
<div class="clear"></div><p><button value="ok" name="s1" id="btn_ok" class="trav_buttons" tabindex="8">OK</button></p></form> <div class="clear"></div>
<?php } ?> <p><button value="ok" name="s1" id="btn_ok" class="trav_buttons" tabindex="8">OK</button></p>
</div> </form>
<?php } ?> <?php endif; ?>
</div>
+130 -317
View File
@@ -1,328 +1,141 @@
<?php <?php
include_once("GameEngine/Data/unitdata.php");
// RALLY POINT INCOMMING TROOPS
include_once 'GameEngine/Data/unitdata.php';
$units = $database->getMovement(34, $village->wid, 1); $units = $database->getMovement(34, $village->wid, 1);
$total_for = count($units);
$send = $database->getMovement(1, $village->wid, 1);
$total_for2 = count($send);
$artifactsSum = $database->getArtifactsSumByKind($session->uid, $village->wid, 3); $artifactsSum = $database->getArtifactsSumByKind($session->uid, $village->wid, 3);
for($y = 0; $y < $total_for; $y++){ ?>
$session->timer++;
if($units[$y]['sort_type'] == 3){
if($units[$y]['attack_type'] == 2) $actionType = REINFORCEMENTFOR;
elseif($units[$y]['attack_type'] == 3) $actionType = ATTACK_ON;
elseif($units[$y]['attack_type'] == 4) $actionType = RAID_ON;
$reinfowner = $database->getVillageField($units[$y]['from'], "owner"); <?php foreach ($units as $u):
if($units[$y]['attack_type'] != 1){ $session->timer++;
if($units[$y]['from'] != 0){ $sort = (int)$u['sort_type'];
if($units[$y]['t11'] > 0 && $reinfowner == $session->uid) $colspan = 11; $atk = (int)$u['attack_type'];
else $colspan = 10;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\"> if ($sort === 3 && $atk!= 1):
<a href=\"karte.php?d=".$units[$y]['from']."&c=".$generator->getMapCheck($units[$y]['from'])."\">".$database->getVillageField($units[$y]['from'], "name")."</a></td> $action = ($atk == 2? REINFORCEMENTFOR : ($atk == 3? ATTACK_ON : RAID_ON));
<td colspan=\"$colspan\">"; $from = (int)$u['from'];
echo "<a href=\"karte.php?d=".$units[$y]['to']."&c=".$generator->getMapCheck($units[$y]['to'])."\">".$actionType." ".$database->getVillageField($units[$y]['to'], "name")."</a>"; $isElders = ($from === 0);
echo "</td></tr></thead><tbody class=\"units\">"; $owner = $isElders? 0 : $database->getVillageField($from, 'owner');
$tribe = $database->getUserField($database->getVillageField($units[$y]['from'], "owner"), "tribe", 0); $isMine = ($owner == $session->uid);
$start = ($tribe - 1) * 10 + 1; $colspan = ($u['t11'] > 0 && $isMine)? 11 : 10;
$end = ($tribe * 10); $tribe = $isElders? 4 : $database->getUserField($owner, 'tribe', 0);
echo "<tr><th>&nbsp;</th>"; $start = ($tribe - 1) * 10 + 1;
for($i = $start; $i <= ($end); $i++){ $end = $tribe * 10;
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>"; $dt = $generator->procMtime($u['endtime']);
} ?>
if($units[$y]['t11'] != 0 && $reinfowner == $session->uid){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= $colspan; $i++){
$totalunits = $units[$y]['t1'] + $units[$y]['t2'] + $units[$y]['t3'] + $units[$y]['t4'] + $units[$y]['t5'] + $units[$y]['t6'] + $units[$y]['t7'] + $units[$y]['t8'] + $units[$y]['t9'] + $units[$y]['t10'] + $units[$y]['t11'];
if($units[$y]['attack_type'] == 2){
if($reinfowner != $session->uid) echo "<td class=\"none\">?</td>";
else
{
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $units[$y]['t'.$i]."</td>";
}
}
}else{
if($artifactsSum['totals'] == 0) echo "<td class=\"none\">?</td>";
else
{
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else echo "<td>?</td>";
}
}
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan='.$colspan.'>
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]." ".HRS."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
}else{
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\">
<a>village of the elders</a></td>
<td colspan=\"10\">";
echo "<a>".VILLAGE_OF_THE_ELDERS_TROOPS."</a>";
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = 4;
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= 10; $i++){
echo "<td class=\"none\">?</td>";
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan="10">
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($units[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
}
}
}else if($units[$y]['sort_type'] == 4){
$actionType = RETURNFROM;
$isoasis = $database->isVillageOases($units[$y]['from']);
if($isoasis == 0) $from = $database->getMInfo($units[$y]['from']);
else $from = $database->getOMInfo($units[$y]['from']);
$to = $database->getMInfo($units[$y]['vref']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1"> <table class="troop_details" cellpadding="1" cellspacing="1">
<thead> <thead><tr>
<tr> <td class="role">
<td class="role"><a <?php if (!$isElders):?>
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td> <a href="karte.php?d=<?= $from?>&c=<?= $generator->getMapCheck($from)?>"><?= $database->getVillageField($from,'name')?></a>
<td colspan="<?php echo $units[$y]['t11'] > 0 ? 11 : 10 ?>"><a <?php else:?><a>village of the elders</a><?php endif;?>
href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td> </td>
</tr> <td colspan="<?= $colspan?>">
</thead> <?php if (!$isElders):?>
<tbody class="units"> <a href="karte.php?d=<?= $u['to']?>&c=<?= $generator->getMapCheck($u['to'])?>"><?= $action?> <?= $database->getVillageField($u['to'],'name')?></a>
<tr> <?php else:?><a><?= VILLAGE_OF_THE_ELDERS_TROOPS?></a><?php endif;?>
<?php </td>
$tribe = $session->tribe; </tr></thead>
$start = ($tribe - 1) * 10 + 1; <tbody class="units">
$end = ($tribe * 10); <tr><th>&nbsp;</th>
echo "<th>&nbsp;</th>"; <?php for ($i=$start;$i<=$end;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>" title="<?= $technology->getUnitName($i)?>"></td><?php endfor;?>
for($i = $start; $i <= ($end); $i++){ <?php if ($u['t11'] && $isMine):?><td><img src="img/x.gif" class="unit uhero" title="Hero"></td><?php endif;?>
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>"; </tr>
} <tr><th><?= TROOPS?></th>
if($units[$y]['t11'] != 0){ <?php for ($i=1;$i<=$colspan;$i++):
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>"; $val = isset($u['t'.$i])? $u['t'.$i] : 0;
} if ($isElders) { echo '<td class="none">?</td>'; continue; }
?> if ($atk == 2) {
</tr> if (!$isMine) echo '<td class="none">?</td>';
<tr> else echo '<td class="'.($val==0?'none':'').'">'.($val==0?'0':$val).'</td>';
<th><?php echo TROOPS;?></th> } else {
<?php if ($artifactsSum['totals']==0) echo '<td class="none">?</td>';
for($i = 1; $i < ($units[$y]['t11'] != 0 ? 12 : 11); $i++){ else echo '<td class="'.($val==0?'none':'').'">'.($val==0?'0':'?').'</td>';
if($units[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>"; }
else endfor;?>
{ </tr>
echo "<td>"; </tbody>
echo $units[$y]['t'.$i]."</td>"; <tbody class="infos"><tr>
} <th><?= ARRIVAL?></th>
} <td colspan="<?= $colspan?>">
?> <div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($u['endtime']-time())?></span> h</div>
</tr> <div class="at small"><?= $dt[0]!='today'? ON.' '.$dt[0].' ' : ''?><?= AT?> <?= $dt[1]?> <?= HRS?></div>
</tbody> </td>
<?php </tr></tbody>
$totalres = $units[$y]['wood'] + $units[$y]['clay'] + $units[$y]['iron'] + $units[$y]['crop'];
if($units[$y]['attack_type'] != 2 && $units[$y]['attack_type'] != 1 && $totalres > 0){
?>
<tbody class="goods">
<tr>
<th><?php echo BOUNTY;?></th>
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11; ?>">
<?php
$totalcarry = 0;
for($i = 0; $i <= 9; $i++) $totalcarry += $units[$y]['t'.($i + 1)] * ${'u'.($start + $i)}['cap'];
echo "<div class=\"res\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".$units[$y]['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".$units[$y]['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".$units[$y]['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".$units[$y]['crop']."</div>";
echo "<div class=\"carry\"><img class=\"car\" src=\"img/x.gif\" alt=\"carry\" title=\"carry\"/>".$totalres."/".$totalcarry."</div>";
?>
</tr>
</tbody>
<?php } ?>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php echo $units[$y]['t11'] == 0 ? 10 : 11 ?>">
<?php
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($units[$y]['endtime'] - time())."</span> h</div>";
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</table> </table>
<?php
}
}
$array = $database->getOasis($village->wid);
foreach($array as $conqured){
$oasis = $database->getMovement("6", $conqured['wref'], 0);
$total_for = count($oasis);
for($y = 0; $y < $total_for; $y++){
$session->timer++;
$to = $database->getOMInfo($oasis[$y]['to']);
if($oasis[$y]['attack_type'] == 2) $actionType = REINFORCEMENTFOR;
else if($oasis[$y]['attack_type'] == 3) $actionType = ATTACK_ON;
else if($oasis[$y]['attack_type'] == 4) $actionType = RAID_ON;
$reinfowner = $database->getVillageField($oasis[$y]['from'], "owner"); <?php elseif ($sort === 4):
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid) $colspan = 11; $fromInfo = $database->isVillageOases($u['from'])? $database->getOMInfo($u['from']) : $database->getMInfo($u['from']);
else $colspan = 10; $colspan = $u['t11']? 11 : 10;
$tribe = $session->tribe; $start=($tribe-1)*10+1;
echo "<table class=\"troop_details\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><td class=\"role\"> $totalRes = $u['wood']+$u['clay']+$u['iron']+$u['crop'];
<a href=\"karte.php?d=".$oasis[$y]['from']."&c=".$generator->getMapCheck($oasis[$y]['from'])."\">".$database->getVillageField($oasis[$y]['from'], "name")."</a></td> $carry = 0; for($i=0;$i<10;$i++) { $t = isset($u['t'.($i+1)])? $u['t'.($i+1)] : 0; $carry += $t * ${'u'.($start+$i)}['cap']; }
<td colspan=\"$colspan\">"; $dt = $generator->procMtime($u['endtime']);
echo "<a href=\"karte.php?d=".$oasis[$y]['to']."&c=".$generator->getMapCheck($oasis[$y]['to'])."\">".$actionType." ".$to['name']."</a>"; ?>
echo "</td></tr></thead><tbody class=\"units\">";
$tribe = $database->getUserField($reinfowner, "tribe", 0);
$start = ($tribe - 1) * 10 + 1;
$end = ($tribe * 10);
echo "<tr><th>&nbsp;</th>";
for($i = $start; $i <= ($end); $i++){
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($oasis[$y]['t11'] != 0 && $reinfowner == $session->uid){
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
echo "</tr><tr><th>".TROOPS."</th>";
for($i = 1; $i <= $colspan; $i++){
$totalunits = $oasis[$y]['t1'] + $oasis[$y]['t2'] + $oasis[$y]['t3'] + $oasis[$y]['t4'] + $oasis[$y]['t5'] + $oasis[$y]['t6'] + $oasis[$y]['t7'] + $oasis[$y]['t8'] + $oasis[$y]['t9'] + $oasis[$y]['t10'] + $oasis[$y]['t11'];
if($oasis[$y]['attack_type'] == 2){
if($reinfowner != $session->uid) echo "<td class=\"none\">?</td>";
else
{
if($oasis[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $oasis[$y]['t'.$i]."</td>";
}
}
}else{
if($artifactsSum['totals'] == 0) echo "<td class=\"none\">?</td>";
else
{
if($oasis[$y]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else echo "<td>?</td>";
}
}
}
echo "</tr></tbody>";
echo '
<tbody class="infos">
<tr>
<th>'.ARRIVAL.'</th>
<td colspan="'.$colspan.'">
<div class="in small"><span id=timer'.$session->timer.'>'.$generator->getTimeFormat($oasis[$y]['endtime'] - time()).'</span> h</div>';
$datetime = $generator->procMtime($oasis[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]." ".HRS."</div>
</div>
</td>
</tr>
</tbody>";
echo "</table>";
}
}
$settlers = $database->getMovement(7, $village->wid, 1);
$total_for3 = count($settlers);
for($x = 0; $x < $total_for3; $x++){
$session->timer++;
$to = $database->getMInfo($settlers[$x]['to']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1"> <table class="troop_details" cellpadding="1" cellspacing="1">
<thead> <thead><tr>
<tr> <td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td class="role"><a <td colspan="<?= $colspan?>"><a href="karte.php?d=<?= $fromInfo['wref']?>&c=<?= $generator->getMapCheck($fromInfo['wref'])?>"><?= RETURNFROM?> <?= $fromInfo['name']?></a></td>
href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td> </tr></thead>
<td colspan="10"><a <tbody class="units">
href="karte.php?d=<?php echo $from['wref']."&c=".$generator->getMapCheck($from['wref']); ?>"><?php echo $actionType." ".$from['name']; ?></a></td> <tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>"></td><?php endfor;?><?php if($u['t11']):?><td><img src="img/x.gif" class="unit uhero"></td><?php endif;?></tr>
</tr> <tr><th><?= TROOPS?></th><?php for($i=1;$i<($u['t11']?12:11);$i++): $v = isset($u['t'.$i])? $u['t'.$i] : 0;?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?></tr>
</thead> </tbody>
<tbody class="units"> <?php if ($totalRes>0 && $atk!=1 && $atk!=2):?>
<?php <tbody class="goods"><tr><th><?= BOUNTY?></th><td colspan="<?= $colspan?>">
$tribe = $session->tribe; <div class="res"><img class="r1" src="img/x.gif"> <?= $u['wood']?> | <img class="r2" src="img/x.gif"> <?= $u['clay']?> | <img class="r3" src="img/x.gif"> <?= $u['iron']?> | <img class="r4" src="img/x.gif"> <?= $u['crop']?></div>
$start = ($tribe - 1) * 10 + 1; <div class="carry"><img class="car" src="img/x.gif"> <?= $totalRes?>/<?= $carry?></div>
$end = ($tribe * 10); </td></tr></tbody>
echo "<tr><th>&nbsp;</th>"; <?php endif;?>
for($i = $start; $i <= ($end); $i++){ <tbody class="infos"><tr><th><?= ARRIVAL?></th><td colspan="<?= $colspan?>">
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>"; <div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($u['endtime']-time())?></span> h</div>
} <div class="at"><?= $dt[0]!='today'? ON.' '.$dt[0].' ' : ''?><?= AT?> <?= $dt[1]?></div>
?> </td></tr></tbody>
</tr>
<tr>
<th><?php echo TROOPS;?></th>
<?php
for($z = 1; $z <= 9; $z++) $settlers[$x]['t'.$z] = 0;
$settlers[$x]['t10'] = 3;
for($i = 1; $i < 11; $i++){
if($settlers[$x]['t'.$i] == 0) echo "<td class=\"none\">0</td>";
else
{
echo "<td>";
echo $settlers[$x]['t'.$i]."</td>";
}
}
?>
</tr>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="10">
<?php
echo "<div class=\"in small\"><span id=timer".$session->timer.">".$generator->getTimeFormat($settlers[$x]['endtime'] - time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$x]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") echo "".ON." ".$datetime[0]." ";
echo "".AT." ".$datetime[1]."</div>";
?>
</div>
</td>
</tr>
</tbody>
</table> </table>
<?php } ?> <?php endif; endforeach;?>
<?php foreach ($database->getOasis($village->wid) as $o):
foreach ($database->getMovement(6,$o['wref'],0) as $m):
$session->timer++; $owner=$database->getVillageField($m['from'],'owner'); $isMine=($owner==$session->uid);
$colspan=($m['t11']&&$isMine)?11:10; $tribe=$database->getUserField($owner,'tribe',0); $start=($tribe-1)*10+1;
$action=($m['attack_type']==2?REINFORCEMENTFOR:($m['attack_type']==3?ATTACK_ON:RAID_ON)); $dt=$generator->procMtime($m['endtime']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $m['from']?>&c=<?= $generator->getMapCheck($m['from'])?>"><?= $database->getVillageField($m['from'],'name')?></a></td>
<td colspan="<?= $colspan?>"><a href="karte.php?d=<?= $m['to']?>&c=<?= $generator->getMapCheck($m['to'])?>"><?= $action?> <?= $database->getOMInfo($m['to'])['name']?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>"></td><?php endfor;?><?php if($m['t11']&&$isMine):?><td><img src="img/x.gif" class="unit uhero"></td><?php endif;?></tr>
<tr><th><?= TROOPS?></th><?php for($i=1;$i<=$colspan;$i++): $v = isset($m['t'.$i])? $m['t'.$i] : 0;
if($m['attack_type']==2){ echo $isMine? '<td class="'.($v==0?'none':'').'">'.($v?$v:'0').'</td>' : '<td class="none">?</td>'; }
else { echo $artifactsSum['totals']==0? '<td class="none">?</td>' : '<td class="'.($v==0?'none':'').'">'.($v==0?'0':'?').'</td>'; }
endfor;?></tr>
</tbody>
<tbody class="infos"><tr><th><?= ARRIVAL?></th><td colspan="<?= $colspan?>">
<div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($m['endtime']-time())?></span> h</div>
<div class="at"><?= $dt[0]!='today'? ON.' '.$dt[0].' ' : ''?><?= AT?> <?= $dt[1]?> <?= HRS?></div>
</td></tr></tbody>
</table>
<?php endforeach; endforeach;?>
<?php foreach ($database->getMovement(7,$village->wid,1) as $s):
$session->timer++; $tribe=$session->tribe; $start=($tribe-1)*10+1; $dt=$generator->procMtime($s['endtime']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td colspan="10"><a href="karte.php?d=<?= $s['to']?>&c=<?= $generator->getMapCheck($s['to'])?>"><?= $database->getMInfo($s['to'])['name']?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>"></td><?php endfor;?></tr>
<tr><th><?= TROOPS?></th><?php for($i=1;$i<=10;$i++): $v=($i==10?3:0);?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?></tr>
</tbody>
<tbody class="infos"><tr><th><?= ARRIVAL?></th><td colspan="10">
<div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($s['endtime']-time())?></span> h</div>
<div class="at"><?= $dt[0]!='today'? ON.' '.$dt[0].' ' : ''?><?= AT?> <?= $dt[1]?></div>
</td></tr></tbody>
</table>
<?php endforeach;?>
+14 -6
View File
@@ -1,8 +1,16 @@
<?php
// RALLY POINT MENU
$t = isset($_GET['t']) ? (int)$_GET['t'] : 0;
$isOverview = ($t === 0) || ($t === 99 && !$session->goldclub);
$isGold = ($t === 99 && $session->goldclub);
?>
<div id="textmenu"> <div id="textmenu">
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['t']) || (isset($_GET['t']) && $_GET['t'] == 99 && !$session->goldclub)) echo "class=\"selected\""; ?> ><?php echo OVERVIEW;?></a> | <a href="build.php?id=<?= $id ?>" <?= $isOverview ? 'class="selected"' : '' ?>><?= OVERVIEW ?></a> |
<a href="a2b.php"><?php echo SEND_TROOPS;?></a> | <a href="a2b.php"><?= SEND_TROOPS ?></a> |
<a href="warsim.php"><?php echo Q20_RESP1;?></a> <a href="warsim.php"><?= Q20_RESP1 ?></a>
<?php if($session->goldclub == 1){ ?>| <?php if ($session->goldclub == 1): ?> |
<a href="build.php?id=<?php echo $id; ?>&amp;t=99" <?php if(isset($_GET['t']) && $_GET['t'] == 99) echo "class=\"selected\""; ?> >Gold Club</a> <a href="build.php?id=<?= $id ?>&amp;t=99" <?= $isGold ? 'class="selected"' : '' ?>>Gold Club</a>
<?php } ?> <?php endif; ?>
</div> </div>
+32 -32
View File
@@ -1,34 +1,34 @@
<?php <?php
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$end = ($tribe*10);
echo "<tr><th>&nbsp;</th>";
for($i=$start;$i<=($end);$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($village->unitarray['hero'] != 0) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
?> // RALLY POINT TROOPS
</tr><tr><th><?php echo TROOPS;?></th>
<?php
for($i=$start;$i<=$end;$i++) {
if($village->unitarray['u'.$i] == 0) {
echo "<td class=\"none\">";
}
else {
echo "<td>";
}
echo $village->unitarray['u'.$i]."</td>";
}
if($village->unitarray['hero'] != 0) { $tribe = $session->tribe;
echo "<td>"; $start = ($tribe - 1) * 10 + 1;
echo $village->unitarray['hero']."</td>"; $end = $tribe * 10;
} $hasHero = $village->unitarray['hero'] != 0;
$colspan = $hasHero ? 11 : 10;
?> ?>
</tr></tbody> <tr><th>&nbsp;</th>
<tbody class="infos"><tr><th><?php echo UPKEEP;?></th> <?php for ($i = $start; $i <= $end; $i++): ?>
<td colspan="<?php if($village->unitarray['hero'] == 0) {echo"10";}else{echo"11";}?>"><?php echo $technology->getUpkeep($village->unitarray,0); ?><img class="r4" src="img/x.gif" title="Crop" alt="Crop" /><?php echo PER_HR;?></td></tr> <td><img src="img/x.gif" class="unit u<?= $i ?>" title="<?= $technology->getUnitName($i) ?>" alt="<?= $technology->getUnitName($i) ?>"></td>
<?php endfor; ?>
<?php if ($hasHero): ?>
<td><img src="img/x.gif" class="unit uhero" title="Hero" alt="Hero"></td>
<?php endif; ?>
</tr>
<tr><th><?= TROOPS ?></th>
<?php for ($i = $start; $i <= $end; $i++):
$cnt = $village->unitarray['u'.$i] ?? 0;
?>
<td class="<?= $cnt == 0 ? 'none' : '' ?>"><?= $cnt ?></td>
<?php endfor; ?>
<?php if ($hasHero): ?>
<td><?= $village->unitarray['hero'] ?></td>
<?php endif; ?>
</tr>
</tbody>
<tbody class="infos">
<tr>
<th><?= UPKEEP ?></th>
<td colspan="<?= $colspan ?>"><?= $technology->getUpkeep($village->unitarray, 0) ?><img class="r4" src="img/x.gif" title="Crop" alt="Crop"><?= PER_HR ?></td>
</tr>
+71 -159
View File
@@ -1,170 +1,82 @@
<?php <?php
$units = $database->getMovement(3,$village->wid,0);
$total_for = count($units);
for($y=0;$y<$total_for;$y++){ // RALLY POINT WALKING
$session->timer++;
if($units[$y]['attack_type'] == 2){ $outgoing = $database->getMovement(3, $village->wid, 0);
$attack_type = REINFORCEMENTFOR;
}
if($units[$y]['attack_type'] == 1){
$attack_type = SCOUTING;
}
if($units[$y]['attack_type'] == 3){
$attack_type = ATTACK_ON;
}
if($units[$y]['attack_type'] == 4){
$attack_type = RAID_ON;
}
$isoasis = $database->isVillageOases($units[$y]['to']);
if ($isoasis ==0){
$to = $database->getMInfo($units[$y]['to']);
} else {
$to = $database->getOMInfo($units[$y]['to']);}
?> ?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead>
<tr>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>"><a href="karte.php?d=<?php echo $to['wref']."&c=".$generator->getMapCheck($to['wref']); ?>"><?php echo $attack_type." ".$to['name']; ?></a></td>
</tr>
</thead>
<tbody class="units">
<?php
echo "<tr><th>&nbsp;</th>";
for($i=($session->tribe-1)*10+1;$i<=$session->tribe*10;$i++) {
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>";
}
if($units[$y]['t11'] != 0) {
echo "<td><img src=\"img/x.gif\" class=\"unit uhero\" title=\"Hero\" alt=\"Hero\" /></td>";
}
?>
</tr>
<tr><th><?php echo TROOPS;?></th>
<?php
if($units[$y]['t11'] != 0) {
$end = 12;
}else{
$end = 11;
}
for($i=1;$i<$end;$i++) {
if($units[$y]['t'.$i] == 0) {
echo "<td class=\"none\">";
}
else {
echo "<td>";
}
echo $units[$y]['t'.$i]."</td>";
}
?>
</tr></tbody>
<?php if(NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET){
if($units[$y]['t8'] > 0 && $units[$y]['attack_type'] == 3 && !$database->isVillageOases($units[$y]['to'])){ ?>
<tbody>
<tr>
<th><?php echo CATAPULT_TARGET;?></th>
<td style="text-align: center" colspan="5">
<?php echo $units[$y]['ctar1'] == 0 ? "Random" : Building::procResType($units[$y]['ctar1']); ?>
</td>
<td style="text-align: center" colspan="<?php if($units[$y]['t11'] == 0) {echo"5";}else{echo"6";}?>">
<?php echo $units[$y]['ctar2'] == 99 ? "Random" : ($units[$y]['ctar2'] == 0 ? "-" : Building::procResType($units[$y]['ctar2'])); ?>
</td>
</tr>
</tbody>
<?php }
} ?>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>">
<?php
echo "<div class=\"in small\"><span id=timer$session->timer>".$generator->getTimeFormat($units[$y]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($units[$y]['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
if (($units[$y]['starttime']+90)>time()){
?>
<div class="abort"><a href="build.php?id=<?php echo $_GET['id']."&mode=troops&cancel=1&moveid=".$units[$y]['moveid']; ?>"><img src="img/x.gif" class="del" /></a></div>
<?php } ?>
</div>
</td>
</tr>
</tbody>
</table>
<?php
}
?>
<?php <?php foreach ($outgoing as $m):
$settlers = $database->getMovement(5,$village->wid,0);
if($settlers){
$total_for = count($settlers);
for($y=0;$y<$total_for;$y++){
$session->timer++; $session->timer++;
$atk = (int)$m['attack_type'];
if ($atk == 1) $action = SCOUTING;
elseif ($atk == 2) $action = REINFORCEMENTFOR;
elseif ($atk == 3) $action = ATTACK_ON;
elseif ($atk == 4) $action = RAID_ON;
else $action = '';
$to = $database->isVillageOases($m['to'])? $database->getOMInfo($m['to']) : $database->getMInfo($m['to']);
$colspan = $m['t11']? 11 : 10;
$tribe = $session->tribe;
$start = ($tribe-1)*10+1;
$dt = $generator->procMtime($m['endtime']);
?> ?>
<table class="troop_details" cellpadding="1" cellspacing="1"> <table class="troop_details" cellpadding="1" cellspacing="1">
<thead> <thead><tr>
<tr> <td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td class="role"><a href="karte.php?d=<?php echo $village->wid."&c=".$generator->getMapCheck($village->wid); ?>"><?php echo $village->vname; ?></a></td> <td colspan="<?= $colspan?>"><a href="karte.php?d=<?= $to['wref']?>&c=<?= $generator->getMapCheck($to['wref'])?>"><?= $action?> <?= $to['name']?></a></td>
<td colspan="10"><a href="karte.php?d=<?php echo $settlers[$y]['to']."&c=".$generator->getMapCheck($settlers[$y]['to']); ?>"><?php echo FOUNDNEWVILLAGE;?></a></td> </tr></thead>
</tr>
</thead>
<tbody class="units"> <tbody class="units">
<?php <tr><th>&nbsp;</th>
$tribe = $session->tribe; <?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>" title="<?= $technology->getUnitName($i)?>"></td><?php endfor;?>
$start = ($tribe-1)*10+1; <?php if($m['t11']):?><td><img src="img/x.gif" class="unit uhero" title="Hero"></td><?php endif;?>
$end = ($tribe*10); </tr>
echo "<tr><th>&nbsp;</th>"; <tr><th><?= TROOPS?></th>
for($i=$start;$i<=($end);$i++) { <?php for($i=1;$i<($m['t11']?12:11);$i++): $v = isset($m['t'.$i])? $m['t'.$i] : 0;?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?>
echo "<td><img src=\"img/x.gif\" class=\"unit u$i\" title=\"".$technology->getUnitName($i)."\" alt=\"".$technology->getUnitName($i)."\" /></td>"; </tr>
} </tbody>
?>
</tr> <?php if (defined('NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET') && NEW_FUNCTIONS_DISPLAY_CATAPULT_TARGET && $m['t8']>0 && $atk==3 &&!$database->isVillageOases($m['to'])):?>
<tr><th><?php echo TROOPS;?></th> <tbody><tr>
<?php <th><?= CATAPULT_TARGET?></th>
for($x=1;$x<=9;$x++) { <td style="text-align:center" colspan="5"><?= $m['ctar1']==0?'Random':Building::procResType($m['ctar1'])?></td>
$units[$y]['t'.$x]=0; <td style="text-align:center" colspan="<?= $m['t11']?6:5?>"><?= $m['ctar2']==99?'Random':($m['ctar2']==0?'-':Building::procResType($m['ctar2']))?></td>
} </tr></tbody>
$units[$y]['t10']=3; <?php endif;?>
for($i=1;$i<=10;$i++) {
if($units[$y]['t'.$i] == 0) { <tbody class="infos"><tr>
echo "<td class=\"none\">0</td>"; <th><?= ARRIVAL?></th>
} <td colspan="<?= $colspan?>">
else { <div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($m['endtime']-time())?></span> h</div>
echo "<td>"; <div class="at"><?= $dt[0]!='today'?ON.' '.$dt[0].' ':''?><?= AT?> <?= $dt[1]?></div>
echo $units[$y]['t'.$i]."</td>"; <?php if(($m['starttime']+90)>time()):?>
} <div class="abort"><a href="build.php?id=<?= $_GET['id']?>&mode=troops&cancel=1&moveid=<?= $m['moveid']?>"><img src="img/x.gif" class="del"></a></div>
} <?php endif;?>
?> </td>
</tr></tbody> </tr></tbody>
<tbody class="infos">
<tr>
<th><?php echo ARRIVAL;?></th>
<td colspan="<?php if($units[$y]['t11'] == 0) {echo"10";}else{echo"11";}?>">
<?php
echo "<div class=\"in small\"><span id=timer$session->timer>".$generator->getTimeFormat($settlers[$y]['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($settlers[$y]['endtime']);
echo "<div class=\"at small\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
if (($settlers[$y]['starttime']+90)>time()){
?>
<div class="abort"><a href="build.php?id=<?php echo $_GET['id']."&mode=troops&cancel=1&moveid=".$settlers[$y]['moveid']; ?>"><img src="img/x.gif" class="del" /></a></div>
<?php } ?>
</div>
</td>
</tr>
</tbody>
</table> </table>
<?php <?php endforeach;?>
}
} <?php $settlers = $database->getMovement(5, $village->wid, 0);
?> foreach ($settlers as $s):
$session->timer++; $tribe=$session->tribe; $start=($tribe-1)*10+1; $dt=$generator->procMtime($s['endtime']);
?>
<table class="troop_details" cellpadding="1" cellspacing="1">
<thead><tr>
<td class="role"><a href="karte.php?d=<?= $village->wid?>&c=<?= $generator->getMapCheck($village->wid)?>"><?= $village->vname?></a></td>
<td colspan="10"><a href="karte.php?d=<?= $s['to']?>&c=<?= $generator->getMapCheck($s['to'])?>"><?= FOUNDNEWVILLAGE?></a></td>
</tr></thead>
<tbody class="units">
<tr><th>&nbsp;</th><?php for($i=$start;$i<$start+10;$i++):?><td><img src="img/x.gif" class="unit u<?= $i?>"></td><?php endfor;?></tr>
<tr><th><?= TROOPS?></th><?php for($i=1;$i<=10;$i++): $v=($i==10?3:0);?><td class="<?= $v==0?'none':''?>"><?= $v?></td><?php endfor;?></tr>
</tbody>
<tbody class="infos"><tr>
<th><?= ARRIVAL?></th><td colspan="10">
<div class="in small"><span id="timer<?= $session->timer?>"><?= $generator->getTimeFormat($s['endtime']-time())?></span> h</div>
<div class="at small"><?= $dt[0]!='today'?ON.' '.$dt[0].' ':''?><?= AT?> <?= $dt[1]?></div>
<?php if(($s['starttime']+90)>time()):?>
<div class="abort"><a href="build.php?id=<?= $_GET['id']?>&mode=troops&cancel=1&moveid=<?= $s['moveid']?>"><img src="img/x.gif" class="del"></a></div>
<?php endif;?>
</td>
</tr></tbody>
</table>
<?php endforeach;?>
+234 -295
View File
@@ -1,307 +1,246 @@
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?>
</p>
<?php include("17_menu.tpl"); ?>
<script language="JavaScript">
<!--
var haendler = <?php echo $market->merchantAvail(); ?>;
var carry = <?php echo $market->maxcarry; ?>;
//-->
</script>
<?php <?php
for ($a = 1; $a <= 4; $a++) { // 17.tpl - MARKETPLACE
if (!isset($_POST['r'.$a])) { global $database, $session, $village, $market, $generator, $form, $id;
$_POST['r'.$a] = 0;
$merchantAvail = (int)$market->merchantAvail();
$maxcarry = (int)$market->maxcarry;
$totalMerchants = (int)$market->merchant;
// --- POST sanitizat ---
$r = [];
for ($i = 1; $i <= 4; $i++) {
$r[$i] = isset($_POST['r'.$i])? max(0, (int)$_POST['r'.$i]) : 0;
}
$allres = array_sum($r);
$x = isset($_POST['x'])? trim($_POST['x']) : '';
$y = isset($_POST['y'])? trim($_POST['y']) : '';
$dname = isset($_POST['dname'])? trim($_POST['dname']) : '';
$send3 = isset($_POST['send3'])? (int)$_POST['send3'] : 1;
$ft = $_POST['ft']?? '';
// --- target ---
$getwref = 0;
$checkexist = false;
$target = null;
if ($x!== '' && $y!== '' && is_numeric($x) && is_numeric($y)) {
$getwref = (int)$database->getVilWref((int)$x, (int)$y);
$checkexist = $database->checkVilExist($getwref);
} elseif ($dname!== '') {
$getwref = (int)$database->getVillageByName($dname);
$checkexist = $database->checkVilExist($getwref);
}
if ($checkexist) {
$villageOwner = (int)$database->getVillageField($getwref, 'owner');
$userAccess = (int)$database->getUserField($villageOwner, 'access', 0);
$userVacation = (int)$database->getUserField($villageOwner, 'vac_mode', 0);
$userID = (int)$database->getUserField($villageOwner, 'id', 0);
$target = [
'wref' => $getwref,
'name' => $database->getVillageField($getwref, 'name'),
'owner' => $villageOwner,
'coor' => $database->getCoor($getwref),
];
$target['time'] = $generator->procDistanceTime($target['coor'], $village->coor, $session->tribe, 0);
}
$maxTotalCarry = $maxcarry * $merchantAvail;
$canRepeat = ($send3 === 1) || ($send3 >= 2 && $send3 <= 3 && $session->goldclub);
$validTarget = $checkexist && $getwref!== $village->wid;
$validAccess = $checkexist && ($userAccess == 2 || $userAccess == MULTIHUNTER || (defined('ADMIN_ALLOW_INCOMING_RAIDS') && ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN));
$showConfirm = ($ft === 'check' && $canRepeat && $validTarget && $allres > 0 && $allres <= $maxTotalCarry && $validAccess && $userVacation == 0);
// coordonate prefill din GET
$coor = ['x' => '', 'y' => ''];
if (isset($_GET['z'])) {
$coor = $database->getCoor((int)$_GET['z']);
}
?>
<div id="build" class="gid17">
<a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo (int)$village->resarray['f'.$id];?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
<?php include("17_menu.tpl");?>
<script language="JavaScript">
</script>
<?php if ($showConfirm && $target):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="mk1">
<input type="hidden" name="id" value="<?php echo (int)$id;?>">
<input type="hidden" name="send3" value="<?php echo $send3;?>">
<table id="send_select" class="send_res" cellpadding="1" cellspacing="1">
<?php for ($i = 1; $i <= 4; $i++):
$resNames = [1=>LUMBER,2=>CLAY,3=>IRON,4=>CROP];
?>
<tr>
<td class="ico"><img class="r<?php echo $i;?>" src="img/x.gif" alt="<?php echo $resNames[$i];?>" title="<?php echo $resNames[$i];?>" /></td>
<td class="nam"><?php echo $resNames[$i];?></td>
<td class="val"><input class="text disabled" type="text" name="r<?php echo $i;?>" id="r<?php echo $i;?>" value="<?php echo $r[$i];?>" readonly="readonly"></td>
<td class="max"> / <span class="none"><b><?php echo $maxcarry;?></b></span></td>
</tr>
<?php endfor;?>
</table>
<table id="target_validate" class="res_target" cellpadding="1" cellspacing="1">
<tbody>
<tr>
<th><?php echo COORDINATES;?>:</th>
<td><a href="karte.php?d=<?php echo $target['wref'];?>&c=<?php echo $generator->getMapCheck($target['wref']);?>"><?php echo htmlspecialchars($target['name']);?>(<?php echo (int)$target['coor']['x'];?>|<?php echo (int)$target['coor']['y'];?>)</a></td>
</tr>
<tr>
<th><?php echo PLAYER;?>:</th>
<td><a href="spieler.php?uid=<?php echo $target['owner'];?>"><?php echo htmlspecialchars($database->getUserField($target['owner'], 'username', 0));?></a></td>
</tr>
<tr>
<th><?php echo DURATION;?>:</th>
<td><?php echo $generator->getTimeFormat($target['time']);?></td>
</tr>
<tr>
<th><?php echo MERCHANT;?>:</th>
<td><?php echo ceil(($allres - 0.1) / $maxcarry);?></td>
</tr>
<tr><td colspan="2"></td></tr>
</tbody>
</table>
<input type="hidden" name="getwref" value="<?php echo $target['wref'];?>">
<div class="clear"></div>
<p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK" <?php if(!$merchantAvail) echo 'disabled';?> /></p>
</form>
<?php else:?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="check">
<input type="hidden" name="id" value="<?php echo (int)$id;?>">
<table id="send_select" class="send_res" cellpadding="1" cellspacing="1">
<?php for ($i = 1; $i <= 4; $i++):
$resNames = [1=>LUMBER,2=>CLAY,3=>IRON,4=>CROP];
?>
<tr>
<td class="ico"><a href="#" onClick="upd_res(<?php echo $i;?>,1); return false;"><img class="r<?php echo $i;?>" src="img/x.gif" alt="<?php echo $resNames[$i];?>" title="<?php echo $resNames[$i];?>" /></a></td>
<td class="nam"><?php echo $resNames[$i];?>:</td>
<td class="val"><input class="text" type="text" name="r<?php echo $i;?>" id="r<?php echo $i;?>" value="" maxlength="5" onKeyUp="upd_res(<?php echo $i;?>)" tabindex="<?php echo $i;?>"></td>
<td class="max"><a href="#" onMouseUp="add_res(<?php echo $i;?>);" onClick="return false;">(<?php echo $maxcarry;?>)</a></td>
</tr>
<?php endfor;?>
</table>
<table id="target_select" class="res_target" cellpadding="1" cellspacing="1">
<tr><td class="mer"><?php echo MERCHANT;?> <?php echo $merchantAvail;?>/<?php echo $totalMerchants;?></td></tr>
<tr><td class="vil"><span><?php echo VILLAGES;?>:</span> <input class="text" type="text" name="dname" value="" maxlength="30" tabindex="5"></td></tr>
<tr><td class="or"><?php echo OR_;?></td></tr>
<tr>
<td class="coo">
<span>X:</span><input class="text" type="text" name="x" value="<?php echo htmlspecialchars($coor['x']);?>" maxlength="4" tabindex="6">
<span>Y:</span><input class="text" type="text" name="y" value="<?php echo htmlspecialchars($coor['y']);?>" maxlength="4" tabindex="7">
</td>
</tr>
</table>
<div class="clear"></div>
<?php if ($session->goldclub == 1):?>
<p><select name="send3"><option value="1" selected>1x</option><option value="2">2x</option><option value="3">3x</option></select> <?php echo GO;?></p>
<?php else:?>
<input type="hidden" name="send3" value="1">
<?php endif;?>
<p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK" <?php if(!$merchantAvail) echo 'disabled';?> /></p>
</form>
<?php
// --- erori ---
$error = '';
if ($ft === 'check') {
if ($form->returnErrors() > 0) {
$error = '<span class="error"><b>'.$form->getError("error").'</b></span>';
} elseif (!$checkexist) {
$error = '<span class="error"><b>'.NO_COORDINATES_SELECTED.'</b></span>';
} elseif ($getwref == $village->wid) {
$error = '<span class="error"><b>'.CANNOT_SEND_RESOURCES.'</b></span>';
} elseif (!$canRepeat) {
$error = '<span class="error"><b>'.INVALID_MERCHANTS_REPETITION.'</b></span>';
} elseif (!$validAccess) {
$error = '<span class="error"><b>'.BANNED_CANNOT_SEND_RESOURCES.'.</b></span>';
} elseif ($allres == 0) {
$error = '<span class="error"><b>'.RESOURCES_NO_SELECTED.'.</b></span>';
} elseif ($userVacation == 1) {
$error = '<span class="error"><b>Player is on vacation mode. You cannot send resources to him.</b></span>';
} elseif ($x === '' && $y === '' && $dname === '') {
$error = '<span class="error"><b>'.ENTER_COORDINATES.'.</b></span>';
} elseif ($allres > $maxTotalCarry) {
$error = '<span class="error"><b>'.TOO_FEW_MERCHANTS.'.</b></span>';
}
echo $error;
}
?>
<?php endif;?>
<p><?php echo MERCHANT_CARRY;?> <b><?php echo $maxcarry;?></b> <?php echo UNITS_OF_RESOURCE;?></p>
<?php
// --- comercianți care vin ---
if (count($market->recieving) > 0) {
echo "<h4>".MERCHANT_COMING.":</h4>";
foreach ($market->recieving as $recieve) {
$villageowner = (int)$database->getVillageField($recieve['from'], "owner");
echo '<table class="traders" cellpadding="1" cellspacing="1">';
echo '<thead><tr><td><a href="spieler.php?uid='.$villageowner.'">'.htmlspecialchars($database->getUserField($villageowner,"username",0)).'</a></td>';
echo '<td><a href="karte.php?d='.$recieve['from'].'&c='.$generator->getMapCheck($recieve['from']).'">'.TRANSPORT_FROM.' '.htmlspecialchars($database->getVillageField($recieve['from'],"name")).'</a></td></tr></thead>';
echo '<tbody><tr><th>'.ARRIVAL_IN.'</th><td>';
echo '<div class="in"><span id="timer'.(++$session->timer).'">'.$generator->getTimeFormat($recieve['endtime']-time()).'</span> h</div>';
$datetime = $generator->procMtime($recieve['endtime']);
echo '<div class="at">'.($datetime[0]!= "today"? ON." ".$datetime[0]." " : "").AT." ".$datetime[1].'</div>';
echo '</td></tr></tbody><tr class="res"><th>'.RESOURCES.'</th><td colspan="2"><span class="f10">';
echo '<img class="r1" src="img/x.gif" alt="'.LUMBER.'" title="'.LUMBER.'" />'.$recieve['wood'].' | ';
echo '<img class="r2" src="img/x.gif" alt="'.CLAY.'" title="'.CLAY.'" />'.$recieve['clay'].' | ';
echo '<img class="r3" src="img/x.gif" alt="'.IRON.'" title="'.IRON.'" />'.$recieve['iron'].' | ';
echo '<img class="r4" src="img/x.gif" alt="'.CROP.'" title="'.CROP.'" />'.$recieve['crop'];
echo '</span></td></tr></table>';
} }
} }
$allres = (int) $_POST['r1'] + (int) $_POST['r2'] + (int) $_POST['r3'] + (int) $_POST['r4'];
if(isset( $_POST['x'] ) && isset( $_POST['y'] ) && $_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$getwref = $database->getVilWref($_POST['x'],$_POST['y']);
$checkexist = $database->checkVilExist($getwref);
}
else if(!empty($_POST['dname'])){
$getwref = $database->getVillageByName($_POST['dname']);
$checkexist = $database->checkVilExist($getwref);
}
if(isset($checkexist) && $checkexist){
$villageOwner = $database->getVillageField($getwref,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
$userVacation = $database->getUserField($villageOwner,'vac_mode',0);
$userID = $database->getUserField($villageOwner,'id',0);
}
$maxcarry = $market->maxcarry;
$maxcarry *= $market->merchantAvail();
if(isset($_POST['ft'])=='check' && (($_POST['send3'] > 1 && $_POST['send3'] <= 3 && $session->goldclub) || $_POST['send3'] == 1) && $getwref != $village->wid && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && ($userAccess == 2 || $userAccess == MULTIHUNTER || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)) && $userVacation == 0){
?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="mk1">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<input type="hidden" name="send3" value="<?php echo $_POST['send3']; ?>">
<table id="send_select" class="send_res" cellpadding="1" cellspacing="1">
<tr>
<td class="ico"><img class="r1" src="img/x.gif" alt="Lumber" title="<?php echo LUMBER;?>" /></td>
<td class="nam"> <?php echo LUMBER;?></td>
<td class="val"><input class="text disabled" type="text" name="r1" id="r1" value="<?php echo $_POST['r1']; ?>" readonly="readonly"></td>
<td class="max"> / <span class="none"><B><?php echo $market->maxcarry; ?></B></span> </td>
</tr>
<tr>
<td class="ico"><img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /></td>
<td class="nam"> <?php echo CLAY;?></td>
<td class="val"><input class="text disabled" type="text" name="r2" id="r2" value="<?php echo $_POST['r2']; ?>" readonly="readonly"></td>
<td class="max"> / <span class="none"><b><?php echo$market->maxcarry; ?></b></span> </td>
</tr>
<tr>
<td class="ico"><img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /></td>
<td class="nam"> <?php echo IRON;?></td>
<td class="val"><input class="text disabled" type="text" name="r3" id="r3" value="<?php echo $_POST['r3']; ?>" readonly="readonly">
</td>
<td class="max"> / <span class="none"><b><?php echo $market->maxcarry; ?></b></span> </td>
</tr>
<tr>
<td class="ico"><img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /></td>
<td class="nam"> <?php echo CROP;?></td>
<td class="val"> <input class="text disabled" type="text" name="r4" id="r4" value="<?php echo $_POST['r4']; ?>" readonly="readonly">
</td>
<td class="max"> / <span class="none"><B><?php echo $market->maxcarry; ?></B></span></td>
</tr></table>
<table id="target_validate" class="res_target" cellpadding="1" cellspacing="1">
<tbody><tr>
<th><?php echo COORDINATES;?>:</th>
<?php
if($_POST['x'] != "" && $_POST['y'] != "" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$getwref = $database->getVilWref($_POST['x'],$_POST['y']);
$getvilname = $database->getVillageField($getwref, "name");
$getvilowner = $database->getVillageField($getwref, "owner");
$getvilcoor['y'] = $_POST['y'];
$getvilcoor['x'] = $_POST['x'];
$time = $generator->procDistanceTime($getvilcoor, $village->coor, $session->tribe, 0);
}
else if(!empty($_POST['dname'])){
$getwref = $database->getVillageByName($_POST['dname']);
$getvilcoor = $database->getCoor($getwref);
$getvilname = $database->getVillageField($getwref, "name");
$getvilowner = $database->getVillageField($getwref, "owner");
$time = $generator->procDistanceTime($getvilcoor, $village->coor, $session->tribe, 0);
}
?>
<td><a href="karte.php?d=<?php echo $getwref; ?>&c=<?php echo $generator->getMapCheck($getwref); ?>"><?php echo $getvilname; ?>(<?php echo $getvilcoor['x']; ?>|<?php echo $getvilcoor['y']; ?>)<span class="clear"></span></a></td>
</tr>
<tr>
<th><?php echo PLAYER;?>:</th>
<td><a href="spieler.php?uid=<?php echo $getvilowner; ?>"><?php echo $database->getUserField($getvilowner,'username',0); ?></a></td>
</tr>
<tr>
<th><?php echo DURATION;?>:</th>
<td><?php echo $generator->getTimeFormat($time); ?></td>
</tr>
<tr>
<th><?php echo MERCHANT;?>:</th>
<td><?php
$resource = array($_POST['r1'],$_POST['r2'],$_POST['r3'],$_POST['r4']);
echo ceil((array_sum($resource)-0.1)/$market->maxcarry); ?></td>
</tr>
<tr> // --- comercianți trimiși ---
<td colspan="2"> if (count($market->sending) > 0) {
</td> echo "<h4>".OWN_MERCHANTS_ONWAY.":</h4>";
</tr> foreach ($market->sending as $send) {
$villageowner = (int)$database->getVillageField($send['to'],"owner");
</tbody></table> echo '<table class="traders" cellpadding="1" cellspacing="1">';
<input type="hidden" name="getwref" value="<?php echo $getwref; ?>"> echo '<thead><tr><td><a href="spieler.php?uid='.$villageowner.'">'.htmlspecialchars($database->getUserField($villageowner,"username",0)).'</a></td>';
<div class="clear"></div> echo '<td><a href="karte.php?d='.$send['to'].'&c='.$generator->getMapCheck($send['to']).'">'.TRANSPORT_TO.' '.htmlspecialchars($database->getVillageField($send['to'],"name")).'</a></td></tr></thead>';
<p> echo '<tbody><tr><th>'.ARRIVAL_IN.'</th><td>';
<div class="clear"></div><p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK" <?php if(!$market->merchantAvail()) { echo "DISABLED"; }?>/></p></form> echo '<div class="in"><span id="timer'.(++$session->timer).'">'.$generator->getTimeFormat($send['endtime']-time()).'</span> h</div>';
<?php }else{ ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="check">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<table id="send_select" class="send_res" cellpadding="1" cellspacing="1"><tr>
<td class="ico">
<a href="#" onClick="upd_res(1,1); return false;"><img class="r1" src="img/x.gif" alt="Lumber" title="<?php echo LUMBER;?>" /></a>
</td>
<td class="nam">
<?php echo LUMBER;?>:
</td>
<td class="val">
<input class="text" type="text" name="r1" id="r1" value="" maxlength="5" onKeyUp="upd_res(1)" tabindex="1">
</td>
<td class="max">
<a href="#" onMouseUp="add_res(1);" onClick="return false;">(<?php echo $market->maxcarry; ?>)</a>
</td>
</tr><tr>
<td class="ico">
<a href="#" onClick="upd_res(2,1); return false;"><img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /></a>
</td>
<td class="nam">
<?php echo CLAY;?>:
</td>
<td class="val">
<input class="text" type="text" name="r2" id="r2" value="" maxlength="5" onKeyUp="upd_res(2)" tabindex="2">
</td>
<td class="max">
<a href="#" onMouseUp="add_res(2);" onClick="return false;">(<?php echo$market->maxcarry; ?>)</a>
</td>
</tr><tr>
<td class="ico">
<a href="#" onClick="upd_res(3,1); return false;"><img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /></a>
</td>
<td class="nam">
<?php echo IRON;?>:
</td>
<td class="val">
<input class="text" type="text" name="r3" id="r3" value="" maxlength="5" onKeyUp="upd_res(3)" tabindex="3">
</td>
<td class="max">
<a href="#" onMouseUp="add_res(3);" onClick="return false;">(<?php echo $market->maxcarry; ?>)</a>
</td>
</tr><tr>
<td class="ico">
<a href="#" onClick="upd_res(4,1); return false;"><img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /></a>
</td>
<td class="nam">
<?php echo CROP;?>:
</td>
<td class="val">
<input class="text" type="text" name="r4" id="r4" value="" maxlength="5" onKeyUp="upd_res(4)" tabindex="4">
</td>
<td class="max">
<a href="#" onMouseUp="add_res(4);" onClick="return false;">(<?php echo $market->maxcarry; ?>)</a>
</td>
</tr></table>
<table id="target_select" class="res_target" cellpadding="1" cellspacing="1">
<tr>
<td class="mer"><?php echo MERCHANT;?> <?php echo $market->merchantAvail(); ?>/<?php echo $market->merchant; ?></td>
</tr>
<td class="vil">
<span><?php echo VILLAGES;?>:</span>
<input class="text" type="text" name="dname" value="" maxlength="30" tabindex="5">
</td>
<tr>
<td class="or"><?php echo OR_;?></td>
</tr>
<tr>
<?php
if(isset($_GET['z'])){
$coor = $database->getCoor($_GET['z']);
}
else{
$coor['x'] = "";
$coor['y'] = "";
}
?>
<td class="coo">
<span>X:</span><input class="text" type="text" name="x" value="<?php echo $coor['x']; ?>" maxlength="4" tabindex="6">
<span>Y:</span><input class="text" type="text" name="y" value="<?php echo $coor['y']; ?>" maxlength="4" tabindex="7">
</td>
</tr>
</table>
<div class="clear"></div>
<?php if($session->goldclub == 1){?>
<p><select name="send3"><option value="1" selected="selected">1x</option><option value="2">2x</option><option value="3">3x</option></select> <?php echo GO;?></p>
<?php
}else{
?>
<input type="hidden" name="send3" value="1">
<?php
}
?>
<p><input type="image" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK" <?php if(!$market->merchantAvail()) { echo "DISABLED"; }?>/></p></form>
<?php
$error = '';
if(isset($_POST['ft'])=='check'){
if($form->returnErrors() > 0) $error = '<span class="error"><b>'.$form->getError("error").'</b></span>';
elseif(!$checkexist){
$error = '<span class="error"><b>'.NO_COORDINATES_SELECTED.'</b></span>';
}elseif($getwref == $village->wid){
$error = '<span class="error"><b>'.CANNOT_SEND_RESOURCES.'</b></span>';
}elseif($_POST['send3'] < 1 || $_POST['send3'] > 3 || ($_POST['send3'] > 1 && !$session->goldclub)){
$error = '<span class="error"><b>'.INVALID_MERCHANTS_REPETITION.'</b></span>';
}elseif($userAccess == '0' or ($userAccess == MULTIHUNTER && $userID == 5) or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == ADMIN)){
$error = '<span class="error"><b>'.BANNED_CANNOT_SEND_RESOURCES.'.</b></span>';
}elseif($_POST['r1']==0 && $_POST['r2']==0 && $_POST['r3']==0 && $_POST['r4']==0){
$error = '<span class="error"><b>'.RESOURCES_NO_SELECTED.'.</b></span>';
}elseif($userVacation == '1') {
$error = '<span class="error"><b>Player is on vacation mode. You cannot send resources to him.</b></span>';
}elseif(!$_POST['x'] && !$_POST['y'] && !$_POST['dname']){
$error = '<span class="error"><b>'.ENTER_COORDINATES.'.</b></span>';
}elseif($allres > $maxcarry){
$error = '<span class="error"><b>'.TOO_FEW_MERCHANTS.'.</b></span>';
}
echo $error;
}
?>
<p>
<?php } ?>
<p><?php echo MERCHANT_CARRY;?> <b><?php echo $market->maxcarry; ?></b> <?php echo UNITS_OF_RESOURCE;?> </p>
<?php
if(count($market->recieving) > 0) {
echo "<h4>".MERCHANT_COMING.":</h4>";
foreach($market->recieving as $recieve) {
echo "<table class=\"traders\" cellpadding=\"1\" cellspacing=\"1\">";
$villageowner = $database->getVillageField($recieve['from'],"owner");
echo "<thead><tr><td><a href=\"spieler.php?uid=$villageowner\">".$database->getUserField($villageowner,"username",0)."</a></td>";
echo "<td><a href=\"karte.php?d=".$recieve['from']."&c=".$generator->getMapCheck($recieve['from'])."\">".TRANSPORT_FROM." ".$database->getVillageField($recieve['from'],"name")."</a></td>";
echo "</tr></thead><tbody><tr><th>".ARRIVAL_IN."</th><td>";
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($recieve['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($recieve['endtime']);
echo "<div class=\"at\">";
if($datetime[0] != "today") {
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
echo "</td></tr></tbody> <tr class=\"res\"> <th>".RESOURCES."</th> <td colspan=\"2\"><span class=\"f10\">";
echo "<img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".$recieve['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".$recieve['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".$recieve['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".$recieve['crop']."</td></tr></tbody>";
echo "</table>";
}
}
if(count($market->sending) > 0) {
echo "<h4>".OWN_MERCHANTS_ONWAY.":</h4>";
foreach($market->sending as $send) {
$villageowner = $database->getVillageField($send['to'],"owner");
$ownername = $database->getUserField($villageowner,"username",0);
echo "<table class=\"traders\" cellpadding=\"1\" cellspacing=\"1\">";
echo "<thead><tr> <td><a href=\"spieler.php?uid=$villageowner\">$ownername</a></td>";
echo "<td><a href=\"karte.php?d=".$send['to']."&c=".$generator->getMapCheck($send['to'])."\">".TRANSPORT_TO." ".$database->getVillageField($send['to'],"name")."</a></td>";
echo "</tr></thead> <tbody><tr> <th>".ARRIVAL_IN."</th> <td>";
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($send['endtime']-time())."</span> h</div>";
$datetime = $generator->procMtime($send['endtime']); $datetime = $generator->procMtime($send['endtime']);
echo "<div class=\"at\">"; echo '<div class="at">'.($datetime[0]!= "today"? ON." ".$datetime[0]." " : "").AT." ".$datetime[1].'</div>';
if($datetime[0] != "today") { echo '</td></tr><tr class="res"><th>'.RESOURCES.'</th><td>';
echo "".ON." ".$datetime[0]." "; echo '<img class="r1" src="img/x.gif" alt="'.LUMBER.'" />'.$send['wood'].' | ';
} echo '<img class="r2" src="img/x.gif" alt="'.CLAY.'" />'.$send['clay'].' | ';
echo "".AT." ".$datetime[1]."</div>"; echo '<img class="r3" src="img/x.gif" alt="'.IRON.'" />'.$send['iron'].' | ';
echo "</td> </tr> <tr class=\"res\"> <th>".RESOURCES."</th><td>"; echo '<img class="r4" src="img/x.gif" alt="'.CROP.'" />'.$send['crop'];
echo "<img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".$send['wood']." | <img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".$send['clay']." | <img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".$send['iron']." | <img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".$send['crop']."</td></tr></tbody>"; echo '</td></tr></tbody></table>';
echo "</table>";
} }
} }
if(count($market->return) > 0) {
echo "<h4>".MERCHANTS_RETURNING.":</h4>"; // --- comercianți care se întorc ---
foreach($market->return as $return) { if (count($market->return) > 0) {
$villageowner = $database->getVillageField($return['from'],"owner"); echo "<h4>".MERCHANTS_RETURNING.":</h4>";
$ownername = $database->getUserField($villageowner,"username",0); foreach ($market->return as $return) {
echo "<table class=\"traders\" cellpadding=\"1\" cellspacing=\"1\">"; $villageowner = (int)$database->getVillageField($return['from'],"owner");
echo "<thead><tr> <td><a href=\"spieler.php?uid=$villageowner\">$ownername</a></td>"; echo '<table class="traders" cellpadding="1" cellspacing="1">';
echo "<td><a href=\"karte.php?d=".$return['from']."&c=".$generator->getMapCheck($return['from'])."\">".RETURNFROM." ".$database->getVillageField($return['from'],"name")."</a></td>"; echo '<thead><tr><td><a href="spieler.php?uid='.$villageowner.'">'.htmlspecialchars($database->getUserField($villageowner,"username",0)).'</a></td>';
echo "</tr></thead> <tbody><tr> <th>".ARRIVAL_IN."</th> <td>"; echo '<td><a href="karte.php?d='.$return['from'].'&c='.$generator->getMapCheck($return['from']).'">'.RETURNFROM.' '.htmlspecialchars($database->getVillageField($return['from'],"name")).'</a></td></tr></thead>';
echo "<div class=\"in\"><span id=timer".++$session->timer.">".$generator->getTimeFormat($return['endtime']-time())."</span> h</div>"; echo '<tbody><tr><th>'.ARRIVAL_IN.'</th><td>';
echo '<div class="in"><span id="timer'.(++$session->timer).'">'.$generator->getTimeFormat($return['endtime']-time()).'</span> h</div>';
$datetime = $generator->procMtime($return['endtime']); $datetime = $generator->procMtime($return['endtime']);
echo "<div class=\"at\">"; echo '<div class="at">'.($datetime[0]!= "today"? ON." ".$datetime[0]." " : "").AT." ".$datetime[1].'</div>';
if($datetime[0] != "today") { echo '</td></tr></tbody></table>';
echo "".ON." ".$datetime[0]." ";
}
echo "".AT." ".$datetime[1]."</div>";
echo "</td> </tr>";
echo "</tbody></table>";
} }
} }
include("upgrade.tpl"); include("upgrade.tpl");
?> ?>
</p></div> </div>
+148 -141
View File
@@ -1,146 +1,153 @@
<?php <?php
if(isset($_GET['u'])) { // 17_1.tpl - MARKETPLACE / OFFERS
$u = $_GET['u']; global $database, $session, $village, $market, $generator, $id;
}
else {
$u=0;
}
?>
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo"> $u = isset($_GET['u']) ? max(0, (int)$_GET['u']) : 0;
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" /> $s = isset($_GET['s']) ? (int)$_GET['s'] : 0;
</a> $b = isset($_GET['b']) ? (int)$_GET['b'] : 0;
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1> $v = isset($_GET['v']) ? $_GET['v'] : '';
<p class="build_desc"><?php echo MARKETPLACE_DESC;?>
</p>
<?php include("17_menu.tpl"); $resIcon = [
if($session->plus) { 1 => ['class' => 'r1', 'name' => LUMBER],
2 => ['class' => 'r2', 'name' => CLAY],
3 => ['class' => 'r3', 'name' => IRON],
4 => ['class' => 'r4', 'name' => CROP],
];
?> ?>
<table id="search_select" class="buy_select" cellpadding="1" cellspacing="1"> <div id="build" class="gid17">
<thead><tr> <a href="#" onClick="return Popup(17,4);" class="build_logo">
<td colspan="4"><?php echo I_AN_SEARCHING;?></td> <img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</tr></thead> </a>
<tbody><tr> <h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo (int)$village->resarray['f'.$id];?></span></h1>
<td <?php if(isset($_GET['s']) && $_GET['s'] == 1) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&s=1<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>"><img class="r1" src="img/x.gif" alt="Lumber" title="<?php echo LUMBER;?>" /></a></td> <p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
<td <?php if(isset($_GET['s']) && $_GET['s'] == 2) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&s=2<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>"><img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /></a></td>
<td <?php if(isset($_GET['s']) && $_GET['s'] == 3) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&s=3<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>"><img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /></a></td> <?php include("17_menu.tpl");?>
<td <?php if(isset($_GET['s']) && $_GET['s'] == 4) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&s=4<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>"><img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /></a></td></tr></tbody>
</table><table id="ratio_select" class="buy_select" cellpadding="1" cellspacing="1"> <?php if ($session->plus):?>
<tbody> <table id="search_select" class="buy_select" cellpadding="1" cellspacing="1">
<tr><td <?php if(isset($_GET['v'])) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&v=1:1<?php if(isset($_GET['s'])) echo "&s=".$_GET['s']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>">1:1</a></td> <thead><tr><td colspan="4"><?php echo I_AN_SEARCHING;?></td></tr></thead>
</tr><tr><td <?php if(!isset($_GET['v'])) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1<?php if(isset($_GET['s'])) echo "&s=".$_GET['s']; if(isset($_GET['b'])) echo "&b=".$_GET['b']; ?>">1:x</a></td> <tbody><tr>
</tr> <?php for ($i = 1; $i <= 4; $i++):?>
</tbody> <td <?php if ($s === $i) echo 'class="hl"';?>>
</table> <a href="build.php?id=<?php echo (int)$id;?>&t=1&s=<?php echo $i;?><?php if($v) echo '&v='.urlencode($v);?><?php if($b) echo '&b='.$b;?>">
<table id="bid_select" class="buy_select" cellpadding="1" cellspacing="1"> <img class="<?php echo $resIcon[$i]['class'];?>" src="img/x.gif" alt="<?php echo $resIcon[$i]['name'];?>" title="<?php echo $resIcon[$i]['name'];?>" />
<thead><tr> </a>
<td colspan="4"><?php echo I_AN_OFFERING;?></td> </td>
</tr></thead> <?php endfor;?>
<tbody><tr> </tr></tbody>
<td <?php if(isset($_GET['b']) && $_GET['b'] == 1) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&b=1<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['s'])) echo "&s=".$_GET['s']; ?>"><img class="r1" src="img/x.gif" alt="Lumber" title="<?php echo LUMBER;?>" /></a></td> </table>
<td <?php if(isset($_GET['b']) && $_GET['b'] == 2) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&b=2<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['s'])) echo "&s=".$_GET['s']; ?>"><img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /></a></td>
<td <?php if(isset($_GET['b']) && $_GET['b'] == 3) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&b=3<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['s'])) echo "&s=".$_GET['s']; ?>"><img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /></a></td> <table id="ratio_select" class="buy_select" cellpadding="1" cellspacing="1">
<td <?php if(isset($_GET['b']) && $_GET['b'] == 4) echo "class=\"hl\""; ?>><a href="build.php?id=<?php echo $id; ?>&t=1&b=4<?php if(isset($_GET['v'])) echo "&v=".$_GET['v']; if(isset($_GET['s'])) echo "&s=".$_GET['s']; ?>"><img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /></a></td></tr></tbody> <tbody>
</table> <tr><td <?php if($v) echo 'class="hl"';?>><a href="build.php?id=<?php echo (int)$id;?>&t=1&v=1:1<?php if($s) echo '&s='.$s;?><?php if($b) echo '&b='.$b;?>">1:1</a></td></tr>
<?php <tr><td <?php if(!$v) echo 'class="hl"';?>><a href="build.php?id=<?php echo (int)$id;?>&t=1<?php if($s) echo '&s='.$s;?><?php if($b) echo '&b='.$b;?>">1:x</a></td></tr>
} </tbody>
?> </table>
<div class="clear"></div><table id="range" cellpadding="1" cellspacing="1">
<?php <table id="bid_select" class="buy_select" cellpadding="1" cellspacing="1">
if(isset($_GET['e1'])) <thead><tr><td colspan="4"><?php echo I_AN_OFFERING;?></td></tr></thead>
{ <tbody><tr>
echo "<p class=\"error2\">".NOT_ENOUGH_RESOURCES."</p>"; <?php for ($i = 1; $i <= 4; $i++):?>
} <td <?php if ($b === $i) echo 'class="hl"';?>>
elseif(isset($_GET['e2'])) <a href="build.php?id=<?php echo (int)$id;?>&t=1&b=<?php echo $i;?><?php if($v) echo '&v='.urlencode($v);?><?php if($s) echo '&s='.$s;?>">
{ <img class="<?php echo $resIcon[$i]['class'];?>" src="img/x.gif" alt="<?php echo $resIcon[$i]['name'];?>" title="<?php echo $resIcon[$i]['name'];?>" />
echo "<p class=\"error2\">".INVALID_OFFER."</p>"; </a>
} </td>
elseif(isset($_GET['e3'])) <?php endfor;?>
{ </tr></tbody>
echo "<p class=\"error2\">".NOT_ENOUGH_MERCHANTS."</p>"; </table>
} <?php endif;?>
?>
<thead><tr> <div class="clear"></div>
<th colspan="5"><a name="h2"></a><?php echo OFFERS_MARKETPLACE;?></th>
</tr> <?php
<tr> // erori
<td><?php echo OFFERED_TO_ME;?></td> if (isset($_GET['e1'])) echo '<p class="error2">'.NOT_ENOUGH_RESOURCES.'</p>';
<td><?php echo WANTED_TO_ME;?></td> elseif (isset($_GET['e2'])) echo '<p class="error2">'.INVALID_OFFER.'</p>';
<td><?php echo PLAYER;?></td> elseif (isset($_GET['e3'])) echo '<p class="error2">'.NOT_ENOUGH_MERCHANTS.'</p>';
<td><?php echo DURATION;?></td> ?>
<td><?php echo ACTION;?></td>
</tr></thead> <table id="range" cellpadding="1" cellspacing="1">
<tbody> <thead>
<?php <tr><th colspan="5"><a name="h2"></a><?php echo OFFERS_MARKETPLACE;?></th></tr>
if(count($market->onsale) > 0) { <tr>
for($i=0+$u;$i<=40+$u;$i++) { <td><?php echo OFFERED_TO_ME;?></td>
if(isset($market->onsale[$i])) { <td><?php echo WANTED_TO_ME;?></td>
echo "<tr><td class=\"val\">"; <td><?php echo PLAYER;?></td>
$reqMerc = 1; <td><?php echo DURATION;?></td>
if($market->onsale[$i]['wamt'] > $market->maxcarry) { <td><?php echo ACTION;?></td>
$reqMerc = round($market->onsale[$i]['wamt']/$market->maxcarry); </tr>
if($market->onsale[$i]['wamt'] > $market->maxcarry*$reqMerc) { </thead>
$reqMerc += 1; <tbody>
} <?php
} $offers = $market->onsale;
switch($market->onsale[$i]['gtype']) { $totalOffers = count($offers);
case 1: echo "<img src=\"img/x.gif\" class=\"r1\" alt=\"Wood\" title=\"".LUMBER."\" />"; break;
case 2: echo "<img src=\"img/x.gif\" class=\"r2\" alt=\"Clay\" title=\"".CLAY."\" />"; break; if ($totalOffers > 0) {
case 3: echo "<img src=\"img/x.gif\" class=\"r3\" alt=\"Iron\" title=\"".IRON."\" />"; break; $end = min($u + 40, $totalOffers);
case 4: echo "<img src=\"img/x.gif\" class=\"r4\" alt=\"Crop\" title=\"".CROP."\" />"; break; for ($i = $u; $i < $end; $i++) {
} if (!isset($offers[$i])) continue;
echo $market->onsale[$i]['gamt']; $offer = $offers[$i];
echo "</td> <td class=\"val\">";
switch($market->onsale[$i]['wtype']) { $reqMerc = max(1, (int)ceil($offer['wamt'] / $market->maxcarry));
case 1: echo "<img src=\"img/x.gif\" class=\"r1\" alt=\"Wood\" title=\"".LUMBER."\" />"; break; $vref = (int)$offer['vref'];
case 2: echo "<img src=\"img/x.gif\" class=\"r2\" alt=\"Clay\" title=\"".CLAY."\" />"; break; $owner = (int)$database->getVillageField($vref, "owner");
case 3: echo "<img src=\"img/x.gif\" class=\"r3\" alt=\"Iron\" title=\"".IRON."\" />"; break; $username = htmlspecialchars($database->getUserField($owner, "username", 0));
case 4: echo "<img src=\"img/x.gif\" class=\"r4\" alt=\"Crop\" title=\"".CROP."\" />"; break; $villagename = htmlspecialchars($database->getVillageField($vref, "name"));
}
echo $market->onsale[$i]['wamt']; $hasRes = true;
echo "</td><td class=\"pla\" title=\"".$database->getVillageField($market->onsale[$i]['vref'],"name")."\">"; switch ($offer['wtype']) {
echo "<a href=\"karte.php?d=".$market->onsale[$i]['vref']."&c=".$generator->getMapCheck($market->onsale[$i]['vref'])."\">".$database->getUserField($database->getVillageField($market->onsale[$i]['vref'],"owner"),"username",0)."</a></td>"; case 1: $hasRes = $village->awood > $offer['wamt']; break;
echo "<td class=\"dur\">".$generator->getTimeFormat($market->onsale[$i]['duration'])."</td>"; case 2: $hasRes = $village->aclay > $offer['wamt']; break;
if(($market->onsale[$i]['wtype'] == 1 && $village->awood <= $market->onsale[$i]['wamt']) ||($market->onsale[$i]['wtype'] == 2 && $village->aclay <= $market->onsale[$i]['wamt']) ||($market->onsale[$i]['wtype'] == 3 && $village->airon <= $market->onsale[$i]['wamt']) ||($market->onsale[$i]['wtype'] == 4 && $village->acrop <= $market->onsale[$i]['wamt'])) { case 3: $hasRes = $village->airon > $offer['wamt']; break;
echo "<td class=\"act none\">".NOT_ENOUGH_RESOURCES."</td></tr>"; case 4: $hasRes = $village->acrop > $offer['wamt']; break;
} }
else if($reqMerc > $market->merchantAvail()) { ?>
echo "<td class=\"act none\">".NOT_ENOUGH_MERCHANTS."</td></tr>"; <tr>
} <td class="val">
else if($session->access != BANNED){ <img src="img/x.gif" class="<?php echo $resIcon[$offer['gtype']]['class'];?>" alt="<?php echo $resIcon[$offer['gtype']]['name'];?>" title="<?php echo $resIcon[$offer['gtype']]['name'];?>" />
echo "<td class=\"act\"><a href=\"build.php?id=$id&t=1&a=".$session->mchecker."&g=".$market->onsale[$i]['id']."\">Accept offer</a></td>"; <?php echo (int)$offer['gamt'];?>
}else{ </td>
echo "<td class=\"act\"><a href=\"banned.php\">".ACCEP_OFFER."</a></td>"; <td class="val">
} <img src="img/x.gif" class="<?php echo $resIcon[$offer['wtype']]['class'];?>" alt="<?php echo $resIcon[$offer['wtype']]['name'];?>" title="<?php echo $resIcon[$offer['wtype']]['name'];?>" />
echo"</tr>"; <?php echo (int)$offer['wamt'];?>
} </td>
} <td class="pla" title="<?php echo $villagename;?>">
} <a href="karte.php?d=<?php echo $vref;?>&c=<?php echo $generator->getMapCheck($vref);?>"><?php echo $username;?></a>
else { </td>
echo "<tr><td class=\"none\" colspan=\"5\">".NO_AVAILABLE_OFFERS."</td></tr>"; <td class="dur"><?php echo $generator->getTimeFormat($offer['duration']);?></td>
} <?php if (!$hasRes):?>
?> <td class="act none"><?php echo NOT_ENOUGH_RESOURCES;?></td>
</tbody><tfoot><tr><td colspan="5"> <?php elseif ($reqMerc > $market->merchantAvail()):?>
<span class="none"> <td class="act none"><?php echo NOT_ENOUGH_MERCHANTS;?></td>
<?php <?php elseif ($session->access != BANNED):?>
if(!isset($_GET['u']) && count($market->onsale) < 40) { <td class="act"><a href="build.php?id=<?php echo (int)$id;?>&t=1&a=<?php echo $session->mchecker;?>&g=<?php echo (int)$offer['id'];?>">Accept offer</a></td>
echo "<span class=\"none\"><b>&laquo;</b></span><span class=\"none\"><b>&raquo;</b></span>"; <?php else:?>
} <td class="act"><a href="banned.php"><?php echo ACCEP_OFFER;?></a></td>
else if (!isset($_GET['u']) && count($market->onsale) > 40) { <?php endif;?>
echo "<span class=\"none\"><b>&laquo;</b></span><a href=\"build.php?id=<?php echo $id; ?>&t=1&u=40\">&raquo;</a>"; </tr>
} <?php
else if(isset($_GET['u']) && count($market->onsale) > $_GET['u']) { }
if(count($market->onsale) > ($_GET['u']+40) && $_GET['u']-40 < count($market->onsale) && $_GET['u'] != 0) { } else {
echo "<a href=\"build.php?id=<?php echo $id; ?>&t=1&u=".($_GET['u']-40)."\">&laquo;</a><a href=\"build.php?id=<?php echo $id; ?>&t=1&u=".($_GET['u']+40)."\">&raquo;</a>"; echo '<tr><td class="none" colspan="5">'.NO_AVAILABLE_OFFERS.'</td></tr>';
}
else if(count($market->onsale) > $_GET['u']+40) {
echo "<span class=\"none\"><b>&laquo;</b></span><a href=\"build.php?id=<?php echo $id; ?>&t=1&u=".($_GET['u']+40)."\">&raquo;</a>";
}
else {
echo "<a href=\"build.php?id=<?php echo $id; ?>&t=1&u=".($_GET['u']-40)."\">&laquo;</a><span class=\"none\"><b>&raquo;</b></span>";
} }
} ?>
?> </tbody>
</td></tr> <tfoot>
</table></div> <tr>
<td colspan="5">
<?php
$prev = $u - 40;
$next = $u + 40;
if ($u == 0) echo '<span class="none"><b>&laquo;</b></span>';
else echo '<a href="build.php?id='.(int)$id.'&t=1&u='.$prev.'">&laquo;</a>';
if ($next >= $totalOffers) echo '<span class="none"><b>&raquo;</b></span>';
else echo '<a href="build.php?id='.(int)$id.'&t=1&u='.$next.'">&raquo;</a>';
?>
</td>
</tr>
</tfoot>
</table>
</div>
+111 -122
View File
@@ -1,125 +1,114 @@
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><span class="level"><?php echo MARKETPLACE;?> <?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
<?php include("17_menu.tpl"); ?>
<form method="POST" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="mk2" />
<table id="sell" cellpadding="1" cellspacing="1">
<tr>
<th><?php echo OFFERING;?></th>
<td class="val"><input class="text" tabindex="1" name="m1" value="" maxlength="6" /></td>
<td class="res">
<select name="rid1" tabindex="2" class="dropdown">
<option value="1" selected="selected"><?php echo LUMBER;?></option>
<option value="2"><?php echo CLAY;?></option>
<option value="3"><?php echo IRON;?></option>
<option value="4"><?php echo CROP;?></option>
</select>
</td>
<td class="tra"><input class="check" type="checkbox" tabindex="5" name="d1" value="1" /> <?php echo MAX_TIME_TRANSPORT;?>: <input class="text" tabindex="6" name="d2" value="2" maxlength="2" /> <?php echo HOURS;?></td>
</tr>
<tr>
<th><?php echo SEARCHING;?></th>
<td class="val"><input class="text" tabindex="3" name="m2" value="" maxlength="6" /></td>
<td class="res">
<select name="rid2" tabindex="4" class="dropdown">
<option value="1"><?php echo LUMBER;?></option>
<option value="2" selected="selected"><?php echo CLAY;?></option>
<option value="3"><?php echo IRON;?></option>
<option value="4"><?php echo CROP;?></option>
</select>
</td>
<td class="al">
<?php
if($session->userinfo['alliance'] != 0)
{
echo "<input class=\"check\" type=\"checkbox\" tabindex=\"7\" name=\"ally\" value=\"1\" /> ".OWN_ALLIANCE_ONLY."";
}
?>
</td>
</tr>
</table>
<?php
if(isset($_GET['e1']))
{
echo "<p class=\"error2\">".NOT_ENOUGH_RESOURCES."</p>";
}
elseif(isset($_GET['e2']))
{
echo "<p class=\"error2\">".INVALID_OFFER."</p>";
}
elseif(isset($_GET['e3']))
{
echo "<p class=\"error2\">".NOT_ENOUGH_MERCHANTS."</p>";
}
echo "<br /><p>".MERCHANT.": " .$market->merchantAvail()."/".$market->merchant."</p>";
?>
<input type="image" tabindex="8" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" <?php //if(!$market->merchantAvail()) { echo "DISABLED"; }?>/></p>
</form>
<?php <?php
if(count($market->onmarket) > 0) // 17_2.tpl - MARKETPLACE / SELL
{ global $database, $session, $village, $market, $id;
echo "<table id=\"sell_overview\" cellpadding=\"1\" cellspacing=\"1\"><thead><tr><th colspan=\"7\">".OWN_OFFERS."</th></tr><tr><td>&nbsp;</td><td>".OFFER."</td><td>ratio</td><td>".SEARCH."</td><td>".MERCHANT."</td><td>".ALLIANCE."</td><td>".DURATION."</td></tr></thead><tbody>";
foreach($market->onmarket as $offer) $res = [
{ 1 => ['class' => 'r1', 'name' => LUMBER],
if($session->access != BANNED) 2 => ['class' => 'r2', 'name' => CLAY],
{ 3 => ['class' => 'r3', 'name' => IRON],
echo "<tr><td class=\"abo\"><a href=\"build.php?id=$id&t=2&a=5&del=".$offer['id']."\"><img class=\"del\"src=\"img/x.gif\" alt=\"Delete\" title=\"".DELETE."\" /></a></td>"; 4 => ['class' => 'r4', 'name' => CROP],
echo "<td class=\"val\">"; ];
}
else $merchantAvail = (int)$market->merchantAvail();
{ $totalMerchants = (int)$market->merchant;
echo "<tr><td class=\"abo\"><a href=\"banned.php\"><img class=\"del\"src=\"img/x.gif\" alt=\"Delete\" title=\"".DELETE."\" /></a></td>";
echo "<td class=\"val\">";
}
switch($offer['gtype'])
{
case 1: echo "<img src=\"img/x.gif\" class=\"r1\" alt=\"Wood\" title=\"".LUMBER."\" />"; break;
case 2: echo "<img src=\"img/x.gif\" class=\"r2\" alt=\"Clay\" title=\"".CLAY."\" />"; break;
case 3: echo "<img src=\"img/x.gif\" class=\"r3\" alt=\"Iron\" title=\"".IRON."\" />"; break;
case 4: echo "<img src=\"img/x.gif\" class=\"r4\" alt=\"Crop\" title=\"".CROP."\" />"; break;
}
echo $offer['gamt'];
$sss = ($offer['wamt']/$offer['gamt']);
$ratio = round($sss, 1);
if($ratio <= 1){
$class = 'red';
}elseif($ratio > 1 && $ratio < 2){
$class = 'orange';
}elseif($ratio >= 2){
$class = 'green';
}
echo "</td><td class=\"ratio\"> ".$ratio." </td> <td class=\"val\">";
switch($offer['wtype'])
{
case 1: echo "<img src=\"img/x.gif\" class=\"r1\" alt=\"Wood\" title=\"".LUMBER."\" />"; break;
case 2: echo "<img src=\"img/x.gif\" class=\"r2\" alt=\"Clay\" title=\"".CLAY."\" />"; break;
case 3: echo "<img src=\"img/x.gif\" class=\"r3\" alt=\"Iron\" title=\"".IRON."\" />"; break;
case 4: echo "<img src=\"img/x.gif\" class=\"r4\" alt=\"Crop\" title=\"".CROP."\" />"; break;
}
echo $offer['wamt'];
echo "</td><td class=\"tra\">".$offer['merchant']." </td><td class=\"al\">";
echo ($offer['alliance'] == 0)? 'No' : 'Yes';
echo "</td><td class=\"dur\">";
if($offer['maxtime'] != 0)
{
echo $offer['maxtime']/3600;
echo " hrs.";
}
else
{
echo "".ALL."";
}
echo "</td></tr>";
}
echo "</table>";
}
?> ?>
<div id="build" class="gid17">
<a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo (int)$village->resarray['f'.$id];?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
<?php include("17_menu.tpl");?>
<form method="POST" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="mk2" />
<table id="sell" cellpadding="1" cellspacing="1">
<tr>
<th><?php echo OFFERING;?></th>
<td class="val"><input class="text" tabindex="1" name="m1" value="" maxlength="6" /></td>
<td class="res">
<select name="rid1" tabindex="2" class="dropdown">
<?php foreach ($res as $k => $r):?>
<option value="<?php echo $k;?>" <?php if($k==1) echo 'selected';?>><?php echo $r['name'];?></option>
<?php endforeach;?>
</select>
</td>
<td class="tra">
<input class="check" type="checkbox" tabindex="5" name="d1" value="1" /> <?php echo MAX_TIME_TRANSPORT;?>:
<input class="text" tabindex="6" name="d2" value="2" maxlength="2" /> <?php echo HOURS;?>
</td>
</tr>
<tr>
<th><?php echo SEARCHING;?></th>
<td class="val"><input class="text" tabindex="3" name="m2" value="" maxlength="6" /></td>
<td class="res">
<select name="rid2" tabindex="4" class="dropdown">
<?php foreach ($res as $k => $r):?>
<option value="<?php echo $k;?>" <?php if($k==2) echo 'selected';?>><?php echo $r['name'];?></option>
<?php endforeach;?>
</select>
</td>
<td class="al">
<?php if ((int)$session->userinfo['alliance'] !== 0):?>
<input class="check" type="checkbox" tabindex="7" name="ally" value="1" /> <?php echo OWN_ALLIANCE_ONLY;?>
<?php endif;?>
</td>
</tr>
</table>
<?php
if (isset($_GET['e1'])) echo '<p class="error2">'.NOT_ENOUGH_RESOURCES.'</p>';
elseif (isset($_GET['e2'])) echo '<p class="error2">'.INVALID_OFFER.'</p>';
elseif (isset($_GET['e3'])) echo '<p class="error2">'.NOT_ENOUGH_MERCHANTS.'</p>';
?>
<br /><p><?php echo MERCHANT;?>: <?php echo $merchantAvail;?>/<?php echo $totalMerchants;?></p>
<p><input type="image" tabindex="8" value="ok" name="s1" id="btn_ok" class="dynamic_img" src="img/x.gif" alt="OK" <?php if(!$merchantAvail) echo 'disabled';?> /></p>
</form>
<?php if (count($market->onmarket) > 0):?>
<table id="sell_overview" cellpadding="1" cellspacing="1">
<thead>
<tr><th colspan="7"><?php echo OWN_OFFERS;?></th></tr>
<tr>
<td>&nbsp;</td>
<td><?php echo OFFER;?></td>
<td>ratio</td>
<td><?php echo SEARCH;?></td>
<td><?php echo MERCHANT;?></td>
<td><?php echo ALLIANCE;?></td>
<td><?php echo DURATION;?></td>
</tr>
</thead>
<tbody>
<?php foreach ($market->onmarket as $offer):
$offerId = (int)$offer['id'];
$gtype = (int)$offer['gtype'];
$wtype = (int)$offer['wtype'];
$ratio = $offer['gamt'] > 0 ? round($offer['wamt'] / $offer['gamt'], 1) : 0;
$ratioClass = $ratio <= 1 ? 'red' : ($ratio < 2 ? 'orange' : 'green');
$delLink = $session->access != BANNED ? "build.php?id=".(int)$id."&t=2&a=5&del=".$offerId : "banned.php";
?>
<tr>
<td class="abo"><a href="<?php echo $delLink;?>"><img class="del" src="img/x.gif" alt="Delete" title="<?php echo DELETE;?>" /></a></td>
<td class="val">
<img src="img/x.gif" class="<?php echo $res[$gtype]['class'];?>" alt="<?php echo $res[$gtype]['name'];?>" title="<?php echo $res[$gtype]['name'];?>" />
<?php echo (int)$offer['gamt'];?>
</td>
<td class="ratio <?php echo $ratioClass;?>"><?php echo $ratio;?></td>
<td class="val">
<img src="img/x.gif" class="<?php echo $res[$wtype]['class'];?>" alt="<?php echo $res[$wtype]['name'];?>" title="<?php echo $res[$wtype]['name'];?>" />
<?php echo (int)$offer['wamt'];?>
</td>
<td class="tra"><?php echo (int)$offer['merchant'];?></td>
<td class="al"><?php echo $offer['alliance'] == 0 ? 'No' : 'Yes';?></td>
<td class="dur"><?php echo $offer['maxtime'] != 0 ? ((int)$offer['maxtime']/3600).' hrs.' : ALL;?></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
</div> </div>
+141 -268
View File
@@ -1,271 +1,144 @@
<?php if($session->gold > 2){ ?>
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?>
</p>
<?php include("17_menu.tpl");
if(isset($_GET['c'])){
?>
<p><b><?php echo NPC_COMPLETED;?>.</b> <?php echo COSTS;?> 3<img src="img/x.gif" class="gold" alt="Gold" title="<?php echo GOLD;?>" /></p>
<a href="javascript: history.go(-2)"><?php echo BACK_BUILDING;?></a>
<?php } else { ?>
<p><?php echo NPC_TRADE_DESC;?></p>
<script language="JavaScript">
var overall;
function calculateRes() {
resObj=document.getElementsByName("m2");
overall=0;
for (i=0; i<resObj.length; i++) {
var tmp="";
for (j=0; j<resObj[i].value.length; j++)
if ((resObj[i].value.charAt(j)>="0") && (resObj[i].value.charAt(j)<="9")) tmp=tmp+resObj[i].value.charAt(j);
resObj[i].value=tmp;
if (tmp=="") tmp="0";
newRes=Math.round(parseInt(tmp)*summe/100);
if (((i<3) && (newRes<=max123)) || ((i==3) && (newRes<=max4)))
newHTML=newRes;
else
newHTML="<span class='corr'>"+newRes+"</span>";
document.getElementById("new"+i).innerHTML=newHTML;
overall+=parseInt(tmp);
}
document.getElementById("overall").innerHTML=overall+"%";
}
function normalize() {
calculateRes();
resObj=document.getElementsByName("m2");
for (i=0; i<resObj.length; i++) {
tmp=parseInt(resObj[i].value);
tmp=tmp*(100/overall);
resObj[i].value=Math.round(tmp);
}
calculateRes();
}
function calculateRest() {
resObj=document.getElementsByName("m2[]");
overall=0;
for (i=0; i<resObj.length; i++) {
var tmp="";
for (j=0; j<resObj[i].value.length; j++)
if ((resObj[i].value.charAt(j)>="0") && (resObj[i].value.charAt(j)<="9")) tmp=tmp+resObj[i].value.charAt(j);
if (tmp=="") {
tmp="0";
newRes=0;
resObj[i].value="";
} else {
newRes=parseInt(tmp);
if ((i<3) && (newRes>max123)) newRes=max123;
if ((i==3) && (newRes>max4)) newRes=max4;
resObj[i].value=newRes;
}
dif=newRes-parseInt(document.getElementById("org"+i).innerHTML);
newHTML=dif;
if (dif>0) newHTML="+"+dif;
document.getElementById("diff"+i).innerHTML=newHTML;
overall+=newRes;
}
document.getElementById("newsum").innerHTML=overall;
rest=parseInt(document.getElementById("org4").innerHTML)-overall;
document.getElementById("remain").innerHTML=rest;
testSum();
}
function fillup(nr) {
resObj=document.getElementsByName("m2[]");
if (nr<3) {
resObj[nr].value=max123;
} else {
resObj[nr].value=max4;
}
calculateRest();
}
function portionOut() {
restRes=parseInt(document.getElementById("remain").innerHTML);
rest=restRes;
resObj=document.getElementsByName("m2[]");
nullCount=0;
notNullCount=0;
// Z&#65533;hlen
for (j=0; j<resObj.length; j++) {
if ((restRes>0) && (resObj[j].value=="")) nullCount++;
if ((restRes<0) && (resObj[j].value!="")) notNullCount++;
}
// Verteilen
nullCount2=0;
if (restRes>0) {
// In allen Feldern schon Zahlen?
if (nullCount==0) {
for (i=0; i<resObj.length; i++) {
free=max123-parseInt(resObj[i].value);
resObj[i].value=(parseInt(resObj[i].value)+Math.round(rest/(4-i)));
rest=rest-Math.min(free,Math.round(rest/(4-i)));
if ((i<3) && (parseInt(resObj[i].value)<max123)) nullCount2++;
}
} else {
for (i=0; i<resObj.length; i++) {
if (resObj[i].value=="") {
resObj[i].value=Math.round(rest/nullCount);
rest=rest-Math.round(rest/nullCount);
nullCount--;
}
if ((i<3) && (parseInt(resObj[i].value)<max123)) nullCount2++;
}
}
} else {
for (j=0; j<resObj.length; j++) {
if (parseInt(resObj[j].value)>0) {
resObj[j].value=(parseInt(resObj[j].value)+Math.round(rest/notNullCount));
rest=rest-Math.round(rest/notNullCount);
notNullCount--;
}
}
}
calculateRest();
// Noch irgendein Rest?
if (rest>0) {
if (max123>max4) {
for (j=0; j<3; j++) {
if (parseInt(resObj[j].value)<max123) {
resObj[j].value=(parseInt(resObj[j].value)+Math.round(rest/nullCount2));
rest=rest-Math.round(rest/nullCount2);
nullCount2--;
}
}
} else {
resObj[3].value=(parseInt(resObj[3].value)+rest);
}
}
calculateRest();
}
function testSum() {
if (document.getElementById("remain").innerHTML!=0) {
document.getElementById("submitText").innerHTML="<a href='javascript:portionOut();'><?php echo DISTRIBUTE_RESOURCES; ?></a>";
document.getElementById("submitText").style.display="block";
document.getElementById("submitButton").style.display="none";
} else {
document.getElementById("submitText").innerHTML="";
document.getElementById("submitText").style.display="none";
document.getElementById("submitButton").style.display="block";
}
}
</script>
<script language="JavaScript">var summe=<?php echo floor($village->awood+$village->acrop+$village->airon+$village->aclay); ?>;var max123=<?php echo $village->maxstore; ?>;var max4=<?php echo $village->maxcrop; ?>;</script>
<form method="post" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="mk3" />
<input type="hidden" name="t" value="3" />
<?php
$wwvillage = $database->getResourceLevel($village->wid);
if($wwvillage['f99t']!=40){
?>
<table id="npc" cellpadding="1" cellspacing="1">
<thead>
<tr>
<th colspan="5"><?php echo NPC_TRADE;?></th>
</tr>
<tr>
<td class="all">
<a href="javascript:fillup(0);"><img class="r1" src="img/x.gif" alt="Lumber" title="<?php echo LUMBER;?>" /></a>
<span id="org0"><?php echo floor($village->awood); ?></span>
</td>
<td class="all">
<a href="javascript:fillup(1);"><img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /></a>
<span id="org1"><?php echo floor($village->aclay); ?></span>
</td>
<td class="all">
<a href="javascript:fillup(2);"><img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /></a>
<span id="org2"><?php echo floor($village->airon); ?></span>
</td>
<td class="all">
<a href="javascript:fillup(3);"><img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /></a>
<span id="org3"><?php echo floor($village->acrop); ?></span>
</td>
<td class="sum"><?php echo SUM;?>:&nbsp;<span id="org4"><?php echo floor($village->awood+$village->acrop+$village->airon+$village->aclay); ?></span></td>
</tr>
</thead>
<tbody>
<tr>
<td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" <?php if(isset($_GET['r1'])) { echo "value=\"".$_GET['r1']."\""; } ?>/>
<input type="hidden" name="m1[]" value="<?php echo floor($village->awood); ?>" />
</td>
<td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" <?php if(isset($_GET['r2'])) { echo "value=\"".$_GET['r2']."\""; } ?>/>
<input type="hidden" name="m1[]" value="<?php echo floor($village->aclay); ?>" />
</td>
<td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" <?php if(isset($_GET['r3'])) { echo "value=\"".$_GET['r3']."\""; } ?>/>
<input type="hidden" name="m1[]" value="<?php echo floor($village->airon); ?>" />
</td>
<td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" <?php if(isset($_GET['r4'])) { echo "value=\"".$_GET['r4']."\""; } ?>/>
<input type="hidden" name="m1[]" value="<?php echo floor($village->acrop); ?>" />
</td>
<td class="sum"><?php echo SUM;?>:&nbsp;<span id="newsum"><?php if(isset($_GET['r1']) && isset($_GET['r2']) && isset($_GET['r3']) && isset($_GET['r4'])) { echo $_GET['r1']+$_GET['r2']+$_GET['r3']+$_GET['r4']; } else { echo 0; } ?></span></td>
</tr>
<tr>
<td class="rem">
<span id="diff0"><?php echo 0-floor($village->awood); ?></span>
</td>
<td class="rem">
<span id="diff1"><?php echo 0-floor($village->aclay); ?></span>
</td>
<td class="rem">
<span id="diff2"><?php echo 0-floor($village->airon); ?></span>
</td>
<td class="rem">
<span id="diff3"><?php echo 0-floor($village->acrop); ?></span>
</td>
<td class="sum"><?php echo REST;?>:&nbsp;<span id="remain">
<?php if(isset($_GET['r1']) && isset($_GET['r2']) && isset($_GET['r3']) && isset($_GET['r4'])) {
echo floor($village->awood+$village->acrop+$village->airon+$village->aclay)-($_GET['r1']+$_GET['r2']+$_GET['r3']+$_GET['r4']);
} else { echo floor($village->awood+$village->acrop+$village->airon+$village->aclay); } ?></span></td>
</tr>
</tbody>
</table>
<p id="submitButton">
<?php if($session->userinfo['gold'] >= 3) { ?><a href="javascript:document.snd.submit();"><?php echo TRADE_RESOURCES;?>)</a> <span class="none">(<?php echo COSTS;?>: <img src="img/x.gif" class="gold_g" alt="Gold" title="<?php echo GOLD;?>" /><b>3</b>)</span><?php } else { echo"<span class='none'>".TRADE_RESOURCES.")</span> (".COSTS.": <img src='img/x.gif' class='gold' alt='Gold' title='".GOLD."' /><b>3</b>)"; }?> </p>
<p id="submitText"></p>
</form>
<script>
testSum();
</script>
<?php }else{ ?>
</br></br>
<?php echo "".YOU_CAN_NAT_NPC_WW."";
}} ?>
</div>
<?php <?php
}else{ // 17_3.tpl - MARKETPLACE / NPC Trade
header("Location: build.php?id=".$_GET['id'].""); global $database, $session, $village, $id;
exit;
if ($session->gold <= 2) {
header("Location: build.php?id=".(int)$_GET['id']);
exit;
} }
$level = (int)$village->resarray['f'.$id];
$totalRes = floor($village->awood + $village->aclay + $village->airon + $village->acrop);
$maxstore = (int)$village->maxstore;
$maxcrop = (int)$village->maxcrop;
// valori prefill din GET
$r = [];
for ($i = 1; $i <= 4; $i++) {
$r[$i] = isset($_GET['r'.$i])? max(0, (int)$_GET['r'.$i]) : '';
}
$newsum = ($r[1]!=='' && $r[2]!=='' && $r[3]!=='' && $r[4]!=='')? array_sum($r) : 0;
$remain = $totalRes - $newsum;
$wwvillage = $database->getResourceLevel($village->wid);
$isWW = ($wwvillage['f99t'] == 40);
$completed = isset($_GET['c']);
?> ?>
<div id="build" class="gid17">
<a href="#" onClick="return Popup(17,4);" class="build_logo">
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
<?php include("17_menu.tpl");?>
<?php if ($completed):?>
<p><b><?php echo NPC_COMPLETED;?>.</b> <?php echo COSTS;?> 3<img src="img/x.gif" class="gold" alt="Gold" title="<?php echo GOLD;?>" /></p>
<a href="javascript: history.go(-2)"><?php echo BACK_BUILDING;?></a>
<?php else:?>
<p><?php echo NPC_TRADE_DESC;?></p>
<script language="JavaScript">
var overall;
function calculateRes() {
resObj=document.getElementsByName("m2");
overall=0;
for (i=0; i<resObj.length; i++) {
var tmp="";
for (j=0; j<resObj[i].value.length; j++)
if ((resObj[i].value.charAt(j)>="0") && (resObj[i].value.charAt(j)<="9")) tmp=tmp+resObj[i].value.charAt(j);
resObj[i].value=tmp;
if (tmp=="") tmp="0";
newRes=Math.round(parseInt(tmp)*summe/100);
if (((i<3) && (newRes<=max123)) || ((i==3) && (newRes<=max4)))
newHTML=newRes;
else
newHTML="<span class='corr'>"+newRes+"</span>";
document.getElementById("new"+i).innerHTML=newHTML;
overall+=parseInt(tmp);
}
document.getElementById("overall").innerHTML=overall+"%";
}
function normalize() { calculateRes(); resObj=document.getElementsByName("m2"); for (i=0; i<resObj.length; i++) { tmp=parseInt(resObj[i].value); tmp=tmp*(100/overall); resObj[i].value=Math.round(tmp); } calculateRes(); }
function calculateRest() {
resObj=document.getElementsByName("m2[]"); overall=0;
for (i=0; i<resObj.length; i++) {
var tmp=""; for (j=0; j<resObj[i].value.length; j++) if ((resObj[i].value.charAt(j)>="0") && (resObj[i].value.charAt(j)<="9")) tmp=tmp+resObj[i].value.charAt(j);
if (tmp=="") { tmp="0"; newRes=0; resObj[i].value=""; } else { newRes=parseInt(tmp); if ((i<3) && (newRes>max123)) newRes=max123; if ((i==3) && (newRes>max4)) newRes=max4; resObj[i].value=newRes; }
dif=newRes-parseInt(document.getElementById("org"+i).innerHTML); newHTML=dif; if (dif>0) newHTML="+"+dif; document.getElementById("diff"+i).innerHTML=newHTML; overall+=newRes;
}
document.getElementById("newsum").innerHTML=overall; rest=parseInt(document.getElementById("org4").innerHTML)-overall; document.getElementById("remain").innerHTML=rest; testSum();
}
function fillup(nr) { resObj=document.getElementsByName("m2[]"); if (nr<3) { resObj[nr].value=max123; } else { resObj[nr].value=max4; } calculateRest(); }
function portionOut() { /*... cod original neschimbat... */ restRes=parseInt(document.getElementById("remain").innerHTML); rest=restRes; resObj=document.getElementsByName("m2[]"); nullCount=0; notNullCount=0; for (j=0; j<resObj.length; j++) { if ((restRes>0) && (resObj[j].value=="")) nullCount++; if ((restRes<0) && (resObj[j].value!="")) notNullCount++; } nullCount2=0; if (restRes>0) { if (nullCount==0) { for (i=0; i<resObj.length; i++) { free=max123-parseInt(resObj[i].value); resObj[i].value=(parseInt(resObj[i].value)+Math.round(rest/(4-i))); rest=rest-Math.min(free,Math.round(rest/(4-i))); if ((i<3) && (parseInt(resObj[i].value)<max123)) nullCount2++; } } else { for (i=0; i<resObj.length; i++) { if (resObj[i].value=="") { resObj[i].value=Math.round(rest/nullCount); rest=rest-Math.round(rest/nullCount); nullCount--; } if ((i<3) && (parseInt(resObj[i].value)<max123)) nullCount2++; } } } else { for (j=0; j<resObj.length; j++) { if (parseInt(resObj[j].value)>0) { resObj[j].value=(parseInt(resObj[j].value)+Math.round(rest/notNullCount)); rest=rest-Math.round(rest/notNullCount); notNullCount--; } } } calculateRest(); if (rest>0) { if (max123>max4) { for (j=0; j<3; j++) { if (parseInt(resObj[j].value)<max123) { resObj[j].value=(parseInt(resObj[j].value)+Math.round(rest/nullCount2)); rest=rest-Math.round(rest/nullCount2); nullCount2--; } } } else { resObj[3].value=(parseInt(resObj[3].value)+rest); } } calculateRest(); }
function testSum() { if (document.getElementById("remain").innerHTML!=0) { document.getElementById("submitText").innerHTML="<a href='javascript:portionOut();'><?php echo DISTRIBUTE_RESOURCES;?></a>"; document.getElementById("submitText").style.display="block"; document.getElementById("submitButton").style.display="none"; } else { document.getElementById("submitText").innerHTML=""; document.getElementById("submitText").style.display="none"; document.getElementById("submitButton").style.display="block"; } }
</script>
<script language="JavaScript">var summe=<?php echo $totalRes;?>;var max123=<?php echo $maxstore;?>;var max4=<?php echo $maxcrop;?>;</script>
<?php if (!$isWW):?>
<form method="post" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="mk3" />
<input type="hidden" name="t" value="3" />
<table id="npc" cellpadding="1" cellspacing="1">
<thead>
<tr><th colspan="5"><?php echo NPC_TRADE;?></th></tr>
<tr>
<?php $resData = [
['wood', $village->awood, 'r1', LUMBER],
['clay', $village->aclay, 'r2', CLAY],
['iron', $village->airon, 'r3', IRON],
['crop', $village->acrop, 'r4', CROP],
];
foreach ($resData as $idx => $rd):?>
<td class="all">
<a href="javascript:fillup(<?php echo $idx;?>);"><img class="<?php echo $rd[2];?>" src="img/x.gif" alt="<?php echo $rd[3];?>" title="<?php echo $rd[3];?>" /></a>
<span id="org<?php echo $idx;?>"><?php echo floor($rd[1]);?></span>
</td>
<?php endforeach;?>
<td class="sum"><?php echo SUM;?>:&nbsp;<span id="org4"><?php echo $totalRes;?></span></td>
</tr>
</thead>
<tbody>
<tr>
<?php for ($i = 0; $i < 4; $i++):
$val = $r[$i+1]!== ''? $r[$i+1] : '';
$orig = floor($resData[$i][1]);
?>
<td class="sel">
<input class="text" onkeyup="calculateRest();" name="m2[]" size="5" maxlength="7" value="<?php echo $val;?>" />
<input type="hidden" name="m1[]" value="<?php echo $orig;?>" />
</td>
<?php endfor;?>
<td class="sum"><?php echo SUM;?>:&nbsp;<span id="newsum"><?php echo $newsum;?></span></td>
</tr>
<tr>
<?php for ($i = 0; $i < 4; $i++):?>
<td class="rem"><span id="diff<?php echo $i;?>"><?php echo 0 - floor($resData[$i][1]);?></span></td>
<?php endfor;?>
<td class="sum"><?php echo REST;?>:&nbsp;<span id="remain"><?php echo $remain;?></span></td>
</tr>
</tbody>
</table>
<p id="submitButton">
<?php if ($session->userinfo['gold'] >= 3):?>
<a href="javascript:document.snd.submit();"><?php echo TRADE_RESOURCES;?></a>
<span class="none">(<?php echo COSTS;?>: <img src="img/x.gif" class="gold_g" alt="Gold" title="<?php echo GOLD;?>" /><b>3</b>)</span>
<?php else:?>
<span class="none"><?php echo TRADE_RESOURCES;?></span> (<?php echo COSTS;?>: <img src='img/x.gif' class='gold' alt='Gold' title='<?php echo GOLD;?>' /><b>3</b>)
<?php endif;?>
</p>
<p id="submitText"></p>
</form>
<script>testSum();</script>
<?php else:?>
<br /><br /><?php echo YOU_CAN_NAT_NPC_WW;?>
<?php endif;?>
<?php endif;?>
</div>
+82 -74
View File
@@ -1,79 +1,87 @@
<?php if($session->goldclub == 1 && count($database->getProfileVillages($session->uid)) > 1) { ?> <?php
<div id="build" class="gid17"><a href="#" onClick="return Popup(17,4);" class="build_logo"> // 17_4.tpl - MARKETPLACE / COMERCIAL ROUTE
<img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" /> global $database, $session, $village, $generator, $id;
</a>
<h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo MARKETPLACE_DESC;?>
</p>
<?php include("17_menu.tpl"); if (!($session->goldclub == 1 && count($database->getProfileVillages($session->uid)) > 1)) {
if(isset($_POST['action'])){ header("Location: build.php?id=".(int)$_GET['id']);
$routeaccess = 1; exit;
} }
if(isset($_GET['create']) && $session->gold > 1){
$routeaccess = 1;
include("17_create.tpl");
}else if(isset($_POST['action']) && $_POST['action'] == 'editRoute' && isset($_POST['routeid']) && !empty($_POST['routeid']) && $database->getTradeRouteUid($_POST['routeid']) == $session->uid){
include("17_edit.tpl");
}else{
?>
<p><?php echo TRADE_ROUTES_DESC;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>.</p> $action = $_POST['action'] ?? '';
<form method="post" action ="build.php?gid=17&t=4"> $routeid = isset($_POST['routeid']) ? (int)$_POST['routeid'] : 0;
<table id="npc" cellpadding="1" cellspacing="1"> $create = isset($_GET['create']) && $session->gold > 1;
<thead> $edit = ($action === 'editRoute' && $routeid > 0 && $database->getTradeRouteUid($routeid) == $session->uid);
<tr>
<th></th>
<th><?php echo DESCRIPTION;?></th>
<th><?php echo START;?></th>
<th><?php echo MERCHANT;?></th>
<th><?php echo TIME_LEFT;?></th>
</tr></thead><tbody>
<?php
$routes = $database->getTradeRoute($village->wid);
if(empty($routes)) {
echo "<td colspan=\"5\" class=\"none\">".NO_TRADE_ROUTES.".</td></tr>";
}else{
foreach($routes as $route){
?> ?>
<tr> <div id="build" class="gid17">
<th><label><input class="radio" type="radio" name="routeid" value="<?php echo $route['id']; ?>" <?php if($routeid == $route['id']) { echo "".CHECKED.""; } ?>></label></th> <a href="#" onClick="return Popup(17,4);" class="build_logo">
<th> <img class="building g17" src="img/x.gif" alt="Marketplace" title="<?php echo MARKETPLACE;?>" />
<?php </a>
echo "".TRADE_ROUTE_TO." <a href=karte.php?d=".$route['wid']."&c=".$generator->getMapCheck($route['wid']).">".$database->getVillageField($route['wid'],"name")."</a>"; <h1><?php echo MARKETPLACE;?> <span class="level"><?php echo LEVEL;?> <?php echo (int)$village->resarray['f'.$id];?></span></h1>
?> <p class="build_desc"><?php echo MARKETPLACE_DESC;?></p>
</th>
<th><?php if($route['start'] > 9){ echo $route['start'];}else{ echo "0".$route['start'];} echo ":00"; ?></th> <?php include("17_menu.tpl");?>
<th><?php echo $route['deliveries']."x".$route['merchant']; ?></th>
<th><?php echo ceil(($route['timeleft']-time())/86400); echo " ".DAYS.""; ?></th> <?php if ($create):?>
</tr> <?php include("17_create.tpl");?>
<?php }} ?>
</tbody><tfoot><tr> <?php elseif ($edit):?>
<th> <?php include("17_edit.tpl");?>
</th>
<th colspan="4"> <?php else:?>
<?php <p><?php echo TRADE_ROUTES_DESC;?> <img src="../../<?php echo GP_LOCATE;?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>.</p>
if ( isset( $routeid ) ) {
$routeid = $routeid == 0? $routeid=0:$routeid; <form method="post" action="build.php?gid=17&t=4">
} else { <table id="npc" cellpadding="1" cellspacing="1">
$routeid = 0; <thead>
} <tr>
?> <th></th>
<button type="submit" name="action" value="extendRoute" id="btn_id" class="trav_buttons"><b><?php echo EXTEND;?>*</b></button> <th><?php echo DESCRIPTION;?></th>
| <button type="submit" name="action" value="editRoute" id="btn_id" class="trav_buttons"><b><?php echo EDIT;?></b></button> <th><?php echo START;?></th>
| <button type="submit" name="action" value="delRoute" id="btn_id" class="trav_buttons"><b><?php echo DELETE;?></b></button> <th><?php echo MERCHANT;?></th>
</th></tr></tfoot></table> <th><?php echo TIME_LEFT;?></th>
</form> </tr>
* <?php echo EXTEND_TRADE_ROUTES;?> <img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b> </thead>
<br> <tbody>
<div class="options"> <?php
<a class="arrow" href="build.php?gid=17&t=4&create">» <?php echo CREATE_TRADE_ROUTES;?></a> $routes = $database->getTradeRoute($village->wid);
if (empty($routes)):
?>
<tr><td colspan="5" class="none"><?php echo NO_TRADE_ROUTES;?>.</td></tr>
<?php else:
foreach ($routes as $route):
$rid = (int)$route['id'];
$wid = (int)$route['wid'];
$vname = htmlspecialchars($database->getVillageField($wid, "name"));
$start = str_pad((int)$route['start'], 2, '0', STR_PAD_LEFT).":00";
$deliveries = (int)$route['deliveries']."x".(int)$route['merchant'];
$daysLeft = max(0, ceil(($route['timeleft'] - time()) / 86400));
?>
<tr>
<th><label><input class="radio" type="radio" name="routeid" value="<?php echo $rid;?>" <?php if($routeid === $rid) echo 'checked';?>></label></th>
<th><?php echo TRADE_ROUTE_TO;?> <a href="karte.php?d=<?php echo $wid;?>&c=<?php echo $generator->getMapCheck($wid);?>"><?php echo $vname;?></a></th>
<th><?php echo $start;?></th>
<th><?php echo $deliveries;?></th>
<th><?php echo $daysLeft.' '.DAYS;?></th>
</tr>
<?php endforeach; endif;?>
</tbody>
<tfoot>
<tr>
<th></th>
<th colspan="4">
<button type="submit" name="action" value="extendRoute" class="trav_buttons"><b><?php echo EXTEND;?>*</b></button>
| <button type="submit" name="action" value="editRoute" class="trav_buttons"><b><?php echo EDIT;?></b></button>
| <button type="submit" name="action" value="delRoute" class="trav_buttons"><b><?php echo DELETE;?></b></button>
</th>
</tr>
</tfoot>
</table>
</form>
* <?php echo EXTEND_TRADE_ROUTES;?> <img src="../../<?php echo GP_LOCATE;?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"><b>2</b>
<br>
<div class="options">
<a class="arrow" href="build.php?gid=17&t=4&create">» <?php echo CREATE_TRADE_ROUTES;?></a>
</div>
<?php endif;?>
</div> </div>
</div>
<?php
}}else{
header("Location: build.php?id=".$_GET['id']."");
exit;
}
?>
+74 -75
View File
@@ -1,78 +1,77 @@
<form action="build.php" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="addRoute">
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
<thead>
<tr>
<th colspan="2"><?php echo CREATE_TRADE_ROUTE;?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<?php echo TARGET_VILLAGE;?>: </th>
<td>
<select id="tvillage" name="tvillage">
<?php <?php
if($session->villages[0] == $village->wid){ // 17_create.tpl - MARKETPLACE / CREATE ROUTE
$firstvillage = 2; global $database, $session, $village;
}else{
$firstvillage = 1;
}
for($i=1;$i<=count($session->villages);$i++) {
if($i == $firstvillage){
$select = 'selected="selected"';
}else{
$select = '';
}
if($session->villages[$i-1] != $village->wid){
$coor = $database->getCoor($session->villages[$i-1]);
echo "<option value=\"".$session->villages[$i-1]."\" ".$select.">".$database->getVillageField($session->villages[$i-1],'name')." (".$coor['x']."|".$coor['y'].")</option>";
}
}
?> </select>
</td>
</tr>
<tr>
<th>
<?php echo RESOURCES;?>: </th>
<td>
<img src="../../<?php echo GP_LOCATE; ?>img/r/1.gif" alt="Lumber" title="<?php echo LUMBER;?>"> <input class="text" type="text" name="r1" id="r1" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/2.gif" alt="Clay" title="<?php echo CLAY;?>"> <input class="text" type="text" name="r2" id="r2" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/3.gif" alt="Iron" title="<?php echo IRON;?>"> <input class="text" type="text" name="r3" id="r3" value="" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/4.gif" alt="Crop" title="<?php echo CROP;?>"> <input class="text" type="text" name="r4" id="r4" value="" maxlength="5" tabindex="1" style="width:50px;">
</td>
</tr>
<tr>
<th>
<?php echo START_TIME_TRADE;?>: </th>
<td>
<select name="start"><option value="0" selected="selected">00</option><option value="1">01</option><option value="2">02</option><option value="3">03</option><option value="4">04</option><option value="5">05</option><option value="6">06</option><option value="7">07</option><option value="8">08</option><option value="9">09</option><option value="10">10</option><option value="11">11</option><option value="12">12</option><option value="13">13</option><option value="14">14</option><option value="15">15</option><option value="16">16</option><option value="17">17</option><option value="18">18</option><option value="19">19</option><option value="20">20</option><option value="21">21</option><option value="22">22</option><option value="23">23</option></select>
</td>
</tr>
<tr>
<th>
<?php echo DELIVERIES;?>: </th>
<td>
<select name="deliveries"><option value="1" selected="selected">1</option><option value="2">2</option><option value="3">3</option></select>
</td>
</tr>
<tr>
<th>
<?php echo COSTS;?>: </th>
<td>
<img src="../../<?php echo GP_LOCATE; ?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"> <b>2</b>
</td>
</tr>
<tr>
<th>
<?php echo DURATION;?>: </th>
<td>
<b>7</b> <?php echo DAYS;?>
</td>
</tr>
</tbody></table>
</div> $villages = $session->villages?? [];
</div> $firstSelect = ($villages[0]?? 0) == $village->wid? 1 : 0;
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p> ?>
<form action="build.php" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="addRoute">
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
<thead>
<tr><th colspan="2"><?php echo CREATE_TRADE_ROUTE;?></th></tr>
</thead>
<tbody>
<tr>
<th><?php echo TARGET_VILLAGE;?>:</th>
<td>
<select id="tvillage" name="tvillage">
<?php
$idx = 0;
foreach ($villages as $vid) {
$vid = (int)$vid;
if ($vid === (int)$village->wid) continue;
$coor = $database->getCoor($vid);
$name = htmlspecialchars($database->getVillageField($vid, 'name'));
$selected = ($idx === $firstSelect)? 'selected' : '';
echo '<option value="'.$vid.'" '.$selected.'>'.$name.' ('.(int)$coor['x'].'|'.(int)$coor['y'].')</option>';
$idx++;
}
?>
</select>
</td>
</tr>
<tr>
<th><?php echo RESOURCES;?>:</th>
<td>
<?php $icons = [1=>'1',2=>'2',3=>'3',4=>'4']; $names = [1=>LUMBER,2=>CLAY,3=>IRON,4=>CROP];
foreach ($icons as $i => $img):?>
<img src="../../<?php echo GP_LOCATE;?>img/r/<?php echo $img;?>.gif" alt="<?php echo $names[$i];?>" title="<?php echo $names[$i];?>">
<input class="text" type="text" name="r<?php echo $i;?>" id="r<?php echo $i;?>" value="" maxlength="5" tabindex="1" style="width:50px;">
<?php endforeach;?>
</td>
</tr>
<tr>
<th><?php echo START_TIME_TRADE;?>:</th>
<td>
<select name="start">
<?php for ($h = 0; $h < 24; $h++):?>
<option value="<?php echo $h;?>" <?php if($h===0) echo 'selected';?>><?php echo str_pad($h,2,'0',STR_PAD_LEFT);?></option>
<?php endfor;?>
</select>
</td>
</tr>
<tr>
<th><?php echo DELIVERIES;?>:</th>
<td>
<select name="deliveries">
<?php for ($d = 1; $d <= 3; $d++):?>
<option value="<?php echo $d;?>" <?php if($d===1) echo 'selected';?>><?php echo $d;?></option>
<?php endfor;?>
</select>
</td>
</tr>
<tr>
<th><?php echo COSTS;?>:</th>
<td><img src="../../<?php echo GP_LOCATE;?>img/a/gold.gif" alt="Gold" title="<?php echo GOLD;?>"> <b>2</b></td>
</tr>
<tr>
<th><?php echo DURATION;?>:</th>
<td><b>7</b> <?php echo DAYS;?></td>
</tr>
</tbody>
</table>
</div></div>
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p>
</form> </form>
</div>
+61 -38
View File
@@ -1,40 +1,63 @@
<?php $edited_route = $database->getTradeRoute2($_POST['routeid']); ?> <?php
<form action="build.php" method="post"> // 17_edit.tpl - MARKETPLACE / EDIT ROUTES
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf"> global $database;
<input type="hidden" name="action" value="editRoute2">
<input type="hidden" name="routeid" value="<?php echo $_POST['routeid']; ?>">
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
<thead>
<tr>
<th colspan="2"><?php echo EDIT_TRADE_ROUTES;?></th>
</tr>
</thead>
<tbody>
<tr>
<th>
<?php echo RESOURCES;?>: </th>
<td>
<img src="../../<?php echo GP_LOCATE; ?>img/r/1.gif" alt="Lumber" title="<?php echo LUMBER;?>"> <input class="text" type="text" name="r1" id="r1" value="<?php echo $edited_route['wood']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/2.gif" alt="Clay" title="<?php echo CLAY;?>"> <input class="text" type="text" name="r2" id="r2" value="<?php echo $edited_route['clay']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/3.gif" alt="Iron" title="<?php echo IRON;?>"> <input class="text" type="text" name="r3" id="r3" value="<?php echo $edited_route['iron']; ?>" maxlength="5" tabindex="1" style="width:50px;"> <img src="../../<?php echo GP_LOCATE; ?>img/r/4.gif" alt="Crop" title="<?php echo CROP;?>"> <input class="text" type="text" name="r4" id="r4" value="<?php echo $edited_route['crop']; ?>" maxlength="5" tabindex="1" style="width:50px;">
</td>
</tr>
<tr>
<th>
<?php echo START_TIME_TRADE;?>: </th>
<td>
<select name="start"><?php for($i=0;$i<=23;$i++){?><option value="<?php echo $i; ?>" <?php if($i == $edited_route['start']){echo "selected";} ?>><?php if($i > 9){echo $i;}else{echo "0".$i;}?></option><?php } ?></select>
</td>
</tr>
<tr>
<th>
<?php echo DELIVERIES;?>: </th>
<td>
<select name="deliveries"><?php for($i=1;$i<=3;$i++){?><option value="<?php echo $i; ?>" <?php if($i == $edited_route['deliveries']){echo "selected";} ?>><?php echo $i; ?></option><?php } ?></select>
</td>
</tr>
</tbody></table>
</div> $routeid = isset($_POST['routeid'])? (int)$_POST['routeid'] : 0;
</div> $edited_route = $database->getTradeRoute2($routeid);
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p>
$wood = (int)($edited_route['wood']??0);
$clay = (int)($edited_route['clay']??0);
$iron = (int)($edited_route['iron']??0);
$crop = (int)($edited_route['crop']??0);
$start = (int)($edited_route['start']??0);
$deliveries = (int)($edited_route['deliveries']??1);
?>
<form action="build.php" method="post">
<div class="boxes boxesColor gray"><div class="boxes-tl"></div><div class="boxes-tr"></div><div class="boxes-tc"></div><div class="boxes-ml"></div><div class="boxes-mr"></div><div class="boxes-mc"></div><div class="boxes-bl"></div><div class="boxes-br"></div><div class="boxes-bc"></div><div class="boxes-contents cf">
<input type="hidden" name="action" value="editRoute2">
<input type="hidden" name="routeid" value="<?php echo $routeid;?>">
<table cellpadding="1" cellspacing="1" id="npc" class="transparent">
<thead>
<tr><th colspan="2"><?php echo EDIT_TRADE_ROUTES;?></th></tr>
</thead>
<tbody>
<tr>
<th><?php echo RESOURCES;?>:</th>
<td>
<?php $res = [
['r1', $wood, '1', LUMBER],
['r2', $clay, '2', CLAY],
['r3', $iron, '3', IRON],
['r4', $crop, '4', CROP],
];
foreach ($res as $r):?>
<img src="../../<?php echo GP_LOCATE;?>img/r/<?php echo $r[2];?>.gif" alt="<?php echo $r[3];?>" title="<?php echo $r[3];?>">
<input class="text" type="text" name="<?php echo $r[0];?>" id="<?php echo $r[0];?>" value="<?php echo $r[1];?>" maxlength="5" tabindex="1" style="width:50px;">
<?php endforeach;?>
</td>
</tr>
<tr>
<th><?php echo START_TIME_TRADE;?>:</th>
<td>
<select name="start">
<?php for ($i = 0; $i <= 23; $i++):?>
<option value="<?php echo $i;?>" <?php if($i === $start) echo 'selected';?>><?php echo str_pad($i,2,'0',STR_PAD_LEFT);?></option>
<?php endfor;?>
</select>
</td>
</tr>
<tr>
<th><?php echo DELIVERIES;?>:</th>
<td>
<select name="deliveries">
<?php for ($i = 1; $i <= 3; $i++):?>
<option value="<?php echo $i;?>" <?php if($i === $deliveries) echo 'selected';?>><?php echo $i;?></option>
<?php endfor;?>
</select>
</td>
</tr>
</tbody>
</table>
</div></div>
<p><input type="image" value="1" name="save" id="btn_save" class="dynamic_img" src="img/x.gif" tabindex="8" alt="OK"/></p>
</form> </form>
</div>
+17 -15
View File
@@ -1,17 +1,19 @@
<?php
// 17_menu.tpl - MENU MARKETPLACE
global $database, $session, $id;
$t = isset($_GET['t'])? (int)$_GET['t'] : 0;
$hasGold = (int)$session->userinfo['gold'] > 2;
$hasRoutes = $session->goldclub == 1 && count($database->getProfileVillages($session->uid)) > 1;
?>
<div id="textmenu"> <div id="textmenu">
<a href="build.php?id=<?php echo $id; ?>"<?php if(!isset($_GET['t'])) { echo "class=\"selected\""; } ?>"><?php echo SEND_RESOURCES;?></a> <a href="build.php?id=<?php echo (int)$id;?>" <?php if($t===0) echo 'class="selected"';?>><?php echo SEND_RESOURCES;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;t=1" <?php if(isset($_GET['t']) && $_GET['t'] == 1) { echo "class=\"selected\""; } ?>><?php echo BUY;?></a> | <a href="build.php?id=<?php echo (int)$id;?>&amp;t=1" <?php if($t===1) echo 'class="selected"';?>><?php echo BUY;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;t=2" <?php if(isset($_GET['t']) && $_GET['t'] == 2) { echo "class=\"selected\""; } ?>><?php echo OFFER;?></a> | <a href="build.php?id=<?php echo (int)$id;?>&amp;t=2" <?php if($t===2) echo 'class="selected"';?>><?php echo OFFER;?></a>
<?php if($session->userinfo['gold'] > 2) { <?php if ($hasGold):?>
?> | <a href="build.php?id=<?php echo (int)$id;?>&amp;t=3" <?php if($t===3) echo 'class="selected"';?>><?php echo NPC_TRADING;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;t=3" <?php if(isset($_GET['t']) && $_GET['t'] == 3) { echo "class=\"selected\""; } ?>><?php echo NPC_TRADING;?></a> <?php endif;?>
<?php <?php if ($hasRoutes):?>
} | <a href="build.php?id=<?php echo (int)$id;?>&amp;t=4" <?php if($t===4) echo 'class="selected"';?>><?php echo TRADE_ROUTES;?></a>
?> <?php endif;?>
<?php if($session->goldclub == 1 && count($database->getProfileVillages($session->uid)) > 1) {
?>
| <a href="build.php?id=<?php echo $id; ?>&amp;t=4" <?php if(isset($_GET['t']) && $_GET['t'] == 4) { echo "class=\"selected\""; } ?>><?php echo TRADE_ROUTES;?></a>
<?php
}
?>
</div> </div>
+61 -63
View File
@@ -1,66 +1,64 @@
<div id="build" class="gid18"><a href="#" onClick="return Popup(18,4);" class="build_logo">
<img class="building g18" src="img/x.gif" alt="Embassy" title="<?php echo EMBASSY; ?>" />
</a>
<h1><?php echo EMBASSY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo EMBASSY_DESC; ?></p>
<?php <?php
if($village->resarray['f'.$id] >= 3 && $session->alliance == 0) { // 18.tpl - EMBESSY
include("18_create.tpl"); global $village, $session, $id, $alliance, $database, $form;
}
if($session->alliance != 0) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" id=\"ally_info\">
<thead><tr>
<th colspan=\"2\">".ALLIANCE."</th>
</tr></thead>
<tbody><tr> $level = (int)$village->resarray['f'.$id];
<th>".TAG."</th> $inAlliance = (int)$session->alliance !== 0;
<td>".$alliance->allianceArray['tag']."</td>
</tr>
<tr>
<th>".NAME."</th>
<td>".$alliance->allianceArray['name']."</td>
<span class=\"error\">".$form->getError("ally3")."</span>
</tr>
<tr>
<td class=\"empty\" colspan=\"2\"></td>
</tr>
<tr>
<td colspan=\"2\"><a href=\"allianz.php\">&nbsp;&raquo; ".TO_THE_ALLIANCE."</a></td>
</tr></tbody>
</table>";
}
else if($village->resarray['f'.$id] >= 1) {
?>
<table cellpadding="1" cellspacing="1" id="join">
<form method="post" action="build.php">
<input type="hidden" name="a" value="2">
<thead><tr>
<th colspan="3"><?php echo JOIN_ALLIANCE; ?></th>
</tr></thead>
<tbody><tr>
<?php
if($alliance->gotInvite) {
foreach($alliance->inviteArray as $invite) {
echo "<td class=\"abo\"><a href=\"build.php?id=".$id."&a=2&d=".$invite['id']."\"><img class=\"del\" src=\"img/x.gif\" alt=\"refuse\" title=\"".REFUSE."\" /></a></td>
<td class=\"nam\"><a href=\"allianz.php?aid=".$invite['alliance']."\">&nbsp;".$database->getAllianceName($invite['alliance'])."</a></td>
<td class=\"acc\"><a href=\"build.php?id=".$id."&a=3&d=".$invite['id']."\">&nbsp;".ACCEPT."</a></td>";
}
}
else {
echo "<td colspan=\"3\" class=\"none\">".NO_INVITATIONS."</td>";
}
?>
</tr></tbody></table>
<p class="error"><?php echo $form->getError("ally4"); ?></p>
<?php
if($alliance->gotInvite) {
echo "<p class=\"error2\" style=\"color: #DD0000\">".$form->getError("ally_accept")."</p>";
}
}
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid18">
<a href="#" onClick="return Popup(18,4);" class="build_logo">
<img class="building g18" src="img/x.gif" alt="Embassy" title="<?php echo EMBASSY;?>" />
</a>
<h1><?php echo EMBASSY;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo EMBASSY_DESC;?></p>
<?php if ($level >= 3 && !$inAlliance) include("18_create.tpl");?>
<?php if ($inAlliance):?>
<table cellpadding="1" cellspacing="1" id="ally_info">
<thead><tr><th colspan="2"><?php echo ALLIANCE;?></th></tr></thead>
<tbody>
<tr>
<th><?php echo TAG;?></th>
<td><?php echo htmlspecialchars($alliance->allianceArray['tag']);?></td>
</tr>
<tr>
<th><?php echo NAME;?></th>
<td>
<?php echo htmlspecialchars($alliance->allianceArray['name']);?>
<span class="error"><?php echo $form->getError("ally3");?></span>
</td>
</tr>
<tr><td class="empty" colspan="2"></td></tr>
<tr><td colspan="2"><a href="allianz.php">&nbsp;&raquo; <?php echo TO_THE_ALLIANCE;?></a></td></tr>
</tbody>
</table>
<?php elseif ($level >= 1):?>
<table cellpadding="1" cellspacing="1" id="join">
<thead><tr><th colspan="3"><?php echo JOIN_ALLIANCE;?></th></tr></thead>
<tbody>
<?php if ($alliance->gotInvite && !empty($alliance->inviteArray)):
foreach ($alliance->inviteArray as $invite):
$invId = (int)$invite['id'];
$allyId = (int)$invite['alliance'];
$allyName = htmlspecialchars($database->getAllianceName($allyId));
?>
<tr>
<td class="abo"><a href="build.php?id=<?php echo (int)$id;?>&a=2&d=<?php echo $invId;?>"><img class="del" src="img/x.gif" alt="refuse" title="<?php echo REFUSE;?>" /></a></td>
<td class="nam"><a href="allianz.php?aid=<?php echo $allyId;?>">&nbsp;<?php echo $allyName;?></a></td>
<td class="acc"><a href="build.php?id=<?php echo (int)$id;?>&a=3&d=<?php echo $invId;?>">&nbsp;<?php echo ACCEPT;?></a></td>
</tr>
<?php endforeach; else:?>
<tr><td colspan="3" class="none"><?php echo NO_INVITATIONS;?></td></tr>
<?php endif;?>
</tbody>
</table>
<p class="error"><?php echo $form->getError("ally4");?></p>
<?php if ($alliance->gotInvite):?>
<p class="error2" style="color: #DD0000"><?php echo $form->getError("ally_accept");?></p>
<?php endif;?>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+38 -53
View File
@@ -1,55 +1,40 @@
<?php if($session->access!=BANNED){ ?> <?php
// 18_create.tpl - EMBESSY / CREATE
global $form, $session;
$isBanned = $session->access == BANNED;
$disabled = $isBanned ? 'disabled' : '';
$tagValue = htmlspecialchars($form->getValue("ally1"));
$nameValue = htmlspecialchars($form->getValue("ally2"));
$maxTag = $isBanned ? 8 : 15;
$maxName = $isBanned ? 25 : 50;
?>
<table cellpadding="1" cellspacing="1" id="found"> <table cellpadding="1" cellspacing="1" id="found">
<form method="post" action="build.php"> <form method="post" action="build.php">
<input type="hidden" name="ft" value="ali1"> <input type="hidden" name="ft" value="ali1">
<thead><tr> <thead><tr><th colspan="2"><?php echo FOUND_ALLIANCE;?></th></tr></thead>
<th colspan="2"><?php echo FOUND_ALLIANCE; ?></th> <tbody>
</tr></thead> <tr>
<tbody><tr> <th><?php echo TAG;?></th>
<th><?php echo TAG; ?></th> <td class="tag">
<td class="tag"> <input class="text" name="ally1" value="<?php echo $tagValue;?>" maxlength="<?php echo $maxTag;?>" <?php echo $disabled;?>>
<input class="text" name="ally1" value="<?php echo $form->getValue("ally1"); ?>" maxlength="15"> <span class="error"><?php echo $form->getError("ally1");?></span>
<span class="error"><?php echo $form->getError("ally1"); ?></span> </td>
</td> </tr>
</tr> <tr>
<tr> <th><?php echo NAME;?></th>
<th><?php echo NAME; ?></th> <td class="nam">
<td class="nam"> <input class="text" name="ally2" value="<?php echo $nameValue;?>" maxlength="<?php echo $maxName;?>" <?php echo $disabled;?>>
<input class="text" name="ally2" value="<?php echo $form->getValue("ally2"); ?>" maxlength="50"> <span class="error"><?php echo $form->getError("ally2");?></span>
<span class="error"><?php echo $form->getError("ally2"); ?></span> </td>
</td> </tr>
</tbody>
</tr></tbody> </table>
</table>
<p><button value="ok" name="s1" id="btn_ok" class="trav_buttons" alt="OK" /> Ok </button></form></p><table cellpadding="1" cellspacing="1" id="join">
<?php }else{ ?>
<table cellpadding="1" cellspacing="1" id="found">
<form method="post" action="build.php">
<input type="hidden" name="ft" value="ali1">
<thead><tr>
<th colspan="2"><?php echo FOUND_ALLIANCE; ?></th>
</tr></thead>
<tbody><tr>
<th><?php echo TAG; ?></th>
<td class="tag">
<input class="text" name="ally1" disabled="disabled" value="<?php echo $form->getValue("ally1"); ?>" maxlength="8">
<span class="error"><?php echo $form->getError("ally1"); ?></span>
</td>
</tr>
<tr>
<th><?php echo NAME; ?></th>
<td class="nam">
<input class="text" name="ally2" disabled="disabled" value="<?php echo $form->getValue("ally2"); ?>" maxlength="25">
<span class="error"><?php echo $form->getError("ally2"); ?></span>
</td>
</tr></tbody>
</table>
<?php
echo "".NO_CREATE_ALLIANCE."";
?></br><?php
}
?>
<?php if (!$isBanned):?>
<p><button type="submit" name="s1" id="btn_ok" class="trav_buttons">Ok</button></p>
</form>
<?php else:?>
</form>
<p><?php echo NO_CREATE_ALLIANCE;?></p>
<?php endif;?>
+80 -57
View File
@@ -1,59 +1,82 @@
<div id="build" class="gid19"><a href="#" onClick="return Popup(19,4);" class="build_logo"> <?php
<img class="building g19" src="img/x.gif" alt="Barracks" title="<?php echo BARRACKS; ?>" /> // 19.tpl - BARRAKS
</a> global $village, $building, $technology, $generator, $session, $id;
<h1><?php echo BARRACKS; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo BARRACKS_DESC; ?> </p>
<?php if ($building->getTypeLevel(19) > 0) { ?> $level = (int)$village->resarray['f'.$id];
<form method="POST" name="snd" action="build.php"> $canTrain = $building->getTypeLevel(19) > 0;
<input type="hidden" name="id" value="<?php echo $id; ?>" /> $trainlist = $technology->getTrainingList(1);
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr></thead><tbody>
<?php
include("19_train.tpl");
?></table>
<p><button id="btn_train" class="trav_buttons" value="ok" name="s1" alt="train" onclick="this.disabled=true;this.form.submit();"/> Train </button></form></p>
<?php
} else {
echo "<b>".TRAINING_COMMENCE_BARRACKS."</b><br>\n";
}
$trainlist = $technology->getTrainingList(1);
if(count($trainlist) > 0) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid19">
<a href="#" onClick="return Popup(19,4);" class="build_logo">
<img class="building g19" src="img/x.gif" alt="Barracks" title="<?php echo BARRACKS;?>" />
</a>
<h1><?php echo BARRACKS;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo BARRACKS_DESC;?></p>
<?php if ($canTrain):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME;?></td>
<td><?php echo QUANTITY;?></td>
<td><?php echo MAX;?></td>
</tr></thead>
<tbody>
<?php include("19_train.tpl");?>
</tbody>
</table>
<p><button type="submit" id="btn_train" class="trav_buttons" name="s1" onclick="this.disabled=true;this.form.submit();">Train</button></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_BARRACKS;?></b><br />
<?php endif;?>
<?php if (count($trainlist) > 0):
$NextFinished = '';
?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr>
<td><?php echo TRAINING;?></td>
<td><?php echo DURATION;?></td>
<td><?php echo FINISHED;?></td>
</tr></thead>
<tbody>
<?php $TrainCount = 0; foreach ($trainlist as $train):
$TrainCount++;
$unit = (int)$train['unit'];
$amt = (int)$train['amt'];
$name = htmlspecialchars($train['name']);
?>
<tr>
<td class="desc">
<img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo $name;?>" title="<?php echo $name;?>" />
<?php echo $amt.' '.$name;?>
</td>
<td class="dur">
<?php if ($TrainCount === 1):
$NextFinished = $generator->getTimeFormat($train['timestamp2'] - time());
$timerId = ++$session->timer;
?>
<span id="timer<?php echo $timerId;?>"><?php echo $generator->getTimeFormat($train['timestamp'] - time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime'] * $amt);?>
<?php endif;?>
</td>
<td class="fin">
<?php
$time = $generator->procMTime($train['timestamp']);
if ($time[0]!== "today") echo "on ".$time[0]." at ";
echo $time[1];
?>
</td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+45 -43
View File
@@ -1,50 +1,52 @@
<?php <?php
if($session->tribe != 4){ // 19_train.tpl - UNIT LIST BARRAKS
for ($i=($session->tribe-1)*10+1;$i<=($session->tribe-1)*10+4;$i++) { global $session, $technology, $village, $database, $generator, $building, $bid19, $id;
if ($i <> 4 && $i <> 23 && $i <> 24 && ($technology->getTech($i) || $i%10 == 1)) {
echo "<tr><td class=\"desc\"> $tribe = (int)$session->tribe;
<div class=\"tit\"> $units = ($tribe !== 4) ? range(($tribe-1)*10+1, ($tribe-1)*10+4) : range(31, 40);
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\"> ".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood'])."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay'])."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron'])."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop'])."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button foreach ($units as $i) {
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); // skip unități invalide
if ($tribe !== 4 && ($i == 4 || $i == 23 || $i == 24)) continue;
if (!($technology->getTech($i) || $i % 10 == 1)) continue;
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $unitData = ${'u'.$i};
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $name = $technology->getUnitName($i);
} $maxTrain = $technology->maxUnit($i, false);
echo "</div> $maxPlus = $technology->maxUnitPlus($i);
</td> $available = (int)($village->unitarray['u'.$i] ?? 0);
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"10\"></td>
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,false)."; return false;\">(".$technology->maxUnit($i,false).")</a></td></tr></tbody>";
}
}
}else{
for ($i=31;$i<=40;$i++) {
echo "<tr><td class=\"desc\"> $dur = $database->getArtifactsValueInfluence(
<div class=\"tit\"> $session->uid,
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> $village->wid,
<a href=\"#\" onClick=\"return Popup(".$i.",1);\"> ".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span> 5,
</div> round($unitData['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED)
<div class=\"details\"> );
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood'])."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay'])."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron'])."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop'])."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />"; $timeFormatted = $generator->getTimeFormat($dur);
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid19[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1) { $total_required = (int)($unitData['wood'] + $unitData['clay'] + $unitData['iron'] + $unitData['crop']);
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required;
}
echo "</div>
</td>
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"10\"></td>
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,false)."; return false;\">(".$technology->maxUnit($i,false).")</a></td></tr></tbody>";
}
}
?> ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>" title="<?php echo htmlspecialchars($name);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER;?>" /><?php echo (int)$unitData['wood'];?>|
<img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /><?php echo (int)$unitData['clay'];?>|
<img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /><?php echo (int)$unitData['iron'];?>|
<img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /><?php echo (int)$unitData['crop'];?>|
<img class="r5" src="img/x.gif" alt="Crop consumption" title="<?php echo CROP_COM;?>" /><?php echo (int)$unitData['pop'];?>|
<img class="clock" src="img/x.gif" alt="Duration" title="<?php echo DURATION;?>" /><?php echo $timeFormatted;?>
<?php if ($showNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade" title="NPC trade" /></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
</tr>
<?php } ?>
+43 -50
View File
@@ -1,55 +1,48 @@
<?php <?php
include("next.tpl");
// CLAYPIT
include 'next.tpl';
// — pregătire date —
$field = 'f' . $id;
$currentLevel = (int) ($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentProd = $bid2[$currentLevel]['prod'] * SPEED;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = ($village->capital == 1) ? 20 : 10;
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextProd = $bid2[$nextLevel]['prod'] * SPEED;
?> ?>
<div id="build" class="gid2"><a href="#" onClick="return Popup(2,4);" class="build_logo"> <div id="build" class="gid2">
<img class="building g2" src="img/x.gif" alt="<?php echo CLAYPIT; ?>" title="<?php echo CLAYPIT; ?>" /> <a href="#" onclick="return Popup(2,4);" class="build_logo">
</a> <img class="building g2" src="img/x.gif" alt="<?= CLAYPIT ?>" title="<?= CLAYPIT ?>">
<h1><?php echo CLAYPIT; ?> <span class="level"><?php echo LEVEL." "; echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo CLAYPIT_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <h1>
<tr> <?= CLAYPIT ?>
<th><?php echo CUR_PROD; ?>:</th> <span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
<td><b><?php echo $bid2[$village->resarray['f'.$id]]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td> </h1>
</tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($village->capital == 1) {
if($next<=20){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid2[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 20; ?>:</th>
<td><b><?php echo $bid2[20]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}else{
if($next<=10){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid2[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 10; ?>:</th>
<td><b><?php echo $bid2[10]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}}
?>
</table>
<?php <p class="build_desc"><?= CLAYPIT_DESC ?></p>
include("upgrade.tpl");
?></p></div>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CUR_PROD ?>:</th>
<td><b><?= $currentProd ?></b> <?= PER_HR ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= NEXT_PROD ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextProd ?></b> <?= PER_HR ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+80 -71
View File
@@ -1,72 +1,81 @@
<div id="build" class="gid20"><a href="#" onClick="return Popup(20,4);" class="build_logo">
<img class="building g20" src="img/x.gif" alt="Stable" title="<?php echo STABLE; ?>" /> </a>
<h1><?php echo STABLE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo STABLE_DESC; ?><br /></p>
<?php if ($building->getTypeLevel(20) > 0) { ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead>
<tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr>
</thead>
<tbody>
<?php
if($session->tribe != 4){
include("20_train.tpl");
}
?>
</tbody>
</table>
<p>
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
</p>
</form>
<?php <?php
} else { // 20.tpl - STABLE
echo "<b>".TRAINING_COMMENCE_STABLE."</b><br>\n"; global $village, $building, $technology, $generator, $session, $id;
}
$trainlist = $technology->getTrainingList(2); $level = (int)$village->resarray['f'.$id];
if(count($trainlist) > 0) { $canTrain = $building->getTypeLevel(20) > 0;
echo " $trainlist = $technology->getTrainingList(2);
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"> ?>
<thead><tr> <div id="build" class="gid20">
<td>".TRAINING."</td> <a href="#" onClick="return Popup(20,4);" class="build_logo">
<td>".DURATION."</td> <img class="building g20" src="img/x.gif" alt="Stable" title="<?php echo STABLE;?>" />
<td>".FINISHED."</td> </a>
</tr></thead> <h1><?php echo STABLE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<tbody>"; <p class="build_desc"><?php echo STABLE_DESC;?><br /></p>
$TrainCount = 0;
foreach($trainlist as $train) { <?php if ($canTrain):?>
$TrainCount++; <form method="POST" name="snd" action="build.php">
echo "<tr><td class=\"desc\">"; <input type="hidden" name="id" value="<?php echo (int)$id;?>" />
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />"; <input type="hidden" name="ft" value="t1" />
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">"; <table cellpadding="1" cellspacing="1" class="build_details">
if ($TrainCount == 1) { <thead><tr>
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time()); <td><?php echo NAME;?></td>
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>"; <td><?php echo QUANTITY;?></td>
} else { <td><?php echo MAX;?></td>
echo $generator->getTimeFormat($train['eachtime']*$train['amt']); </tr></thead>
} <tbody>
echo "</span></td><td class=\"fin\">"; <?php if ($session->tribe!= 4) include("20_train.tpl");?>
$time = $generator->procMTime($train['timestamp']); </tbody>
if($time[0] != "today") { </table>
echo "on ".$time[0]." at "; <p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
} </form>
echo $time[1]; <?php else:?>
} ?> <b><?php echo TRAINING_COMMENCE_STABLE;?></b><br />
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer?>"><?php echo $NextFinished; ?></span></td></tr> <?php endif;?>
</tbody></table>
<?php } <?php if (count($trainlist) > 0):
?> $NextFinished = '';
<?php ?>
include("upgrade.tpl"); <table cellpadding="1" cellspacing="1" class="under_progress">
?> </p></div> <thead><tr>
<td><?php echo TRAINING;?></td>
<td><?php echo DURATION;?></td>
<td><?php echo FINISHED;?></td>
</tr></thead>
<tbody>
<?php $TrainCount = 0; foreach ($trainlist as $train):
$TrainCount++;
$unit = (int)$train['unit'];
$amt = (int)$train['amt'];
$name = htmlspecialchars($train['name']);
?>
<tr>
<td class="desc">
<img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo $name;?>" title="<?php echo $name;?>" />
<?php echo $amt.' '.$name;?>
</td>
<td class="dur">
<?php if ($TrainCount === 1):
$NextFinished = $generator->getTimeFormat($train['timestamp2'] - time());
?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp'] - time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime'] * $amt);?>
<?php endif;?>
</td>
<td class="fin">
<?php
$time = $generator->procMTime($train['timestamp']);
if ($time[0]!== "today") echo "on ".$time[0]." at ";
echo $time[1];
?>
</td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+50 -34
View File
@@ -1,41 +1,57 @@
<?php <?php
// 20_train.tpl - STABLE UNIT TRAIN
global $session, $technology, $village, $database, $generator, $building, $bid20, $bid41, $id;
$tribe = (int)$session->tribe;
$start = ($tribe - 1) * 10 + 4 - ($tribe == 3 ? 1 : 0) + ($tribe == 2 ? 1 : 0);
$end = $tribe * 10 - 4;
$success = 0; $success = 0;
$start = ($session->tribe - 1) * 10 + 4 - (($session->tribe == 3) ? 1 : 0) + (($session->tribe == 2) ? 1 : 0); $horseTrough = $building->getTypeLevel(41);
$end = $session->tribe * 10 - 4;
for($i = $start; $i <= $end; $i++) { for ($i = $start; $i <= $end; $i++) {
if($technology->getTech($i)) { if (!$technology->getTech($i)) continue;
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
if(${'u'.$i}['drinking'] <= $building->getTypeLevel(41)) {
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".(${'u'.$i}['pop']-1)."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
}else{
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".(${'u'.$i}['pop'])."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
}
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100) * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button $unitData = ${'u'.$i};
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); $name = $technology->getUnitName($i);
$maxTrain = $technology->maxUnit($i);
$maxPlus = $technology->maxUnitPlus($i);
$available = (int)($village->unitarray['u'.$i] ?? 0);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $pop = (int)$unitData['pop'] - ($unitData['drinking'] <= $horseTrough ? 1 : 0);
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\"> $baseTime = $unitData['time'] * ($bid20[$village->resarray['f'.$id]]['attri'] / 100);
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a> if ($horseTrough >= 1) $baseTime *= (1 / $bid41[$horseTrough]['attri']);
</td> $dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($baseTime / SPEED));
</tr>"; $timeFormatted = $generator->getTimeFormat($dur);
$success += 1;
} $total_required = (int)($unitData['wood'] + $unitData['clay'] + $unitData['iron'] + $unitData['crop']);
} $showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required;
if($success == 0) { $success++;
echo "<tr><td colspan=\"3\"><div class=\"none\" align=\"center\">".AVAILABLE_ACADEMY."</div></td></tr>";
}
?> ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>" title="<?php echo htmlspecialchars($name);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="Wood" title="<?php echo LUMBER;?>" /><?php echo (int)$unitData['wood'];?>|
<img class="r2" src="img/x.gif" alt="Clay" title="<?php echo CLAY;?>" /><?php echo (int)$unitData['clay'];?>|
<img class="r3" src="img/x.gif" alt="Iron" title="<?php echo IRON;?>" /><?php echo (int)$unitData['iron'];?>|
<img class="r4" src="img/x.gif" alt="Crop" title="<?php echo CROP;?>" /><?php echo (int)$unitData['crop'];?>|
<img class="r5" src="img/x.gif" alt="Crop consumption" title="<?php echo CROP_COM;?>" /><?php echo $pop;?>|
<img class="clock" src="img/x.gif" alt="Duration" title="<?php echo DURATION;?>" /><?php echo $timeFormatted;?>
<?php if ($showNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade" /></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
</tr>
<?php } ?>
<?php if ($success === 0):?>
<tr><td colspan="3"><div class="none" align="center"><?php echo AVAILABLE_ACADEMY;?></div></td></tr>
<?php endif;?>
+99 -109
View File
@@ -1,114 +1,104 @@
<div id="build" class="gid21"><a href="#" onClick="return Popup(21,4, 'gid');" class="build_logo">
<img class="building g21" src="img/x.gif" alt="Workshop" title="<?php echo WORKSHOP; ?>" /> </a>
<h1><?php echo WORKSHOP; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo WORKSHOP_DESC; ?></p>
<?php if ($building->getTypeLevel(21) > 0) { ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead>
<tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr>
</thead>
<tbody>
<?php
$success = 0;
$start = ($session->tribe == 1)? 7 : (($session->tribe == 2)? 17 : 27);
if ($session->tribe == 1){
$start = 7;
}else if ($session->tribe == 2){
$start = 17;
}else if ($session->tribe == 3){
$start = 27;
}else if ($session->tribe == 5){
$start = 47;
}
if($session->tribe != 4){
for($i=$start;$i<=($start+1);$i++) {
if($technology->getTech($i)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u$i\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup($i,1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>";
echo "<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid21[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
echo "</div></td>
<td class=\"val\">
<input type=\"text\" class=\"text\" name=\"t$i\" value=\"0\" maxlength=\"10\">
</td>
<td class=\"max\">
<a href=\"#\" onClick=\"document.snd.t$i.value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a>
</td>
</tr>";
$success += 1;
}
}
if($success == 0) {
echo "<tr><td class=\"none\" colspan=\"3\">".AVAILABLE_ACADEMY."</td></tr>";
}
}
?>
</tbody>
</table>
<p>
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
</p>
</form>
<?php <?php
} else { // 21.tpl - WORKSHOP
echo "<b>".TRAINING_COMMENCE_WORKSHOP."</b><br>\n"; global $village, $building, $technology, $generator, $session, $database, $id, $bid21;
}
$trainlist = $technology->getTrainingList(3); $level = (int)$village->resarray['f'.$id];
if(count($trainlist) > 0) { $canTrain = $building->getTypeLevel(21) > 0;
//$timer = 2*count($trainlist); $trainlist = $technology->getTrainingList(3);
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid21">
<a href="#" onClick="return Popup(21,4, 'gid');" class="build_logo">
<img class="building g21" src="img/x.gif" alt="Workshop" title="<?php echo WORKSHOP;?>" />
</a>
<h1><?php echo WORKSHOP;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo WORKSHOP_DESC;?></p>
<?php if ($canTrain):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME;?></td>
<td><?php echo QUANTITY;?></td>
<td><?php echo MAX;?></td>
</tr></thead>
<tbody>
<?php
$success = 0;
$tribe = (int)$session->tribe;
if ($tribe!== 4) {
$starts = [1=>7, 2=>17, 3=>27, 5=>47];
$start = $starts[$tribe]?? 7;
for ($i = $start; $i <= $start+1; $i++) {
if (!$technology->getTech($i)) continue;
$unitData = ${'u'.$i};
$name = $technology->getUnitName($i);
$maxTrain = $technology->maxUnit($i);
$maxPlus = $technology->maxUnitPlus($i);
$available = (int)($village->unitarray['u'.$i]?? 0);
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unitData['time'] * ($bid21[$level]['attri']/100) / SPEED));
$timeFormatted = $generator->getTimeFormat($dur);
$total_required = (int)($unitData['wood']+$unitData['clay']+$unitData['iron']+$unitData['crop']);
$showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
$success++;
?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>" title="<?php echo htmlspecialchars($name);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$unitData['wood'];?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$unitData['clay'];?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$unitData['iron'];?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$unitData['crop'];?>|
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/><?php echo (int)$unitData['pop'];?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $timeFormatted;?>
<?php if ($showNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$unitData['wood']*$maxPlus;?>&r2=<?php echo (int)$unitData['clay']*$maxPlus;?>&r3=<?php echo (int)$unitData['iron']*$maxPlus;?>&r4=<?php echo (int)$unitData['crop']*$maxPlus;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade"/></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
</tr>
<?php } } if ($success===0):?>
<tr><td class="none" colspan="3"><?php echo AVAILABLE_ACADEMY;?></td></tr>
<?php endif;?>
</tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_WORKSHOP;?></b><br />
<?php endif;?>
<?php if (count($trainlist) > 0):
$NextFinished = '';
?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
<tbody>
<?php $TrainCount=0; foreach($trainlist as $train):
$TrainCount++; $unit=(int)$train['unit']; $amt=(int)$train['amt']; $name=htmlspecialchars($train['name']);
?>
<tr>
<td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo $name;?>" title="<?php echo $name;?>"/> <?php echo $amt.' '.$name;?></td>
<td class="dur">
<?php if($TrainCount===1): $NextFinished=$generator->getTimeFormat($train['timestamp2']-time());?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp']-time());?></span>
<?php else: echo $generator->getTimeFormat($train['eachtime']*$amt); endif;?>
</td>
<td class="fin"><?php $time=$generator->procMTime($train['timestamp']); if($time[0]!=="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+20 -14
View File
@@ -1,17 +1,23 @@
<div id="build" class="gid22"><a href="#" onClick="return Popup(22,4);" class="build_logo">
<img class="building g22" src="img/x.gif" alt="Academy" title="<?php echo ACADEMY; ?>" />
</a>
<h1><?php echo ACADEMY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo ACADEMY_DESC; ?></p>
<?php <?php
if ($building->getTypeLevel(22) > 0) { // 22.tpl - ACADEMY
include("22_".$session->tribe.".tpl"); global $village, $building, $session, $id;
} else {
echo "<p><b>".RESEARCH_COMMENCE_ACADEMY."</b><br>\n";
}
include("upgrade.tpl"); $level = (int)$village->resarray['f'.$id];
$hasAcademy = $building->getTypeLevel(22) > 0;
$tribe = (int)$session->tribe;
?> ?>
</p> <div id="build" class="gid22">
</div> <a href="#" onClick="return Popup(22,4);" class="build_logo">
<img class="building g22" src="img/x.gif" alt="Academy" title="<?php echo ACADEMY;?>" />
</a>
<h1><?php echo ACADEMY;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo ACADEMY_DESC;?></p>
<?php if ($hasAcademy):?>
<?php include("22_".$tribe.".tpl");?>
<?php else:?>
<p><b><?php echo RESEARCH_COMMENCE_ACADEMY;?></b><br /></p>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+95 -149
View File
@@ -1,154 +1,100 @@
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo ACADEMY; ?></td>
<td><?php echo ACTION; ?></td>
</tr></thead>
<tbody>
<?php <?php
$fail = $success = 0; // 22_1.tpl - ACADEMY - ROMAN UNITS
global $technology, $generator, $village, $session, $building, $bid22, $id;
$acares = $technology->grabAcademyRes(); $acares = $technology->grabAcademyRes();
for($i=2;$i<=9;$i++) { $success = $fail = 0;
if($technology->meetRRequirement($i) && !$technology->getTech($i) && !$technology->isResearch($i,1)) { $level = (int)$village->resarray['f'.$id];
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'r'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'r'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'r'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'r'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) {
echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span></div></td>";
echo "<td class=\"act\">
<div class=\"none\">".EXPAND_WAREHOUSE."</div>
</td></tr>";
}
else if(${'r'.$i}['crop'] > $village->maxcrop) {
echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span></div></td>";
echo "<td class=\"act\">
<div class=\"none\">".EXPAND_GRANARY."</div>
</td></tr>";
}
else if(${'r'.$i}['wood'] > $village->awood || ${'r'.$i}['clay'] > $village->aclay || ${'r'.$i}['iron'] > $village->airon || ${'r'.$i}['crop'] > $village->acrop) {
if($village->getProd("crop")>0){
$time = $technology->calculateAvaliable(22,${'r'.$i});
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
} else {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>";
}
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>";
}
else if (count($acares) > 0) {
echo "</td>";
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else if($session->access != BANNED){
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
}else{
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"banned.php\">".RESEARCH."</a></td></tr>";
}
$success += 1;
}
else {
$fail += 1;
}
}
if($success == 0) {
echo "<td colspan=\"2\"><div class=\"none\" align=\"center\">".RESEARCH_AVAILABLE."</div></td>";
}
?> ?>
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td><?php echo ACADEMY;?></td><td><?php echo ACTION;?></td></tr></thead>
<?php <tbody>
if($fail > 0) { <?php for ($i = 2; $i <= 9; $i++):
echo "<p class=\"switch\"><a id=\"researchFutureLink\" href=\"#\" onclick=\"return $('researchFuture').toggle();\">".SHOW_MORE."</a></p> if (!($technology->meetRRequirement($i) &&!$technology->getTech($i) &&!$technology->isResearch($i,1))) { $fail++; continue; }
<table id=\"researchFuture\" class=\"build_details hide\" cellspacing=\"1\" cellpadding=\"1\"> $success++;
<thead><tr><td colspan=\"2\">".PREREQUISITES."</td></tr><tbody>"; $res = ${'r'.$i};
if(!$technology->meetRRequirement(2) && !$technology->getTech(2)) { $name = $technology->getUnitName($i);
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u2\" title=\"".U2."\" alt=\"Praetorian\" src=\"img/x.gif\"/> $time = $generator->getTimeFormat(round($res['time'] * ($bid22[$level]['attri']/100) / SPEED));
<a onclick=\"return Popup(2, 1);\" href=\"#\">Praetorian</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 1);\">".ACADEMY."</a> $total_required = (int)($res['wood']+$res['clay']+$res['iron']+$res['crop']);
<span title=\"+2\">&nbsp;".LEVEL." 1</span><br /><a href=\"#\" onclick=\"return Popup(13, 4);\">".ARMOURY." </a><span title=\"+1\">&nbsp;".LEVEL." 1</span></td></tr>"; $showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
} ?>
if(!$technology->meetRRequirement(3) && !$technology->getTech(3)) { <tr>
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u3\" title=\"".U3."\" alt=\"Imperian\" src=\"img/x.gif\"/> <td class="desc">
<a onclick=\"return Popup(3, 1);\" href=\"#\">Imperian</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a> <div class="tit"><img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>" title="<?php echo htmlspecialchars($name);?>"/><a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a></div>
<span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(12, 4);\">".BLACKSMITH." </a><span title=\"+1\">&nbsp;".LEVEL." 1</span> </td></tr>"; <div class="details">
} <img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$res['wood'];?>|
if(!$technology->meetRRequirement(4) && !$technology->getTech(4)) { <img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$res['clay'];?>|
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u4\" title=\"".U4."\" alt=\"Equites Legati\" src=\"img/x.gif\"/> <img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$res['iron'];?>|
<a onclick=\"return Popup(4, 1);\" href=\"#\">Equites Legati</a></div></td><td class=\"cond\"> <img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$res['crop'];?>|
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE."</a><span title=\"+1\">&nbsp;".LEVEL." 1</span> </td></tr>"; <img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
} <?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$res['wood'];?>&r2=<?php echo (int)$res['clay'];?>&r3=<?php echo (int)$res['iron'];?>&r4=<?php echo (int)$res['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
if(!$technology->meetRRequirement(5) && !$technology->getTech(5)) { <?php
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u5\" title=\"".U5."\" alt=\"Equites Imperatoris\" src=\"img/x.gif\"/> if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span>";
<a onclick=\"return Popup(5, 1);\" href=\"#\">Equites Imperatoris</a></div></td><td class=\"cond\"> elseif ($res['crop']>$village->maxcrop) echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span>";
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE."</a><span title=\"+5\">&nbsp;".LEVEL." 5</span> </td></tr>"; elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) {
} if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(22,$res); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; }
if(!$technology->meetRRequirement(6) && !$technology->getTech(6)) { else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>";
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u6\" title=\"".U6."\" alt=\"Equites Caesaris\" src=\"img/x.gif\"/> }
<a onclick=\"return Popup(6, 1);\" href=\"#\">Equites Caesaris</a></div></td><td class=\"cond\"> ?>
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+12\">&nbsp;".LEVEL." 15</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\"> </div>
".STABLE."</a><span title=\"+10\">&nbsp;".LEVEL." 10</span> </td></tr>"; </td>
} <td class="<?php echo ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore||$res['crop']>$village->maxcrop||$res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop||count($acares)>0)?'none':'act';?>">
if(!$technology->meetRRequirement(7) && !$technology->getTech(7)) { <?php
echo " if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<div class=\"none\">".EXPAND_WAREHOUSE."</div>";
<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u7\" title=\"".U7."\" alt=\"Battering Ram\" src=\"img/x.gif\"/> elseif ($res['crop']>$village->maxcrop) echo "<div class=\"none\">".EXPAND_GRANARY."</div>";
<a onclick=\"return Popup(7, 1);\" href=\"#\">Battering Ram</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a> elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) echo "<div class=\"none\">".TOO_FEW_RESOURCES."</div>";
<span title=\"+7\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a><span title=\"+1\">&nbsp;".LEVEL." 1</span></td></tr>"; elseif (count($acares)>0) echo RESEARCH_IN_PROGRESS;
} elseif ($session->access!=BANNED) echo "<a class=\"research\" href=\"build.php?id=".(int)$id."&amp;a=".$i."&amp;c=".$session->mchecker."\">".RESEARCH."</a>";
if(!$technology->meetRRequirement(8) && !$technology->getTech(8)) { else echo "<a class=\"research\" href=\"banned.php\">".RESEARCH."</a>";
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u8\" title=\"".U8."\" alt=\"Fire Catapult\" src=\"img/x.gif\"/> ?>
<a onclick=\"return Popup(8, 1);\" href=\"#\">Fire Catapult</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a> </td>
<span title=\"+10\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+12\">&nbsp;".LEVEL." 15</span> </td> </tr>
</tr>"; <?php endfor; if ($success===0):?>
} <tr><td colspan="2"><div class="none" align="center"><?php echo RESEARCH_AVAILABLE;?></div></td></tr>
if(!$technology->meetRRequirement(9) && !$technology->getTech(9)) { <?php endif;?>
echo " <tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u9\" title=\"".U9."\" alt=\"Senator\" src=\"img/x.gif\"/> </tbody>
<a onclick=\"return Popup(9, 1);\" href=\"#\">Senator</a></div></td><td class=\"cond\"> </table>
<a href=\"#\" onclick=\"return Popup(16, 4);\">".RALLYPOINT."</a><span title=\"+9\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">
".ACADEMY."</a><span title=\"+17\">&nbsp;".LEVEL." 20</span></td></tr>";
}
echo "<script type=\"text/javascript\">
//<![CDATA[
$(\"researchFuture\").toggle = (function()
{
this.toggleClass(\"hide\");
$(\"researchFutureLink\").set(\"text\", <?php if ($fail>0):?>
this.hasClass(\"hide\") <p class="switch"><a id="researchFutureLink" href="#" onclick="document.getElementById('researchFuture').classList.toggle('hide'); this.textContent = this.textContent == '<?php echo SHOW_MORE;?>'? '<?php echo HIDE_MORE;?>' : '<?php echo SHOW_MORE;?>'; return false;"><?php echo SHOW_MORE;?></a></p>
? \"".SHOW_MORE."\" <table id="researchFuture" class="build_details hide" cellspacing="1" cellpadding="1">
: \"".HIDE_MORE."\" <thead><tr><td colspan="2"><?php echo PREREQUISITES;?></td></tr></thead>
); <tbody>
<?php if (!$technology->meetRRequirement(2) &&!$technology->getTech(2)):?>
<tr><td class="desc"><div class="tit"><img class="unit u2" src="img/x.gif" alt="Praetorian"/><a onclick="return Popup(2,1);" href="#">Praetorian</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,1);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 1</span><br><a href="#" onclick="return Popup(13,4);"><?php echo ARMOURY;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(3) &&!$technology->getTech(3)):?>
<tr><td class="desc"><div class="tit"><img class="unit u3" src="img/x.gif" alt="Imperian"/><a onclick="return Popup(3,1);" href="#">Imperian</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(12,4);"><?php echo BLACKSMITH;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(4) &&!$technology->getTech(4)):?>
<tr><td class="desc"><div class="tit"><img class="unit u4" src="img/x.gif" alt="Equites Legati"/><a onclick="return Popup(4,1);" href="#">Equites Legati</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(5) &&!$technology->getTech(5)):?>
<tr><td class="desc"><div class="tit"><img class="unit u5" src="img/x.gif" alt="Equites Imperatoris"/><a onclick="return Popup(5,1);" href="#">Equites Imperatoris</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(6) &&!$technology->getTech(6)):?>
<tr><td class="desc"><div class="tit"><img class="unit u6" src="img/x.gif" alt="Equites Caesaris"/><a onclick="return Popup(6,1);" href="#">Equites Caesaris</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 10</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(7) &&!$technology->getTech(7)):?>
<tr><td class="desc"><div class="tit"><img class="unit u7" src="img/x.gif" alt="Battering Ram"/><a onclick="return Popup(7,1);" href="#">Battering Ram</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(8) &&!$technology->getTech(8)):?>
<tr><td class="desc"><div class="tit"><img class="unit u8" src="img/x.gif" alt="Fire Catapult"/><a onclick="return Popup(8,1);" href="#">Fire Catapult</a></div></td><td class="cond"><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(9) &&!$technology->getTech(9)):?>
<tr><td class="desc"><div class="tit"><img class="unit u9" src="img/x.gif" alt="Senator"/><a onclick="return Popup(9,1);" href="#">Senator</a></div></td><td class="cond"><a href="#" onclick="return Popup(16,4);"><?php echo RALLYPOINT;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 20</span></td></tr>
<?php endif;?>
</tbody>
</table>
<?php endif;?>
return false; <?php if (count($acares)>0):?>
}).bind($(\"researchFuture\")); <table cellpadding="1" cellspacing="1" class="under_progress">
//]]> <thead><tr><td><?php echo RESEARCHING;?></td><td><?php echo DURATION;?></td><td><?php echo COMPLETE;?></td></tr></thead>
</script>"; <tbody>
echo "</tbody></table>"; <?php foreach ($acares as $aca): $unit=(int)substr($aca['tech'],1,2); $name=$technology->getUnitName($unit); $date=$generator->procMtime($aca['timestamp']);?>
} <tr><td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><?php echo htmlspecialchars($name);?></td><td class="dur"><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($aca['timestamp']-time());?></span></td><td class="fin"><span><?php echo $date[1];?></span><span> hrs</span></td></tr>
//$acares = $technology->grabAcademyRes(); <?php endforeach;?>
if(count($acares) > 0) { </tbody>
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".RESEARCHING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr> </table>
</thead><tbody>"; <?php endif;?>
foreach($acares as $aca) {
$unit = substr($aca['tech'],1,2);
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."</td>";
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($aca['timestamp']-time())."</span></td>";
$date = $generator->procMtime($aca['timestamp']);
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
?>
+92 -145
View File
@@ -1,150 +1,97 @@
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo ACADEMY; ?></td>
<td><?php echo ACTION; ?></td>
</tr></thead>
<tbody>
<?php <?php
$fail = $success = 0; // 22_2.tpl - ACADEMY TEUTON UNITS
global $technology, $generator, $village, $session, $building, $bid22, $id;
$acares = $technology->grabAcademyRes(); $acares = $technology->grabAcademyRes();
for($i=12;$i<=19;$i++) { $success = $fail = 0;
if($technology->meetRRequirement($i) && !$technology->getTech($i) && !$technology->isResearch($i,1)) { $level = (int)$village->resarray['f'.$id];
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'r'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'r'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'r'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'r'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) {
echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_WAREHOUSE."</div>
</td></tr>";
}
else if(${'r'.$i}['crop'] > $village->maxcrop) {
echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_GRANARY."</div>
</td></tr>";
}
else if(${'r'.$i}['wood'] > $village->awood || ${'r'.$i}['clay'] > $village->aclay || ${'r'.$i}['iron'] > $village->airon || ${'r'.$i}['crop'] > $village->acrop) {
if($village->getProd("crop")>0){
$time = $technology->calculateAvaliable(22,${'r'.$i});
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
} else {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>";
}
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>";
}
else if ( count($acares) > 0 ) {
echo "</td>";
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else if($session->access != BANNED){
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
}else{
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"banned.php\">".RESEARCH."</a></td></tr>";
}
$success += 1;
}
else {
$fail += 1;
}
}
if($success == 0) {
echo "<td colspan=\"2\"><div class=\"none\" align=\"center\">".RESEARCH_AVAILABLE."</div></td>";
}
?> ?>
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td><?php echo ACADEMY;?></td><td><?php echo ACTION;?></td></tr></thead>
<?php if($fail > 0) { <tbody>
echo "<p class=\"switch\"><a id=\"researchFutureLink\" href=\"#\" onclick=\"return $('researchFuture').toggle();\">".SHOW_MORE."</a></p> <?php for ($i = 12; $i <= 19; $i++):
<table id=\"researchFuture\" class=\"build_details hide\" cellspacing=\"1\" cellpadding=\"1\"> if (!($technology->meetRRequirement($i) &&!$technology->getTech($i) &&!$technology->isResearch($i,1))) { $fail++; continue; }
<thead><tr><td colspan=\"2\">".PREREQUISITES."</td></tr><tbody>"; $success++;
if(!$technology->meetRRequirement(13) && !$technology->getTech(13)) { $res = ${'r'.$i};
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u13\" title=\"".U13."\" alt=\"Axeman\" src=\"img/x.gif\"/> $name = $technology->getUnitName($i);
<a onclick=\"return Popup(13, 1);\" href=\"#\">Axeman</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a> $time = $generator->getTimeFormat(round($res['time'] * ($bid22[$level]['attri']/100) / SPEED));
<span title=\"+2\">".LEVEL." 3</span><br /><a href=\"#\" onclick=\"return Popup(12, 4);\">".BLACKSMITH." </a><span title=\"+1\">".LEVEL." 1</span> </td></tr>"; $total_required = (int)($res['wood']+$res['clay']+$res['iron']+$res['crop']);
} $showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
if(!$technology->meetRRequirement(14) && !$technology->getTech(14)) { ?>
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u14\" title=\"".U14."\" alt=\"Scout\" src=\"img/x.gif\"/> <tr>
<a onclick=\"return Popup(14, 1);\" href=\"#\">Scout</a></div></td><td class=\"cond\"> <td class="desc">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 1</span><br /><a href=\"#\" onclick=\"return Popup(15, 4);\">".MAINBUILDING."</a> <div class="tit"><img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>" title="<?php echo htmlspecialchars($name);?>"/><a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a></div>
<span title=\"+3\">".LEVEL." 5</span> </td></tr>"; <div class="details">
} <img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$res['wood'];?>|
if(!$technology->meetRRequirement(15) && !$technology->getTech(15)) { <img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$res['clay'];?>|
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u15\" title=\"".U15."\" alt=\"Paladin\" src=\"img/x.gif\"/> <img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$res['iron'];?>|
<a onclick=\"return Popup(15, 1);\" href=\"#\">Paladin</a></div></td><td class=\"cond\"> <img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$res['crop'];?>|
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE." </a> <img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
<span title=\"+5\">".LEVEL." 5</span> </td></tr>"; <?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$res['wood'];?>&r2=<?php echo (int)$res['clay'];?>&r3=<?php echo (int)$res['iron'];?>&r4=<?php echo (int)$res['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
} <?php
if(!$technology->meetRRequirement(16) && !$technology->getTech(16)) { if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span>";
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u16\" title=\"".U16."\" alt=\"Teutonic Knight\" src=\"img/x.gif\"/> elseif ($res['crop']>$village->maxcrop) echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span>";
<a onclick=\"return Popup(16, 1);\" href=\"#\">Teutonic Knight</a></div></td><td class=\"cond\"> elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) {
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 15</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\"> if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(22,$res); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; }
".STABLE." </a><span title=\"+3\">".LEVEL." 10</span> </td></tr>"; else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>";
} }
if(!$technology->meetRRequirement(17) && !$technology->getTech(17)) { ?>
echo " </div>
<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u17\" title=\"".U17."\" alt=\"Ram\" src=\"img/x.gif\"/> </td>
<a onclick=\"return Popup(17, 1);\" href=\"#\">Ram</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a> <td class="<?php echo ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore||$res['crop']>$village->maxcrop||$res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop||count($acares)>0)?'none':'act';?>">
<span title=\"+7\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP." </a><span title=\"+1\">".LEVEL." 1</span></td></tr>"; <?php
} if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<div class=\"none\">".EXPAND_WAREHOUSE."</div>";
if(!$technology->meetRRequirement(18) && !$technology->getTech(18)) { elseif ($res['crop']>$village->maxcrop) echo "<div class=\"none\">".EXPAND_GRANARY."</div>";
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u18\" title=\"".U18."\" alt=\"Catapult\" src=\"img/x.gif\"/> elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) echo "<div class=\"none\">".TOO_FEW_RESOURCES."</div>";
<a onclick=\"return Popup(18, 1);\" href=\"#\">Catapult</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a> elseif (count($acares)>0) echo RESEARCH_IN_PROGRESS;
<span title=\"+10\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+12\">".LEVEL." 15</span> </td> elseif ($session->access!=BANNED) echo "<a class=\"research\" href=\"build.php?id=".(int)$id."&amp;a=".$i."&amp;c=".$session->mchecker."\">".RESEARCH."</a>";
</tr>"; else echo "<a class=\"research\" href=\"banned.php\">".RESEARCH."</a>";
} ?>
if(!$technology->meetRRequirement(19) && !$technology->getTech(19)) { </td>
echo " <tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u19\" title=\"".U19."\" alt=\"Chief\" src=\"img/x.gif\"/> </tr>
<a onclick=\"return Popup(19, 1);\" href=\"#\">Chief</a></div></td><td class=\"cond\"> <?php endfor; if ($success===0):?>
<a href=\"#\" onclick=\"return Popup(16, 4);\">".RALLYPOINT." </a><span title=\"+4\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\"> <tr><td colspan="2"><div class="none" align="center"><?php echo RESEARCH_AVAILABLE;?></div></td></tr>
Academy </a><span title=\"+17\">".LEVEL." 20</span></td></tr>"; <?php endif;?>
} </tbody>
echo " <script type=\"text/javascript\"> </table>
//<![CDATA[
$(\"researchFuture\").toggle = (function()
{
this.toggleClass(\"hide\");
$(\"researchFutureLink\").set(\"text\", <?php if ($fail>0):?>
this.hasClass(\"hide\") <p class="switch"><a id="researchFutureLink" href="#" onclick="document.getElementById('researchFuture').classList.toggle('hide'); this.textContent = this.textContent == '<?php echo SHOW_MORE;?>'? '<?php echo HIDE_MORE;?>' : '<?php echo SHOW_MORE;?>'; return false;"><?php echo SHOW_MORE;?></a></p>
? \"".SHOW_MORE."\" <table id="researchFuture" class="build_details hide" cellspacing="1" cellpadding="1">
: \"".HIDE_MORE."\" <thead><tr><td colspan="2"><?php echo PREREQUISITES;?></td></tr></thead>
); <tbody>
<?php if (!$technology->meetRRequirement(13) &&!$technology->getTech(13)):?>
<tr><td class="desc"><div class="tit"><img class="unit u13" src="img/x.gif" alt="Axeman"/><a onclick="return Popup(13,1);" href="#">Axeman</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 3</span><br><a href="#" onclick="return Popup(12,4);"><?php echo BLACKSMITH;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(14) &&!$technology->getTech(14)):?>
<tr><td class="desc"><div class="tit"><img class="unit u14" src="img/x.gif" alt="Scout"/><a onclick="return Popup(14,1);" href="#">Scout</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 1</span><br><a href="#" onclick="return Popup(15,4);"><?php echo MAINBUILDING;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(15) &&!$technology->getTech(15)):?>
<tr><td class="desc"><div class="tit"><img class="unit u15" src="img/x.gif" alt="Paladin"/><a onclick="return Popup(15,1);" href="#">Paladin</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(16) &&!$technology->getTech(16)):?>
<tr><td class="desc"><div class="tit"><img class="unit u16" src="img/x.gif" alt="Teutonic Knight"/><a onclick="return Popup(16,1);" href="#">Teutonic Knight</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 10</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(17) &&!$technology->getTech(17)):?>
<tr><td class="desc"><div class="tit"><img class="unit u17" src="img/x.gif" alt="Ram"/><a onclick="return Popup(17,1);" href="#">Ram</a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(18) &&!$technology->getTech(18)):?>
<tr><td class="desc"><div class="tit"><img class="unit u18" src="img/x.gif" alt="Catapult"/><a onclick="return Popup(18,1);" href="#">Catapult</a></div></td><td class="cond"><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(19) &&!$technology->getTech(19)):?>
<tr><td class="desc"><div class="tit"><img class="unit u19" src="img/x.gif" alt="Chief"/><a onclick="return Popup(19,1);" href="#">Chief</a></div></td><td class="cond"><a href="#" onclick="return Popup(16,4);"><?php echo RALLYPOINT;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(22,4);">Academy</a> <span><?php echo LEVEL;?> 20</span></td></tr>
<?php endif;?>
</tbody>
</table>
<?php endif;?>
return false; <?php if (count($acares)>0):?>
}).bind($(\"researchFuture\")); <table cellpadding="1" cellspacing="1" class="under_progress">
//]]> <thead><tr><td><?php echo RESEARCHING;?></td><td><?php echo DURATION;?></td><td><?php echo COMPLETE;?></td></tr></thead>
</script>"; <tbody>
echo "</tbody></table>"; <?php foreach ($acares as $aca): $unit=(int)substr($aca['tech'],1,2); $name=$technology->getUnitName($unit); $date=$generator->procMtime($aca['timestamp']);?>
} <tr><td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><?php echo htmlspecialchars($name);?></td><td class="dur"><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($aca['timestamp']-time());?></span></td><td class="fin"><span><?php echo $date[1];?></span><span> hrs</span></td></tr>
//$acares = $technology->grabAcademyRes(); <?php endforeach;?>
if(count($acares) > 0) { </tbody>
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".RESEARCHING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr> </table>
</thead><tbody>"; <?php endif;?>
foreach($acares as $aca) {
$unit = substr($aca['tech'],1,2);
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."</td>";
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($aca['timestamp']-time())."</span></td>";
$date = $generator->procMtime($aca['timestamp']);
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
?>
+96 -149
View File
@@ -1,153 +1,100 @@
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo ACADEMY; ?></td>
<td><?php echo ACTION; ?></td>
</tr></thead>
<tbody><tr>
<?php <?php
$fail = $success = 0; // 22_3.tpl - ACADEMY GAULS UNITS
$acares = $technology->grabAcademyRes(); global $technology, $generator, $village, $session, $building, $bid22, $id;
for($i=22;$i<=29;$i++) {
if($technology->meetRRequirement($i) && !$technology->getTech($i) && !$technology->isResearch($i,1)) {
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'r'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'r'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'r'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'r'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) {
echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_WAREHOUSE."</div>
</td></tr>";
}
else if(${'r'.$i}['crop'] > $village->maxcrop) {
echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_GRANARY."</div>
</td></tr>";
}
else if(${'r'.$i}['wood'] > $village->awood || ${'r'.$i}['clay'] > $village->aclay || ${'r'.$i}['iron'] > $village->airon || ${'r'.$i}['crop'] > $village->acrop) {
if($village->getProd("crop")>0){
$time = $technology->calculateAvaliable(22,${'r'.$i});
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
} else {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>";
}
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>";
}
else if ( count($acares) > 0 ) {
echo "</td>";
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else if($session->access != BANNED){
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
}else{
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"banned.php\">".RESEARCH."</a></td></tr>";
}
$success +=1;
}
else {
$fail += 1;
}
}
if($success == 0) {
echo "<td colspan=\"2\"><div class=\"none\" align=\"center\">".RESEARCH_AVAILABLE."</div></td>";
}
?>
</tbody></table>
<?php if($fail > 0) {
echo "<p class=\"switch\"><a id=\"researchFutureLink\" href=\"#\" onclick=\"return $('researchFuture').toggle();\">".SHOW_MORE."</a></p>
<table id=\"researchFuture\" class=\"build_details hide\" cellspacing=\"1\" cellpadding=\"1\">
<thead><tr><td colspan=\"2\">".PREREQUISITES."</td></tr><tbody>";
if(!$technology->meetRRequirement(22) && !$technology->getTech(22)) {
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u22\" title=\"".U22."\" alt=\"".U22."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(22, 1);\" href=\"#\">".U22."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a>
<span title=\"+2\">&nbsp;".LEVEL." 3</span><br /><a href=\"#\" onclick=\"return Popup(12, 4);\">".BLACKSMITH." </a><span title=\"+1\">&nbsp;".LEVEL." 1</span></td></tr>";
}
if(!$technology->meetRRequirement(23) && !$technology->getTech(23)) {
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u23\" title=\"".U23."\" alt=\"Pathfinder\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(23, 1);\" href=\"#\">".U23."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a>
<span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE." </a><span title=\"+1\">&nbsp;".LEVEL." 1</span> </td></tr>";
}
if(!$technology->meetRRequirement(24) && !$technology->getTech(24)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u24\" title=\"".U24."\" alt=\"Theutates Thunder\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(24, 1);\" href=\"#\">".U24."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE."</a>
<span title=\"+3\">&nbsp;".LEVEL." 3</span> </td></tr>";
}
if(!$technology->meetRRequirement(25) && !$technology->getTech(25)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u25\" title=\"".U25."\" alt=\"Druidrider\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(25, 1);\" href=\"#\">".U25."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+2\">&nbsp;".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE."</a>
<span title=\"+5\">&nbsp;".LEVEL." 5</span> </td></tr>";
}
if(!$technology->meetRRequirement(26) && !$technology->getTech(26)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u26\" title=\"".U26."\" alt=\"Haeduan\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(26, 1);\" href=\"#\">".U26."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+12\">&nbsp;".LEVEL." 15</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">
".STABLE."</a><span title=\"+10\">&nbsp;".LEVEL." 10</span> </td></tr>";
}
if(!$technology->meetRRequirement(27) && !$technology->getTech(27)) {
echo "
<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u27\" title=\"".U27."\" alt=\"Ram\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(27, 1);\" href=\"#\">".U27."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a>
<span title=\"+7\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a><span title=\"+1\">&nbsp;".LEVEL." 1</span></td></tr>";
}
if(!$technology->meetRRequirement(28) && !$technology->getTech(28)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u28\" title=\"".U28."\" alt=\"Trebuchet\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(28, 1);\" href=\"#\">".U28."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a>
<span title=\"+10\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY."</a><span title=\"+12\">&nbsp;".LEVEL." 15</span> </td>
</tr>";
}
if(!$technology->meetRRequirement(29) && !$technology->getTech(29)) {
echo " <tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u29\" title=\"".U29."\" alt=\"Chieftain\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(29, 1);\" href=\"#\">".U29."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(14, 4);\">".RALLYPOINT."</a><span title=\"+9\">&nbsp;".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">
".ACADEMY."</a><span title=\"+17\">&nbsp;".LEVEL." 20</span></td></tr>";
}
echo " <script type=\"text/javascript\">
//<![CDATA[
$(\"researchFuture\").toggle = (function()
{
this.toggleClass(\"hide\");
$(\"researchFutureLink\").set(\"text\",
this.hasClass(\"hide\")
? \"".SHOW_MORE."\"
: \"".HIDE_MORE."\"
);
return false;
}).bind($(\"researchFuture\"));
//]]>
</script>";
echo "</tbody></table>";
}
$acares = $technology->grabAcademyRes(); $acares = $technology->grabAcademyRes();
if(count($acares) > 0) { $success = $fail = 0;
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".RESEARCHING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr> $level = (int)$village->resarray['f'.$id];
</thead><tbody>";
foreach($acares as $aca) {
$unit = substr($aca['tech'],1,2);
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."</td>";
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($aca['timestamp']-time())."</span></td>";
$date = $generator->procMtime($aca['timestamp']);
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
?> ?>
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr><td><?php echo ACADEMY;?></td><td><?php echo ACTION;?></td></tr></thead>
<tbody>
<?php for ($i = 22; $i <= 29; $i++):
if (!($technology->meetRRequirement($i) &&!$technology->getTech($i) &&!$technology->isResearch($i,1))) { $fail++; continue; }
$success++;
$res = ${'r'.$i};
$name = $technology->getUnitName($i);
$time = $generator->getTimeFormat(round($res['time'] * ($bid22[$level]['attri']/100) / SPEED));
$total_required = (int)($res['wood']+$res['clay']+$res['iron']+$res['crop']);
$showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
?>
<tr>
<td class="desc">
<div class="tit"><img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a></div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$res['wood'];?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$res['clay'];?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$res['iron'];?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$res['crop'];?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
<?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$res['wood'];?>&r2=<?php echo (int)$res['clay'];?>&r3=<?php echo (int)$res['iron'];?>&r4=<?php echo (int)$res['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span>";
elseif ($res['crop']>$village->maxcrop) echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) {
if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(22,$res); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; }
else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>";
}
?>
</div>
</td>
<td class="<?php echo ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore||$res['crop']>$village->maxcrop||$res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop||count($acares)>0)?'none':'act';?>">
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<div class=\"none\">".EXPAND_WAREHOUSE."</div>";
elseif ($res['crop']>$village->maxcrop) echo "<div class=\"none\">".EXPAND_GRANARY."</div>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) echo "<div class=\"none\">".TOO_FEW_RESOURCES."</div>";
elseif (count($acares)>0) echo RESEARCH_IN_PROGRESS;
elseif ($session->access!=BANNED) echo "<a class=\"research\" href=\"build.php?id=".(int)$id."&amp;a=".$i."&amp;c=".$session->mchecker."\">".RESEARCH."</a>";
else echo "<a class=\"research\" href=\"banned.php\">".RESEARCH."</a>";
?>
</td>
</tr>
<?php endfor; if ($success===0):?>
<tr><td colspan="2"><div class="none" align="center"><?php echo RESEARCH_AVAILABLE;?></div></td></tr>
<?php endif;?>
</tbody>
</table>
<?php if ($fail>0):?>
<p class="switch"><a href="#" onclick="document.getElementById('researchFuture').classList.toggle('hide'); this.textContent = this.textContent == '<?php echo SHOW_MORE;?>'? '<?php echo HIDE_MORE;?>' : '<?php echo SHOW_MORE;?>'; return false;"><?php echo SHOW_MORE;?></a></p>
<table id="researchFuture" class="build_details hide" cellspacing="1" cellpadding="1">
<thead><tr><td colspan="2"><?php echo PREREQUISITES;?></td></tr></thead>
<tbody>
<?php if (!$technology->meetRRequirement(22) &&!$technology->getTech(22)):?>
<tr><td class="desc"><div class="tit"><img class="unit u22" src="img/x.gif" alt="<?php echo U22;?>"/><a onclick="return Popup(22,1);" href="#"><?php echo U22;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 3</span><br><a href="#" onclick="return Popup(12,4);"><?php echo BLACKSMITH;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(23) &&!$technology->getTech(23)):?>
<tr><td class="desc"><div class="tit"><img class="unit u23" src="img/x.gif" alt="<?php echo U23;?>"/><a onclick="return Popup(23,1);" href="#"><?php echo U23;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(24) &&!$technology->getTech(24)):?>
<tr><td class="desc"><div class="tit"><img class="unit u24" src="img/x.gif" alt="<?php echo U24;?>"/><a onclick="return Popup(24,1);" href="#"><?php echo U24;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 3</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(25) &&!$technology->getTech(25)):?>
<tr><td class="desc"><div class="tit"><img class="unit u25" src="img/x.gif" alt="<?php echo U25;?>"/><a onclick="return Popup(25,1);" href="#"><?php echo U25;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(26) &&!$technology->getTech(26)):?>
<tr><td class="desc"><div class="tit"><img class="unit u26" src="img/x.gif" alt="<?php echo U26;?>"/><a onclick="return Popup(26,1);" href="#"><?php echo U26;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 10</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(27) &&!$technology->getTech(27)):?>
<tr><td class="desc"><div class="tit"><img class="unit u27" src="img/x.gif" alt="<?php echo U27;?>"/><a onclick="return Popup(27,1);" href="#"><?php echo U27;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(28) &&!$technology->getTech(28)):?>
<tr><td class="desc"><div class="tit"><img class="unit u28" src="img/x.gif" alt="<?php echo U28;?>"/><a onclick="return Popup(28,1);" href="#"><?php echo U28;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(29) &&!$technology->getTech(29)):?>
<tr><td class="desc"><div class="tit"><img class="unit u29" src="img/x.gif" alt="<?php echo U29;?>"/><a onclick="return Popup(29,1);" href="#"><?php echo U29;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(14,4);"><?php echo RALLYPOINT;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 20</span></td></tr>
<?php endif;?>
</tbody>
</table>
<?php endif;?>
<?php if (count($acares)>0):?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo RESEARCHING;?></td><td><?php echo DURATION;?></td><td><?php echo COMPLETE;?></td></tr></thead>
<tbody>
<?php foreach ($acares as $aca): $unit=(int)substr($aca['tech'],1,2); $name=$technology->getUnitName($unit); $date=$generator->procMtime($aca['timestamp']);?>
<tr><td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><?php echo htmlspecialchars($name);?></td><td class="dur"><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($aca['timestamp']-time());?></span></td><td class="fin"><span><?php echo $date[1];?></span><span> hrs</span></td></tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
+93 -143
View File
@@ -1,147 +1,97 @@
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo ACADEMY; ?></td>
<td><?php echo ACTION; ?></td>
</tr></thead>
<tbody>
<?php <?php
$fail = $success = 0; // 22_4.tpl - NATARS ACADEMY RESEARCH
global $technology, $generator, $village, $session, $building, $bid22, $id;
$acares = $technology->grabAcademyRes(); $acares = $technology->grabAcademyRes();
for($i=32;$i<=39;$i++) { $success = $fail = 0;
if($technology->meetRRequirement($i) && !$technology->getTech($i) && !$technology->isResearch($i,1)) { $level = (int)$village->resarray['f'.$id];
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'r'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'r'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'r'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'r'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) {
echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_WAREHOUSE."</div>
</td></tr>";
}
else if(${'r'.$i}['crop'] > $village->maxcrop) {
echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_GRANARY."</div>
</td></tr>";
}
else if(${'r'.$i}['wood'] > $village->awood || ${'r'.$i}['clay'] > $village->aclay || ${'r'.$i}['iron'] > $village->airon || ${'r'.$i}['crop'] > $village->acrop) {
$time = $technology->calculateAvaliable($i);
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".TOO_FEW_RESOURCES."</div>
</td></tr>";
}
else if ( count($acares) > 0 ) {
echo "</td>";
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else if($session->access != BANNED){
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
}else{
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"banned.php\">".RESEARCH."</a></td></tr>";
}
$success += 1;
}
else {
$fail += 1;
}
}
if($success == 0) {
echo "<td colspan=\"2\"><div class=\"none\" align=\"center\">".RESEARCH_AVAILABLE."</div></td>";
}
?> ?>
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td><?php echo ACADEMY;?></td><td><?php echo ACTION;?></td></tr></thead>
<?php if($fail > 0) { <tbody>
echo "<p class=\"switch\"><a id=\"researchFutureLink\" href=\"#\" onclick=\"return $('researchFuture').toggle();\">".SHOW_MORE."</a></p> <?php for ($i = 32; $i <= 39; $i++):
<table id=\"researchFuture\" class=\"build_details hide\" cellspacing=\"1\" cellpadding=\"1\"> if (!($technology->meetRRequirement($i) &&!$technology->getTech($i) &&!$technology->isResearch($i,1))) { $fail++; continue; }
<thead><tr><td colspan=\"2\">".PREREQUISITES."</td></tr><tbody>"; $success++;
if(!$technology->meetRRequirement(33) && !$technology->getTech(33)) { $res = ${'r'.$i};
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u33\" title=\"".U33."\" alt=\"".U33."\" src=\"img/x.gif\"/> $name = $technology->getUnitName($i);
<a onclick=\"return Popup(33, 1);\" href=\"#\">".U33."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a> $time = $generator->getTimeFormat(round($res['time'] * ($bid22[$level]['attri']/100) / SPEED));
<span title=\"+2\">".LEVEL." 3</span><br /><a href=\"#\" onclick=\"return Popup(12, 4);\">".BLACKSMITH." </a><span title=\"+1\">".LEVEL." 1</span> </td></tr>"; $total_required = (int)($res['wood']+$res['clay']+$res['iron']+$res['crop']);
} $showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
if(!$technology->meetRRequirement(34) && !$technology->getTech(34)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u34\" title=\"".U34."\" alt=\"".U34."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(34, 1);\" href=\"#\">".U34."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 1</span><br /><a href=\"#\" onclick=\"return Popup(15, 4);\">".MAINBUILDING."</a>
<span title=\"+3\">".LEVEL." 5</span> </td></tr>";
}
if(!$technology->meetRRequirement(35) && !$technology->getTech(35)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u35\" title=\"".U35."\" alt=\"".U35."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(35, 1);\" href=\"#\">".U35."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE." </a>
<span title=\"+5\">".LEVEL." 5</span> </td></tr>";
}
if(!$technology->meetRRequirement(36) && !$technology->getTech(36)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u36\" title=\"".U36."\" alt=\"".U36."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(36, 1);\" href=\"#\">".U36."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 15</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">
".STABLE." </a><span title=\"+3\">".LEVEL." 10</span> </td></tr>";
}
if(!$technology->meetRRequirement(17) && !$technology->getTech(17)) {
echo "
<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u37\" title=\"".U37."\" alt=\"".U37."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(37, 1);\" href=\"#\">".U37."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a>
<span title=\"+7\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP." </a><span title=\"+1\">".LEVEL." 1</span></td></tr>";
}
if(!$technology->meetRRequirement(38) && !$technology->getTech(38)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u38\" title=\"".U38."\" alt=\"".U38."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(38, 1);\" href=\"#\">".U38."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a>
<span title=\"+10\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+12\">".LEVEL." 15</span> </td>
</tr>";
}
if(!$technology->meetRRequirement(39) && !$technology->getTech(39)) {
echo " <tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u39\" title=\"".U39."\" alt=\"".U39."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(39, 1);\" href=\"#\">".U39."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(16, 4);\">".RALLYPOINT." </a><span title=\"+4\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">
".ACADEMY." </a><span title=\"+17\">".LEVEL." 20</span></td></tr>";
}
echo " <script type=\"text/javascript\">
//<![CDATA[
$(\"researchFuture\").toggle = (function()
{
this.toggleClass(\"hide\");
$(\"researchFutureLink\").set(\"text\",
this.hasClass(\"hide\")
? \"".SHOW_MORE."\"
: \"".HIDE_MORE."\"
);
return false;
}).bind($(\"researchFuture\"));
//]]>
</script>";
echo "</tbody></table>";
}
//$acares = $technology->grabAcademyRes();
if(count($acares) > 0) {
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".RESEARCHING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr>
</thead><tbody>";
foreach($acares as $aca) {
$unit = substr($aca['tech'],1,2);
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."</td>";
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($aca['timestamp']-time())."</span></td>";
$date = $generator->procMtime($aca['timestamp']);
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
?> ?>
<tr>
<td class="desc">
<div class="tit"><img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a></div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$res['wood'];?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$res['clay'];?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$res['iron'];?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$res['crop'];?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
<?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$res['wood'];?>&r2=<?php echo (int)$res['clay'];?>&r3=<?php echo (int)$res['iron'];?>&r4=<?php echo (int)$res['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span>";
elseif ($res['crop']>$village->maxcrop) echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) {
if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(22,$res); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; }
else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>";
}
?>
</div>
</td>
<td class="<?php echo ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore||$res['crop']>$village->maxcrop||$res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop||count($acares)>0)?'none':'act';?>">
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<div class=\"none\">".EXPAND_WAREHOUSE."</div>";
elseif ($res['crop']>$village->maxcrop) echo "<div class=\"none\">".EXPAND_GRANARY."</div>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) echo "<div class=\"none\">".TOO_FEW_RESOURCES."</div>";
elseif (count($acares)>0) echo RESEARCH_IN_PROGRESS;
elseif ($session->access!=BANNED) echo "<a class=\"research\" href=\"build.php?id=".(int)$id."&amp;a=".$i."&amp;c=".$session->mchecker."\">".RESEARCH."</a>";
else echo "<a class=\"research\" href=\"banned.php\">".RESEARCH."</a>";
?>
</td>
</tr>
<?php endfor; if ($success===0):?>
<tr><td colspan="2"><div class="none" align="center"><?php echo RESEARCH_AVAILABLE;?></div></td></tr>
<?php endif;?>
</tbody>
</table>
<?php if ($fail>0):?>
<p class="switch"><a href="#" onclick="document.getElementById('researchFuture').classList.toggle('hide'); this.textContent = this.textContent == '<?php echo SHOW_MORE;?>'? '<?php echo HIDE_MORE;?>' : '<?php echo SHOW_MORE;?>'; return false;"><?php echo SHOW_MORE;?></a></p>
<table id="researchFuture" class="build_details hide" cellspacing="1" cellpadding="1">
<thead><tr><td colspan="2"><?php echo PREREQUISITES;?></td></tr></thead>
<tbody>
<?php if (!$technology->meetRRequirement(33) &&!$technology->getTech(33)):?>
<tr><td class="desc"><div class="tit"><img class="unit u33" src="img/x.gif" alt="<?php echo U33;?>"/><a onclick="return Popup(33,1);" href="#"><?php echo U33;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 3</span><br><a href="#" onclick="return Popup(12,4);"><?php echo BLACKSMITH;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(34) &&!$technology->getTech(34)):?>
<tr><td class="desc"><div class="tit"><img class="unit u34" src="img/x.gif" alt="<?php echo U34;?>"/><a onclick="return Popup(34,1);" href="#"><?php echo U34;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 1</span><br><a href="#" onclick="return Popup(15,4);"><?php echo MAINBUILDING;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(35) &&!$technology->getTech(35)):?>
<tr><td class="desc"><div class="tit"><img class="unit u35" src="img/x.gif" alt="<?php echo U35;?>"/><a onclick="return Popup(35,1);" href="#"><?php echo U35;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(36) &&!$technology->getTech(36)):?>
<tr><td class="desc"><div class="tit"><img class="unit u36" src="img/x.gif" alt="<?php echo U36;?>"/><a onclick="return Popup(36,1);" href="#"><?php echo U36;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 10</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(37) &&!$technology->getTech(37)):?>
<tr><td class="desc"><div class="tit"><img class="unit u37" src="img/x.gif" alt="<?php echo U37;?>"/><a onclick="return Popup(37,1);" href="#"><?php echo U37;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(38) &&!$technology->getTech(38)):?>
<tr><td class="desc"><div class="tit"><img class="unit u38" src="img/x.gif" alt="<?php echo U38;?>"/><a onclick="return Popup(38,1);" href="#"><?php echo U38;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(39) &&!$technology->getTech(39)):?>
<tr><td class="desc"><div class="tit"><img class="unit u39" src="img/x.gif" alt="<?php echo U39;?>"/><a onclick="return Popup(39,1);" href="#"><?php echo U39;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(16,4);"><?php echo RALLYPOINT;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 20</span></td></tr>
<?php endif;?>
</tbody>
</table>
<?php endif;?>
<?php if (count($acares)>0):?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo RESEARCHING;?></td><td><?php echo DURATION;?></td><td><?php echo COMPLETE;?></td></tr></thead>
<tbody>
<?php foreach ($acares as $aca): $unit=(int)substr($aca['tech'],1,2); $name=$technology->getUnitName($unit); $date=$generator->procMtime($aca['timestamp']);?>
<tr><td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><?php echo htmlspecialchars($name);?></td><td class="dur"><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($aca['timestamp']-time());?></span></td><td class="fin"><span><?php echo $date[1];?></span><span> hrs</span></td></tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
+93 -139
View File
@@ -1,143 +1,97 @@
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo ACADEMY; ?></td>
<td><?php echo ACTION; ?></td>
</tr></thead>
<tbody>
<?php <?php
$fail = $success = 0; // 22_5.tpl - ACADEMY RESEARCH TRIBE 5
global $technology, $generator, $village, $session, $building, $bid22, $id;
$acares = $technology->grabAcademyRes(); $acares = $technology->grabAcademyRes();
for($i=42;$i<=49;$i++) { $success = $fail = 0;
if($technology->meetRRequirement($i) && !$technology->getTech($i) && !$technology->isResearch($i,1)) { $level = (int)$village->resarray['f'.$id];
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'r'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'r'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'r'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'r'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round(${'r'.$i}['time'] * ($bid22[$village->resarray['f'.$id]]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if(${'r'.$i}['wood'] > $village->maxstore || ${'r'.$i}['clay'] > $village->maxstore || ${'r'.$i}['iron'] > $village->maxstore) {
echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_WAREHOUSE."</div>
</td></tr>";
}
else if(${'r'.$i}['crop'] > $village->maxcrop) {
echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".EXPAND_GRANARY."</div>
</td></tr>";
}
else if(${'r'.$i}['wood'] > $village->awood || ${'r'.$i}['clay'] > $village->aclay || ${'r'.$i}['iron'] > $village->airon || ${'r'.$i}['crop'] > $village->acrop) {
$time = $technology->calculateAvaliable($i);
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
echo "<td class=\"none\">
<div class=\"none\">".TOO_FEW_RESOURCES."</div>
</td></tr>";
}
else if ( count($acares) > 0 ) {
echo "</td>";
echo "<td class=\"none\">
".RESEARCH_IN_PROGRESS."</td></tr>";
}
else {
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"build.php?id=$id&amp;a=$i&amp;c=".$session->mchecker."\">".RESEARCH."</a></td></tr>";
}
$success += 1;
}
else {
$fail += 1;
}
}
if($success == 0) {
echo "<td colspan=\"2\"><div class=\"none\" align=\"center\">".RESEARCH_AVAILABLE."</div></td>";
}
?> ?>
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td><?php echo ACADEMY;?></td><td><?php echo ACTION;?></td></tr></thead>
<?php if($fail > 0) { <tbody>
echo "<p class=\"switch\"><a id=\"researchFutureLink\" href=\"#\" onclick=\"return $('researchFuture').toggle();\">".SHOW_MORE."</a></p> <?php for ($i = 42; $i <= 49; $i++):
<table id=\"researchFuture\" class=\"build_details hide\" cellspacing=\"1\" cellpadding=\"1\"> if (!($technology->meetRRequirement($i) &&!$technology->getTech($i) &&!$technology->isResearch($i,1))) { $fail++; continue; }
<thead><tr><td colspan=\"2\">".PREREQUISITES."</td></tr><tbody>"; $success++;
if(!$technology->meetRRequirement(43) && !$technology->getTech(43)) { $res = ${'r'.$i};
echo"<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u43\" title=\"".U43."\" alt=\"".U43."\" src=\"img/x.gif\"/> $name = $technology->getUnitName($i);
<a onclick=\"return Popup(43, 1);\" href=\"#\">".U43."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a> $time = $generator->getTimeFormat(round($res['time'] * ($bid22[$level]['attri']/100) / SPEED));
<span title=\"+2\">".LEVEL." 3</span><br /><a href=\"#\" onclick=\"return Popup(12, 4);\">".BLACKSMITH." </a><span title=\"+1\">".LEVEL." 1</span> </td></tr>"; $total_required = (int)($res['wood']+$res['clay']+$res['iron']+$res['crop']);
} $showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total_required;
if(!$technology->meetRRequirement(44) && !$technology->getTech(44)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u44\" title=\"".U44."\" alt=\"".U44."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(34, 1);\" href=\"#\">".U44."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(44, 5);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 1</span><br /><a href=\"#\" onclick=\"return Popup(15, 4);\">".MAINBUILDING."</a>
<span title=\"+3\">".LEVEL." 5</span> </td></tr>";
}
if(!$technology->meetRRequirement(45) && !$technology->getTech(45)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u45\" title=\"".U45."\" alt=\"".U45."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(45, 1);\" href=\"#\">".U45."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(45, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">".STABLE." </a>
<span title=\"+5\">".LEVEL." 5</span> </td></tr>";
}
if(!$technology->meetRRequirement(46) && !$technology->getTech(46)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u46\" title=\"".U46."\" alt=\"".U46."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(46, 1);\" href=\"#\">".U46."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+2\">".LEVEL." 15</span><br /><a href=\"#\" onclick=\"return Popup(20, 4);\">
".STABLE." </a><span title=\"+3\">".LEVEL." 10</span> </td></tr>";
}
if(!$technology->meetRRequirement(47) && !$technology->getTech(47)) {
echo "
<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u47\" title=\"".U47."\" alt=\"".U47."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(47, 1);\" href=\"#\">".U47."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a>
<span title=\"+7\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP." </a><span title=\"+1\">".LEVEL." 1</span></td></tr>";
}
if(!$technology->meetRRequirement(48) && !$technology->getTech(48)) {
echo "<tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u48\" title=\"".U48."\" alt=\"".U48."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(48, 1);\" href=\"#\">".U48."</a></div></td><td class=\"cond\"><a href=\"#\" onclick=\"return Popup(21, 4);\">".WORKSHOP."</a>
<span title=\"+10\">".LEVEL." 10</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">".ACADEMY." </a><span title=\"+12\">".LEVEL." 15</span> </td>
</tr>";
}
if(!$technology->meetRRequirement(49) && !$technology->getTech(49)) {
echo " <tr><td class=\"desc\"><div class=\"tit\"><img class=\"unit u49\" title=\"".U49."\" alt=\"".U49."\" src=\"img/x.gif\"/>
<a onclick=\"return Popup(49, 1);\" href=\"#\">".U49."</a></div></td><td class=\"cond\">
<a href=\"#\" onclick=\"return Popup(16, 4);\">".RALLYPOINT." </a><span title=\"+4\">".LEVEL." 5</span><br /><a href=\"#\" onclick=\"return Popup(22, 4);\">
".ACADEMY." </a><span title=\"+17\">".LEVEL." 20</span></td></tr>";
}
echo " <script type=\"text/javascript\">
//<![CDATA[
$(\"researchFuture\").toggle = (function()
{
this.toggleClass(\"hide\");
$(\"researchFutureLink\").set(\"text\",
this.hasClass(\"hide\")
? \"".SHOW_MORE."\"
: \"".HIDE_MORE."\"
);
return false;
}).bind($(\"researchFuture\"));
//]]>
</script>";
echo "</tbody></table>";
}
//$acares = $technology->grabAcademyRes();
if(count($acares) > 0) {
echo "<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"><thead><tr><td>".RESEARCHING."</td><td>".DURATION."</td><td>".COMPLETE."</td></tr>
</thead><tbody>";
foreach($acares as $aca) {
$unit = substr($aca['tech'],1,2);
echo "<tr><td class=\"desc\"><img class=\"unit u$unit\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($unit)."\" title=\"".$technology->getUnitName($unit)."\" />".$technology->getUnitName($unit)."</td>";
echo "<td class=\"dur\"><span id=\"timer".++$session->timer."\">".$generator->getTimeFormat($aca['timestamp']-time())."</span></td>";
$date = $generator->procMtime($aca['timestamp']);
echo "<td class=\"fin\"><span>".$date[1]."</span><span> hrs</span></td>";
echo "</tr>";
}
echo "</tbody></table>";
}
?> ?>
<tr>
<td class="desc">
<div class="tit"><img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($name);?></a></div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$res['wood'];?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$res['clay'];?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$res['iron'];?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$res['crop'];?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
<?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo (int)$res['wood'];?>&r2=<?php echo (int)$res['clay'];?>&r3=<?php echo (int)$res['iron'];?>&r4=<?php echo (int)$res['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<br><span class=\"none\">".EXPAND_WAREHOUSE1."</span>";
elseif ($res['crop']>$village->maxcrop) echo "<br><span class=\"none\">".EXPAND_GRANARY1."</span>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) {
if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(22,$res); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; }
else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>";
}
?>
</div>
</td>
<td class="<?php echo ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore||$res['crop']>$village->maxcrop||$res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop||count($acares)>0)?'none':'act';?>">
<?php
if ($res['wood']>$village->maxstore||$res['clay']>$village->maxstore||$res['iron']>$village->maxstore) echo "<div class=\"none\">".EXPAND_WAREHOUSE."</div>";
elseif ($res['crop']>$village->maxcrop) echo "<div class=\"none\">".EXPAND_GRANARY."</div>";
elseif ($res['wood']>$village->awood||$res['clay']>$village->aclay||$res['iron']>$village->airon||$res['crop']>$village->acrop) echo "<div class=\"none\">".TOO_FEW_RESOURCES."</div>";
elseif (count($acares)>0) echo RESEARCH_IN_PROGRESS;
elseif ($session->access!=BANNED) echo "<a class=\"research\" href=\"build.php?id=".(int)$id."&amp;a=".$i."&amp;c=".$session->mchecker."\">".RESEARCH."</a>";
else echo "<a class=\"research\" href=\"banned.php\">".RESEARCH."</a>";
?>
</td>
</tr>
<?php endfor; if ($success===0):?>
<tr><td colspan="2"><div class="none" align="center"><?php echo RESEARCH_AVAILABLE;?></div></td></tr>
<?php endif;?>
</tbody>
</table>
<?php if ($fail>0):?>
<p class="switch"><a href="#" onclick="document.getElementById('researchFuture').classList.toggle('hide'); this.textContent = this.textContent == '<?php echo SHOW_MORE;?>'? '<?php echo HIDE_MORE;?>' : '<?php echo SHOW_MORE;?>'; return false;"><?php echo SHOW_MORE;?></a></p>
<table id="researchFuture" class="build_details hide" cellspacing="1" cellpadding="1">
<thead><tr><td colspan="2"><?php echo PREREQUISITES;?></td></tr></thead>
<tbody>
<?php if (!$technology->meetRRequirement(43) &&!$technology->getTech(43)):?>
<tr><td class="desc"><div class="tit"><img class="unit u43" src="img/x.gif" alt="<?php echo U43;?>"/><a onclick="return Popup(43,1);" href="#"><?php echo U43;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 3</span><br><a href="#" onclick="return Popup(12,4);"><?php echo BLACKSMITH;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(44) &&!$technology->getTech(44)):?>
<tr><td class="desc"><div class="tit"><img class="unit u44" src="img/x.gif" alt="<?php echo U44;?>"/><a onclick="return Popup(44,1);" href="#"><?php echo U44;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 1</span><br><a href="#" onclick="return Popup(15,4);"><?php echo MAINBUILDING;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(45) &&!$technology->getTech(45)):?>
<tr><td class="desc"><div class="tit"><img class="unit u45" src="img/x.gif" alt="<?php echo U45;?>"/><a onclick="return Popup(45,1);" href="#"><?php echo U45;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 5</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(46) &&!$technology->getTech(46)):?>
<tr><td class="desc"><div class="tit"><img class="unit u46" src="img/x.gif" alt="<?php echo U46;?>"/><a onclick="return Popup(46,1);" href="#"><?php echo U46;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span><br><a href="#" onclick="return Popup(20,4);"><?php echo STABLE;?></a> <span><?php echo LEVEL;?> 10</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(47) &&!$technology->getTech(47)):?>
<tr><td class="desc"><div class="tit"><img class="unit u47" src="img/x.gif" alt="<?php echo U47;?>"/><a onclick="return Popup(47,1);" href="#"><?php echo U47;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 1</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(48) &&!$technology->getTech(48)):?>
<tr><td class="desc"><div class="tit"><img class="unit u48" src="img/x.gif" alt="<?php echo U48;?>"/><a onclick="return Popup(48,1);" href="#"><?php echo U48;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(21,4);"><?php echo WORKSHOP;?></a> <span><?php echo LEVEL;?> 10</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 15</span></td></tr>
<?php endif;?>
<?php if (!$technology->meetRRequirement(49) &&!$technology->getTech(49)):?>
<tr><td class="desc"><div class="tit"><img class="unit u49" src="img/x.gif" alt="<?php echo U49;?>"/><a onclick="return Popup(49,1);" href="#"><?php echo U49;?></a></div></td><td class="cond"><a href="#" onclick="return Popup(16,4);"><?php echo RALLYPOINT;?></a> <span><?php echo LEVEL;?> 5</span><br><a href="#" onclick="return Popup(22,4);"><?php echo ACADEMY;?></a> <span><?php echo LEVEL;?> 20</span></td></tr>
<?php endif;?>
</tbody>
</table>
<?php endif;?>
<?php if (count($acares)>0):?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo RESEARCHING;?></td><td><?php echo DURATION;?></td><td><?php echo COMPLETE;?></td></tr></thead>
<tbody>
<?php foreach ($acares as $aca): $unit=(int)substr($aca['tech'],1,2); $name=$technology->getUnitName($unit); $date=$generator->procMtime($aca['timestamp']);?>
<tr><td class="desc"><img class="unit u<?php echo $unit;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($name);?>"/><?php echo htmlspecialchars($name);?></td><td class="dur"><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($aca['timestamp']-time());?></span></td><td class="fin"><span><?php echo $date[1];?></span><span> hrs</span></td></tr>
<?php endforeach;?>
</tbody>
</table>
<?php endif;?>
+29 -21
View File
@@ -1,27 +1,35 @@
<?php <?php
// 23.tpl - Cranny
global $session, $village, $database, $bid23, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$multiplier = (($session->tribe == 3) ? 2 : 1) * CRANNY_CAPACITY; $multiplier = (($session->tribe == 3) ? 2 : 1) * CRANNY_CAPACITY;
$actualLevel = $village->resarray['f'.$id]; $actualLevel = (int)$village->resarray['f'.$id];
$level = min($actualLevel + 1 + $loopsame + $doublebuild + $master, 10); $level = min($actualLevel + 1 + $loopsame + $doublebuild + $master, 10);
$currentHidden = $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$actualLevel]['attri'] * $multiplier);
$nextHidden = $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$level]['attri'] * $multiplier);
?> ?>
<div id="build" class="gid23"><a href="#" onClick="return Popup(23,4);" class="build_logo"> <div id="build" class="gid23">
<img class="building g23" src="img/x.gif" alt="Cranny" title="<?php echo CRANNY; ?>" /> <a href="#" onClick="return Popup(23,4);" class="build_logo">
</a> <img class="building g23" src="img/x.gif" alt="Cranny" title="<?php echo CRANNY;?>" />
<h1><?php echo CRANNY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo CRANNY_DESC; ?></p> <h1><?php echo CRANNY;?> <span class="level"><?php echo LEVEL;?> <?php echo $actualLevel;?></span></h1>
<table cellpadding="1" cellspacing="1" id="build_value"> <p class="build_desc"><?php echo CRANNY_DESC;?></p>
<tr>
<th><?php echo CURRENT_HIDDEN_UNITS; ?></th> <table cellpadding="1" cellspacing="1" id="build_value">
<td><b><?php echo $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$village->resarray['f'.$id]]['attri'] * $multiplier); ?></b> <?php echo UNITS; ?></td> <tr>
</tr> <th><?php echo CURRENT_HIDDEN_UNITS;?></th>
<?php if($actualLevel < 10){?> <td><b><?php echo $currentHidden;?></b> <?php echo UNITS;?></td>
<tr> </tr>
<th><?php echo HIDDEN_UNITS_LEVEL; ?> <?php echo $level; ?>:</th> <?php if ($actualLevel < 10):?>
<td><b><?php echo $database->getArtifactsValueInfluence($session->uid, $village->wid, 7, $bid23[$level]['attri'] * $multiplier); ?></b> <?php echo UNITS; ?></td> <tr>
</tr> <th><?php echo HIDDEN_UNITS_LEVEL;?> <?php echo $level;?>:</th>
<?php } ?> <td><b><?php echo $nextHidden;?></b> <?php echo UNITS;?></td>
</table> </tr>
<?php <?php endif;?>
include("upgrade.tpl"); </table>
?>
<?php include("upgrade.tpl");?>
</div> </div>
+19 -16
View File
@@ -1,18 +1,21 @@
<div id="build" class="gid24"><a href="#" onClick="return Popup(24,4);" class="build_logo">
<img class="building g24" src="img/x.gif" alt="Town Hall" title="<?php echo TOWNHALL; ?>" />
</a>
<h1><?php echo TOWNHALL; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo TOWNHALL_DESC; ?>
</p>
<?php <?php
if ($building->getTypeLevel(24) > 0) { // 24.tpl - Town Hall
include("Templates/Build/24_1.tpl"); global $village, $building, $id;
include("Templates/Build/24_2.tpl"); $level = (int)$village->resarray['f'.$id];
} else {
echo "<p><b>".CELEBRATIONS_COMMENCE_TOWNHALL."</b><br>\n";
}
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid24">
<a href="#" onClick="return Popup(24,4);" class="build_logo">
<img class="building g24" src="img/x.gif" alt="Town Hall" title="<?php echo TOWNHALL;?>" />
</a>
<h1><?php echo TOWNHALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo TOWNHALL_DESC;?></p>
<?php if ($building->getTypeLevel(24) > 0):?>
<?php include("Templates/Build/24_1.tpl"); ?>
<?php include("Templates/Build/24_2.tpl"); ?>
<?php else:?>
<p><b><?php echo CELEBRATIONS_COMMENCE_TOWNHALL;?></b></p>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+65 -79
View File
@@ -1,82 +1,68 @@
<table cellpadding="1" cellspacing="1" class="build_details"> <?php
<thead> // 24_1.tpl - TOWNHALL CELEBRATIONS
<tr> global $village, $database, $generator, $building, $session, $cel, $gc, $bid24, $id, $technology;
<td><?php echo CELEBRATIONS; ?></td>
<td><?php echo ACTION; ?></td>
</tr>
</thead>
<tbody>
<tr> $level = (int)$village->resarray['f'.$id];
<?php $inuse = (int)$database->getVillageField($village->wid, 'celebration');
$level = $village->resarray['f'.$id]; $now = time();
$inuse = $database->getVillageField($village->wid, 'celebration'); $inProgress = $inuse > $now;
$time = Time();
$i = 1;
echo "<tr><td class=\"desc\"><div class=\"tit\">".$cel[$i]['name']." (".$cel[$i]['attri']." ".CULTURE_POINTS.")</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".$cel[$i]['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".$cel[$i]['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".$cel[$i]['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".$cel[$i]['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round($cel[$i]['time'] * ($bid24[$building->getTypeLevel(24)]['attri'] / 100)/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)($cel[$i]['wood'] + $cel[$i]['clay'] + $cel[$i]['iron'] + $cel[$i]['crop']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=".$cel[$i]['wood']."&r2=".$cel[$i]['clay']."&r3=".$cel[$i]['iron']."&r4=".$cel[$i]['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if($inuse > $time){
echo "<td class=\"act\">
<div class=\"none\">".CELEBRATIONS_IN_PROGRESS."</div>
</td></tr>";
}
else if($cel[$i]['wood'] > $village->awood || $cel[$i]['clay'] > $village->aclay || $cel[$i]['iron'] > $village->airon || $cel[$i]['crop'] > $village->acrop) {
if($village->getProd("crop")>0){
$time = $technology->calculateAvaliable(24,$cel[$i]);
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
} else {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>";
}
echo "<td class=\"act\"><div class=\"none\">".TOO_FEW_RESOURCES."</div></td></tr>";
}
else {
echo "</td>";
echo "<td class=\"act\">";
echo "<a class=\"research\" href=\"celebration.php?type=$i&id=$id\">".HOLD."</a></td></tr>";
}
if($level >= 10){
$level = $village->resarray['f'.$id];
echo "<tr><td class=\"desc\">
<div class=\"tit\">
".GREAT_CELEBRATIONS." (2000 ".CULTURE_POINTS.")
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />29700|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />33250|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />32000|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />6700|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
echo $generator->getTimeFormat(round($gc[$level]/SPEED));
//-- If available resources combined are not enough, remove NPC button
$total_required = (int)(29700 + 33250 + 32000 + 6700);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "|<a href=\"build.php?gid=17&t=3&r1=29700&r2=33250&r3=32000&r4=6700\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
}
if($inuse > $time){
echo "<td class=\"act\">
<div class=\"none\">".CELEBRATIONS_IN_PROGRESS."</div>
</td></tr>";
}
else if(29700 > $village->awood || 33250 > $village->aclay || 32000 > $village->airon || 6700 > $village->acrop) {
if($village->getProd("crop")>0){
$time = $technology->calculateAvaliable(24,$cel[2]);
echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$time[0]." at ".$time[1]."</span></div></td>";
} else {
echo "<br><span class=\"none\">".CROP_NEGATIVE."</span></div></td>";
}
echo "<td class=\"act\">
<div class=\"none\">".TOO_FEW_RESOURCES."</div>
</td></tr>";
}
else {
echo "</td>";
echo "<td class=\"act\">
<a class=\"research\" href=\"celebration.php?type=2&id=$id\">".HOLD."</a></td></tr>";
}
}
?> ?>
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td><?php echo CELEBRATIONS;?></td><td><?php echo ACTION;?></td></tr></thead>
<tbody>
<?php
$i = 1;
$c = $cel[$i];
$time = $generator->getTimeFormat(round($c['time'] * ($bid24[$building->getTypeLevel(24)]['attri']/100) / SPEED));
$total = $c['wood']+$c['clay']+$c['iron']+$c['crop'];
$showNpc = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $total;
$canAfford = $c['wood']<=$village->awood && $c['clay']<=$village->aclay && $c['iron']<=$village->airon && $c['crop']<=$village->acrop;
?>
<tr>
<td class="desc">
<div class="tit"><?php echo $c['name'];?> (<?php echo $c['attri'];?> <?php echo CULTURE_POINTS;?>)</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo (int)$c['wood'];?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo (int)$c['clay'];?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo (int)$c['iron'];?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo (int)$c['crop'];?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $time;?>
<?php if ($showNpc):?>|<a href="build.php?gid=17&t=3&r1=<?php echo $c['wood'];?>&r2=<?php echo $c['clay'];?>&r3=<?php echo $c['iron'];?>&r4=<?php echo $c['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
<?php if (!$canAfford &&!$inProgress): if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(24,$c); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; } else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>"; endif;?>
</div>
</td>
<td class="act">
<?php if ($inProgress):?><div class="none"><?php echo CELEBRATIONS_IN_PROGRESS;?></div>
<?php elseif (!$canAfford):?><div class="none"><?php echo TOO_FEW_RESOURCES;?></div>
<?php else:?><a class="research" href="celebration.php?type=<?php echo $i;?>&id=<?php echo $id;?>"><?php echo HOLD;?></a><?php endif;?>
</td>
</tr>
<?php if ($level >= 10):
$gcTime = $generator->getTimeFormat(round($gc[$level]/SPEED));
$gcTotal = 29700+33250+32000+6700;
$showNpc2 = $session->userinfo['gold']>=3 && $building->getTypeLevel(17)>=1 && $village->atotal >= $gcTotal;
$canAfford2 = 29700<=$village->awood && 33250<=$village->aclay && 32000<=$village->airon && 6700<=$village->acrop;
?>
<tr>
<td class="desc">
<div class="tit"><?php echo GREAT_CELEBRATIONS;?> (2000 <?php echo CULTURE_POINTS;?>)</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/>29700|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/>33250|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/>32000|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/>6700|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $gcTime;?>
<?php if ($showNpc2):?>|<a href="build.php?gid=17&t=3&r1=29700&r2=33250&r3=32000&r4=6700" title="NPC trade"><img class="npc" src="img/x.gif"/></a><?php endif;?>
<?php if (!$canAfford2 &&!$inProgress): if ($village->getProd("crop")>0){ $t=$technology->calculateAvaliable(24,$cel[2]); echo "<br><span class=\"none\">".ENOUGH_RESOURCES." ".$t[0]." at ".$t[1]."</span>"; } else echo "<br><span class=\"none\">".CROP_NEGATIVE."</span>"; endif;?>
</div>
</td>
<td class="act">
<?php if ($inProgress):?><div class="none"><?php echo CELEBRATIONS_IN_PROGRESS;?></div>
<?php elseif (!$canAfford2):?><div class="none"><?php echo TOO_FEW_RESOURCES;?></div>
<?php else:?><a class="research" href="celebration.php?type=2&id=<?php echo $id;?>"><?php echo HOLD;?></a><?php endif;?>
</td>
</tr>
<?php endif;?>
</tbody>
</table>
+14 -12
View File
@@ -1,14 +1,16 @@
<?php <?php
$timeleft = $database->getVillageField($village->wid, 'celebration'); // 24_2.tpl - TOWNHALL TIMER
if($timeleft > time()){ global $database, $village, $generator, $session;
echo '</br>';
echo '<table cellpadding="0" cellspacing="0" id="building_contract">'; $timeleft = (int)$database->getVillageField($village->wid, 'celebration');
echo '<tr><td>'; if ($timeleft > time()):
echo 'celebration still needs:';
echo "</td><td><span id=\"timer".++$session->timer."\">";
echo $generator->getTimeFormat($timeleft - time());
echo "</span> hrs.</td>";
echo "<td>done at ".date('H:i', $timeleft)."</td></tr>";
echo "</table>";
}
?> ?>
<br>
<table cellpadding="0" cellspacing="0" id="building_contract">
<tr>
<td>celebration still needs:</td>
<td><span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($timeleft - time());?></span> hrs.</td>
<td>done at <?php echo date('H:i', $timeleft);?></td>
</tr>
</table>
<?php endif;?>
+25 -22
View File
@@ -1,26 +1,29 @@
<div id="build" class="gid25"><h1><?php echo RESIDENCE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');"
class="build_logo"> <img
class="building g25"
src="img/x.gif" alt="Residence"
title="<?php echo RESIDENCE; ?>" /> </a>
<?php echo RESIDENCE_DESC; ?></p>
<?php <?php
if ($village->capital == 1) { // 25.tpl - Residence
echo "<p class=\"act\">".CAPITAL."</p>"; global $village, $id;
}
include("25_menu.tpl"); $level = (int)$village->resarray['f'.$id];
if($village->resarray['f'.$id] >= 10){
include ("25_train.tpl");
}
else{
echo '<div class="c">'.RESIDENCE_TRAIN_DESC.'</div>';
}
include("upgrade.tpl");
?> ?>
<div id="build" class="gid25">
<h1><?php echo RESIDENCE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');" class="build_logo">
<img class="building g25" src="img/x.gif" alt="Residence" title="<?php echo RESIDENCE;?>" />
</a>
<?php echo RESIDENCE_DESC;?>
</p>
<?php if ($village->capital == 1):?>
<p class="act"><?php echo CAPITAL;?></p>
<?php endif;?>
<?php include("25_menu.tpl"); ?>
<?php if ($level >= 10):?>
<?php include("25_train.tpl");?>
<?php else:?>
<div class="c"><?php echo RESIDENCE_TRAIN_DESC;?></div>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div> </div>
+34 -24
View File
@@ -1,28 +1,38 @@
<div id="build" class="gid25"><h1><?php echo RESIDENCE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <?php
<p class="build_desc"> // 25_2.tpl - RESIDENCE CULTURE POINTS
<a href="#" onClick="return Popup(25,4, 'gid');" global $village, $database, $session, $id;
class="build_logo"> <img
class="building g25"
src="img/x.gif" alt="Residence"
title="<?php echo RESIDENCE; ?>" /> </a>
<?php echo RESIDENCE_DESC; ?></p>
<?php include("25_menu.tpl"); ?> $level = (int)$village->resarray['f'.$id];
$isNatar = (int)$database->getVillageField($village->wid, 'natar') == 1;
$villageCp = $isNatar ? 0 : (int)$database->getVillageField($village->wid, 'cp');
$accountCp = (int)$database->getVSumField($session->uid, 'cp');
$totalVillages = count($database->getProfileVillages($session->uid));
<p><?php echo RESIDENCE_CULTURE_DESC; ?></p> $mode = CP;
$nextCpNeeded = ${'cp'.$mode}[$totalVillages + 1];
?>
<div id="build" class="gid25">
<h1><?php echo RESIDENCE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');" class="build_logo">
<img class="building g25" src="img/x.gif" alt="Residence" title="<?php echo RESIDENCE;?>" />
</a>
<?php echo RESIDENCE_DESC;?>
</p>
<table cellpadding="1" cellspacing="1" id="build_value"> <?php include("25_menu.tpl"); ?>
<tr>
<th><?php echo PRODUCTION_POINTS; ?></th> <p><?php echo RESIDENCE_CULTURE_DESC;?></p>
<?php if($database->getVillageField($village->wid, 'natar') == 0){ ?>
<td><b><?php echo $database->getVillageField($village->wid, 'cp'); ?></b> <?php echo POINTS_DAY; ?></td> <table cellpadding="1" cellspacing="1" id="build_value">
<?php }else{ ?> <tr>
<td><b>0</b> <?php echo POINTS_DAY; ?></td> <th><?php echo PRODUCTION_POINTS;?></th>
<?php } ?> <td><b><?php echo $villageCp;?></b> <?php echo POINTS_DAY;?></td>
</tr> </tr>
<tr> <tr>
<th><?php echo PRODUCTION_ALL_POINTS; ?></th> <th><?php echo PRODUCTION_ALL_POINTS;?></th>
<td><b><?php echo $database->getVSumField($session->uid, 'cp'); ?></b> <?php echo POINTS_DAY; ?></td> <td><b><?php echo $accountCp;?></b> <?php echo POINTS_DAY;?></td>
</tr> </tr>
</table><p><?php echo VILLAGES_PRODUCED; ?> <b><?php echo $session->cp; ?></b> <?php echo POINTS_NEED; ?> <b><?php $mode = CP; $total = count($database->getProfileVillages($session->uid)); echo ${'cp'.$mode}[$total+1]; ?></b> <?php echo POINTS; ?>.</p> </table>
<p><?php echo VILLAGES_PRODUCED;?> <b><?php echo $session->cp;?></b> <?php echo POINTS_NEED;?> <b><?php echo $nextCpNeeded;?></b> <?php echo POINTS;?>.</p>
</div> </div>
+17 -10
View File
@@ -1,13 +1,20 @@
<div id="build" class="gid25"><h1><?php echo RESIDENCE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <?php
<p class="build_desc"> // 25_3.tpl - Residence loyalty
<a href="#" onClick="return Popup(25,4, 'gid');" global $village, $database, $id;
class="build_logo"> <img
class="building g25"
src="img/x.gif" alt="Residence"
title="<?php echo RESIDENCE; ?>" /> </a>
<?php echo RESIDENCE_DESC; ?></p>
$level = (int)$village->resarray['f'.$id];
$loyalty = floor((float)$database->getVillageField($village->wid, 'loyalty'));
?>
<div id="build" class="gid25">
<h1><?php echo RESIDENCE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');" class="build_logo">
<img class="building g25" src="img/x.gif" alt="Residence" title="<?php echo RESIDENCE;?>" />
</a>
<?php echo RESIDENCE_DESC;?>
</p>
<?php include("25_menu.tpl"); ?> <?php include("25_menu.tpl"); ?>
<?php echo RESIDENCE_LOYALTY_DESC; ?> <b><?php echo floor($database->getVillageField($village->wid,'loyalty')); ?></b> <?php echo PERCENT; ?>.</div> <p><?php echo RESIDENCE_LOYALTY_DESC;?> <b><?php echo $loyalty;?></b> <?php echo PERCENT;?>.</p>
</div>
+53 -51
View File
@@ -1,54 +1,56 @@
<div id="build" class="gid25"><h1><?php echo RESIDENCE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');"
class="build_logo"> <img
class="building g25"
src="img/x.gif" alt="Residence"
title="<?php echo RESIDENCE; ?>" /> </a>
<?php echo RESIDENCE_DESC; ?></p>
<?php include("25_menu.tpl"); ?>
<table cellpadding="1" cellspacing="1" id="expansion">
<thead><tr>
<th colspan="6"><a name="h2"></a><?php echo CONQUERED_BY_VILLAGE; ?></th>
</tr>
<tr>
<td colspan="2"><?php echo VILLAGE; ?></td>
<td><?php echo PLAYER; ?></td>
<td><?php echo INHABITANTS; ?></td>
<td><?php echo COORDINATES; ?></td>
<td><?php echo DATE; ?></td>
</tr></thead>
<tbody>
<?php <?php
$slot1 = $database->getVillageField($village->wid, 'exp1'); // 25_4.tpl - RESIDENCE EXPANSION
$slot2 = $database->getVillageField($village->wid, 'exp2'); global $village, $database, $generator, $id;
$slot3 = $database->getVillageField($village->wid, 'exp3');
if($slot1 != 0 || $slot2 != 0 || $slot3 != 0){ $level = (int)$village->resarray['f'.$id];
for($i=1; $i <= 3; $i++){ $slots = [
if (${'slot'.$i}<>0) { (int)$database->getVillageField($village->wid, 'exp1'),
$coor = $database->getCoor(${'slot'.$i}); (int)$database->getVillageField($village->wid, 'exp2'),
$vname = $database->getVillageField(${'slot'.$i},'name'); (int)$database->getVillageField($village->wid, 'exp3'),
$owner = $database->getVillageField(${'slot'.$i},'owner'); ];
$pop = $database->getVillageField(${'slot'.$i},'pop');
$vcreated = $database->getVillageField(${'slot'.$i},'created');
$ownername = $database->getUserField($owner,'username',0);
echo '
<tr>
<td class="ra">'.$i.'.</td>
<td class="vil"><a href="karte.php?d='.${'slot'.$i}.'&c='.$generator->getMapCheck(${'slot'.$i}).'">'.$vname.'</a></td>
<td class="pla"><a href="spieler.php?uid='.$owner.'">'.$ownername.'</a></td>
<td class="ha">'.$pop.'</td>
<td class="aligned_coords"><div class="cox">('.$coor['x'].'</div><div class="pi">|</div><div class="coy">'.$coor['y'].')</div></td>
<td class="dat">'.date('d.m.Y',$vcreated).'</td>
</tr>';
}
}
}
else{
echo '<tr><td colspan="6" class="none">'.NONE_CONQUERED_BY_VILLAGE.'</td></tr>';
}
?> ?>
</tbody></table></div> <div id="build" class="gid25">
<h1><?php echo RESIDENCE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(25,4, 'gid');" class="build_logo">
<img class="building g25" src="img/x.gif" alt="Residence" title="<?php echo RESIDENCE;?>" />
</a>
<?php echo RESIDENCE_DESC;?>
</p>
<?php include("25_menu.tpl"); ?>
<table cellpadding="1" cellspacing="1" id="expansion">
<thead>
<tr><th colspan="6"><a name="h2"></a><?php echo CONQUERED_BY_VILLAGE;?></th></tr>
<tr>
<td colspan="2"><?php echo VILLAGE;?></td>
<td><?php echo PLAYER;?></td>
<td><?php echo INHABITANTS;?></td>
<td><?php echo COORDINATES;?></td>
<td><?php echo DATE;?></td>
</tr>
</thead>
<tbody>
<?php $hasSlots = false; foreach ($slots as $idx => $slotId): if ($slotId == 0) continue; $hasSlots = true;
$coor = $database->getCoor($slotId);
$vname = $database->getVillageField($slotId, 'name');
$owner = $database->getVillageField($slotId, 'owner');
$pop = $database->getVillageField($slotId, 'pop');
$vcreated = $database->getVillageField($slotId, 'created');
$ownername = $database->getUserField($owner, 'username', 0);
?>
<tr>
<td class="ra"><?php echo $idx+1;?>.</td>
<td class="vil"><a href="karte.php?d=<?php echo $slotId;?>&c=<?php echo $generator->getMapCheck($slotId);?>"><?php echo htmlspecialchars($vname);?></a></td>
<td class="pla"><a href="spieler.php?uid=<?php echo $owner;?>"><?php echo htmlspecialchars($ownername);?></a></td>
<td class="ha"><?php echo (int)$pop;?></td>
<td class="aligned_coords"><div class="cox">(<?php echo $coor['x'];?></div><div class="pi">|</div><div class="coy"><?php echo $coor['y'];?>)</div></td>
<td class="dat"><?php echo date('d.m.Y', $vcreated);?></td>
</tr>
<?php endforeach; if (!$hasSlots):?>
<tr><td colspan="6" class="none"><?php echo NONE_CONQUERED_BY_VILLAGE;?></td></tr>
<?php endif;?>
</tbody>
</table>
</div>
+51 -64
View File
@@ -1,68 +1,55 @@
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead>
<tr>
<td>Naam</td>
<td>Aantal</td>
<td>max</td>
</tr>
</thead>
<tbody>
<?php <?php
$i = 20; // 25_create.tpl - RESIDENCE TRAIN UNITS
echo "<tr><td class=\"desc\"> global $id, $technology, $village, $generator;
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(Available: ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"duration\" />";
echo $generator->getTimeFormat(round(${'u'.$i}['time']/SPEED));
//-- If available resources combined are not enough, remove NPC button
//$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
//if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $i = 20; // Settler (sau 19 pentru Chief la Palace)
//echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $unit = ${'u'.$i};
//} $available = (int)$village->unitarray['u'.$i];
echo " $maxTrain = $technology->maxUnit($i);
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"4\"></td> $trainlist = $technology->getTrainingList(20);
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a></td></tr></tbody> ?>
"; <form method="POST" name="snd" action="build.php">
?> <input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t1" />
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead><tr><td>Naam</td><td>Aantal</td><td>max</td></tr></thead>
<p> <tbody>
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /> <tr>
</p> <td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo $technology->getUnitName($i);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo $technology->getUnitName($i);?></a>
<span class="info">(Available: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="Lumber"/><?php echo (int)$unit['wood'];?>|
<img class="r2" src="img/x.gif" title="Clay"/><?php echo (int)$unit['clay'];?>|
<img class="r3" src="img/x.gif" title="Iron"/><?php echo (int)$unit['iron'];?>|
<img class="r4" src="img/x.gif" title="Crop"/><?php echo (int)$unit['crop'];?>|
<img class="clock" src="img/x.gif" title="duration"/><?php echo $generator->getTimeFormat(round($unit['time']/SPEED));?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="4"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a></td>
</tr>
</tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
<?php <?php if (count($trainlist) > 0): $timer = 2*count($trainlist);?>
$trainlist = $technology->getTrainingList(20); <table cellpadding="1" cellspacing="1" class="under_progress">
if(count($trainlist) > 0) { <thead><tr><td>Training</td><td>Duration</td><td>Finished</td></tr></thead>
$timer = 2*count($trainlist); <tbody>
echo " <?php foreach ($trainlist as $train):?>
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"> <tr>
<thead><tr> <td class="desc"><img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo $train['name'];?>"/><?php echo $train['amt'];?> <?php echo $train['name'];?></td>
<td>Training</td> <td class="dur"><span id="timer<?php echo $timer;?>"><?php echo $generator->getTimeFormat(($train['commence']+($train['eachtime']*$train['amt']))-time());?></span></td>
<td>Duration</td> <td class="fin"><?php $time = $generator->procMTime($train['commence']+$train['amt']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?> o'clock</td>
<td>Finished</td> </tr>
</tr></thead> <tr class="next"><td colspan="3">The next unit will be finished in <span id="timer<?php echo --$timer;?>"><?php echo $generator->getTimeFormat(($train['commence']+$train['eachtime'])-time());?></span></td></tr>
<tbody>"; <?php $timer--; endforeach;?>
foreach($trainlist as $train) { </tbody>
echo "<tr><td class=\"desc\">"; </table>
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />".$train['amt']." ".$train['name']."</td><td class=\"dur\"><span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+($train['eachtime']*$train['amt']))-time())."</span></td><td class=\"fin\">"; <?php endif;?>
$timer -= 1; </form>
$time = $generator->procMTime($train['commence']+(1*$train['amt']));
if($time[0] != "today") {
echo "on ".$time[0]." at";
}
echo $time[1]."</span><span> o'clock</td>
</tr><tr class=\"next\"><td colspan=\"3\">The next unit will be finished in <span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+$train['eachtime'])-time())."</span></td></tr>";
}
echo "</tbody></table>";
}
?>
</form>
+9 -4
View File
@@ -1,7 +1,12 @@
<?php
// 25_menu.tpl - RESIDENCE MENU
global $id;
$s = $_GET['s'] ?? null;
?>
<div id="textmenu"> <div id="textmenu">
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['s']))echo "class=\"selected\""; ?>><?php echo TRAIN; ?></a> <a href="build.php?id=<?php echo (int)$id;?>" <?php if(!$s) echo 'class="selected"';?>><?php echo TRAIN;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) echo "class=\"selected\""; ?>><?php echo CULTURE_POINTS; ?></a> | <a href="build.php?id=<?php echo (int)$id;?>&amp;s=2" <?php if($s==2) echo 'class="selected"';?>><?php echo CULTURE_POINTS;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) echo "class=\"selected\""; ?>><?php echo LOYALTY; ?></a> | <a href="build.php?id=<?php echo (int)$id;?>&amp;s=3" <?php if($s==3) echo 'class="selected"';?>><?php echo LOYALTY;?></a>
| <a href="build.php?id=<?php echo $id; ?>&amp;s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) echo "class=\"selected\""; ?>><?php echo EXPANSION; ?></a> | <a href="build.php?id=<?php echo (int)$id;?>&amp;s=4" <?php if($s==4) echo 'class="selected"';?>><?php echo EXPANSION;?></a>
</div> </div>
+31 -33
View File
@@ -1,34 +1,32 @@
<?php <?php
$trainlist = $technology->getTrainingList(4); // 25_progress.tpl - RESIDENCE TRAINING UNITS PROGRESS
if(count($trainlist) > 0) { global $technology, $generator, $session;
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"> $trainlist = $technology->getTrainingList(4);
<thead><tr> if (count($trainlist) > 0):
<td>".TRAINING."</td> $TrainCount = 0;
<td>".DURATION."</td> $NextFinished = '';
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer; ?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
?> ?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
<tbody>
<?php foreach ($trainlist as $train): $TrainCount++;?>
<tr>
<td class="desc">
<img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo $train['name'];?>" title="<?php echo $train['name'];?>" />
<?php echo $train['amt'];?> <?php echo $train['name'];?>
</td>
<td class="dur">
<?php if ($TrainCount == 1): $NextFinished = $generator->getTimeFormat($train['timestamp2']-time());?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp']-time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime']*$train['amt']);?>
<?php endif;?>
</td>
<td class="fin"><?php $time = $generator->procMTime($train['timestamp']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
+2 -9
View File
@@ -1,13 +1,6 @@
<?php <?php
#################################################################################
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## // 25_train.tpl - RESIDENCE TRAINING UNITS PROGRESS
## --------------------------------------------------------------------------- ##
## Filename 25_train.tpl ##
## Made by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$slots = $database->getAvailableExpansionTraining(); $slots = $database->getAvailableExpansionTraining();
+38 -28
View File
@@ -1,38 +1,58 @@
<?php <?php
// PALACE - gid 26 - refactorizat
if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5){ if(time() - (!empty($_SESSION['time_p']) ? $_SESSION['time_p'] : 0) > 5){
$_SESSION['time_p'] = ''; $_SESSION['time_p'] = '';
$_SESSION['error_p'] = ''; $_SESSION['error_p'] = '';
} }
// --- LOGICA SCHIMBARE CAPITALA ---
if($_POST and $_GET['action'] == 'change_capital' && !$village->capital){ if($_POST && $_GET['action'] == 'change_capital' && !$village->capital){
$pass = mysqli_escape_string($database->dblink, $_POST['pass']); $pass = $_POST['pass'];
$query = mysqli_query($database->dblink, 'SELECT password FROM `'.TB_PREFIX.'users` WHERE `id` = '.(int)$session->uid); $query = mysqli_query($database->dblink, 'SELECT password FROM `'.TB_PREFIX.'users` WHERE `id` = '.(int)$session->uid);
$data = mysqli_fetch_assoc($query); $data = mysqli_fetch_assoc($query);
// 1. Verifică parola
if(password_verify($pass, $data['password'])){ if(password_verify($pass, $data['password'])){
$query1 = mysqli_query($database->dblink, 'SELECT wref FROM `'.TB_PREFIX.'vdata` WHERE `owner` = '.(int)$session->uid.' AND `capital` = 1'); $query1 = mysqli_query($database->dblink, 'SELECT wref FROM `'.TB_PREFIX.'vdata` WHERE `owner` = '.(int)$session->uid.' AND `capital` = 1');
$data1 = mysqli_fetch_assoc($query1); $data1 = mysqli_fetch_assoc($query1);
$query2 = mysqli_query($database->dblink, 'SELECT * FROM `'.TB_PREFIX.'fdata` WHERE `vref` = '.(int)$data1['wref']); $oldWid = (int)$data1['wref'];
$data2 = mysqli_fetch_assoc($query2); $newWid = (int)$village->wid;
if($data2['vref'] != $village->wid){
if($oldWid != $newWid){
// ia datele ambelor sate
$query2 = mysqli_query($database->dblink, 'SELECT * FROM `'.TB_PREFIX.'fdata` WHERE `vref` = '.$oldWid);
$data2 = mysqli_fetch_assoc($query2);
$query3 = mysqli_query($database->dblink, 'SELECT * FROM `'.TB_PREFIX.'fdata` WHERE `vref` = '.$newWid);
$data3 = mysqli_fetch_assoc($query3);
// 1. taie resursele vechii capitale la nivel 10
for($i = 1; $i <= 18; ++$i){ for($i = 1; $i <= 18; ++$i){
if($data2['f'.$i] > 10){ if($data2['f'.$i] > 10){
$query2 = mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'` = 10 WHERE `vref` = '.(int)$data2['vref']); mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'` = 10 WHERE `vref` = '.$oldWid);
} }
} }
// 2. șterge Zidarul din vechea capitală
for($i = 19; $i <= 40; ++$i){ for($i = 19; $i <= 40; ++$i){
if($data2['f'.$i.'t'] == 34){ if($data2['f'.$i.'t'] == 34){
$query3 = mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.(int)$data2['vref']); mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.$oldWid);
} }
} }
// 3. FIX: șterge clădirile specifice capitalei din NOUA capitală
$capitalOnly = [29,30,38,39,42];
for($i = 19; $i <= 40; ++$i){ for($i = 19; $i <= 40; ++$i){
if($data2['f'.$i.'t'] == 29 || $data2['f'.$i.'t'] == 30 || $data2['f'.$i.'t'] == 38 || $data2['f'.$i.'t'] == 39 || $data2['f'.$i.'t'] == 42){ if(in_array((int)$data3['f'.$i.'t'], $capitalOnly)){
$query3 = mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.(int)$village->wid); mysqli_query($database->dblink, 'UPDATE `'.TB_PREFIX.'fdata` SET `f'.$i.'t` = 0, `f'.$i.'` = 0 WHERE `vref` = '.$newWid);
} }
} }
$database->changeCapital((int)$data1['wref'], 0); $database->changeCapital($oldWid, 0);
$database->changeCapital($village->wid); $database->changeCapital($newWid);
// 4. FIX BUG-UL TĂU: recount populație instant
if(!isset($automation)){
include_once("GameEngine/Automation.php");
}
$automation->recountPop($oldWid, false);
$automation->recountPop($newWid, false);
header("location: build.php?gid=26"); header("location: build.php?gid=26");
exit; exit;
} }
@@ -40,37 +60,29 @@ if($_POST and $_GET['action'] == 'change_capital' && !$village->capital){
$error = '<br /><font color="red">'.LOGIN_PW_ERROR.'</font><br />'; $error = '<br /><font color="red">'.LOGIN_PW_ERROR.'</font><br />';
$_SESSION['error_p'] = $error; $_SESSION['error_p'] = $error;
$_SESSION['time_p'] = time(); $_SESSION['time_p'] = time();
echo '<script language="javascript">location.href="build.php?id='.$building->getTypeField(26).'&confirm=yes";</script>'; echo '<script>location.href="build.php?id='.$building->getTypeField(26).'&confirm=yes";</script>';
exit;
} }
} }
?> ?>
<div id="build" class="gid26"><h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <div id="build" class="gid26"><h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"> <p class="build_desc">
<a href="#" onClick="return Popup(26,4, 'gid');" <a href="#" onClick="return Popup(26,4, 'gid');" class="build_logo"> <img class="building g26" src="img/x.gif" alt="Palace" title="<?php echo PALACE; ?>" /> </a>
class="build_logo"> <img
class="building g26"
src="img/x.gif" alt="Palace"
title="<?php echo PALACE; ?>" /> </a>
<?php echo PALACE_DESC; ?></p> <?php echo PALACE_DESC; ?></p>
<?php <?php
if ($building->getTypeLevel(26) > 0) { if ($building->getTypeLevel(26) > 0) {
include("26_menu.tpl"); include("26_menu.tpl");
if($village->resarray['f'.$id] >= 10) include ("26_train.tpl"); if($village->resarray['f'.$id] >= 10) include ("26_train.tpl");
else echo '<div class="c">'.PALACE_TRAIN_DESC.'</div>'; else echo '<div class="c">'.PALACE_TRAIN_DESC.'</div>';
?>
<?php
if($village->capital == 1) { if($village->capital == 1) {
?> ?>
<p class="none"><?php echo CAPITAL; ?></p> <p class="none"><?php echo CAPITAL; ?></p>
<?php <?php
} else { } else {
if(empty($_GET['confirm'])) { if(empty($_GET['confirm'])) {
print '<p><a href="?id='.$building->getTypeField(26).'&confirm=yes">&raquo '.CHANGE_CAPITAL.'</a></p>'; print '<p><a href="?id='.$building->getTypeField(26).'&confirm=yes">&raquo; '.CHANGE_CAPITAL.'</a></p>';
} else { } else {
print '<p>Are you sure, that you want to change your capital?<br /><b>You can\'t undo this!</b><br />For security you must enter your password to confirm:<br /> print '<p>Are you sure, that you want to change your capital?<br /><b>You can\'t undo this!</b><br />For security you must enter your password to confirm:<br />
<form method="post" action="build.php?id='.$building->getTypeField(26).'&action=change_capital"> <form method="post" action="build.php?id='.$building->getTypeField(26).'&action=change_capital">
@@ -81,9 +93,7 @@ if($village->capital == 1) {
</p>'; </p>';
} }
} }
} } else echo "<b>".PALACE_CONSTRUCTION."</b>";
else echo "<b><?php echo PALACE_CONSTRUCTION; ?></b>";
include("upgrade.tpl"); include("upgrade.tpl");
?> ?>
</div> </div>
+48 -24
View File
@@ -1,27 +1,51 @@
<div id="build" class="gid26"><h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <?php
<p class="build_desc"> // 26_2.tpl - PALACE / POINT CULTURE
<a href="#" onClick="return Popup(26,4, 'gid');" global $database, $session, $village;
class="build_logo"> <img
class="building g26"
src="img/x.gif" alt="Palace"
title="Palace" /> </a>
<?php echo PALACE_DESC; ?></p>
<?php include("26_menu.tpl"); ?> $level = (int)$village->resarray['f'.$id];
$isNatar = (int)$database->getVillageField($village->wid, 'natar') === 1;
<p><?php echo RESIDENCE_CULTURE_DESC; ?></p> // ia datele o singură dată
<table cellpadding="1" cellspacing="1" id="build_value"> $cpVillage = $isNatar ? 0 : (int)$database->getVillageField($village->wid, 'cp');
<tr> $cpTotal = (int)$database->getVSumField($session->uid, 'cp');
<th><?php echo PRODUCTION_POINTS; ?></th> $villages = $database->getProfileVillages($session->uid);
<?php if($database->getVillageField($village->wid, 'natar') == 0){ ?> $totalVillages = count($villages);
<td><b><?php echo $database->getVillageField($village->wid, 'cp'); ?></b> <?php echo POINTS_DAY; ?></td>
<?php }else{ ?> // calcul pentru următorul sat - fără variable variables
<td><b>0</b> <?php echo POINTS_DAY; ?></td> $cpMode = CP; // 0 = normal, 1 = speed
<?php } ?> $cpArrayName = 'cp' . $cpMode;
</tr> $cpArray = $GLOBALS[$cpArrayName] ?? [];
<tr> $nextCpNeed = $cpArray[$totalVillages + 1] ?? 0;
<th><?php echo PRODUCTION_ALL_POINTS; ?></th> $currentCp = (int)$session->cp;
<td><b><?php echo $database->getVSumField($session->uid, 'cp'); ?></b> <?php echo POINTS_DAY; ?></td> ?>
</tr> <div id="build" class="gid26">
</table><p><?php echo VILLAGES_PRODUCED; ?> <b><?php echo $session->cp; ?></b> <?php echo POINTS_NEED; ?> <b><?php $mode = CP; $total = count($database->getProfileVillages($session->uid)); echo ${'cp'.$mode}[$total+1]; ?></b> <?php echo POINTS; ?>.</p> <h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL.' '.$level; ?></span></h1>
<p class="build_desc">
<a href="#" onclick="return Popup(26,4,'gid');" class="build_logo">
<img class="building g26" src="img/x.gif" alt="<?php echo PALACE; ?>" title="<?php echo PALACE; ?>" />
</a>
<?php echo PALACE_DESC; ?>
</p>
<?php include("26_menu.tpl"); ?>
<p><?php echo RESIDENCE_CULTURE_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo PRODUCTION_POINTS; ?></th>
<td><b><?php echo $cpVillage; ?></b> <?php echo POINTS_DAY; ?></td>
</tr>
<tr>
<th><?php echo PRODUCTION_ALL_POINTS; ?></th>
<td><b><?php echo $cpTotal; ?></b> <?php echo POINTS_DAY; ?></td>
</tr>
</table>
<p>
<?php echo VILLAGES_PRODUCED; ?> <b><?php echo $currentCp; ?></b>
<?php echo POINTS_NEED; ?> <b><?php echo $nextCpNeed; ?></b>
<?php echo POINTS; ?>.
</p>
</div> </div>
+22 -10
View File
@@ -1,13 +1,25 @@
<div id="build" class="gid26"><h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <?php
<p class="build_desc"> // 26_3.tpl - PALACE / LOIALITY
<a href="#" onClick="return Popup(26,4, 'gid');" global $database, $village;
class="build_logo"> <img
class="building g26"
src="img/x.gif" alt="Palace"
title="<?php echo PALACE; ?>" /> </a>
<?php echo PALACE_DESC; ?></p>
$level = (int)$village->resarray['f'.$id];
$loyalty = floor((float)$database->getVillageField($village->wid, 'loyalty'));
$loyalty = max(0, min(100, $loyalty)); // siguranță: între 0-100%
?>
<div id="build" class="gid26">
<h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL.' '.$level; ?></span></h1>
<?php include("26_menu.tpl"); ?> <p class="build_desc">
<a href="#" onclick="return Popup(26,4,'gid');" class="build_logo">
<img class="building g26" src="img/x.gif" alt="<?php echo PALACE; ?>" title="<?php echo PALACE; ?>" />
</a>
<?php echo PALACE_DESC; ?>
</p>
<?php echo RESIDENCE_LOYALTY_DESC; ?> <b><?php echo floor($database->getVillageField($village->wid,'loyalty')); ?></b> <?php echo PERCENT; ?>.</div> <?php include("26_menu.tpl"); ?>
<p class="loyalty">
<?php echo RESIDENCE_LOYALTY_DESC; ?>
<b><?php echo $loyalty; ?></b> <?php echo PERCENT; ?>.
</p>
</div>
+77 -52
View File
@@ -1,55 +1,80 @@
<div id="build" class="gid26"><h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc">
<a href="#" onClick="return Popup(26,4, 'gid');"
class="build_logo"> <img
class="building g26"
src="img/x.gif" alt="Palace"
title="<?php echo PALACE; ?>" /> </a>
<?php echo PALACE_DESC; ?>
<?php include("26_menu.tpl"); ?>
<table cellpadding="1" cellspacing="1" id="expansion">
<thead><tr>
<th colspan="6"><a name="h2"></a><?php echo CONQUERED_BY_VILLAGE; ?></th>
</tr>
<tr>
<td colspan="2"><?php echo VILLAGE; ?></td>
<td><?php echo PLAYER; ?></td>
<td><?php echo INHABITANTS; ?></td>
<td><?php echo COORDINATES; ?></td>
<td><?php echo DATE; ?></td>
</tr></thead>
<tbody>
<?php <?php
$slot1 = $database->getVillageField($village->wid, 'exp1'); // 26_4.tpl - PALACE / CONQUERED VILLAGES
$slot2 = $database->getVillageField($village->wid, 'exp2'); global $database, $village, $generator;
$slot3 = $database->getVillageField($village->wid, 'exp3');
if($slot1 != 0 || $slot2 != 0 || $slot3 != 0){ $level = (int)$village->resarray['f'.$id];
for($i=1; $i <= 3; $i++){
if (${'slot'.$i}<>0) { // ia toate 3 sloturile o singură dată
$coor = $database->getCoor(${'slot'.$i}); $slots = [
$vname = $database->getVillageField(${'slot'.$i},'name'); (int)$database->getVillageField($village->wid, 'exp1'),
$owner = $database->getVillageField(${'slot'.$i},'owner'); (int)$database->getVillageField($village->wid, 'exp2'),
$pop = $database->getVillageField(${'slot'.$i},'pop'); (int)$database->getVillageField($village->wid, 'exp3'),
$vcreated = $database->getVillageField(${'slot'.$i},'created'); ];
$ownername = $database->getUserField($owner,'username',0); $slots = array_filter($slots); // elimină 0
echo '
<tr>
<td class="ra">'.$i.'.</td>
<td class="vil"><a href="karte.php?d='.${'slot'.$i}.'&c='.$generator->getMapCheck(${'slot'.$i}).'">'.$vname.'</a></td>
<td class="pla"><a href="spieler.php?uid='.$owner.'">'.$ownername.'</a></td>
<td class="ha">'.$pop.'</td>
<td class="aligned_coords"><div class="cox">('.$coor['x'].'</div><div class="pi">|</div><div class="coy">'.$coor['y'].')</div></td>
<td class="dat">'.date('d.m.Y',$vcreated).'</td>
</tr>';
}
}
}
else{
echo '<tr><td colspan="6" class="none">'.NONE_CONQUERED_BY_VILLAGE.'</td></tr>';
}
?> ?>
</tbody></table></div> <div id="build" class="gid26">
<h1><?php echo PALACE; ?> <span class="level"><?php echo LEVEL.' '.$level; ?></span></h1>
<p class="build_desc">
<a href="#" onclick="return Popup(26,4,'gid');" class="build_logo">
<img class="building g26" src="img/x.gif" alt="<?php echo PALACE; ?>" title="<?php echo PALACE; ?>" />
</a>
<?php echo PALACE_DESC; ?>
</p>
<?php include("26_menu.tpl"); ?>
<table cellpadding="1" cellspacing="1" id="expansion">
<thead>
<tr>
<th colspan="6"><a name="h2"></a><?php echo CONQUERED_BY_VILLAGE; ?></th>
</tr>
<tr>
<td colspan="2"><?php echo VILLAGE; ?></td>
<td><?php echo PLAYER; ?></td>
<td><?php echo INHABITANTS; ?></td>
<td><?php echo COORDINATES; ?></td>
<td><?php echo DATE; ?></td>
</tr>
</thead>
<tbody>
<?php if (!empty($slots)):
$i = 1;
foreach ($slots as $wid):
// un singur set de date per sat
$coor = $database->getCoor($wid);
$villageData = $database->getVillage($wid); // conține name, owner, pop, created
$ownerName = $database->getUserField($villageData['owner'], 'username', 0);
$mapCheck = $generator->getMapCheck($wid);
?>
<tr>
<td class="ra"><?php echo $i; ?>.</td>
<td class="vil">
<a href="karte.php?d=<?php echo $wid; ?>&c=<?php echo $mapCheck; ?>">
<?php echo htmlspecialchars($villageData['name']); ?>
</a>
</td>
<td class="pla">
<a href="spieler.php?uid=<?php echo (int)$villageData['owner']; ?>">
<?php echo htmlspecialchars($ownerName); ?>
</a>
</td>
<td class="ha"><?php echo (int)$villageData['pop']; ?></td>
<td class="aligned_coords">
<div class="cox">(<?php echo (int)$coor['x']; ?></div>
<div class="pi">|</div>
<div class="coy"><?php echo (int)$coor['y']; ?>)</div>
</td>
<td class="dat"><?php echo date('d.m.Y', (int)$villageData['created']); ?></td>
</tr>
<?php
$i++;
endforeach;
else: ?>
<tr>
<td colspan="6" class="none"><?php echo NONE_CONQUERED_BY_VILLAGE; ?></td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
+92 -63
View File
@@ -1,68 +1,97 @@
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead>
<tr>
<td>Naam</td>
<td>Aantal</td>
<td>max</td>
</tr>
</thead>
<tbody>
<?php <?php
$i = 20; // 26_create.tpl - PALACE / TRAIN SETTLERS
echo "<tr><td class=\"desc\"> global $village, $technology, $generator, $id;
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(Available: ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"Lumber\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"Clay\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"Iron\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"Crop\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"duration\" />";
echo $generator->getTimeFormat(round(${'u'.$i}['time']/SPEED));
//-- If available resources combined are not enough, remove NPC button
//$total_required = (int)(${'r'.$i}['wood'] + ${'r'.$i}['clay'] + ${'r'.$i}['iron'] + ${'r'.$i}['crop']);
//if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $unitId = 20; // colonist
//echo "|<a href=\"build.php?gid=17&t=3&r1=".${'r'.$i}['wood']."&r2=".${'r'.$i}['clay']."&r3=".${'r'.$i}['iron']."&r4=".${'r'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $unitName = $technology->getUnitName($unitId);
//} $costs = $GLOBALS['u'.$unitId]; // $u20 din config
echo " $maxTrain = $technology->maxUnit($unitId);
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"4\"></td> $available = (int)($village->unitarray['u'.$unitId]?? 0);
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i)."; return false;\">(".$technology->maxUnit($i).")</a></td></tr></tbody> $trainTime = $generator->getTimeFormat(round($costs['time'] / SPEED));
"; $trainList = $technology->getTrainingList($unitId);
?> ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t1" />
</tbody> <table cellpadding="1" cellspacing="1" class="build_details">
</table> <thead>
<p> <tr>
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /> <td>Naam</td>
</p> <td>Aantal</td>
<td>max</td>
</tr>
</thead>
<tbody>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $unitId;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($unitName);?>" title="<?php echo htmlspecialchars($unitName);?>" />
<a href="#" onclick="return Popup(<?php echo $unitId;?>,1);"><?php echo htmlspecialchars($unitName);?></a>
<span class="info">(Available: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><?php echo $costs['wood'];?>|
<img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><?php echo $costs['clay'];?>|
<img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><?php echo $costs['iron'];?>|
<img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><?php echo $costs['crop'];?>|
<img class="clock" src="img/x.gif" alt="duration" title="duration" /><?php echo $trainTime;?>
</div>
</td>
<td class="val">
<input type="text" class="text" name="t<?php echo $unitId;?>" value="0" maxlength="4">
</td>
<td class="max">
<a href="#" onclick="document.snd.t<?php echo $unitId;?>.value=<?php echo $maxTrain;?>; return false;">(<?php echo $maxTrain;?>)</a>
</td>
</tr>
</tbody>
</table>
<?php <p>
$trainlist = $technology->getTrainingList(20); <input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
if(count($trainlist) > 0) { </p>
$timer = 2*count($trainlist);
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>Training</td>
<td>Duration</td>
<td>Finished</td>
</tr></thead>
<tbody>";
foreach($trainlist as $train) {
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />".$train['amt']." ".$train['name']."</td><td class=\"dur\"><span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+($train['eachtime']*$train['amt']))-time())."</span></td><td class=\"fin\">";
$timer -= 1;
$time = $generator->procMTime($train['commence']+(1*$train['amt']));
if($time[0] != "today") {
echo "on ".$time[0]." at";
}
echo $time[1]."</span><span> o'clock</td>
</tr><tr class=\"next\"><td colspan=\"3\">The next unit will be finished in <span id=timer".$timer.">".$generator->getTimeFormat(($train['commence']+$train['eachtime'])-time())."</span></td></tr>";
}
echo "</tbody></table>";
}
?>
</form> <?php if (!empty($trainList)):
$timer = count($trainList) * 2;
?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead>
<tr>
<td>Training</td>
<td>Duration</td>
<td>Finished</td>
</tr>
</thead>
<tbody>
<?php foreach ($trainList as $train):
$totalFinish = $train['commence'] + ($train['eachtime'] * $train['amt']);
$nextFinish = $train['commence'] + $train['eachtime'];
$remainingTotal = max(0, $totalFinish - time());
$remainingNext = max(0, $nextFinish - time());
$time = $generator->procMTime($totalFinish);
?>
<tr>
<td class="desc">
<img class="unit u<?php echo (int)$train['unit'];?>" src="img/x.gif" alt="<?php echo htmlspecialchars($train['name']);?>" title="<?php echo htmlspecialchars($train['name']);?>" />
<?php echo (int)$train['amt'];?> <?php echo htmlspecialchars($train['name']);?>
</td>
<td class="dur">
<span id="timer<?php echo $timer;?>"><?php echo $generator->getTimeFormat($remainingTotal);?></span>
</td>
<td class="fin">
<?php if ($time[0]!= "today") echo "on ".$time[0]." at "; echo $time[1];?> o'clock
</td>
</tr>
<tr class="next">
<td colspan="3">
The next unit will be finished in <span id="timer<?php echo $timer-1;?>"><?php echo $generator->getTimeFormat($remainingNext);?></span>
</td>
</tr>
<?php
$timer -= 2;
endforeach;?>
</tbody>
</table>
<?php endif;?>
</form>
+22 -4
View File
@@ -1,7 +1,25 @@
<?php
// 26_menu.tpl - PALACE / MENU
global $id;
$current = $_GET['s'] ?? '';
$menu = [
'' => TRAIN,
'2' => CULTURE_POINTS,
'3' => LOYALTY,
'4' => EXPANSION,
];
?>
<div id="textmenu"> <div id="textmenu">
<a href="build.php?id=<?php echo $id; ?>" <?php if(!isset($_GET['s'])) { echo "class=\"selected\""; } ?>><?php echo TRAIN; ?></a> <?php
| <a href="build.php?id=<?php echo $id; ?>&amp;s=2" <?php if(isset($_GET['s']) && $_GET['s'] == 2) { echo "class=\"selected\""; } ?>><?php echo CULTURE_POINTS; ?></a> $first = true;
| <a href="build.php?id=<?php echo $id; ?>&amp;s=3" <?php if(isset($_GET['s']) && $_GET['s'] == 3) { echo "class=\"selected\""; } ?>><?php echo LOYALTY; ?></a> foreach ($menu as $s => $label):
| <a href="build.php?id=<?php echo $id; ?>&amp;s=4" <?php if(isset($_GET['s']) && $_GET['s'] == 4) { echo "class=\"selected\""; } ?>><?php echo EXPANSION; ?></a> if (!$first) echo ' | ';
$first = false;
$url = 'build.php?id='.(int)$id.($s !== '' ? '&amp;s='.$s : '');
$selected = ($current === (string)$s) ? ' class="selected"' : '';
?>
<a href="<?php echo $url;?>"<?php echo $selected;?>><?php echo $label;?></a>
<?php endforeach; ?>
</div> </div>
+58 -33
View File
@@ -1,34 +1,59 @@
<?php <?php
$trainlist = $technology->getTrainingList(4); // 26_progress.tpl - PALACE / TRAIN PROGRESS
if(count($trainlist) > 0) { global $technology, $generator, $session;
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"> $trainList = $technology->getTrainingList(4); // unit 4 = pentru chief? păstrez ID-ul tău
<thead><tr> if (!empty($trainList)):
<td>".TRAINING."</td> $trainCount = 0;
<td>".DURATION."</td> $nextFinished = '';
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer; ?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
?> ?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead>
<tr>
<td><?php echo TRAINING;?></td>
<td><?php echo DURATION;?></td>
<td><?php echo FINISHED;?></td>
</tr>
</thead>
<tbody>
<?php foreach ($trainList as $train):
$trainCount++;
$isFirst = ($trainCount === 1);
// timp rămas
$remaining = max(0, (int)$train['timestamp'] - time());
$duration = $isFirst? $remaining : (int)$train['eachtime'] * (int)$train['amt'];
$time = $generator->procMTime((int)$train['timestamp']);
if ($isFirst) {
$nextFinished = $generator->getTimeFormat(max(0, (int)$train['timestamp2'] - time()));
$timerMain = ++$session->timer;
}
?>
<tr>
<td class="desc">
<img class="unit u<?php echo (int)$train['unit'];?>" src="img/x.gif" alt="<?php echo htmlspecialchars($train['name']);?>" title="<?php echo htmlspecialchars($train['name']);?>" />
<?php echo (int)$train['amt'];?> <?php echo htmlspecialchars($train['name']);?>
</td>
<td class="dur">
<?php if ($isFirst):?>
<span id="timer<?php echo $timerMain;?>"><?php echo $generator->getTimeFormat($remaining);?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($duration);?>
<?php endif;?>
</td>
<td class="fin">
<?php if ($time[0]!== "today") echo "on ".$time[0]." at "; echo $time[1];?>
</td>
</tr>
<?php endforeach;?>
<tr class="next">
<td colspan="3">
<?php echo UNIT_FINISHED;?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $nextFinished;?></span>
</td>
</tr>
</tbody>
</table>
<?php endif;?>
+75 -53
View File
@@ -1,64 +1,86 @@
<?php <?php
################################################################################# // 26_train.tpl - PALACE / Antrenare coloniști și șefi
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## global $database, $session, $village, $technology, $generator, $building, $bid26, $id;
## --------------------------------------------------------------------------- ##
## Filename 26_train.tpl ##
## Made by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$slots = $database->getAvailableExpansionTraining(); $slots = $database->getAvailableExpansionTraining();
$totalSlots = ($slots['settlers'] ?? 0) + ($slots['chiefs'] ?? 0);
if ($slots['settlers'] + $slots['chiefs'] > 0) { ?>
if ($totalSlots > 0): ?>
<form method="POST" name="snd" action="build.php"> <form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t1" /> <input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details"> <table cellpadding="1" cellspacing="1" class="build_details">
<thead> <thead>
<tr> <tr>
<td><?php echo NAME; ?></td> <td><?php echo NAME;?></td>
<td><?php echo QUANTITY; ?></td> <td><?php echo QUANTITY;?></td>
<td><?php echo MAX; ?></td> <td><?php echo MAX;?></td>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<?php <?php
for ($i = ($session->tribe - 1) * 10 + 9; $i <= $session->tribe * 10; $i++) { $start = ($session->tribe - 1) * 10 + 9;
if ($slots['settlers'] > 0 && $i % 10 == 0 || $slots['chiefs'] > 0 && $i % 10 == 9 && $session->tribe != 4) { $end = $session->tribe * 10;
$maxunit = MIN($technology->maxUnit($i), ($i % 10 == 0 ? $slots['settlers'] : $slots['chiefs']));
echo "<tr><td class=\"desc\"> for ($i = $start; $i <= $end; $i++):
<div class=\"tit\"> $isSettler = ($i % 10 === 0);
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> $isChief = ($i % 10 === 9 && $session->tribe != 4);
<a href=\"#\" onClick=\"return Popup(".$i.",1);\">".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span></div>
<div class=\"details\"><img class=\"r1\" src=\"img/x.gif\" alt=\"Lumber\" title=\"".LUMBER."\" />".${'u'.$i}['wood']."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".${'u'.$i}['clay']."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".${'u'.$i}['iron']."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".${'u'.$i}['crop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid26[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button if (($isSettler && $slots['settlers'] > 0) || ($isChief && $slots['chiefs'] > 0)):
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); $unitName = $technology->getUnitName($i);
$costs = $GLOBALS['u'.$i];
$maxByTech = $technology->maxUnit($i);
$slotLimit = $isSettler ? $slots['settlers'] : $slots['chiefs'];
$maxUnit = min($maxByTech, $slotLimit);
$available = (int)($village->unitarray['u'.$i] ?? 0);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { // timp cu bonus palat și artefacte
echo "|<a href=\"build.php?gid=17&t=3&r1=".${'u'.$i}['wood']."&r2=".${'u'.$i}['clay']."&r3=".${'u'.$i}['iron']."&r4=".${'u'.$i}['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $baseTime = $costs['time'] * ($bid26[$village->resarray['f'.$id]]['attri'] / 100) / SPEED;
} $duration = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($baseTime));
echo "<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"4\"></td>
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$maxunit."; return false;\">(".$maxunit.")</a></td></tr></tbody>"; $totalRequired = $costs['wood'] + $costs['clay'] + $costs['iron'] + $costs['crop'];
} $canNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
} ?> ?>
</div> <tr>
</tbody> <td class="desc">
</table> <div class="tit">
<p> <img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo htmlspecialchars($unitName);?>" title="<?php echo htmlspecialchars($unitName);?>" />
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /> <a href="#" onclick="return Popup(<?php echo $i;?>,1);"><?php echo htmlspecialchars($unitName);?></a>
</p> <span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" alt="<?php echo LUMBER;?>" title="<?php echo LUMBER;?>" /><?php echo $costs['wood'];?>|
<img class="r2" src="img/x.gif" alt="<?php echo CLAY;?>" title="<?php echo CLAY;?>" /><?php echo $costs['clay'];?>|
<img class="r3" src="img/x.gif" alt="<?php echo IRON;?>" title="<?php echo IRON;?>" /><?php echo $costs['iron'];?>|
<img class="r4" src="img/x.gif" alt="<?php echo CROP;?>" title="<?php echo CROP;?>" /><?php echo $costs['crop'];?>|
<img class="clock" src="img/x.gif" alt="<?php echo DURATION;?>" title="<?php echo DURATION;?>" /><?php echo $generator->getTimeFormat($duration);?>
<?php if ($canNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo $costs['wood'];?>&r2=<?php echo $costs['clay'];?>&r3=<?php echo $costs['iron'];?>&r4=<?php echo $costs['crop'];?>" title="NPC trade">
<img class="npc" src="img/x.gif" alt="NPC trade" title="NPC trade" />
</a>
<?php endif;?>
</div>
</td>
<td class="val">
<input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="4">
</td>
<td class="max">
<a href="#" onclick="document.snd.t<?php echo $i;?>.value=<?php echo $maxUnit;?>; return false;">(<?php echo $maxUnit;?>)</a>
</td>
</tr>
<?php
endif;
endfor; ?>
</tbody>
</table>
<p>
<input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" />
</p>
</form> </form>
<?php <?php else: ?>
} <div class="c"><?php echo PALACE_TRAIN_DESC;?></div>
else echo '<div class="c">'.PALACE_TRAIN_DESC.'</div>'; <?php endif;
include ("26_progress.tpl"); include("26_progress.tpl");
?> ?>
+29 -32
View File
@@ -1,37 +1,34 @@
<?php <?php
// 28.tpl - TRADEOFFICE
global $village, $building, $bid28, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid28[$level]['attri'] : 100;
?> ?>
<div id="build" class="gid28"><a href="#" onClick="return Popup(28,4);" class="build_logo"> <div id="build" class="gid28">
<img class="building g28" src="img/x.gif" alt="Trade Office" title="<?php echo TRADEOFFICE; ?>" /> <a href="#" onClick="return Popup(28,4);" class="build_logo">
</a> <img class="building g28" src="img/x.gif" alt="Trade Office" title="<?php echo TRADEOFFICE;?>" />
<h1><?php echo TRADEOFFICE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo TRADEOFFICE_DESC; ?></p> <h1><?php echo TRADEOFFICE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo TRADEOFFICE_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<table cellpadding="1" cellspacing="1" id="build_value"> <tr>
<tr> <th><?php echo CURRENT_MERCHANT;?></th>
<th><?php echo CURRENT_MERCHANT; ?></th> <td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid28[$village->resarray['f'.$id]]['attri'] : 100; ?></b> <?php echo PERCENT; ?></td> </tr>
</tr> <tr>
<tr> <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
<?php $next = $level + 1 + $loopsame + $doublebuild + $master;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { $next = $next > 20 ? 20 : $next;
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next<=20){
?>
<th><?php echo MERCHANT_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid28[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}else{
?>
<th><?php echo MERCHANT_LEVEL; ?> 20:</th>
<td><b><?php echo $bid28[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?> ?>
</tr> <th><?php echo MERCHANT_LEVEL;?> <?php echo $next;?>:</th>
</table> <td><b><?php echo (int)$bid28[$next]['attri'];?></b> <?php echo PERCENT;?></td>
<?php <?php endif;?>
include("upgrade.tpl"); </tr>
?> </table>
</p></div>
<?php include("upgrade.tpl");?>
</div>
+49 -57
View File
@@ -1,59 +1,51 @@
<div id="build" class="gid29"><a href="#" onClick="return Popup(29,4);" class="build_logo"> <?php
<img class="building g29" src="img/x.gif" alt="Great Barracks" title="<?php echo GREATBARRACKS; ?>" /> // 29.tpl - GREATBARRACKS
</a> global $village, $building, $technology, $generator, $session, $id;
<h1><?php echo GREATBARRACKS; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo GREATBARRACKS_DESC; ?></p>
<?php if ($building->getTypeLevel(29) > 0) { ?> $level = (int)$village->resarray['f'.$id];
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr></thead><tbody>
<?php
include("29_train.tpl");
?></table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></form></p>
<?php
} else {
echo "<b>".TRAINING_COMMENCE_GREATBARRACKS."</b><br>\n";
}
$trainlist = $technology->getTrainingList(5);
if(count($trainlist) > 0) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer; ?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid29">
<a href="#" onClick="return Popup(29,4);" class="build_logo">
<img class="building g29" src="img/x.gif" alt="Great Barracks" title="<?php echo GREATBARRACKS;?>" />
</a>
<h1><?php echo GREATBARRACKS;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo GREATBARRACKS_DESC;?></p>
<?php if ($building->getTypeLevel(29) > 0):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr><td><?php echo NAME;?></td><td><?php echo QUANTITY;?></td><td><?php echo MAX;?></td></tr></thead>
<tbody><?php include("29_train.tpl");?></tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_GREATBARRACKS;?></b><br />
<?php endif;?>
<?php $trainlist = $technology->getTrainingList(5); if (count($trainlist) > 0): $TrainCount = 0; $NextFinished = '';?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
<tbody>
<?php foreach ($trainlist as $train): $TrainCount++;?>
<tr>
<td class="desc"><img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo $train['name'];?>" title="<?php echo $train['name'];?>" /><?php echo $train['amt'];?> <?php echo $train['name'];?></td>
<td class="dur">
<?php if ($TrainCount == 1): $NextFinished = $generator->getTimeFormat($train['timestamp2']-time());?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp']-time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime']*$train['amt']);?>
<?php endif;?>
</td>
<td class="fin"><?php $time = $generator->procMTime($train['timestamp']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+43 -22
View File
@@ -1,27 +1,48 @@
<?php <?php
for ($i=($session->tribe-1)*10+1;$i<=($session->tribe-1)*10+4;$i++) { // 29_train.tpl - GREATBARRACKS TRAIN
if ($i <> 4 && $i <> 23 && $i <> 24 && ($technology->getTech($i) || $i%10 == 1)) { global $session, $technology, $village, $database, $building, $bid29, $generator, $id;
echo "<tr><td class=\"desc\"> $start = ($session->tribe - 1) * 10 + 1;
<div class=\"tit\"> $end = ($session->tribe - 1) * 10 + 4;
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" /> $level = (int)$village->resarray['f'.$id];
<a href=\"#\" onClick=\"return Popup(".$i.",1);\"> ".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid29[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button for ($i = $start; $i <= $end; $i++):
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); if ($i == 4 || $i == 23 || $i == 24) continue;
if (!($technology->getTech($i) || $i % 10 == 1)) continue;
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $unit = ${'u'.$i};
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $costWood = (int)$unit['wood'] * 3;
} $costClay = (int)$unit['clay'] * 3;
echo "</div> $costIron = (int)$unit['iron'] * 3;
</td> $costCrop = (int)$unit['crop'] * 3;
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"10\"></td> $pop = (int)$unit['pop'];
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,true)."; return false;\">(".$technology->maxUnit($i,true).")</a></td></tr></tbody>"; $available = (int)$village->unitarray['u'.$i];
} $max = $technology->maxUnit($i, true);
} $maxPlus = $technology->maxUnitPlus($i);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unit['time'] * ($bid29[$level]['attri'] / 100) / SPEED));
$totalRequired = (int)($unit['wood'] + $unit['clay'] + $unit['iron'] + $unit['crop']);
$showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
?> ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo $technology->getUnitName($i);?>" title="<?php echo $technology->getUnitName($i);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo $technology->getUnitName($i);?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo $costWood;?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo $costClay;?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo $costIron;?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo $costCrop;?>|
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/><?php echo $pop;?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $generator->getTimeFormat($time);?>
<?php if ($showNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo $costWood/3*$maxPlus;?>&r2=<?php echo $costClay/3*$maxPlus;?>&r3=<?php echo $costIron/3*$maxPlus;?>&r4=<?php echo $costCrop/3*$maxPlus;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade" /></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
</tr>
<?php endfor;?>
+42 -50
View File
@@ -1,56 +1,48 @@
<?php <?php
include("next.tpl");
// IRONMINE
include 'next.tpl';
// — pregătire date —
$field = 'f' . $id;
$currentLevel = (int) ($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentProd = $bid3[$currentLevel]['prod'] * SPEED;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = ($village->capital == 1) ? 20 : 10;
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextProd = $bid3[$nextLevel]['prod'] * SPEED;
?> ?>
<div id="build" class="gid3"><a href="#" onClick="return Popup(3,4);" class="build_logo"> <div id="build" class="gid3">
<img class="building g3" src="img/x.gif" alt="<?php echo IRONMINE; ?>" title="<?php echo IRONMINE; ?>" /> <a href="#" onclick="return Popup(3,4);" class="build_logo">
</a> <img class="building g3" src="img/x.gif" alt="<?= IRONMINE ?>" title="<?= IRONMINE ?>">
<h1><?php echo IRONMINE; ?> <span class="level"><?php echo LEVEL." "; echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo IRONMINE_DESC; ?></p>
<h1>
<?= IRONMINE ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= IRONMINE_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <table cellpadding="1" cellspacing="1" id="build_value">
<tr> <tr>
<th><?php echo CUR_PROD; ?></th> <th><?= CUR_PROD ?>:</th>
<td><b><?php echo $bid3[$village->resarray['f'.$id]]['prod']* SPEED; ?></b> per hour</td> <td><b><?= $currentProd ?></b> <?= PER_HR ?></td>
</tr> </tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($village->capital == 1) {
if($next<=20){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid3[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 20; ?>:</th>
<td><b><?php echo $bid3[20]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}else{
if($next<=10){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid3[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 10; ?>:</th>
<td><b><?php echo $bid3[10]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}}
?>
</table>
<?php <?php if (!$isMax): ?>
include("upgrade.tpl"); <tr>
?></p></div> <th><?= NEXT_PROD ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextProd ?></b> <?= PER_HR ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+49 -57
View File
@@ -1,59 +1,51 @@
<div id="build" class="gid30"><a href="#" onClick="return Popup(30,4);" class="build_logo"> <?php
<img class="building g30" src="img/x.gif" alt="Great Stables" title="<?php echo GREATSTABLE; ?>" /> // 30.tpl - GREATSTABLE
</a> global $village, $building, $technology, $generator, $session, $id;
<h1><?php echo GREATSTABLE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo GREATSTABLE_DESC; ?><br /></p>
<?php if ($building->getTypeLevel(30) > 0) { ?> $level = (int)$village->resarray['f'.$id];
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr></thead><tbody>
<?php
include("30_train.tpl");
?></table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></form></p>
<?php
} else {
echo "<b>".TRAINING_COMMENCE_GREATSTABLE."</b><br>\n";
}
$trainlist = $technology->getTrainingList(6);
if(count($trainlist) > 0) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer; ?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid30">
<a href="#" onClick="return Popup(30,4);" class="build_logo">
<img class="building g30" src="img/x.gif" alt="Great Stables" title="<?php echo GREATSTABLE;?>" />
</a>
<h1><?php echo GREATSTABLE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo GREATSTABLE_DESC;?><br /></p>
<?php if ($building->getTypeLevel(30) > 0):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr><td><?php echo NAME;?></td><td><?php echo QUANTITY;?></td><td><?php echo MAX;?></td></tr></thead>
<tbody><?php include("30_train.tpl");?></tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_GREATSTABLE;?></b><br />
<?php endif;?>
<?php $trainlist = $technology->getTrainingList(6); if (count($trainlist) > 0): $TrainCount = 0; $NextFinished = '';?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
<tbody>
<?php foreach ($trainlist as $train): $TrainCount++;?>
<tr>
<td class="desc"><img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo $train['name'];?>" title="<?php echo $train['name'];?>" /><?php echo $train['amt'];?> <?php echo $train['name'];?></td>
<td class="dur">
<?php if ($TrainCount == 1): $NextFinished = $generator->getTimeFormat($train['timestamp2']-time());?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp']-time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime']*$train['amt']);?>
<?php endif;?>
</td>
<td class="fin"><?php $time = $generator->procMTime($train['timestamp']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+52 -26
View File
@@ -1,31 +1,57 @@
<?php <?php
// 30_train.tpl - GREATSTABLE TRAIN
global $session, $technology, $village, $database, $building, $bid30, $bid41, $generator, $id;
$start = ($session->tribe - 1) * 10 + 3;
$end = ($session->tribe - 1) * 10 + 6;
$level = (int)$village->resarray['f'.$id];
$horseDrinking = $building->getTypeLevel(41);
$success = 0; $success = 0;
for ($i=($session->tribe-1)*10+3;$i<=($session->tribe-1)*10+6;$i++) {
if ($i <> 3 && $i <> 13 && $i <> 14 && $technology->getTech($i)) {
$success ++;
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\"> ".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".(${'u'.$i}['pop']-($building->getTypeLevel(41)>=1?1:0))."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid30[$village->resarray['f'.$id]]['attri'] * ($building->getTypeLevel(41)>=1?(1/$bid41[$building->getTypeLevel(41)]['attri']):1) / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button for ($i = $start; $i <= $end; $i++):
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); if ($i == 3 || $i == 13 || $i == 14) continue;
if (!$technology->getTech($i)) continue;
$success++;
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $unit = ${'u'.$i};
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $costWood = (int)$unit['wood'] * 3;
} $costClay = (int)$unit['clay'] * 3;
echo "</div> $costIron = (int)$unit['iron'] * 3;
</td> $costCrop = (int)$unit['crop'] * 3;
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"10\"></td> $pop = (int)$unit['pop'] - ($horseDrinking >= 1 ? 1 : 0);
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,true)."; return false;\">(".$technology->maxUnit($i,true).")</a></td></tr></tbody>"; $available = (int)$village->unitarray['u'.$i];
} $max = $technology->maxUnit($i, true);
} $maxPlus = $technology->maxUnitPlus($i);
if($success == 0) {
echo "<tr><td colspan=\"3\"><div class=\"none\" align=\"center\">".AVAILABLE_ACADEMY."</div></td></tr>"; $speedMod = $bid30[$level]['attri'] / 100;
} if ($horseDrinking >= 1) $speedMod *= (1 / $bid41[$horseDrinking]['attri']);
$time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round($unit['time'] * $speedMod / SPEED));
$totalRequired = (int)($unit['wood'] + $unit['clay'] + $unit['iron'] + $unit['crop']);
$showNpc = $session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired;
?> ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo $technology->getUnitName($i);?>" title="<?php echo $technology->getUnitName($i);?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo $technology->getUnitName($i);?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo $available;?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo $costWood;?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo $costClay;?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo $costIron;?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo $costCrop;?>|
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/><?php echo $pop;?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $generator->getTimeFormat($time);?>
<?php if ($showNpc):?>
|<a href="build.php?gid=17&t=3&r1=<?php echo $unit['wood']*$maxPlus;?>&r2=<?php echo $unit['clay']*$maxPlus;?>&r3=<?php echo $unit['iron']*$maxPlus;?>&r4=<?php echo $unit['crop']*$maxPlus;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade" /></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="10"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
</tr>
<?php endfor; if ($success == 0):?>
<tr><td colspan="3"><div class="none" align="center"><?php echo AVAILABLE_ACADEMY;?></div></td></tr>
<?php endif;?>
+24 -28
View File
@@ -1,35 +1,31 @@
<?php <?php
// 31.tpl - CITYWALL
global $village, $building, $bid31, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid31[$level]['attri'] : 0;
?> ?>
<div id="build" class="gid31"> <div id="build" class="gid31">
<h1><?php echo CITYWALL; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <h1><?php echo CITYWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo CITYWALL_DESC; ?></p> <p class="build_desc"><?php echo CITYWALL_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <table cellpadding="1" cellspacing="1" id="build_value">
<tr> <tr>
<th><?php echo DEFENCE_NOW; ?></th> <th><?php echo DEFENCE_NOW;?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid31[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> <td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
</tr><tr> </tr>
<?php <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { $next = $level + 1 + $loopsame + $doublebuild + $master;
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master; $next = $next > 20 ? 20 : $next;
if($next <= 20){
?> ?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th> <tr>
<th><?php echo DEFENCE_LEVEL;?> <?php echo $next;?>:</th>
<td><b><?php echo (int)$bid31[$next]['attri'];?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
</table>
<td><b><?php echo $bid31[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> <?php include("upgrade.tpl");?>
<?php </div>
}else{
?>
<th><?php echo DEFENCE_LEVEL; ?> 20:</th>
<td><b><?php echo $bid31[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}
}
?>
</tr></table>
<?php
include("upgrade.tpl");
?>
</p>
</div>
+24 -28
View File
@@ -1,35 +1,31 @@
<?php <?php
// 32.tpl - EARTHWALL
global $village, $building, $bid32, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid32[$level]['attri'] : 0;
?> ?>
<div id="build" class="gid32"> <div id="build" class="gid32">
<h1><?php echo EARTHWALL; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <h1><?php echo EARTHWALL;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo EARTHWALL_DESC; ?></p> <p class="build_desc"><?php echo EARTHWALL_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <table cellpadding="1" cellspacing="1" id="build_value">
<tr> <tr>
<th><?php echo DEFENCE_NOW; ?></th> <th><?php echo DEFENCE_NOW;?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid32[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> <td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
</tr><tr> </tr>
<?php <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { $next = $level + 1 + $loopsame + $doublebuild + $master;
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master; $next = $next > 20 ? 20 : $next;
if($next <= 20){
?> ?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th> <tr>
<th><?php echo DEFENCE_LEVEL;?> <?php echo $next;?>:</th>
<td><b><?php echo (int)$bid32[$next]['attri'];?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
</table>
<td><b><?php echo $bid32[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> <?php include("upgrade.tpl");?>
<?php </div>
}else{
?>
<th><?php echo DEFENCE_LEVEL; ?> 20:</th>
<td><b><?php echo $bid32[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}
}
?>
</tr></table>
<?php
include("upgrade.tpl");
?>
</p>
</div>
+24 -28
View File
@@ -1,35 +1,31 @@
<?php <?php
// 33.tpl - PALISADE
global $village, $building, $bid33, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid33[$level]['attri'] : 0;
?> ?>
<div id="build" class="gid33"> <div id="build" class="gid33">
<h1><?php echo PALISADE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <h1><?php echo PALISADE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo PALISADE_DESC; ?></p> <p class="build_desc"><?php echo PALISADE_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <table cellpadding="1" cellspacing="1" id="build_value">
<tr> <tr>
<th><?php echo DEFENCE_NOW; ?></th> <th><?php echo DEFENCE_NOW;?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid33[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> <td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
</tr><tr> </tr>
<?php <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { $next = $level + 1 + $loopsame + $doublebuild + $master;
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master; $next = $next > 20 ? 20 : $next;
if($next <= 20){
?> ?>
<th><?php echo DEFENCE_LEVEL; ?> <?php echo $next; ?>:</th> <tr>
<th><?php echo DEFENCE_LEVEL;?> <?php echo $next;?>:</th>
<td><b><?php echo (int)$bid33[$next]['attri'];?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
</table>
<td><b><?php echo $bid33[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> <?php include("upgrade.tpl");?>
<?php </div>
}else{
?>
<th><?php echo DEFENCE_LEVEL; ?> 20:</th>
<td><b><?php echo $bid33[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}
}
?>
</tr></table>
<?php
include("upgrade.tpl");
?>
</p>
</div>
+3
View File
@@ -1,4 +1,7 @@
<?php <?php
// 34.tpl STONEMASON
include("next.tpl"); include("next.tpl");
?> ?>
<div id="build" class="gid34"><a href="#" onClick="return Popup(34,4);" class="build_logo"> <div id="build" class="gid34"><a href="#" onClick="return Popup(34,4);" class="build_logo">
+33 -33
View File
@@ -1,37 +1,37 @@
<?php <?php
// 35.tpl
// 35.tpl - BREWERY
global $village, $building, $bid35, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
?>
<div id="build" class="gid35"><a href="#" onClick="return Popup(35,4);" class="build_logo">
<img class="building g35" src="img/x.gif" alt="Brewery" title="<?php echo BREWERY; ?>" />
</a>
<h1><?php echo BREWERY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo BREWERY_DESC; ?></p>
$level = (int)$village->resarray['f'.$id];
<table cellpadding="1" cellspacing="1" id="build_value"> $current = $level > 0 ? (int)$bid35[$level]['attri'] : 0;
<tr>
<th><?php echo CURRENT_BONUS; ?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid35[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 10){
?>
<th><?php echo BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid35[$next]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}else{
?>
<th><?php echo BONUS_LEVEL; ?> 10:</th>
<td><b><?php echo $bid35[10]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid35">
<a href="#" onClick="return Popup(35,4);" class="build_logo">
<img class="building g35" src="img/x.gif" alt="Brewery" title="<?php echo BREWERY;?>" />
</a>
<h1><?php echo BREWERY;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo BREWERY_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_BONUS;?></th>
<td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
</tr>
<?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
$next = $level + 1 + $loopsame + $doublebuild + $master;
$next = $next > 10 ? 10 : $next;
?>
<tr>
<th><?php echo BONUS_LEVEL;?> <?php echo $next;?>:</th>
<td><b><?php echo (int)$bid35[$next]['attri'];?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
</table>
<?php include("upgrade.tpl");?>
</div>
+100 -125
View File
@@ -1,135 +1,110 @@
<?php <?php
// 36.tpl - TRAPS
global $village, $building, $technology, $generator, $database, $session, $bid19, $bid36, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$currentCap = $level > 0? (int)$bid36[$level]['attri'] * TRAPPER_CAPACITY : 0;
?> ?>
<div id="build" class="gid36"><h1><?php echo TRAPPER; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> <div id="build" class="gid36">
<p class="build_desc"> <h1><?php echo TRAPPER;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<a href="#" onClick="return Popup(36,4, 'gid');" <p class="build_desc">
class="build_logo"> <img <a href="#" onClick="return Popup(36,4,'gid');" class="build_logo">
class="building g36" <img class="building g36" src="img/x.gif" alt="Trapper" title="<?php echo TRAPPER;?>" />
src="img/x.gif" alt="Trapper" </a>
title="<?php echo TRAPPER; ?>" /> </a> <?php echo TRAPPER_DESC;?>
<?php echo TRAPPER_DESC; ?> </p> </p>
<table cellpadding="1" cellspacing="1" id="build_value"> <table cellpadding="1" cellspacing="1" id="build_value">
<tr> <tr>
<th><?php echo CURRENT_TRAPS; ?></th> <th><?php echo CURRENT_TRAPS;?></th>
<td><b><?php echo $bid36[$village->resarray['f'.$id]]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td> <td><b><?php echo $currentCap;?></b> <?php echo TRAPS;?></td>
</tr> </tr>
<tr> <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
<?php $next = $level + 1 + $loopsame + $doublebuild + $master;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) { $next = $next > 20? 20 : $next;
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>
if($next<=20){ <tr>
?> <th><?php echo TRAPS_LEVEL;?> <?php echo $next;?>:</th>
<th><?php echo TRAPS_LEVEL; ?> <?php echo $next; ?>:</th> <td><b><?php echo (int)$bid36[$next]['attri'] * TRAPPER_CAPACITY;?></b> <?php echo TRAPS;?></td>
<td><b><?php echo $bid36[$next]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td> </tr>
<?php <?php endif;?>
}else{ </table>
?>
<th><?php echo TRAPS_LEVEL; ?> 20:</th>
<td><b><?php echo $bid36[20]['attri'] * TRAPPER_CAPACITY; ?></b> <?php echo TRAPS; ?></td>
<?php
}
}
?>
</tr> <p><?php echo CURRENT_HAVE;?> <b><?php echo (int)$village->unitarray['u99'];?></b> <?php echo TRAPS;?>, <b><?php echo (int)$village->unitarray['u99o'];?></b> <?php echo WHICH_OCCUPIED;?></p>
</table>
<p><?php echo CURRENT_HAVE; ?> <b><?php echo $village->unitarray['u99']; ?></b> <?php echo TRAPS; ?>, <b><?php echo $village->unitarray['u99o']; ?></b> <?php echo WHICH_OCCUPIED; ?></p>
<?php if ($building->getTypeLevel(36) > 0) { ?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead>
<tr> <?php if ($building->getTypeLevel(36) > 0):
<td><?php echo NAME; ?></td> $trainlist = $technology->getTrainingList(8);
<td><?php echo QUANTITY; ?></td> $train_amt = 0;
<td><?php echo MAX; ?></td> foreach ($trainlist as $t) $train_amt += (int)$t['amt'];
</tr>
</thead>
<tbody>
<tr> $max = $technology->maxUnit(99, false);
<td class="desc"> $max1 = 0;
<div class="tit"><img class="unit u99" src="img/x.gif" for ($i = 19; $i < 41; $i++) {
alt="Trap" if ((int)$village->resarray['f'.$i.'t'] == 36) {
title="Trap" /> <a href="#" $max1 += (int)$bid36[(int)$village->resarray['f'.$i]]['attri'] * TRAPPER_CAPACITY;
onClick="return Popup(36,4,'gid');"><?php echo TRAP; ?></a> <span class="info">(<?php echo AVAILABLE; ?>: <?php echo $village->unitarray['u99']; ?>)</span> }
</div> }
<div class="details"> $max = min($max, $max1 - ((int)$village->unitarray['u99'] + $train_amt));
<span><img class="r1" src="img/x.gif" if ($max < 0) $max = 0;
alt="Lumber" title="<?php echo LUMBER; ?>" />20|</span><span><img class="r2" src="img/x.gif"
alt="Clay" title="<?php echo CLAY; ?>" />30|</span><span><img class="r3" src="img/x.gif"
alt="Iron" title="<?php echo IRON; ?>" />10|</span><span><img class="r4" src="img/x.gif"
alt="Crop" title="<?php echo CROP; ?>" />20|</span><span><img class="r5" src="img/x.gif" alt="Crop consumption"
title="<?php echo CROP_COM; ?>" />0|<img class="clock" src="img/x.gif"
alt="Duration" title="<?php echo DURATION; ?>" />
<?php echo $generator->getTimeFormat($database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(($bid19[$village->resarray['f'.$id]]['attri'] / 100) * ${'u99'}['time'] / SPEED))); ?>
</span>
</div> $time = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(($bid19[$level]['attri'] / 100) * ${'u99'}['time'] / SPEED));
</td> ?>
<?php <form method="POST" name="snd" action="build.php">
$trainlist = $technology->getTrainingList(8); <input type="hidden" name="id" value="<?php echo (int)$id;?>" />
foreach($trainlist as $train) $train_amt += $train['amt']; <input type="hidden" name="ft" value="t1" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr><td><?php echo NAME;?></td><td><?php echo QUANTITY;?></td><td><?php echo MAX;?></td></tr></thead>
<tbody>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u99" src="img/x.gif" alt="Trap" title="Trap" />
<a href="#" onClick="return Popup(36,4,'gid');"><?php echo TRAP;?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo (int)$village->unitarray['u99'];?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/>20|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/>30|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/>10|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/>20|
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/>0|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $generator->getTimeFormat($time);?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t99" value="0" maxlength="4"></td>
<td class="max"><a href="#" onClick="document.snd.t99.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
</tr>
</tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" onclick="this.disabled=true;this.form.submit();"/></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_TRAPPER;?></b><br />
<?php endif;?>
$max = $technology->maxUnit(99, false); <?php if (!empty($trainlist)): $TrainCount = 0; $NextFinished = '';?>
$max1 = 0; <table cellpadding="1" cellspacing="1" class="under_progress">
for($i = 19; $i < 41; $i++){ <thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
if($village->resarray['f'.$i.'t'] == 36){ <tbody>
$max1 += $bid36[$village->resarray['f'.$i]]['attri'] * TRAPPER_CAPACITY; <?php foreach ($trainlist as $train): $TrainCount++;?>
} <tr>
} <td class="desc"><img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo U99;?>" title="<?php echo U99;?>" /><?php echo $train['amt'];?> <?php echo U99;?></td>
<td class="dur">
<?php if ($TrainCount == 1): $NextFinished = $generator->getTimeFormat(($train['timestamp'] - time()) - ($train['amt'] - 1) * $train['eachtime']);?>
<span id="timer1"><?php echo $generator->getTimeFormat($train['timestamp'] - time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime'] * $train['amt']);?>
<?php endif;?>
</td>
<td class="fin"><?php $time = $generator->procMTime($train['timestamp']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer2"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
if (!isset($train_amt)) $train_amt = 0; <?php include("upgrade.tpl");?>
</div>
if($max > $max1 - ($village->unitarray['u99'] + $train_amt)){
$max = $max1 - ($village->unitarray['u99'] + $train_amt);
}
if($max < 0) $max = 0;
?>
<td class="val"><input type="text" class="text" name="t99" value="0" maxlength="4"></td>
<td class="max"><a href="#" onClick="document.snd.t99.value=<?php echo $max; ?>">(<?php echo $max; ?>)</a></td>
</tr>
</tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" onclick="this.disabled=true;this.form.submit();"/></p></form>
<?php
} else {
echo "<b>".TRAINING_COMMENCE_TRAPPER."</b><br>\n";
}
if(!empty($trainlist)) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".U99."\" title=\"".U99."\" />";
echo $train['amt']." ".U99."</td><td class=\"dur\">";
if ($TrainCount == 1) {
$NextFinished = $generator->getTimeFormat(($train['timestamp'] - time()) - ($train['amt'] - 1) * $train['eachtime']);
echo "<span id=timer1>".$generator->getTimeFormat($train['timestamp'] - time())."</span>";
}
else echo $generator->getTimeFormat($train['eachtime'] * $train['amt']);
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") echo "on ".$time[0]." at ";
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer2"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?>
</p></div>
+29 -33
View File
@@ -1,38 +1,34 @@
<?php <?php
// 38.tpl - GREATWAREHOUSE
global $village, $building, $bid38, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid38[$level]['attri'] * STORAGE_MULTIPLIER : 0;
?> ?>
<div id="build" class="gid38"><a href="#" onClick="return Popup(38,4);" class="build_logo"> <div id="build" class="gid38">
<img class="building g38" src="img/x.gif" alt="Great Warehouse" title="<?php echo GREATWAREHOUSE; ?>" /> <a href="#" onClick="return Popup(38,4);" class="build_logo">
</a> <img class="building g38" src="img/x.gif" alt="Great Warehouse" title="<?php echo GREATWAREHOUSE;?>" />
<h1><?php echo GREATWAREHOUSE; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo GREATWAREHOUSE_DESC; ?></p> <h1><?php echo GREATWAREHOUSE;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo GREATWAREHOUSE_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<table cellpadding="1" cellspacing="1" id="build_value"> <tr>
<tr> <th><?php echo CURRENT_CAPACITY;?></th>
<th><?php echo CURRENT_CAPACITY; ?></th> <td><b><?php echo $current;?></b> <?php echo RESOURCE_UNITS;?></td>
<td><b><?php echo $bid38[$village->resarray['f'.$id]]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td> </tr>
</tr> <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
<tr> $next = $level + 1 + $loopsame + $doublebuild + $master;
<?php $next = $next > 20 ? 20 : $next;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
?> ?>
<th><?php echo CAPACITY_LEVEL; ?> <?php echo $next ?>:</th> <tr>
<td><b><?php echo $bid38[$next]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td> <th><?php echo CAPACITY_LEVEL;?> <?php echo $next;?>:</th>
<?php <td><b><?php echo (int)$bid38[$next]['attri'] * STORAGE_MULTIPLIER;?></b> <?php echo RESOURCE_UNITS;?></td>
}else{ </tr>
?> <?php endif;?>
<th><?php echo CAPACITY_LEVEL; ?> 20:</th> </table>
<td><b><?php echo $bid38[20]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo RESOURCE_UNITS; ?></td>
<?php <?php include("upgrade.tpl");?>
} </div>
}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?>
</p></div>
+29 -34
View File
@@ -1,39 +1,34 @@
<?php <?php
// 39.tpl - GREATGRANARY
global $village, $building, $bid39, $id, $loopsame, $doublebuild, $master;
include("next.tpl"); include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)$bid39[$level]['attri'] * STORAGE_MULTIPLIER : 0;
?> ?>
<div id="build" class="gid39"><a href="#" onClick="return Popup(39,4);" class="build_logo"> <div id="build" class="gid39">
<img class="building g39" src="img/x.gif" alt="Great Granary" title="<?php echo GREATGRANARY; ?>" /> <a href="#" onClick="return Popup(39,4);" class="build_logo">
</a> <img class="building g39" src="img/x.gif" alt="Great Granary" title="<?php echo GREATGRANARY;?>" />
<h1><?php echo GREATGRANARY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1> </a>
<p class="build_desc"><?php echo GREATGRANARY_DESC; ?></p> <h1><?php echo GREATGRANARY;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo GREATGRANARY_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<table cellpadding="1" cellspacing="1" id="build_value"> <tr>
<tr> <th><?php echo CURRENT_CAPACITY;?></th>
<th><?php echo CURRENT_CAPACITY; ?></th> <td><b><?php echo $current;?></b> <?php echo CROP_UNITS;?></td>
<td><b><?php echo $bid39[$village->resarray['f'.$id]]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td> </tr>
</tr> <?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
$next = $level + 1 + $loopsame + $doublebuild + $master;
<tr> $next = $next > 20 ? 20 : $next;
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($next<=20){
?> ?>
<th><?php echo CAPACITY_LEVEL; ?> <?php echo $next ?>:</th> <tr>
<td><b><?php echo $bid39[$next]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td> <th><?php echo CAPACITY_LEVEL;?> <?php echo $next;?>:</th>
<?php <td><b><?php echo (int)$bid39[$next]['attri'] * STORAGE_MULTIPLIER;?></b> <?php echo CROP_UNITS;?></td>
}else{ </tr>
?> <?php endif;?>
<th><?php echo CAPACITY_LEVEL; ?> 20:</th> </table>
<td><b><?php echo $bid39[20]['attri']*STORAGE_MULTIPLIER; ?></b> <?php echo CROP_UNITS; ?></td>
<?php <?php include("upgrade.tpl");?>
} </div>
}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?>
</p></div>
+44 -52
View File
@@ -1,56 +1,48 @@
<?php <?php
include("next.tpl");
// CROPLAND
include 'next.tpl';
// — pregătire date —
$field = 'f' . $id;
$currentLevel = (int) ($village->resarray[$field] ?? 0);
$buildingType = $village->resarray[$field . 't'] ?? 0;
$currentProd = $bid4[$currentLevel]['prod'] * SPEED;
$isMax = $building->isMax($buildingType, $id);
$maxLevel = ($village->capital == 1) ? 20 : 10;
$nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
$nextLevel = min($nextLevelRaw, $maxLevel);
$nextProd = $bid4[$nextLevel]['prod'] * SPEED;
?> ?>
<div id="build" class="gid4"><a href="#" onClick="return Popup(4,4);" class="build_logo"> <div id="build" class="gid4">
<img class="building g4" src="img/x.gif" alt="<?php echo CROPLAND; ?>" title="<?php echo CROPLAND; ?>" /> <a href="#" onclick="return Popup(4,4);" class="build_logo">
</a> <img class="building g4" src="img/x.gif" alt="<?= CROPLAND ?>" title="<?= CROPLAND ?>">
<h1><?php echo CROPLAND; ?> <span class="level"><?php echo LEVEL." "; echo $village->resarray['f'.$id];?></span></h1> </a>
<p class="build_desc"><?php echo CROPLAND_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value"> <h1>
<tr> <?= CROPLAND ?>
<th><?php echo CUR_PROD; ?></th> <span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
<td><b><?php echo $bid4[$village->resarray['f'.$id]]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td> </h1>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master;
if($village->capital == 1) {
if($next<=20){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid4[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 20; ?>:</th>
<td><b><?php echo $bid4[20]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}else{
if($next<=10){
?>
<tr>
<th><?php echo NEXT_PROD; echo $next; ?>:</th>
<td><b><?php echo $bid4[$next]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}else{
?>
<tr>
<th><?php echo NEXT_PROD; echo 10; ?>:</th>
<td><b><?php echo $bid4[10]['prod']* SPEED; ?></b> <?php echo PER_HR; ?></td>
</tr>
<?php
}}}
?>
</tr>
</table>
<?php <p class="build_desc"><?= CROPLAND_DESC ?></p>
include("upgrade.tpl");
?></p></div> <table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CUR_PROD ?>:</th>
<td><b><?= $currentProd ?></b> <?= PER_HR ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= NEXT_PROD ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextProd ?></b> <?= PER_HR ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+33 -30
View File
@@ -1,32 +1,35 @@
<div id="build" class="gid41"><a href="#" onClick="return Popup(41,4);" class="build_logo">
<img class="building g41" src="img/x.gif" alt="Horse Drinking Trough" title="<?php echo HORSEDRINKING; ?>" />
</a>
<h1><?php echo HORSEDRINKING; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo HORSEDRINKING_DESC; ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_BONUS; ?></th>
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid41[$village->resarray['f'.$id]]['attri'] * 100 - 100 : 0; ?></b> <?php echo PERCENT; ?></td>
</tr>
<tr>
<?php
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
if($next <= 20){
?>
<th><?php echo BONUS_LEVEL; ?> <?php echo $next; ?>:</th>
<td><b><?php echo $bid41[$next]['attri'] * 100 - 100; ?></b> <?php echo PERCENT; ?></td>
<?php
}else{
?>
<th><?php echo BONUS_LEVEL; ?> 20:</th>
<td><b><?php echo $bid41[20]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php <?php
include("upgrade.tpl"); // 41.tpl - HORSEDRINKING
global $village, $building, $bid41, $id, $loopsame, $doublebuild, $master;
include("next.tpl");
$level = (int)$village->resarray['f'.$id];
$current = $level > 0 ? (int)($bid41[$level]['attri'] * 100 - 100) : 0;
?> ?>
</p></div> <div id="build" class="gid41">
<a href="#" onClick="return Popup(41,4);" class="build_logo">
<img class="building g41" src="img/x.gif" alt="Horse Drinking Trough" title="<?php echo HORSEDRINKING;?>" />
</a>
<h1><?php echo HORSEDRINKING;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo HORSEDRINKING_DESC;?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?php echo CURRENT_BONUS;?></th>
<td><b><?php echo $current;?></b> <?php echo PERCENT;?></td>
</tr>
<?php if (!$building->isMax($village->resarray['f'.$id.'t'], $id)):
$next = $level + 1 + $loopsame + $doublebuild + $master;
$next = $next > 20 ? 20 : $next;
$nextBonus = (int)($bid41[$next]['attri'] * 100 - 100);
?>
<tr>
<th><?php echo BONUS_LEVEL;?> <?php echo $next;?>:</th>
<td><b><?php echo $nextBonus;?></b> <?php echo PERCENT;?></td>
</tr>
<?php endif;?>
</table>
<?php include("upgrade.tpl");?>
</div>
+56 -57
View File
@@ -1,59 +1,58 @@
<div id="build" class="gid42"><a href="#" onClick="return Popup(42,4);" class="build_logo"> <?php
<img class="building g42" src="img/x.gif" alt="Great Workshop" title="<?php echo GREATWORKSHOP; ?>" /> // 42.tpl - GREATWORKSHOP
</a> global $village, $building, $technology, $generator, $session, $id;
<h1><?php echo GREATWORKSHOP; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo GREATWORKSHOP_DESC; ?></p>
<?php if ($building->getTypeLevel(42) > 0) { ?> include("next.tpl");
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" /> $level = (int)$village->resarray['f'.$id];
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr>
<td><?php echo NAME; ?></td>
<td><?php echo QUANTITY; ?></td>
<td><?php echo MAX; ?></td>
</tr></thead><tbody>
<?php
include("42_train.tpl");
?></table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></form></p>
<?php
} else {
echo "<b>".TRAINING_COMMENCE_GREATWORKSHOP."</b><br>\n";
}
$trainlist = $technology->getTrainingList(7);
if(count($trainlist) > 0) {
echo "
<table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\">
<thead><tr>
<td>".TRAINING."</td>
<td>".DURATION."</td>
<td>".FINISHED."</td>
</tr></thead>
<tbody>";
$TrainCount = 0;
foreach($trainlist as $train) {
$TrainCount++;
echo "<tr><td class=\"desc\">";
echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />";
echo $train['amt']." ".$train['name']."</td><td class=\"dur\">";
if ($TrainCount == 1 ) {
$NextFinished = $generator->getTimeFormat($train['timestamp2']-time());
echo "<span id=timer".++$session->timer.">".$generator->getTimeFormat($train['timestamp']-time())."</span>";
} else {
echo $generator->getTimeFormat($train['eachtime']*$train['amt']);
}
echo "</td><td class=\"fin\">";
$time = $generator->procMTime($train['timestamp']);
if($time[0] != "today") {
echo "on ".$time[0]." at ";
}
echo $time[1];
} ?>
</tr><tr class="next"><td colspan="3"><?php echo UNIT_FINISHED; ?> <span id="timer<?php echo ++$session->timer; ?>"><?php echo $NextFinished; ?></span></td></tr>
</tbody></table>
<?php }
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid42">
<a href="#" onClick="return Popup(42,4);" class="build_logo">
<img class="building g42" src="img/x.gif" alt="Great Workshop" title="<?php echo GREATWORKSHOP;?>" />
</a>
<h1><?php echo GREATWORKSHOP;?> <span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo GREATWORKSHOP_DESC;?></p>
<?php if ($building->getTypeLevel(42) > 0):?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="id" value="<?php echo (int)$id;?>" />
<input type="hidden" name="ft" value="t3" />
<table cellpadding="1" cellspacing="1" class="build_details">
<thead><tr><td><?php echo NAME;?></td><td><?php echo QUANTITY;?></td><td><?php echo MAX;?></td></tr></thead>
<tbody>
<?php include("42_train.tpl");?>
</tbody>
</table>
<p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" /></p>
</form>
<?php else:?>
<b><?php echo TRAINING_COMMENCE_GREATWORKSHOP;?></b><br />
<?php endif;?>
<?php
$trainlist = $technology->getTrainingList(7);
if (!empty($trainlist)): $TrainCount = 0; $NextFinished = '';
?>
<table cellpadding="1" cellspacing="1" class="under_progress">
<thead><tr><td><?php echo TRAINING;?></td><td><?php echo DURATION;?></td><td><?php echo FINISHED;?></td></tr></thead>
<tbody>
<?php foreach ($trainlist as $train): $TrainCount++;?>
<tr>
<td class="desc"><img class="unit u<?php echo $train['unit'];?>" src="img/x.gif" alt="<?php echo $train['name'];?>" title="<?php echo $train['name'];?>" /><?php echo $train['amt'];?> <?php echo $train['name'];?></td>
<td class="dur">
<?php if ($TrainCount == 1): $NextFinished = $generator->getTimeFormat($train['timestamp2'] - time());?>
<span id="timer<?php echo ++$session->timer;?>"><?php echo $generator->getTimeFormat($train['timestamp'] - time());?></span>
<?php else:?>
<?php echo $generator->getTimeFormat($train['eachtime'] * $train['amt']);?>
<?php endif;?>
</td>
<td class="fin"><?php $time = $generator->procMTime($train['timestamp']); if($time[0]!="today") echo "on ".$time[0]." at "; echo $time[1];?></td>
</tr>
<?php endforeach;?>
<tr class="next"><td colspan="3"><?php echo UNIT_FINISHED;?> <span id="timer<?php echo ++$session->timer;?>"><?php echo $NextFinished;?></span></td></tr>
</tbody>
</table>
<?php endif;?>
<?php include("upgrade.tpl");?>
</div>
+56 -26
View File
@@ -1,31 +1,61 @@
<?php <?php
// 42_train.tpl -
global $session, $technology, $village, $generator, $database, $building, $bid42, $id;
$success = 0; $success = 0;
for ($i=($session->tribe-1)*10+7;$i<=($session->tribe-1)*10+8;$i++) { $start = ($session->tribe - 1) * 10 + 7;
if ($technology->getTech($i)) { $end = $start + 1; // ram + catapult
$success++;
echo "<tr><td class=\"desc\">
<div class=\"tit\">
<img class=\"unit u".$i."\" src=\"img/x.gif\" alt=\"".$technology->getUnitName($i)."\" title=\"".$technology->getUnitName($i)."\" />
<a href=\"#\" onClick=\"return Popup(".$i.",1);\"> ".$technology->getUnitName($i)."</a> <span class=\"info\">(".AVAILABLE.": ".$village->unitarray['u'.$i].")</span>
</div>
<div class=\"details\">
<img class=\"r1\" src=\"img/x.gif\" alt=\"Wood\" title=\"".LUMBER."\" />".(${'u'.$i}['wood']*3)."|<img class=\"r2\" src=\"img/x.gif\" alt=\"Clay\" title=\"".CLAY."\" />".(${'u'.$i}['clay']*3)."|<img class=\"r3\" src=\"img/x.gif\" alt=\"Iron\" title=\"".IRON."\" />".(${'u'.$i}['iron']*3)."|<img class=\"r4\" src=\"img/x.gif\" alt=\"Crop\" title=\"".CROP."\" />".(${'u'.$i}['crop']*3)."|<img class=\"r5\" src=\"img/x.gif\" alt=\"Crop consumption\" title=\"".CROP_COM."\" />".${'u'.$i}['pop']."|<img class=\"clock\" src=\"img/x.gif\" alt=\"Duration\" title=\"".DURATION."\" />";
$dur = $database->getArtifactsValueInfluence($session->uid, $village->wid, 5, round(${'u'.$i}['time'] * ($bid42[$village->resarray['f'.$id]]['attri'] / 100) / SPEED));
echo $generator->getTimeFormat($dur);
//-- If available resources combined are not enough, remove NPC button for ($i = $start; $i <= $end; $i++) {
$total_required = (int)(${'u'.$i}['wood'] + ${'u'.$i}['clay'] + ${'u'.$i}['iron'] + ${'u'.$i}['crop']); if (!$technology->getTech($i)) continue;
$success++;
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { $unit = ${'u'.$i};
echo "|<a href=\"build.php?gid=17&t=3&r1=".((${'u'.$i}['wood'])*$technology->maxUnitPlus($i))."&r2=".((${'u'.$i}['clay'])*$technology->maxUnitPlus($i))."&r3=".((${'u'.$i}['iron'])*$technology->maxUnitPlus($i))."&r4=".((${'u'.$i}['crop'])*$technology->maxUnitPlus($i))."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; $name = $technology->getUnitName($i);
} $wood = $unit['wood'] * 3;
echo "</div> $clay = $unit['clay'] * 3;
</td> $iron = $unit['iron'] * 3;
<td class=\"val\"><input type=\"text\" class=\"text\" name=\"t".$i."\" value=\"0\" maxlength=\"4\"></td> $crop = $unit['crop'] * 3;
<td class=\"max\"><a href=\"#\" onClick=\"document.snd.t".$i.".value=".$technology->maxUnit($i,true)."; return false;\">(".$technology->maxUnit($i,true).")</a></td></tr></tbody>"; $pop = $unit['pop'];
}
} $dur = $database->getArtifactsValueInfluence(
if($success == 0) { $session->uid, $village->wid, 5,
echo "<tr><td colspan=\"3\"><div class=\"none\" align=\"center\">".AVAILABLE_ACADEMY."</div></td></tr>"; round($unit['time'] * ($bid42[$village->resarray['f'.$id]]['attri'] / 100) / SPEED)
} );
$max = $technology->maxUnit($i, true);
?> ?>
<tr>
<td class="desc">
<div class="tit">
<img class="unit u<?php echo $i;?>" src="img/x.gif" alt="<?php echo $name;?>" title="<?php echo $name;?>" />
<a href="#" onClick="return Popup(<?php echo $i;?>,1);"><?php echo $name;?></a>
<span class="info">(<?php echo AVAILABLE;?>: <?php echo (int)$village->unitarray['u'.$i];?>)</span>
</div>
<div class="details">
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><?php echo $wood;?>|
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><?php echo $clay;?>|
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><?php echo $iron;?>|
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><?php echo $crop;?>|
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/><?php echo $pop;?>|
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $generator->getTimeFormat($dur);?>
<?php
$total_required = $unit['wood'] + $unit['clay'] + $unit['iron'] + $unit['crop'];
if ($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required):
$r1 = $unit['wood'] * $technology->maxUnitPlus($i);
$r2 = $unit['clay'] * $technology->maxUnitPlus($i);
$r3 = $unit['iron'] * $technology->maxUnitPlus($i);
$r4 = $unit['crop'] * $technology->maxUnitPlus($i);
?>
|<a href="build.php?gid=17&t=3&r1=<?php echo $r1;?>&r2=<?php echo $r2;?>&r3=<?php echo $r3;?>&r4=<?php echo $r4;?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade" /></a>
<?php endif;?>
</div>
</td>
<td class="val"><input type="text" class="text" name="t<?php echo $i;?>" value="0" maxlength="4"></td>
<td class="max"><a href="#" onClick="document.snd.t<?php echo $i;?>.value=<?php echo $max;?>; return false;">(<?php echo $max;?>)</a></td>
</tr>
<?php
}
if ($success == 0): ?>
<tr><td colspan="3"><div class="none" align="center"><?php echo AVAILABLE_ACADEMY;?></div></td></tr>
<?php endif; ?>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid5"><a href="#" onClick="return Popup(5,4);" class="build_logo">
<img class="building g5" src="img/x.gif" alt="Sawmill" title="<?php echo SAWMILL; ?>" />
</a>
<h1><?php echo SAWMILL; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo SAWMILL_DESC; ?></p>
// SAWMILL
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_WOOD_BONUS; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid5[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentBonus = $currentLevel > 0 ? $bid5[$currentLevel]['attri'] : 0;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next<=5){ $maxLevel = 5; // sawmill e max 5
?>
<th><?php echo WOOD_BONUS_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid5[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextBonus = $bid5[$nextLevel]['attri'];
}else{
?>
<th><?php echo WOOD_BONUS_LEVEL; ?> 5:</th>
<td><b><?php echo $bid5[5]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid5">
<a href="#" onclick="return Popup(5,4);" class="build_logo">
<img class="building g5" src="img/x.gif" alt="<?= SAWMILL ?>" title="<?= SAWMILL ?>">
</a>
<h1>
<?= SAWMILL ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= SAWMILL_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_WOOD_BONUS ?>:</th>
<td><b><?= $currentBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= WOOD_BONUS_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid6"><a href="#" onClick="return Popup(6,4);" class="build_logo">
<img class="building g6" src="img/x.gif" alt="Brickyard" title="<?php echo BRICKYARD; ?>" />
</a>
<h1><?php echo BRICKYARD; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo BRICKYARD_DESC; ?></p>
// BRICKYARD
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_CLAY_BONUS; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid6[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentBonus = $currentLevel > 0 ? $bid6[$currentLevel]['attri'] : 0;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next <= 5){ $maxLevel = 5;
?>
<th><?php echo CLAY_BONUS_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid6[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextBonus = $bid6[$nextLevel]['attri'];
}else{
?>
<th><?php echo CLAY_BONUS_LEVEL; ?> 5:</th>
<td><b><?php echo $bid6[5]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid6">
<a href="#" onclick="return Popup(6,4);" class="build_logo">
<img class="building g6" src="img/x.gif" alt="<?= BRICKYARD ?>" title="<?= BRICKYARD ?>">
</a>
<h1>
<?= BRICKYARD ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= BRICKYARD_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_CLAY_BONUS ?>:</th>
<td><b><?= $currentBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= CLAY_BONUS_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid7"><a href="#" onClick="return Popup(7,4);" class="build_logo">
<img class="building g7" src="img/x.gif" alt="Iron Foundry" title="<?php echo IRONFOUNDRY; ?>" />
</a>
<h1><?php echo IRONFOUNDRY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo IRONFOUNDRY_DESC; ?></p>
// IRONFOUNDRY
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_IRON_BONUS; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid7[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentBonus = $currentLevel > 0 ? $bid7[$currentLevel]['attri'] : 0;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next<=5){ $maxLevel = 5;
?>
<th><?php echo IRON_BONUS_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid7[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextBonus = $bid7[$nextLevel]['attri'];
}else{
?>
<th><?php echo IRON_BONUS_LEVEL; ?> 5:</th>
<td><b><?php echo $bid7[5]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid7">
<a href="#" onclick="return Popup(7,4);" class="build_logo">
<img class="building g7" src="img/x.gif" alt="<?= IRONFOUNDRY ?>" title="<?= IRONFOUNDRY ?>">
</a>
<h1>
<?= IRONFOUNDRY ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= IRONFOUNDRY_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_IRON_BONUS ?>:</th>
<td><b><?= $currentBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= IRON_BONUS_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid8"><a href="#" onClick="return Popup(8,4);" class="build_logo">
<img class="building g8" src="img/x.gif" alt="Grain Mill" title="<?php echo GRAINMILL; ?>" />
</a>
<h1><?php echo GRAINMILL; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo GRAINMILL_DESC; ?></p>
// GRAINMILL
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_CROP_BONUS; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid8[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentBonus = $currentLevel > 0 ? $bid8[$currentLevel]['attri'] : 0;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next <= 5){ $maxLevel = 5;
?>
<th><?php echo CROP_BONUS_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid8[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextBonus = $bid8[$nextLevel]['attri'];
}else{
?>
<th><?php echo CROP_BONUS_LEVEL; ?> 5:</th>
<td><b><?php echo $bid8[5]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid8">
<a href="#" onclick="return Popup(8,4);" class="build_logo">
<img class="building g8" src="img/x.gif" alt="<?= GRAINMILL ?>" title="<?= GRAINMILL ?>">
</a>
<h1>
<?= GRAINMILL ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= GRAINMILL_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_CROP_BONUS ?>:</th>
<td><b><?= $currentBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= CROP_BONUS_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+43 -33
View File
@@ -1,37 +1,47 @@
<?php <?php
include("next.tpl");
?>
<div id="build" class="gid9"><a href="#" onClick="return Popup(9,4);" class="build_logo">
<img class="building g9" src="img/x.gif" alt="Bakery" title="<?php echo BAKERY; ?>" />
</a>
<h1><?php echo BAKERY; ?> <span class="level"><?php echo LEVEL; ?> <?php echo $village->resarray['f'.$id]; ?></span></h1>
<p class="build_desc"><?php echo BAKERY_DESC; ?></p>
// BAKERY
<table cellpadding="1" cellspacing="1" id="build_value"> include 'next.tpl';
<tr>
<th><?php echo CURRENT_CROP_BONUS; ?></th> $field = 'f' . $id;
<td><b><?php echo $village->resarray['f'.$id] > 0 ? $bid9[$village->resarray['f'.$id]]['attri'] : 0; ?></b> <?php echo PERCENT; ?></td> $currentLevel = (int) ($village->resarray[$field] ?? 0);
</tr> $buildingType = $village->resarray[$field . 't'] ?? 0;
<tr>
<?php $currentBonus = $currentLevel > 0 ? $bid9[$currentLevel]['attri'] : 0;
if(!$building->isMax($village->resarray['f'.$id.'t'],$id)) {
$next = $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; $isMax = $building->isMax($buildingType, $id);
if($next <= 5){ $maxLevel = 5;
?>
<th><?php echo CROP_BONUS_LEVEL; ?> <?php echo $next; ?>:</th> $nextLevelRaw = $currentLevel + 1 + $loopsame + $doublebuild + $master;
<td><b><?php echo $bid9[$next]['attri']; ?></b> <?php echo PERCENT; ?></td> $nextLevel = min($nextLevelRaw, $maxLevel);
<?php $nextBonus = $bid9[$nextLevel]['attri'];
}else{
?>
<th><?php echo CROP_BONUS_LEVEL; ?> 5:</th>
<td><b><?php echo $bid9[5]['attri']; ?></b> <?php echo PERCENT; ?></td>
<?php
}}
?>
</tr>
</table>
<?php
include("upgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid9">
<a href="#" onclick="return Popup(9,4);" class="build_logo">
<img class="building g9" src="img/x.gif" alt="<?= BAKERY ?>" title="<?= BAKERY ?>">
</a>
<h1>
<?= BAKERY ?>
<span class="level"><?= LEVEL ?> <?= $currentLevel ?></span>
</h1>
<p class="build_desc"><?= BAKERY_DESC ?></p>
<table cellpadding="1" cellspacing="1" id="build_value">
<tr>
<th><?= CURRENT_CROP_BONUS ?>:</th>
<td><b><?= $currentBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php if (!$isMax): ?>
<tr>
<th><?= CROP_BONUS_LEVEL ?> <?= $nextLevel ?>:</th>
<td><b><?= $nextBonus ?></b> <?= PERCENT ?></td>
</tr>
<?php endif; ?>
</table>
<?php include 'upgrade.tpl'; ?>
</div>
+80 -85
View File
@@ -1,89 +1,84 @@
<?php <?php declare(strict_types=1);
$bid = $_GET['bid']; /**
unset($_GET['bid']); * availupgrade.tpl - fix redeclare + PHP 8.2 safe
$bindicator = $building->canBuild($id,$bid); * NU mai declară funcții, folosește variabilă
$loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; */
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; $bid = (int)($_GET['bid']?? 0);
$id = (int)$id;
$bindicator = (int)$building->canBuild($id, $bid);
$uprequire = $building->resourceRequired($id, $bid); $uprequire = $building->resourceRequired($id, $bid);
// --- pregătim o singură dată HTML-ul pentru Master Builder ---
$masterBuilderHtml = '';
if ($session->goldclub == 1) {
$canUse = ($session->gold >= 1 && $village->master == 0);
$checker = htmlspecialchars((string)$session->checker, ENT_QUOTES, 'UTF-8');
$url = "dorf2.php?master={$bid}&id={$id}&c={$checker}";
$label = htmlspecialchars(CONSTRUCTING_MASTER_BUILDER, ENT_QUOTES, 'UTF-8');
$goldIcon = htmlspecialchars(GP_LOCATE. 'img/a/gold_g.gif', ENT_QUOTES, 'UTF-8');
$cost = '<span class="gold-cost">(costs: <img src="'.$goldIcon.'" alt="Gold" title="Gold"/>1)</span>';
$masterBuilderHtml = $canUse
? '<br><a class="build" href="'.htmlspecialchars($url, ENT_QUOTES, 'UTF-8').'">'.$label.'</a> '.$cost
: '<br><span class="none">'.$label.'</span> '.$cost;
}
$totalRequired = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']);
$canNpc = ($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $totalRequired);
?> ?>
<td class="res"> <td class="res">
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><?php echo $uprequire['wood']; ?> | <img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><?php echo $uprequire['clay']; ?> | <img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><?php echo $uprequire['iron']; ?> | <img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><?php echo $uprequire['crop']; ?> | <img class="r5" src="img/x.gif" alt="Crop consumption" title="Crop consumption" /><?php echo $uprequire['pop']; ?> | <img class="clock" src="img/x.gif" alt="duration" title="duration" /><?php echo $generator->getTimeFormat($uprequire['time']); <img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><?= (int)$uprequire['wood']?> |
<img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><?= (int)$uprequire['clay']?> |
//-- If available resources combined are not enough, remove NPC button <img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><?= (int)$uprequire['iron']?> |
$total_required = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']); <img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><?= (int)$uprequire['crop']?> |
<img class="r5" src="img/x.gif" alt="Crop consumption" title="Crop consumption" /><?= (int)$uprequire['pop']?> |
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) { <img class="clock" src="img/x.gif" alt="duration" title="duration" /><?= htmlspecialchars($generator->getTimeFormat($uprequire['time']), ENT_QUOTES, 'UTF-8')?>
echo "|<a href=\"build.php?gid=17&t=3&r1=".$uprequire['wood']."&r2=".$uprequire['clay']."&r3=".$uprequire['iron']."&r4=".$uprequire['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; <?php if ($canNpc):?>
} ?></td> | <a href="build.php?gid=17&amp;t=3&amp;r1=<?= (int)$uprequire['wood']?>&amp;r2=<?= (int)$uprequire['clay']?>&amp;r3=<?= (int)$uprequire['iron']?>&amp;r4=<?= (int)$uprequire['crop']?>" title="NPC trade">
</tr> <img class="npc" src="img/x.gif" alt="NPC trade" title="NPC trade" />
<tr> </a>
<td class="link"> <?php endif;?>
<?php
if($bindicator == 2) {
echo "<span class=\"none\">" . WORKERS_ALREADY_WORK_WAITING . "</span>";
if($session->goldclub == 1){
?> </br>
<?php
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">" . CONSTRUCTING_MASTER_BUILDER . "</a>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}else{
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}
}
}
else if($bindicator == 3) {
echo "<span class=\"none\">The workers are already at work. (waiting loop)</span>";
if($session->goldclub == 1){
?> </br>
<?php
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">" . CONSTRUCTING_MASTER_BUILDER . "</a>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}else{
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}
}
}
else if($bindicator == 4) {
echo "<span class=\"none\">Not enough food. Expand cropland.</span>";
}
else if($bindicator == 5) {
echo "<span class=\"none\">Upgrade Warehouse.</span>";
}
else if($bindicator == 6) {
echo "<span class=\"none\">Upgrade Granary.</span>";
}
else if($bindicator == 7) {
$neededtime = $building->calculateAvaliable($id,$bid);
echo "<span class=\"none\">" .ENOUGH_RESOURCES . " " .$neededtime[0]." at ".$neededtime[1]."</span>";
if($session->goldclub == 1){
?> </br>
<?php
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">" . CONSTRUCTING_MASTER_BUILDER . "</a>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}else{
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(costs: <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="Gold"/>1)</font>';
}
}
}
else if($bindicator == 8) {
if($session->access!=BANNED){
echo "<a class=\"build\" href=\"dorf2.php?a=$bid&id=$id&c=".$session->checker."\">". CONSTRUCT_BUILD."</a>";
}else{
echo "<a class=\"build\" href=\"banned.php\">". CONSTRUCT_BUILD."</a>";
}
}
else if($bindicator == 9) {
if($session->access!=BANNED){
echo "<a class=\"build\" href=\"dorf2.php?a=$bid&id=$id&c=".$session->checker."\">Construct building. (waiting loop)</a>";
}else{
echo "<a class=\"build\" href=\"banned.php?a=$bid&id=$id&c=".$session->checker."\">Construct building. (waiting loop)</a>";
}
}
?>
</td> </td>
</tr>
<tr>
<td class="link">
<?php
switch ($bindicator) {
case 2:
echo '<span class="none">'.htmlspecialchars(WORKERS_ALREADY_WORK_WAITING, ENT_QUOTES, 'UTF-8').'</span>';
echo $masterBuilderHtml;
break;
case 3:
echo '<span class="none">The workers are already at work. (waiting loop)</span>';
echo $masterBuilderHtml;
break;
case 4:
echo '<span class="none">Not enough food. Expand cropland.</span>';
break;
case 5:
echo '<span class="none">Upgrade Warehouse.</span>';
break;
case 6:
echo '<span class="none">Upgrade Granary.</span>';
break;
case 7:
$needed = $building->calculateAvaliable($id, $bid);
echo '<span class="none">'.htmlspecialchars(ENOUGH_RESOURCES, ENT_QUOTES, 'UTF-8').' '.htmlspecialchars((string)$needed[0], ENT_QUOTES, 'UTF-8').' at '.htmlspecialchars((string)$needed[1], ENT_QUOTES, 'UTF-8').'</span>';
echo $masterBuilderHtml;
break;
case 8:
$url = ($session->access!= BANNED)
? "dorf2.php?a={$bid}&id={$id}&c={$session->checker}"
: "banned.php";
echo '<a class="build" href="'.htmlspecialchars($url, ENT_QUOTES, 'UTF-8').'">'.htmlspecialchars(CONSTRUCT_BUILD, ENT_QUOTES, 'UTF-8').'</a>';
break;
case 9:
$url = ($session->access!= BANNED)
? "dorf2.php?a={$bid}&id={$id}&c={$session->checker}"
: "banned.php?a={$bid}&id={$id}&c={$session->checker}";
echo '<a class="build" href="'.htmlspecialchars($url, ENT_QUOTES, 'UTF-8').'">Construct building. (waiting loop)</a>';
break;
}
?>
</td>
+6 -3
View File
@@ -1,5 +1,8 @@
<?php <?php
$loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0; // next.tpl - calculează offset-ul pentru nivelul următor
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0; global $building, $database, $village, $id;
$master = count($database->getMasterJobsByField($village->wid,$id));
$loopsame = ($building->isCurrent($id) || $building->isLoop($id)) ? 1 : 0;
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id)) ? 1 : 0;
$master = count($database->getMasterJobsByField($village->wid, $id));
?> ?>
+80 -139
View File
@@ -1,146 +1,87 @@
<?php <?php
// upgrade.tpl
global $village, $building, $database, $generator, $session, $technology, $id;
$bid = $village->resarray['f'.$id.'t']; $bid = (int)$village->resarray['f'.$id.'t'];
$bindicate = $building->canBuild($id, $bid); $bindicate = $building->canBuild($id, $bid);
if($bindicate == 1) {
echo "<p><span class=\"none\">".MAX_LEVEL."</span></p>";
} else if($bindicate == 10) {
echo "<p><span class=\"none\">".BUILDING_MAX_LEVEL_UNDER."</span></p>";
} else if($bindicate == 11) {
echo "<p><span class=\"none\">".BUILDING_BEING_DEMOLISHED."</span></p>";
} else {
$loopsame = ($building->isCurrent($id) || $building->isLoop($id)) ? 1 : 0;
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id)) ? 1 : 0;
$master = count($database->getMasterJobsByField($village->wid,$id));
// master and loopsame would have duplicated level display, if ($bindicate == 1) {
// so we need to decrease loopsame if master is the only job left echo '<p><span class="none">'.MAX_LEVEL.'</span></p>';
if ($master == 1 && $loopsame == 1) $loopsame = 0; return;
}
//-- If available resources combined are not enough, remove NPC button if ($bindicate == 10) {
$uprequire = $building->resourceRequired($id,$village->resarray['f'.$id.'t'],1 + $loopsame + $doublebuild + $master); echo '<p><span class="none">'.BUILDING_MAX_LEVEL_UNDER.'</span></p>';
?> return;
<?php }
$total_required = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']); if ($bindicate == 11) {
?> echo '<p><span class="none">'.BUILDING_BEING_DEMOLISHED.'</span></p>';
<p id="contract"><b><?php echo COSTS_UPGRADING_LEVEL;?> <?php echo $village->resarray['f'.$id]+1+$loopsame+$doublebuild+$master; ?>:<br /> return;
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber" /><span class="little_res"><?php echo $uprequire['wood']; ?></span> | <img class="r2" src="img/x.gif" alt="Clay" title="Clay" /><span class="little_res"><?php echo $uprequire['clay']; ?></span> | <img class="r3" src="img/x.gif" alt="Iron" title="Iron" /><span class="little_res"><?php echo $uprequire['iron']; ?></span> | <img class="r4" src="img/x.gif" alt="Crop" title="Crop" /><span class="little_res"><?php echo $uprequire['crop']; ?></span> | <img class="r5" src="img/x.gif" alt="Crop consumption" title="Crop consumption" /><?php echo $uprequire['pop']; ?> | <img class="clock" src="img/x.gif" alt="duration" title="duration" /><?php echo $generator->getTimeFormat($uprequire['time']);
if($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required) {
echo "| <a href=\"build.php?gid=17&t=3&r1=".$uprequire['wood']."&r2=".$uprequire['clay']."&r3=".$uprequire['iron']."&r4=".$uprequire['crop']."\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>";
} ?><br />
<?php
if($bindicate == 2) {
echo "<span class=\"none\">".WORKERS_ALREADY_WORK."</span>";
if($session->goldclub == 1){
?> </br>
<?php
if($id <= 18) {
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}else{
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}
}
}
else if($bindicate == 3) {
echo "<span class=\"none\">".WORKERS_ALREADY_WORK_WAITING."</span>";
if($session->goldclub == 1){
?> </br>
<?php
if($id <= 18) {
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}else{
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}
}
}
else if($bindicate == 4) {
echo "<span class=\"none\">".ENOUGH_FOOD_EXPAND_CROPLAND."</span>";
}
else if($bindicate == 5) {
echo "<span class=\"none\">".UPGRADE_WAREHOUSE.".</span>";
}
else if($bindicate == 6) {
echo "<span class=\"none\">".UPGRADE_GRANARY.".</span>";
}
else if($bindicate == 7) {
if($village->allcrop - $village->pop - $technology->getUpkeep($village->unitall, 0) > 0){
$neededtime = $building->calculateAvaliable($id,$village->resarray['f'.$id.'t'],1+$loopsame+$doublebuild+$master);
echo "<span class=\"none\">".ENOUGH_RESOURCES." ".$neededtime[0]." at ".$neededtime[1]."</span>";
}else{
echo "<span class=\"none\">".YOUR_CROP_NEGATIVE."</span>";
}
if($session->goldclub == 1){
?> </br>
<?php
if($id <= 18) {
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}else{
if($session->gold >= 1 && $village->master == 0){
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id&c=$session->checker\">".CONSTRUCTING_MASTER_BUILDER." </a>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}else{
echo "<span class=\"none\">".CONSTRUCTING_MASTER_BUILDER."</span>";
echo '<font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
}
}
}
else if($bindicate == 8) {
if($session->access==BANNED){
echo "<a class=\"build\" href=\"banned.php\">".UPGRADE_LEVEL." ";
}
else if($id <= 18) {
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">".UPGRADE_LEVEL." ";
}
else {
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">".UPGRADE_LEVEL." ";
}
echo $village->resarray['f'.$id]+1;
echo ".</a>";
}
else if($bindicate == 9) {
if($session->access==BANNED){
echo "<a class=\"build\" href=\"banned.php\">".UPGRADE_LEVEL." ";
}
else if($id <= 18) {
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">".UPGRADE_LEVEL." ";
}
else {
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">".UPGRADE_LEVEL." ";
}
echo $village->resarray['f'.$id]+($loopsame > 0 ? 2:1);
echo ".</a> <span class=\"none\">".WAITING."</span> ";
}
} }
$loopsame = ($building->isCurrent($id) || $building->isLoop($id))? 1 : 0;
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id))? 1 : 0;
$master = count($database->getMasterJobsByField($village->wid, $id));
if ($master == 1 && $loopsame == 1) $loopsame = 0;
$nextLevel = (int)$village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
$uprequire = $building->resourceRequired($id, $bid, 1 + $loopsame + $doublebuild + $master);
$total_required = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']);
?> ?>
<p id="contract">
<b><?php echo COSTS_UPGRADING_LEVEL;?> <?php echo $nextLevel;?>:</b><br />
<img class="r1" src="img/x.gif" title="<?php echo LUMBER;?>"/><span class="little_res"><?php echo $uprequire['wood'];?></span> |
<img class="r2" src="img/x.gif" title="<?php echo CLAY;?>"/><span class="little_res"><?php echo $uprequire['clay'];?></span> |
<img class="r3" src="img/x.gif" title="<?php echo IRON;?>"/><span class="little_res"><?php echo $uprequire['iron'];?></span> |
<img class="r4" src="img/x.gif" title="<?php echo CROP;?>"/><span class="little_res"><?php echo $uprequire['crop'];?></span> |
<img class="r5" src="img/x.gif" title="<?php echo CROP_COM;?>"/><?php echo $uprequire['pop'];?> |
<img class="clock" src="img/x.gif" title="<?php echo DURATION;?>"/><?php echo $generator->getTimeFormat($uprequire['time']);?>
<?php if ($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required):?>
| <a href="build.php?gid=17&t=3&r1=<?php echo $uprequire['wood'];?>&r2=<?php echo $uprequire['clay'];?>&r3=<?php echo $uprequire['iron'];?>&r4=<?php echo $uprequire['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade"/></a>
<?php endif;?>
<br />
<?php
switch ($bindicate) {
case 2:
echo '<span class="none">'.WORKERS_ALREADY_WORK.'</span>';
break;
case 3:
echo '<span class="none">'.WORKERS_ALREADY_WORK_WAITING.'</span>';
break;
case 4:
echo '<span class="none">'.ENOUGH_FOOD_EXPAND_CROPLAND.'</span>';
break;
case 5:
echo '<span class="none">'.UPGRADE_WAREHOUSE.'.</span>';
break;
case 6:
echo '<span class="none">'.UPGRADE_GRANARY.'.</span>';
break;
case 7:
if ($village->allcrop - $village->pop - $technology->getUpkeep($village->unitall, 0) > 0) {
$neededtime = $building->calculateAvaliable($id, $bid, 1 + $loopsame + $doublebuild + $master);
echo '<span class="none">'.ENOUGH_RESOURCES.' '.$neededtime[0].' at '.$neededtime[1].'</span>';
} else {
echo '<span class="none">'.YOUR_CROP_NEGATIVE.'</span>';
}
break;
case 8:
case 9:
$href = $session->access == BANNED? 'banned.php' : (($id <= 18)? "dorf1.php?a=$id&c=$session->checker" : "dorf2.php?a=$id&c=$session->checker");
$lvl = $bindicate == 8? $village->resarray['f'.$id] + 1 : $village->resarray['f'.$id] + ($loopsame > 0? 2 : 1);
echo '<a class="build" href="'.$href.'">'.UPGRADE_LEVEL.' '.$lvl.'.</a>';
if ($bindicate == 9) echo ' <span class="none">'.WAITING.'</span>';
break;
}
if (in_array($bindicate, [2,3,7]) && $session->goldclub == 1) {
echo '<br/>';
$masterHref = ($id <= 18? 'dorf1.php' : 'dorf2.php'). "?master=$bid&id=$id&c=$session->checker";
if ($session->gold >= 1 && $village->master == 0) {
echo '<a class="build" href="'.$masterHref.'">'.CONSTRUCTING_MASTER_BUILDER.'</a>';
} else {
echo '<span class="none">'.CONSTRUCTING_MASTER_BUILDER.'</span>';
}
echo ' <font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
?>
</p>
+33 -41
View File
@@ -1,46 +1,38 @@
<?php <?php
// ww.tpl - World Wonder
global $building, $village, $database, $id, $session;
################################################################################# $loopsame = ($building->isCurrent($id) || $building->isLoop($id)) ? 1 : 0;
## -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =- ## $doublebuild = ($building->isCurrent($id) && $building->isLoop($id)) ? 1 : 0;
## --------------------------------------------------------------------------- ##
## Filename ww.tpl ##
## Developed by: Dixie ##
## Edited by: Dzoki ##
## License: TravianX Project ##
## Copyright: TravianX (c) 2010-2011. All rights reserved. ##
## ##
#################################################################################
$loopsame = ($building->isCurrent($id) || $building->isLoop($id))?1:0;
$doublebuild = ($building->isCurrent($id) && $building->isLoop($id))?1:0;
?>
<div id="build" class="gid40"><a href="#" onClick="return Popup(40,4);" class="build_logo"> $vref = (int)$_SESSION['wid'];
<img class="building g40" src="img/x.gif" alt="World Wonder" title="<?php echo WORLD_WONDER;?>" />
</a>
<h1><?php echo WONDER;?> <br /><span class="level"><?php echo LEVEL;?> <?php echo $village->resarray['f'.$id];?></span></h1>
<p class="build_desc"><?php echo WONDER_DESC;?></p>
<form action="GameEngine/Game/WorldWonderName.php" method="POST">
<?php
$vref = $_SESSION['wid'];
$wwname = $database->getWWName($vref); $wwname = $database->getWWName($vref);
$level = (int)$village->resarray['f'.$id];
if($village->resarray['f'.$id] < 0){
echo ''.WORLD_WONDER_CHANGE_NAME.'.
<center><br />'.WORLD_WONDER_NAME.': <input class="text" name="wwname" id="wwname" disabled="disabled" value="'.$wwname.'" maxlength="20"></center><p class="btn"><button value="" tabindex="9" name="s1" disabled="disabled" id="btn_ok" class="trav_buttons" alt="OK" /> Ok </button></p>';
} else if($village->resarray['f'.$id] > 0 and $village->resarray['f'.$id] < 11) {
echo '<center><br />'.WORLD_WONDER_NAME.': <input class="text" name="wwname" id="wwname" value="'.$wwname.'" maxlength="20"></center><p class="btn"><button value="" tabindex="9" name="s1" id="btn_ok" class="trav_buttons" alt="OK" /> Ok </button></p>';
} else if ($village->resarray['f'.$id] > 10){
echo ''.WORLD_WONDER_NOTCHANGE_NAME.'.
<center><br />'.WORLD_WONDER_NAME.': <input class="text" name="wwname" id="wwname" disabled="disabled" value="'.$wwname.'" maxlength="20"></center><p class="btn"><button value="" tabindex="9" name="s1" disabled="disabled" id="btn_ok" class="trav_buttons" alt="OK" /> Ok </button></p>';
}?>
</form>
<?php
if(isset($_GET['n'])) {
echo '<div style="text-align: center"><font color="Red"><b>'.WORLD_WONDER_NAME_CHANGED.'.</b></font></div><br />';
}
?>
<?php
include("wwupgrade.tpl");
?> ?>
</p></div> <div id="build" class="gid40">
<a href="#" onClick="return Popup(40,4);" class="build_logo">
<img class="building g40" src="img/x.gif" alt="World Wonder" title="<?php echo WORLD_WONDER;?>" />
</a>
<h1><?php echo WONDER;?><br /><span class="level"><?php echo LEVEL;?> <?php echo $level;?></span></h1>
<p class="build_desc"><?php echo WONDER_DESC;?></p>
<form action="GameEngine/Game/WorldWonderName.php" method="POST">
<?php
$disabled = ($level < 1 || $level > 10) ? 'disabled="disabled"' : '';
$msg = $level < 0 ? WORLD_WONDER_CHANGE_NAME.'.' : ($level > 10 ? WORLD_WONDER_NOTCHANGE_NAME.'.' : '');
if ($msg) echo $msg;
?>
<center><br /><?php echo WORLD_WONDER_NAME;?>:
<input class="text" name="wwname" id="wwname" <?php echo $disabled;?> value="<?php echo htmlspecialchars($wwname);?>" maxlength="20">
</center>
<p class="btn">
<button type="submit" tabindex="9" name="s1" id="btn_ok" class="trav_buttons" <?php echo $disabled;?> alt="OK">Ok</button>
</p>
</form>
<?php if (isset($_GET['n'])):?>
<div style="text-align: center"><font color="Red"><b><?php echo WORLD_WONDER_NAME_CHANGED;?>.</b></font></div><br />
<?php endif;?>
<?php include("wwupgrade.tpl");?>
</div>
+71 -144
View File
@@ -1,154 +1,81 @@
<?php <?php
$bid = $village->resarray[ 'f' . $id . 't' ]; // wwupgrade.tpl
$bindicate = $building->canBuild( $id, $bid ); global $village, $building, $database, $generator, $session, $id;
$wwlevel = $village->resarray['f99'];
if ( $wwlevel >= 50 ) { $bid = (int)$village->resarray['f'.$id.'t'];
$needed_plan = 1; $bindicate = $building->canBuild($id, $bid);
} else { $wwlevel = (int)$village->resarray['f99'];
$needed_plan = 0; $needed_plan = $wwlevel >= 50? 1 : 0;
if (!$building->allowWwUpgrade()) {
echo $needed_plan == 0
? '<p><span class="none">'.NEED_WWCONSTRUCTION_PLAN.'.</span></p>'
: '<p><span class="none">'.NEED_MORE_WWCONSTRUCTION_PLAN.'.</span></p>';
return;
} }
if ( $building->allowWwUpgrade() ) { if ($bindicate == 1) {
if ( $bindicate == 1 ) { echo '<p><span class="none">'.MAX_LEVEL.'</span></p>'; return;
echo "<p><span class=\"none\">" . MAX_LEVEL . "</span></p>"; }
} else if ( $bindicate == 10 ) { if ($bindicate == 10) {
echo "<p><span class=\"none\">" . BUILDING_MAX_LEVEL_UNDER . "</span></p>"; echo '<p><span class="none">'.BUILDING_MAX_LEVEL_UNDER.'</span></p>'; return;
} else if ( $bindicate == 11 ) { }
echo "<p><span class=\"none\">" . BUILDING_BEING_DEMOLISHED . "</span></p>"; if ($bindicate == 11) {
} else { echo '<p><span class="none">'.BUILDING_BEING_DEMOLISHED.'</span></p>'; return;
$loopsame = ( $building->isCurrent( $id ) || $building->isLoop( $id ) ) ? 1 : 0; }
$doublebuild = ( $building->isCurrent( $id ) && $building->isLoop( $id ) ) ? 1 : 0;
$master = count( $database->getMasterJobsByField( $village->wid, $id ) ); $loopsame = ($building->isCurrent($id) || $building->isLoop($id))? 1 : 0;
$uprequire = $building->resourceRequired( $id, $village->resarray[ 'f' . $id . 't' ], 1 + $loopsame + $doublebuild + $master ); $doublebuild = ($building->isCurrent($id) && $building->isLoop($id))? 1 : 0;
$master = count($database->getMasterJobsByField($village->wid, $id));
$nextLevel = (int)$village->resarray['f'.$id] + 1 + $loopsame + $doublebuild + $master;
$uprequire = $building->resourceRequired($id, $bid, 1 + $loopsame + $doublebuild + $master);
$total_required = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']);
?> ?>
<p id="contract"> <p id="contract">
<b><?php echo COSTS_UPGRADING_LEVEL; ?> <?php echo $village->resarray[ 'f' . $id ] + 1 + $loopsame + $doublebuild + $master; ?> <b><?php echo COSTS_UPGRADING_LEVEL;?> <?php echo $nextLevel;?>:</b><br />
:<br/> <img class="r1" src="img/x.gif" title="Lumber"/><span class="little_res"><?php echo $uprequire['wood'];?></span> |
<img class="r1" src="img/x.gif" alt="Lumber" title="Lumber"/><span <img class="r2" src="img/x.gif" title="Clay"/><span class="little_res"><?php echo $uprequire['clay'];?></span> |
class="little_res"><?php echo $uprequire['wood']; ?></span> | <img class="r2" src="img/x.gif" alt="Clay" <img class="r3" src="img/x.gif" title="Iron"/><span class="little_res"><?php echo $uprequire['iron'];?></span> |
title="Clay"/><span <img class="r4" src="img/x.gif" title="Crop"/><span class="little_res"><?php echo $uprequire['crop'];?></span> |
class="little_res"><?php echo $uprequire['clay']; ?></span> | <img class="r3" src="img/x.gif" alt="Iron" <img class="r5" src="img/x.gif" title="Crop consumption"/><?php echo $uprequire['pop'];?> |
title="Iron"/><span <img class="clock" src="img/x.gif" title="duration"/><?php echo $generator->getTimeFormat($uprequire['time']);?>
class="little_res"><?php echo $uprequire['iron']; ?></span> | <img class="r4" src="img/x.gif" alt="Crop" <?php if ($session->userinfo['gold'] >= 3 && $building->getTypeLevel(17) >= 1 && $village->atotal >= $total_required):?>
title="Crop"/><span | <a href="build.php?gid=17&t=3&r1=<?php echo $uprequire['wood'];?>&r2=<?php echo $uprequire['clay'];?>&r3=<?php echo $uprequire['iron'];?>&r4=<?php echo $uprequire['crop'];?>" title="NPC trade"><img class="npc" src="img/x.gif" alt="NPC trade"/></a>
class="little_res"><?php echo $uprequire['crop']; ?></span> | <img class="r5" src="img/x.gif" <?php endif;?>
alt="Crop consumption" <br />
title="Crop consumption"/><?php echo $uprequire['pop']; ?> <?php
| <img class="clock" src="img/x.gif" alt="duration" switch ($bindicate) {
title="duration"/><?php echo $generator->getTimeFormat( $uprequire['time'] ); case 2: echo '<span class="none">'.WORKERS_ALREADY_WORK.'</span>'; break;
//-- If available resources combined are not enough, remove NPC button case 3: echo '<span class="none">'.WORKERS_ALREADY_WORK_WAITING.'</span>'; break;
$total_required = (int)($uprequire['wood'] + $uprequire['clay'] + $uprequire['iron'] + $uprequire['crop']); case 4: echo '<span class="none">'.ENOUGH_FOOD_EXPAND_CROPLAND.'</span>'; break;
if ( $session->userinfo['gold'] >= 3 && $building->getTypeLevel( 17 ) >= 1 && $village->atotal >= $total_required) { case 5: echo '<span class="none">'.UPGRADE_WAREHOUSE.'.</span>'; break;
echo "|<a href=\"build.php?gid=17&t=3&r1=" . $uprequire['wood'] . "&r2=" . $uprequire['clay'] . "&r3=" . $uprequire['iron'] . "&r4=" . $uprequire['crop'] . "\" title=\"NPC trade\"><img class=\"npc\" src=\"img/x.gif\" alt=\"NPC trade\" title=\"NPC trade\" /></a>"; case 6: echo '<span class="none">'.UPGRADE_GRANARY.'.</span>'; break;
} ?><br/> case 7:
<?php if ($village->allcrop > 0) {
if ( $bindicate == 2 ) { $neededtime = $building->calculateAvaliable($id, $bid, 1 + $loopsame + $doublebuild + $master);
echo "<span class=\"none\">" . WORKERS_ALREADY_WORK . "</span>"; echo '<span class="none">'.ENOUGH_RESOURCES.' '.$neededtime[0].' at '.$neededtime[1].'</span>';
if ( $session->goldclub == 1 ) {
?> </br>
<?php
if ( $id <= 18 ) {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
} else {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
}
}
} else if ( $bindicate == 3 ) {
echo "<span class=\"none\">" . WORKERS_ALREADY_WORK_WAITING . "</span>";
if ( $session->goldclub == 1 ) {
?> </br>
<?php
if ( $id <= 18 ) {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
} else {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
}
}
} else if ( $bindicate == 4 ) {
echo "<span class=\"none\">" . ENOUGH_FOOD_EXPAND_CROPLAND . "</span>";
} else if ( $bindicate == 5 ) {
echo "<span class=\"none\">" . UPGRADE_WAREHOUSE . ".</span>";
} else if ( $bindicate == 6 ) {
echo "<span class=\"none\">" . UPGRADE_GRANARY . ".</span>";
} else if ( $bindicate == 7 ) {
if ( $village->allcrop > 0 ) {
$neededtime = $building->calculateAvaliable( $id, $village->resarray[ 'f' . $id . 't' ], 1 + $loopsame + $doublebuild + $master );
echo "<span class=\"none\">" . ENOUGH_RESOURCES . " " . $neededtime[0] . " at " . $neededtime[1] . "</span>";
} else {
echo "<span class=\"none\">" . YOUR_CROP_NEGATIVE . "</span>";
}
if ( $session->goldclub == 1 ) {
?> </br>
<?php
if ( $id <= 18 ) {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf1.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
} else {
if ( $session->gold >= 1 && $village->master == 0 ) {
echo "<a class=\"build\" href=\"dorf2.php?master=$bid&id=$id\">" . CONSTRUCTING_MASTER_BUILDER . " </a>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
} else {
echo "<span class=\"none\">" . CONSTRUCTING_MASTER_BUILDER . "</span>";
echo '<font color="#B3B3B3">(' . COSTS . ': <img src="' . GP_LOCATE . 'img/a/gold_g.gif" alt="Gold" title="' . GOLD . '"/>1)</font>';
}
}
}
} else if ( $bindicate == 8 ) {
if ( $session->access == BANNED ) {
echo "<a class=\"build\" href=\"banned.php\">" . UPGRADE_LEVEL . " ";
} else if ( $id <= 18 ) {
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">" . UPGRADE_LEVEL . " ";
} else { } else {
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">" . UPGRADE_LEVEL . " "; echo '<span class="none">'.YOUR_CROP_NEGATIVE.'</span>';
} }
echo $village->resarray[ 'f' . $id ] + 1; break;
echo ".</a>"; case 8:
} else if ( $bindicate == 9 ) { case 9:
if ( $session->access == BANNED ) { $href = $session->access == BANNED? 'banned.php' : (($id <= 18)? "dorf1.php?a=$id&c=$session->checker" : "dorf2.php?a=$id&c=$session->checker");
echo "<a class=\"build\" href=\"banned.php\">" . UPGRADE_LEVEL . " "; $lvl = $bindicate == 8? $village->resarray['f'.$id] + 1 : $village->resarray['f'.$id] + ($loopsame > 0? 2 : 1);
} else if ( $id <= 18 ) { echo '<a class="build" href="'.$href.'">'.UPGRADE_LEVEL.' '.$lvl.'.</a>';
echo "<a class=\"build\" href=\"dorf1.php?a=$id&c=$session->checker\">" . UPGRADE_LEVEL . " "; if ($bindicate == 9) echo ' <span class="none">'.WAITING.'</span>';
} else { break;
echo "<a class=\"build\" href=\"dorf2.php?a=$id&c=$session->checker\">" . UPGRADE_LEVEL . " "; }
}
echo $village->resarray[ 'f' . $id ] + ( $loopsame > 0 ? 2 : 1 ); if (in_array($bindicate, [2,3,7]) && $session->goldclub == 1) {
echo ".</a> <span class=\"none\">" . WAITING . "</span> "; echo '<br/>';
} $masterHref = ($id <= 18? 'dorf1.php' : 'dorf2.php'). "?master=$bid&id=$id&c=$session->checker";
} if ($session->gold >= 1 && $village->master == 0) {
echo '<a class="build" href="'.$masterHref.'">'.CONSTRUCTING_MASTER_BUILDER.'</a>';
} else { } else {
if ( $needed_plan == 0 ) { echo '<span class="none">'.CONSTRUCTING_MASTER_BUILDER.'</span>';
echo "<span class=\"none\">" . NEED_WWCONSTRUCTION_PLAN . ".</span>";
} else {
echo "<span class=\"none\">" . NEED_MORE_WWCONSTRUCTION_PLAN . ".</span>";
}
} }
echo ' <font color="#B3B3B3">('.COSTS.': <img src="'.GP_LOCATE.'img/a/gold_g.gif" alt="Gold" title="'.GOLD.'"/>1)</font>';
}
?> ?>
</p>
+14 -4
View File
@@ -242,6 +242,17 @@ if ($hour > 1759 || $hour < 500) {
position:static; position:static;
} }
.dayNightIcon {
margin-top: 22px; /* aici cobori iconița */
text-align: center;
}
.dayNightIcon img {
width: 18px;
height: 18px;
display: inline-block;
}
</style> </style>
<!-- ===================== DAY/NIGHT ICON ===================== --> <!-- ===================== DAY/NIGHT ICON ===================== -->
@@ -256,10 +267,9 @@ if ($hour > 1759 || $hour < 500) {
<p> <p>
<img src="img/x.gif" <div class="dayNightIcon">
style="display:block;margin:0 auto;vertical-align:middle;" <img src="img/x.gif" class="<?php echo safeHTML($dayNightImage); ?>" alt="" />
class="<?php echo safeHTML($dayNightImage); ?>" </div>
alt="" />
</p> </p>